Skip to content

Commit 26db92f

Browse files
committed
Do not filter "hidden" tables in "Create Table Form" FK drop down. Fixes #4.
1 parent 919c25d commit 26db92f

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

ui/admin/src/components/logs/LogsPage.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,7 @@ function WorldMap(props: { country_codes: { [key in string]?: number } }) {
376376
? `<b>${props.name}</b><br />${requests} req`
377377
: "Hover over a country";
378378

379+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
379380
(this as any)._container.innerHTML = contents;
380381
},
381382
});

ui/admin/src/components/tables/TablesPage.tsx

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,13 +1081,14 @@ function pickInitiallySelectedTable(
10811081
function TablePickerPane(props: {
10821082
horizontal: boolean;
10831083
tablesAndViews: (Table | View)[];
1084+
allTables: Table[];
10841085
selectedTableName: Signal<string | undefined>;
10851086
schemaRefetch: () => Promise<void>;
10861087
}) {
10871088
const tablesAndViews = createMemo(() =>
10881089
props.tablesAndViews.toSorted((a, b) => {
1089-
const aHidden = a.name.startsWith("_");
1090-
const bHidden = b.name.startsWith("_");
1090+
const aHidden = hiddenTable(a);
1091+
const bHidden = hiddenTable(b);
10911092

10921093
if (aHidden == bHidden) {
10931094
return a.name.localeCompare(b.name);
@@ -1096,10 +1097,6 @@ function TablePickerPane(props: {
10961097
return aHidden ? 1 : -1;
10971098
}),
10981099
);
1099-
const tables = () =>
1100-
tablesAndViews().filter(
1101-
(either) => (either as Table) !== undefined,
1102-
) as Table[];
11031100

11041101
const showHidden = useStore($showHiddenTables);
11051102

@@ -1169,7 +1166,7 @@ function TablePickerPane(props: {
11691166
<SheetContent class={sheetMaxWidth}>
11701167
<CreateAlterTableForm
11711168
schemaRefetch={props.schemaRefetch}
1172-
allTables={tables()}
1169+
allTables={props.allTables}
11731170
setSelected={setSelectedTableName}
11741171
{...sheet}
11751172
/>
@@ -1219,11 +1216,11 @@ function TableSplitView(props: {
12191216
): (Table | View)[] {
12201217
return schemas.filter((s) => showHidden || !s.name.startsWith("_"));
12211218
}
1222-
const tablesAndViews = () =>
1223-
filterHidden(
1224-
[...props.schemas.tables, ...props.schemas.views],
1225-
showHidden(),
1226-
);
1219+
const allTablesAndViews = () => [
1220+
...props.schemas.tables,
1221+
...props.schemas.views,
1222+
];
1223+
const tablesAndViews = () => filterHidden(allTablesAndViews(), showHidden());
12271224

12281225
const [searchParams] = useSearchParams<{ table: string }>();
12291226
const selectedTableNameSignal = createSignal<string | undefined>(
@@ -1245,6 +1242,7 @@ function TableSplitView(props: {
12451242
<TablePickerPane
12461243
horizontal={p.horizontal}
12471244
tablesAndViews={tablesAndViews()}
1245+
allTables={props.schemas.tables}
12481246
selectedTableName={selectedTableNameSignal}
12491247
schemaRefetch={props.schemaRefetch}
12501248
/>

0 commit comments

Comments
 (0)