console (fix): json values are not truncated in GDC browse rows

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/10459
GitOrigin-RevId: 0ed4456cb42d19739421cfbce77bdb5cdb0355a5
This commit is contained in:
Vijay Prasanna 2023-11-08 12:27:35 +05:30 committed by hasura-bot
parent a477eb46f1
commit b27dbb9af3
3 changed files with 18 additions and 4 deletions

View File

@ -110,6 +110,7 @@ export const ReactTableWrapper: React.VFC<ReactTableWrapperProps> = ({
<FaExternalLinkAlt />
</span>
) : (
// eslint-disable-next-line jsx-a11y/anchor-is-valid
<a
onClick={() => {
relationships?.onClick({
@ -269,6 +270,7 @@ export const ReactTableWrapper: React.VFC<ReactTableWrapperProps> = ({
key={`${row.id}-${i}`}
data-testid={`@table-cell-${row.id}-${i}`}
style={{ maxWidth: '20ch' }}
className="px-sm py-xs whitespace-nowrap text-muted overflow-hidden text-ellipsis"
>
{flexRender(cell.column.columnDef.cell, cell.getContext())}
</CardedTable.TableBodyCell>

View File

@ -6,9 +6,9 @@ import {
Textarea,
InputField,
SimpleForm,
CodeEditorField,
} from '../../../../../new-components/Form';
import { TableColumn } from '../../../../DataSource';
import ReactJson from 'react-json-view';
interface RowDialogProps {
row: Record<string, any>;
@ -28,7 +28,19 @@ export const RowDialog = ({ onClose, row, columns }: RowDialogProps) => {
)?.consoleDataType;
if (columnDataType === 'json')
return <CodeEditorField name={key} label={key} disabled />;
return (
<div>
<div className="font-semibold">{key}</div>
<div className="border p-4 rounded">
<ReactJson
src={
typeof row[key] === 'string' ? JSON.parse(row[key]) : row[key]
}
collapsed
/>
</div>
</div>
);
if (columnDataType === 'string')
return <InputField disabled type="text" name={key} label={key} />;

View File

@ -11,7 +11,7 @@ export const manageTableUrl = ({
const tab =
sessionStore.getItem('manageTable.lastTab') ?? DEFAULT_MANAGE_TABLE_TAB;
return `data/v2/manage/table/${tab}?database=${dataSourceName}&table=${encodeURIComponent(
return `/data/v2/manage/table/${tab}?database=${dataSourceName}&table=${encodeURIComponent(
JSON.stringify(table)
)}`;
};
@ -26,6 +26,6 @@ export const manageFunctionUrl = ({
dataSourceName: string;
fn: unknown;
}) =>
`data/v2/manage/function?database=${dataSourceName}&function=${encodeURIComponent(
`/data/v2/manage/function?database=${dataSourceName}&function=${encodeURIComponent(
JSON.stringify(fn)
)}`;