mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-12-13 19:33:55 +03:00
console: Fix GDC connect form validation error
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/10444 GitOrigin-RevId: 3328b7ec2b3fddad7f21dc038dcc4eda0fe15914
This commit is contained in:
parent
3eabaeb704
commit
b0c14764f8
@ -13,8 +13,10 @@ import { hasuraToast } from '../../../../new-components/Toasts';
|
||||
import { useAvailableDrivers } from '../../../ConnectDB/hooks';
|
||||
import { OpenApi3Form } from '../../../OpenApi3Form';
|
||||
import { useMetadata } from '../../../hasura-metadata-api';
|
||||
import { Source } from '../../../hasura-metadata-types';
|
||||
import { useManageDatabaseConnection } from '../../hooks/useManageDatabaseConnection';
|
||||
import { DisplayToastErrorMessage } from '../Common/DisplayToastErrorMessage';
|
||||
import { cleanEmpty } from '../ConnectPostgresWidget/utils/helpers';
|
||||
import { GraphQLCustomization } from '../GraphQLCustomization/GraphQLCustomization';
|
||||
import { adaptGraphQLCustomization } from '../GraphQLCustomization/utils/adaptResponse';
|
||||
import { Template } from './components/Template';
|
||||
@ -25,8 +27,6 @@ import {
|
||||
useFormValidationSchema,
|
||||
} from './useFormValidationSchema';
|
||||
import { generateGDCRequestPayload } from './utils/generateRequest';
|
||||
import { Source } from '../../../hasura-metadata-types';
|
||||
import { cleanEmpty } from '../ConnectPostgresWidget/utils/helpers';
|
||||
|
||||
interface ConnectGDCSourceWidgetProps {
|
||||
driver: string;
|
||||
@ -129,6 +129,11 @@ export const ConnectGDCSourceWidget = (props: ConnectGDCSourceWidgetProps) => {
|
||||
methods: { formState, reset },
|
||||
} = useConsoleForm({
|
||||
schema,
|
||||
options: {
|
||||
defaultValues: {
|
||||
template_variables: [],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
|
@ -108,7 +108,7 @@ export const TemplateVariables = () => {
|
||||
),
|
||||
}),
|
||||
],
|
||||
[]
|
||||
[remove]
|
||||
);
|
||||
|
||||
const table = useReactTable({
|
||||
|
@ -26,6 +26,10 @@ const createValidationSchema = (configSchemas: GDCConfigSchemas) =>
|
||||
.gte(0, { message: 'Timeout must be a postive number' })
|
||||
.optional(),
|
||||
template: z.string().optional(),
|
||||
|
||||
// template variables is not marked as optional b/c it makes some pretty annoying TS issues with react-hook-form
|
||||
// the field is initialized with a default value of `[]`
|
||||
// with clean up empty fields, including arrays before submission, so it won't be sent to the server if the array is empty
|
||||
template_variables: z
|
||||
.object({
|
||||
name: reqString('variable name'),
|
||||
|
Loading…
Reference in New Issue
Block a user