Skip to content

Commit

Permalink
UI FIx: add an import, formatting (#1111)
Browse files Browse the repository at this point in the history
Seems like we were missing an import and also UI needed to be formatted
(prettier)
  • Loading branch information
Amogh-Bharadwaj authored Jan 19, 2024
1 parent c8bce78 commit 91f96ac
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion ui/app/api/peers/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const constructPeer = (
name,
type: DBType.CLICKHOUSE,
clickhouseConfig: config as ClickhouseConfig,
};
};
case 'S3':
return {
name,
Expand Down
3 changes: 2 additions & 1 deletion ui/app/peers/create/[peerType]/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { S3Config } from '@/grpc_generated/peers';
import { Dispatch, SetStateAction } from 'react';
import {
bqSchema,
chSchema,
peerNameSchema,
pgSchema,
s3Schema,
Expand Down Expand Up @@ -51,7 +52,7 @@ const validateFields = (
case 'CLICKHOUSE':
const chConfig = chSchema.safeParse(config);
if (!chConfig.success) validationErr = chConfig.error.issues[0].message;
break;
break;
case 'S3':
const s3Config = s3Schema.safeParse(config);
if (!s3Config.success) validationErr = s3Config.error.issues[0].message;
Expand Down
8 changes: 3 additions & 5 deletions ui/app/peers/create/[peerType]/helpers/ch.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { ClickhouseConfig, SSHConfig } from '@/grpc_generated/peers';
import { Dispatch, SetStateAction } from 'react';
import { ClickhouseConfig } from '@/grpc_generated/peers';
import { PeerSetting } from './common';

export const clickhouseSetting: PeerSetting[] = [
Expand Down Expand Up @@ -49,7 +48,6 @@ export const clickhouseSetting: PeerSetting[] = [
helpfulLink:
'https://docs.snowflake.com/en/user-guide/data-load-s3-config-storage-integration',
},

];

export const blankClickhouseSetting: ClickhouseConfig = {
Expand All @@ -58,5 +56,5 @@ export const blankClickhouseSetting: ClickhouseConfig = {
user: '',
password: '',
database: '',
s3Integration:''
};
s3Integration: '',
};
2 changes: 1 addition & 1 deletion ui/app/peers/create/[peerType]/helpers/common.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { PeerConfig, PeerSetter } from '@/app/dto/PeersDTO';
import { blankBigquerySetting } from './bq';
import { blankClickhouseSetting } from './ch';
import { blankPostgresSetting } from './pg';
import { blankS3Setting } from './s3';
import { blankSnowflakeSetting } from './sf';
import {blankClickhouseSetting} from './ch';

export interface PeerSetting {
label: string;
Expand Down
8 changes: 5 additions & 3 deletions ui/app/peers/create/[peerType]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use client';
import { PeerConfig } from '@/app/dto/PeersDTO';
import BigqueryForm from '@/components/PeerForms/BigqueryConfig';
import ClickhouseForm from '@/components/PeerForms/ClickhouseConfig';
import PostgresForm from '@/components/PeerForms/PostgresForm';
import S3Form from '@/components/PeerForms/S3Form';
import SnowflakeForm from '@/components/PeerForms/SnowflakeForm';
import ClickhouseForm from '@/components/PeerForms/ClickhouseConfig';

import { Button } from '@/lib/Button';
import { ButtonGroup } from '@/lib/ButtonGroup';
Expand All @@ -17,10 +17,10 @@ import Link from 'next/link';
import { useRouter } from 'next/navigation';
import { useState } from 'react';
import { handleCreate, handleValidate } from './handlers';
import { clickhouseSetting } from './helpers/ch';
import { getBlankSetting } from './helpers/common';
import { postgresSetting } from './helpers/pg';
import { snowflakeSetting } from './helpers/sf';
import {clickhouseSetting} from './helpers/ch';

type CreateConfigProps = {
params: { peerType: string };
Expand Down Expand Up @@ -48,7 +48,9 @@ export default function CreateConfig({
case 'BIGQUERY':
return <BigqueryForm setter={setConfig} />;
case 'CLICKHOUSE':
return <ClickhouseForm settings={clickhouseSetting} setter={setConfig} />;
return (
<ClickhouseForm settings={clickhouseSetting} setter={setConfig} />
);
case 'S3':
return <S3Form setter={setConfig} />;
default:
Expand Down
1 change: 0 additions & 1 deletion ui/app/peers/create/[peerType]/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,6 @@ export const chSchema = z.object({
.max(100, 'Password must be less than 100 characters'),
});


export const s3Schema = z.object({
url: z
.string({
Expand Down
2 changes: 1 addition & 1 deletion ui/components/PeerComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const DBTypeToImageMapping = (peerType: DBType | string) => {
case 'S3':
return '/svgs/aws.svg';
case 'CLICKHOUSE':
return '/svgs/ch.svg';
return '/svgs/ch.svg';
case DBType.EVENTHUB_GROUP:
case DBType.EVENTHUB:
return '/svgs/ms.svg';
Expand Down
2 changes: 1 addition & 1 deletion ui/components/PeerForms/ClickhouseConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,4 @@ export default function PostgresForm({ settings, setter }: ConfigProps) {
))}
</>
);
}
}
3 changes: 1 addition & 2 deletions ui/components/SelectSource.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ export default function SelectSource({
value === 'SNOWFLAKE' ||
value === 'BIGQUERY' ||
value === 'S3' ||
value === 'CLICKHOUSE'
)
value === 'CLICKHOUSE')
)
.map((value) => ({ label: value, value }));

Expand Down

0 comments on commit 91f96ac

Please sign in to comment.