From 014d362d7cc618c8b864218260eee1b43e6b4e2b Mon Sep 17 00:00:00 2001 From: Vijay Prasanna Date: Fri, 25 Aug 2023 19:55:33 +0530 Subject: [PATCH] console: fix issue with column data type being reported as "STRING" for gdc tables PR-URL: https://github.com/hasura/graphql-engine-mono/pull/10204 GitOrigin-RevId: 0b997aafe55ed13b0963b1cb7b84764dfdddb13c --- .../DataSource/gdc/introspection/utils.tsx | 26 +++---------------- .../RowPermissionsInput.stories.tsx | 7 +++++ 2 files changed, 10 insertions(+), 23 deletions(-) diff --git a/frontend/libs/console/legacy-ce/src/lib/features/DataSource/gdc/introspection/utils.tsx b/frontend/libs/console/legacy-ce/src/lib/features/DataSource/gdc/introspection/utils.tsx index c27ff7c8d98..5ba41f7f003 100644 --- a/frontend/libs/console/legacy-ce/src/lib/features/DataSource/gdc/introspection/utils.tsx +++ b/frontend/libs/console/legacy-ce/src/lib/features/DataSource/gdc/introspection/utils.tsx @@ -1,4 +1,3 @@ -import { getEntries } from '../../../../components/Services/Data/Common/tsUtils'; import { DataNode } from 'antd/lib/tree'; import React from 'react'; import { FaTable, FaFolder } from 'react-icons/fa'; @@ -71,26 +70,7 @@ export function convertToTreeData( export function adaptAgentDataType( sqlDataType: TableColumn['dataType'] ): TableColumn['dataType'] { - const DataTypeToSQLTypeMap: Record = { - bool: ['bool'], - string: ['string'], - number: ['number', 'integer', 'float'], - datetime: ['datetime'], - timestamp: ['timestamp'], - xml: ['xml'], - json: ['json', 'jsonb'], - }; - - const [dataType] = getEntries(DataTypeToSQLTypeMap).find(([, value]) => - value.includes( - typeof sqlDataType === 'string' - ? sqlDataType.toLowerCase() - : sqlDataType.type.toLowerCase() - ) - ) ?? [ - typeof sqlDataType === 'string' ? 'string' : sqlDataType.type.toLowerCase(), - [], - ]; - - return dataType; + return typeof sqlDataType === 'string' + ? sqlDataType.toLowerCase() + : sqlDataType.type.toLowerCase(); } diff --git a/frontend/libs/console/legacy-ce/src/lib/features/Permissions/PermissionsForm/components/RowPermissionsBuilder/components/RowPermissionsInput.stories.tsx b/frontend/libs/console/legacy-ce/src/lib/features/Permissions/PermissionsForm/components/RowPermissionsBuilder/components/RowPermissionsInput.stories.tsx index 10d113c42d1..93a453b98e4 100644 --- a/frontend/libs/console/legacy-ce/src/lib/features/Permissions/PermissionsForm/components/RowPermissionsBuilder/components/RowPermissionsInput.stories.tsx +++ b/frontend/libs/console/legacy-ce/src/lib/features/Permissions/PermissionsForm/components/RowPermissionsBuilder/components/RowPermissionsInput.stories.tsx @@ -1157,6 +1157,13 @@ export const NestedObjectsInitiallyEmpty: StoryObj = play: async ({ canvasElement }) => { const canvas = within(canvasElement); + await waitFor( + async () => { + await canvas.findByTestId('RootInputReady'); + }, + { timeout: 1000 } + ); + await canvas.findAllByRole('option', { name: 'address', });