Skip to content

Commit

Permalink
ui cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
pankaj-peerdb committed Jan 2, 2024
1 parent e041b0f commit d66fac8
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 6 deletions.
1 change: 0 additions & 1 deletion ui/app/api/mirrors/qrep/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { GetFlowHttpAddressFromEnv } from '@/rpc/http';
export async function POST(request: Request) {
const body = await request.json();
const { config } = body;
console.log('/qrep/post config:', config);
const flowServiceAddr = GetFlowHttpAddressFromEnv();
const req: CreateQRepFlowRequest = {
qrepConfig: config,
Expand Down
2 changes: 1 addition & 1 deletion ui/app/api/mirrors/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ export async function GET(request: Request) {
};
return newMirror;
});
return new Response(JSON.stringify(stringifyConfig(flows)));
return new Response(JSON.stringify((flows)));
}
7 changes: 6 additions & 1 deletion ui/app/api/peers/getTruePeer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
S3Config,
SnowflakeConfig,
SqlServerConfig,
ClickhouseConfig,
} from '@/grpc_generated/peers';

export const getTruePeer = (peer: CatalogPeer) => {
Expand All @@ -23,7 +24,8 @@ export const getTruePeer = (peer: CatalogPeer) => {
| EventHubConfig
| S3Config
| SqlServerConfig
| EventHubGroupConfig;
| EventHubGroupConfig
| ClickhouseConfig;
switch (peer.type) {
case 0:
config = BigqueryConfig.decode(options);
Expand Down Expand Up @@ -53,6 +55,9 @@ export const getTruePeer = (peer: CatalogPeer) => {
config = EventHubGroupConfig.decode(options);
newPeer.eventhubGroupConfig = config;
break;
case 8:
config = ClickhouseConfig.decode(options);
newPeer.clickhouseConfig = config;
default:
return newPeer;
}
Expand Down
4 changes: 3 additions & 1 deletion ui/app/mirrors/create/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export default function CreateMirrors() {
const [config, setConfig] = useState<CDCConfig | QRepConfig>(blankCDCSetting);
const [peers, setPeers] = useState<Peer[]>([]);
const [rows, setRows] = useState<TableMapRow[]>([]);

const [qrepQuery, setQrepQuery] =
useState<string>(`-- Here's a sample template:
SELECT * FROM <table_name>
Expand Down Expand Up @@ -142,9 +143,10 @@ export default function CreateMirrors() {
placeholder={`Select the ${
peerEnd === 'src' ? 'source' : 'destination'
} peer`}
onChange={(val, action) =>
onChange={(val, action) =>{
handlePeer(val, peerEnd as 'src' | 'dst', setConfig)
}
}
options={
(peerEnd === 'src'
? peers.filter((peer) => peer.type == DBType.POSTGRES)
Expand Down
3 changes: 2 additions & 1 deletion ui/app/peers/create/[peerType]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,10 @@ export default function CreateConfig({
</Button>
<Button
style={{ backgroundColor: 'gold' }}
onClick={() =>
onClick={() =>{
handleValidate(dbType, config, setFormMessage, setLoading, name)
}
}
>
Validate
</Button>
Expand Down
2 changes: 1 addition & 1 deletion ui/components/PeerComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const DBTypeToImageMapping = (peerType: DBType | string) => {
case 'BIGQUERY':
return '/svgs/bq.svg';
case 'CLICKHOUSE':
return '/svgs/pg.svg';
return '/svgs/ch.svg';
case DBType.S3:
case 'S3':
return '/svgs/aws.svg';
Expand Down
2 changes: 2 additions & 0 deletions ui/components/PeerTypeComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export const DBTypeToGoodText = (ptype: DBType) => {
return 'SQL Server';
case DBType.MONGO:
return 'MongoDB';
case DBType.CLICKHOUSE:
return "Clickhouse"
case DBType.UNRECOGNIZED:
return 'Unrecognised';
}
Expand Down
1 change: 1 addition & 0 deletions ui/public/svgs/ch.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d66fac8

Please sign in to comment.