Skip to content

Commit

Permalink
refactor (console): relationship tab components for GDC, local types …
Browse files Browse the repository at this point in the history
…& stories

PR-URL: hasura/graphql-engine-mono#6801
GitOrigin-RevId: d1e97752bc52633a3a853a8d474efb6c437ba5dd
  • Loading branch information
vijayprasanna13 authored and hasura-bot committed Nov 16, 2022
1 parent 4722029 commit 980813c
Show file tree
Hide file tree
Showing 62 changed files with 2,069 additions and 1,239 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
import Endpoints from '@/Endpoints';
import { areTablesEqual } from '@/features/RelationshipsTable';
import { useHttpClient } from '@/features/Network';
import { useQuery, UseQueryResult } from 'react-query';
import { useTablesForeignKeys } from './useTableForeignKeys';
Expand Down Expand Up @@ -40,7 +41,7 @@ export const useTableEnums = ({
for (const table of tables) {
const relation = foreignKeys.reduce(
(tally: ForeignKeyMapping | null, fk: ForeignKeyMapping[]) => {
const found = fk.find(f => f.to.table === table.name);
const found = fk.find(f => areTablesEqual(f.to.table, table));
if (!found) return tally;
return found;
},
Expand Down
7 changes: 2 additions & 5 deletions console/src/features/Data/ManageTable/ManageTable.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BrowseRowsContainer } from '@/features/BrowseRows';
import { DatabaseRelationshipsContainer } from '@/features/DataRelationships';
import { DatabaseRelationships } from '@/features/DatabaseRelationships';
import { getTableName } from '@/features/DataSource';
import { PermissionsTab } from '@/features/PermissionsTab';
import { Table } from '@/features/hasura-metadata-types';
Expand Down Expand Up @@ -47,10 +47,7 @@ const availableTabs = (
value: 'relationships',
label: 'Relationships',
content: (
<DatabaseRelationshipsContainer
dataSourceName={dataSourceName}
table={table}
/>
<DatabaseRelationships dataSourceName={dataSourceName} table={table} />
),
},
{
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ import { useListAllRelationshipsFromMetadata } from './hooks/useListAllRelations
export const columns = ['NAME', 'SOURCE', 'TYPE', 'RELATIONSHIP', null];

const getTableDisplayName = (table: Table): string => {
/*
this function isn't entirely generic but it will hold for the current set of native DBs we have & GDC as well
*/

if (Array.isArray(table)) return table.join('.');

if (!table) return 'Empty Object';
Expand Down

This file was deleted.

Loading

0 comments on commit 980813c

Please sign in to comment.