From 969cb05bdf04f6c11d60419bf1241d55535a10b5 Mon Sep 17 00:00:00 2001 From: Vijay Prasanna Date: Thu, 22 Sep 2022 11:18:40 +0530 Subject: [PATCH] fix (console): update @hasura/dc-agents-types dependency to 0.6.0 PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5978 GitOrigin-RevId: 9fc7bad5c003a733b8d67f0240651ba60585d0b7 --- console/package-lock.json | 14 +++++++------- console/package.json | 2 +- .../Data/DataSources/DataSourceFormWrapper.tsx | 12 ++---------- .../ConnectDB/hooks/useAvailableDrivers.ts | 2 +- console/src/features/DataSource/cockroach/index.ts | 2 +- .../gdc/introspection/getDatabaseConfiguration.ts | 7 +++++-- console/src/features/DataSource/types.ts | 2 +- 7 files changed, 18 insertions(+), 23 deletions(-) diff --git a/console/package-lock.json b/console/package-lock.json index 7db5174acc4..512a7ca9444 100644 --- a/console/package-lock.json +++ b/console/package-lock.json @@ -13,7 +13,7 @@ "@babel/plugin-transform-runtime": "^7.14.5", "@graphql-codegen/core": "^1.17.8", "@graphql-codegen/typescript": "^1.17.10", - "@hasura/dc-api-types": "^0.4.0", + "@hasura/dc-api-types": "^0.6.0", "@hookform/resolvers": "2.8.10", "@radix-ui/react-collapsible": "^1.0.0", "@radix-ui/react-dialog": "^1.0.0", @@ -3609,9 +3609,9 @@ "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" }, "node_modules/@hasura/dc-api-types": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/@hasura/dc-api-types/-/dc-api-types-0.4.0.tgz", - "integrity": "sha512-Zpjb1RkCW19o/YT4q4z22SzxCGwG59ZI1DCRzo18OlbwC6tjmjrAGSJJCc0MclUKzZoCokFIPISkWxcxgMbBRg==" + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@hasura/dc-api-types/-/dc-api-types-0.6.0.tgz", + "integrity": "sha512-ikK2MYpA5jMq/38MtTv0tkeElGN6+izvQnM02rBjjdMYiSoaQ6VSsDLlbl9ERbMGW0/Hr2Fj0ZNuUsFdM2jamA==" }, "node_modules/@hookform/devtools": { "version": "4.0.1", @@ -44401,9 +44401,9 @@ } }, "@hasura/dc-api-types": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/@hasura/dc-api-types/-/dc-api-types-0.4.0.tgz", - "integrity": "sha512-Zpjb1RkCW19o/YT4q4z22SzxCGwG59ZI1DCRzo18OlbwC6tjmjrAGSJJCc0MclUKzZoCokFIPISkWxcxgMbBRg==" + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@hasura/dc-api-types/-/dc-api-types-0.6.0.tgz", + "integrity": "sha512-ikK2MYpA5jMq/38MtTv0tkeElGN6+izvQnM02rBjjdMYiSoaQ6VSsDLlbl9ERbMGW0/Hr2Fj0ZNuUsFdM2jamA==" }, "@hookform/devtools": { "version": "4.0.1", diff --git a/console/package.json b/console/package.json index b936917d924..f79b5be5021 100644 --- a/console/package.json +++ b/console/package.json @@ -81,7 +81,7 @@ "@babel/plugin-transform-runtime": "^7.14.5", "@graphql-codegen/core": "^1.17.8", "@graphql-codegen/typescript": "^1.17.10", - "@hasura/dc-api-types": "^0.4.0", + "@hasura/dc-api-types": "^0.6.0", "@hookform/resolvers": "2.8.10", "@radix-ui/react-collapsible": "^1.0.0", "@radix-ui/react-dialog": "^1.0.0", diff --git a/console/src/components/Services/Data/DataSources/DataSourceFormWrapper.tsx b/console/src/components/Services/Data/DataSources/DataSourceFormWrapper.tsx index 005783409e5..5354b2cb240 100644 --- a/console/src/components/Services/Data/DataSources/DataSourceFormWrapper.tsx +++ b/console/src/components/Services/Data/DataSources/DataSourceFormWrapper.tsx @@ -1,17 +1,15 @@ import React, { FormEvent } from 'react'; import { LabeledInput } from '@/components/Common/LabeledInput'; import { Connect, useAvailableDrivers } from '@/features/ConnectDB'; -// import { GDC_DB_CONNECTOR_DEV } from '@/utils/featureFlags'; import { availableFeatureFlagIds, useIsFeatureFlagEnabled, } from '@/features/FeatureFlags'; import { Button } from '@/new-components/Button'; -import { NativeDrivers } from '@/features/MetadataAPI'; import ConnectDatabaseForm, { ConnectDatabaseFormProps } from './ConnectDBForm'; import styles from './DataSources.module.scss'; import { SampleDBSection } from './SampleDatabase'; -import { Driver, getSupportedDrivers } from '../../../../dataSources'; +import { Driver } from '../../../../dataSources'; import { isDBSupported } from './utils'; interface DataSourceFormWrapperProps extends ConnectDatabaseFormProps { @@ -45,8 +43,6 @@ const driverToLabel: Record< }, }; -const supportedDrivers = getSupportedDrivers('connectDbForm.enabled'); - const DataSourceFormWrapper: React.FC = props => { const { onSubmit, @@ -61,11 +57,7 @@ const DataSourceFormWrapper: React.FC = props => { connectionTypeState, } = props; - const { isLoading, data: availableDrivers } = useAvailableDrivers(); - const drivers = availableDrivers?.filter( - availableDriver => - supportedDrivers.includes(availableDriver?.name as NativeDrivers) // NOTE: with GDC this type casting needs to change - ); + const { isLoading, data: drivers } = useAvailableDrivers(); const { enabled: isGDCFeatureFlagEnabled } = useIsFeatureFlagEnabled( availableFeatureFlagIds.gdcId diff --git a/console/src/features/ConnectDB/hooks/useAvailableDrivers.ts b/console/src/features/ConnectDB/hooks/useAvailableDrivers.ts index d2f638eedac..62f9fb9d38c 100644 --- a/console/src/features/ConnectDB/hooks/useAvailableDrivers.ts +++ b/console/src/features/ConnectDB/hooks/useAvailableDrivers.ts @@ -8,7 +8,7 @@ export const useAvailableDrivers = () => { queryKey: ['get_available_drivers'], queryFn: async () => { const drivers = await DataSource(httpClient).driver.getAllSourceKinds(); - return drivers; + return drivers.filter(driver => driver.release !== 'disabled'); }, }); }; diff --git a/console/src/features/DataSource/cockroach/index.ts b/console/src/features/DataSource/cockroach/index.ts index 8ee140fb4d5..66a8378b379 100644 --- a/console/src/features/DataSource/cockroach/index.ts +++ b/console/src/features/DataSource/cockroach/index.ts @@ -15,7 +15,7 @@ export const cockroach: Database = { getDriverInfo: async () => ({ name: 'cockroach', displayName: 'CockroachDB', - release: 'Beta', + release: 'disabled', }), getDatabaseConfiguration: async () => { return Feature.NotImplemented; diff --git a/console/src/features/DataSource/gdc/introspection/getDatabaseConfiguration.ts b/console/src/features/DataSource/gdc/introspection/getDatabaseConfiguration.ts index 1d1531d27cc..9c5eef249a9 100644 --- a/console/src/features/DataSource/gdc/introspection/getDatabaseConfiguration.ts +++ b/console/src/features/DataSource/gdc/introspection/getDatabaseConfiguration.ts @@ -11,7 +11,7 @@ export const getDatabaseConfiguration = async ( const result = await runMetadataQuery<{ capabilities: CapabilitiesResponse['capabilities']; - config_schema_response: CapabilitiesResponse['configSchemas']; + config_schema_response: CapabilitiesResponse['config_schemas']; options: { uri: string; }; @@ -25,7 +25,10 @@ export const getDatabaseConfiguration = async ( }, }); - return result.config_schema_response as { + return { + configSchema: result.config_schema_response.config_schema, + otherSchemas: result.config_schema_response.other_schemas, + } as { configSchema: Property; otherSchemas: Record; }; diff --git a/console/src/features/DataSource/types.ts b/console/src/features/DataSource/types.ts index e5d9f123cad..e33f980a749 100644 --- a/console/src/features/DataSource/types.ts +++ b/console/src/features/DataSource/types.ts @@ -121,7 +121,7 @@ export type GetTablesListAsTreeProps = { dataSourceName: string; } & NetworkArgs; -type ReleaseType = 'GA' | 'Beta'; +type ReleaseType = 'GA' | 'Beta' | 'disabled'; export type DriverInfoResponse = { name: SupportedDrivers;