Skip to content

Commit

Permalink
chore(ui): format code
Browse files Browse the repository at this point in the history
  • Loading branch information
bouassaba committed Oct 30, 2024
1 parent fc439c8 commit 2342187
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 38 deletions.
Binary file modified ui/bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@koupr/ui": "1.9.0",
"@reduxjs/toolkit": "1.9.2",
"classnames": "2.5.1",
"formik": "2.2.9",
"formik": "2.4.5",
"framer-motion": "9.0.4",
"react": "18.2.0",
"react-dom": "18.2.0",
Expand Down
9 changes: 4 additions & 5 deletions ui/src/api/action.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable react-hooks/rules-of-hooks */
import useSWR from 'swr'
import useSWR, { SWRConfiguration } from 'swr'
import { DatabaseObject } from './common-models'
import { Diff } from './comparison'
import { apiFetch, apiFetcher } from './fetch'
Expand Down Expand Up @@ -155,7 +154,7 @@ export type DropObjectsFailure = {
}

export default class ActionAPI {
static useGetById(id?: string, swrOptions?: any) {
static useGetById(id?: string, swrOptions?: SWRConfiguration) {
return useSWR<Action>(id ? `/actions/${id}` : null, apiFetcher, swrOptions)
}

Expand All @@ -168,11 +167,11 @@ export default class ActionAPI {
}).then((result) => result.json())
}

static useGetAll(swrOptions?: any) {
static useGetAll(swrOptions?: SWRConfiguration) {
return useSWR<Action[]>(`/actions`, apiFetcher, swrOptions)
}

static useGetAllByType(type: string, swrOptions?: any) {
static useGetAllByType(type: string, swrOptions?: SWRConfiguration) {
return useSWR<Action[]>(
`/actions?${new URLSearchParams({ type })}`,
apiFetcher,
Expand Down
1 change: 0 additions & 1 deletion ui/src/api/comparison.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable react-hooks/rules-of-hooks */
import { DatabaseObject } from './common-models'
import { apiFetch } from './fetch'

Expand Down
7 changes: 3 additions & 4 deletions ui/src/api/connection.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable react-hooks/rules-of-hooks */
import useSWR from 'swr'
import useSWR, { SWRConfiguration } from 'swr'
import { apiFetch, apiFetcher } from './fetch'

export type Connection = {
Expand Down Expand Up @@ -31,7 +30,7 @@ export type UpdateOptions = {
}

export default class ConnectionAPI {
static useGetById(id?: string, swrOptions?: any) {
static useGetById(id?: string, swrOptions?: SWRConfiguration) {
return useSWR<Connection>(
id ? `/connections/${id}` : null,
apiFetcher,
Expand All @@ -48,7 +47,7 @@ export default class ConnectionAPI {
}).then((result) => result.json())
}

static useGetAll(swrOptions?: any) {
static useGetAll(swrOptions?: SWRConfiguration) {
return useSWR<Connection[]>(`/connections`, apiFetcher, swrOptions)
}

Expand Down
53 changes: 26 additions & 27 deletions ui/src/components/connection/create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,14 @@ import {
FormLabel,
} from '@chakra-ui/react'
import { variables } from '@koupr/ui'
import { Field, FieldAttributes, Form, Formik, FormikHelpers } from 'formik'
import {
Field,
FieldAttributes,
FieldProps,
Form,
Formik,
FormikHelpers,
} from 'formik'
import * as Yup from 'yup'
import { BsEye, BsEyeSlash } from 'react-icons/bs'
import { FiChevronLeft } from 'react-icons/fi'
Expand Down Expand Up @@ -103,9 +110,9 @@ const Create = ({ onComplete, onDismiss }: CreateProps) => {
<Stack spacing={variables.spacingLg}>
<Stack spacing={variables.spacing}>
<Field name="name">
{({ field }: FieldAttributes<any>) => (
{({ field }: FieldAttributes<FieldProps>) => (
<FormControl
isInvalid={errors.name && touched.name ? true : false}
isInvalid={Boolean(errors.name && touched.name)}
>
<FormLabel htmlFor="name">Name</FormLabel>
<Input {...field} w="400px" disabled={isSubmitting} />
Expand All @@ -114,11 +121,9 @@ const Create = ({ onComplete, onDismiss }: CreateProps) => {
)}
</Field>
<Field name="jdbcUrl">
{({ field }: FieldAttributes<any>) => (
{({ field }: FieldAttributes<FieldProps>) => (
<FormControl
isInvalid={
errors.jdbcUrl && touched.jdbcUrl ? true : false
}
isInvalid={Boolean(errors.jdbcUrl && touched.jdbcUrl)}
>
<FormLabel htmlFor="jdbcUrl">JDBC URL</FormLabel>
<Input {...field} w="650px" disabled={isSubmitting} />
Expand All @@ -127,13 +132,11 @@ const Create = ({ onComplete, onDismiss }: CreateProps) => {
)}
</Field>
<Field name="jdbcUsername">
{({ field }: FieldAttributes<any>) => (
{({ field }: FieldAttributes<FieldProps>) => (
<FormControl
isInvalid={
errors.jdbcUsername && touched.jdbcUsername
? true
: false
}
isInvalid={Boolean(
errors.jdbcUsername && touched.jdbcUsername,
)}
>
<FormLabel htmlFor="jdbcUsername">
JDBC username
Expand All @@ -144,13 +147,11 @@ const Create = ({ onComplete, onDismiss }: CreateProps) => {
)}
</Field>
<Field name="jdbcPassword">
{({ field }: FieldAttributes<any>) => (
{({ field }: FieldAttributes<FieldProps>) => (
<FormControl
isInvalid={
errors.jdbcPassword && touched.jdbcPassword
? true
: false
}
isInvalid={Boolean(
errors.jdbcPassword && touched.jdbcPassword,
)}
>
<FormLabel htmlFor="jdbcPassword">
JDBC password
Expand Down Expand Up @@ -184,13 +185,11 @@ const Create = ({ onComplete, onDismiss }: CreateProps) => {
)}
</Field>
<Field name="databaseType">
{({ field }: FieldAttributes<any>) => (
{({ field }: FieldAttributes<FieldProps>) => (
<FormControl
isInvalid={
errors.databaseType && touched.databaseType
? true
: false
}
isInvalid={Boolean(
errors.databaseType && touched.databaseType,
)}
>
<FormLabel htmlFor="databaseType">
Database type
Expand All @@ -201,10 +200,10 @@ const Create = ({ onComplete, onDismiss }: CreateProps) => {
w="250px"
>
<option value="postgres" disabled>
Postgres (comming soon)
Postgres (coming soon)
</option>
<option value="mysql" disabled>
MySQL (comming soon)
MySQL (coming soon)
</option>
<option value="red">Oracle</option>
</Select>
Expand Down

0 comments on commit 2342187

Please sign in to comment.