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
This commit is contained in:
Vijay Prasanna 2023-08-25 19:55:33 +05:30 committed by hasura-bot
parent 0e55ea931f
commit 014d362d7c
2 changed files with 10 additions and 23 deletions

View File

@ -1,4 +1,3 @@
import { getEntries } from '../../../../components/Services/Data/Common/tsUtils';
import { DataNode } from 'antd/lib/tree'; import { DataNode } from 'antd/lib/tree';
import React from 'react'; import React from 'react';
import { FaTable, FaFolder } from 'react-icons/fa'; import { FaTable, FaFolder } from 'react-icons/fa';
@ -71,26 +70,7 @@ export function convertToTreeData(
export function adaptAgentDataType( export function adaptAgentDataType(
sqlDataType: TableColumn['dataType'] sqlDataType: TableColumn['dataType']
): TableColumn['dataType'] { ): TableColumn['dataType'] {
const DataTypeToSQLTypeMap: Record<string, string[]> = { return typeof sqlDataType === 'string'
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.toLowerCase()
: sqlDataType.type.toLowerCase() : sqlDataType.type.toLowerCase();
)
) ?? [
typeof sqlDataType === 'string' ? 'string' : sqlDataType.type.toLowerCase(),
[],
];
return dataType;
} }

View File

@ -1157,6 +1157,13 @@ export const NestedObjectsInitiallyEmpty: StoryObj<typeof RowPermissionsInput> =
play: async ({ canvasElement }) => { play: async ({ canvasElement }) => {
const canvas = within(canvasElement); const canvas = within(canvasElement);
await waitFor(
async () => {
await canvas.findByTestId('RootInputReady');
},
{ timeout: 1000 }
);
await canvas.findAllByRole('option', { await canvas.findAllByRole('option', {
name: 'address', name: 'address',
}); });