From a833379b865d686587e57991836c116438e6503a Mon Sep 17 00:00:00 2001 From: Vijay Prasanna Date: Mon, 24 Jul 2023 20:55:44 +0530 Subject: [PATCH] console (feature): add `template` and `timeout` props to the GDC connect UI PR-URL: https://github.com/hasura/graphql-engine-mono/pull/9883 GitOrigin-RevId: 5370b18bcab90919b94c99bd0c74c260b515a6d8 --- .../ConnectGDCSourceWidget.stories.tsx | 2 +- .../ConnectGDCSourceWidget.tsx | 22 +++++++++++++ .../components/Template.tsx | 33 +++++++++++++++++++ .../components/Timeout.stories.tsx | 33 +++++++++++++++++++ .../components/Timeout.tsx | 11 +++++++ .../utils/generateRequest.ts | 6 +++- 6 files changed, 105 insertions(+), 2 deletions(-) create mode 100644 frontend/libs/console/legacy-ce/src/lib/features/ConnectDBRedesign/components/ConnectGDCSourceWidget/components/Template.tsx create mode 100644 frontend/libs/console/legacy-ce/src/lib/features/ConnectDBRedesign/components/ConnectGDCSourceWidget/components/Timeout.stories.tsx create mode 100644 frontend/libs/console/legacy-ce/src/lib/features/ConnectDBRedesign/components/ConnectGDCSourceWidget/components/Timeout.tsx diff --git a/frontend/libs/console/legacy-ce/src/lib/features/ConnectDBRedesign/components/ConnectGDCSourceWidget/ConnectGDCSourceWidget.stories.tsx b/frontend/libs/console/legacy-ce/src/lib/features/ConnectDBRedesign/components/ConnectGDCSourceWidget/ConnectGDCSourceWidget.stories.tsx index 253016c466e..e5916ea5eae 100644 --- a/frontend/libs/console/legacy-ce/src/lib/features/ConnectDBRedesign/components/ConnectGDCSourceWidget/ConnectGDCSourceWidget.stories.tsx +++ b/frontend/libs/console/legacy-ce/src/lib/features/ConnectDBRedesign/components/ConnectGDCSourceWidget/ConnectGDCSourceWidget.stories.tsx @@ -7,7 +7,7 @@ export default { component: ConnectGDCSourceWidget, decorators: [ReactQueryDecorator()], parameters: { - msw: handlers({ agentTestType: 'super_connector_agents_not_added' }), + msw: handlers({ agentTestType: 'super_connector_agents_added' }), }, } as Meta; diff --git a/frontend/libs/console/legacy-ce/src/lib/features/ConnectDBRedesign/components/ConnectGDCSourceWidget/ConnectGDCSourceWidget.tsx b/frontend/libs/console/legacy-ce/src/lib/features/ConnectDBRedesign/components/ConnectGDCSourceWidget/ConnectGDCSourceWidget.tsx index 98f05ec31bd..61d36cba958 100644 --- a/frontend/libs/console/legacy-ce/src/lib/features/ConnectDBRedesign/components/ConnectGDCSourceWidget/ConnectGDCSourceWidget.tsx +++ b/frontend/libs/console/legacy-ce/src/lib/features/ConnectDBRedesign/components/ConnectGDCSourceWidget/ConnectGDCSourceWidget.tsx @@ -24,6 +24,8 @@ import { GraphQLCustomization } from '../GraphQLCustomization/GraphQLCustomizati import { graphQLCustomizationSchema } from '../GraphQLCustomization/schema'; import { adaptGraphQLCustomization } from '../GraphQLCustomization/utils/adaptResponse'; import { generateGDCRequestPayload } from './utils/generateRequest'; +import { Timeout } from './components/Timeout'; +import { Template } from './components/Template'; interface ConnectGDCSourceWidgetProps { driver: string; @@ -53,6 +55,11 @@ const useFormValidationSchema = (driver: string) => { configSchemas.otherSchemas ), customization: graphQLCustomizationSchema.optional(), + timeout: z + .number() + .gte(0, { message: 'Timeout must be a postive number' }) + .optional(), + template: z.string().optional(), }); return { validationSchema, configSchemas }; @@ -136,6 +143,8 @@ export const ConnectGDCSourceWidget = (props: ConnectGDCSourceWidgetProps) => { name: metadataSource?.name, // This is a particularly weird case with metadata only valid for GDC sources. configuration: (metadataSource?.configuration as any).value, + timeout: (metadataSource?.configuration as any)?.timeout?.seconds, + template: (metadataSource?.configuration as any)?.template ?? '', customization: adaptGraphQLCustomization( metadataSource?.customization ?? {} ), @@ -238,6 +247,19 @@ export const ConnectGDCSourceWidget = (props: ConnectGDCSourceWidgetProps) => { references={data?.configSchemas.otherSchemas} /> +
+ + Advanced Settings +
+ } + > + +