mirror of
https://github.com/trailbaseio/trailbase.git
synced 2026-05-23 02:28:34 -05:00
Fix index names in admin dash's table view.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { createSignal, Show } from "solid-js";
|
||||
import { createSignal, Show, Switch, Match } from "solid-js";
|
||||
import { useStore } from "@nanostores/solid";
|
||||
import { TbUser } from "solid-icons/tb";
|
||||
import { type User } from "trailbase";
|
||||
@@ -22,22 +22,26 @@ function avatarUrl(user: User): string {
|
||||
}
|
||||
|
||||
function Avatar(props: { user: User | undefined; size: number }) {
|
||||
if (props.user === undefined) {
|
||||
return <TbUser size={props.size} color="#0073aa" />;
|
||||
}
|
||||
|
||||
return (
|
||||
<object
|
||||
class="rounded-full bg-transparent"
|
||||
type="image/png"
|
||||
data={avatarUrl(props.user)}
|
||||
width={props.size}
|
||||
height={props.size}
|
||||
aria-label="Avatar image"
|
||||
>
|
||||
{/* Fallback */}
|
||||
<TbUser size={props.size} color="#0073aa" />
|
||||
</object>
|
||||
<Switch>
|
||||
<Match when={props.user === undefined}>
|
||||
<TbUser size={props.size} color="#0073aa" />
|
||||
</Match>
|
||||
|
||||
<Match when={props.user !== undefined}>
|
||||
<object
|
||||
class="rounded-full bg-transparent"
|
||||
type="image/png"
|
||||
data={avatarUrl(props.user!)}
|
||||
width={props.size}
|
||||
height={props.size}
|
||||
aria-label="Avatar image"
|
||||
>
|
||||
{/* Fallback */}
|
||||
<TbUser size={props.size} color="#0073aa" />
|
||||
</object>
|
||||
</Match>
|
||||
</Switch>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -686,7 +686,14 @@ export function TablePane(props: {
|
||||
|
||||
const table = () => props.selectedTable;
|
||||
const indexes = () =>
|
||||
props.schemas.indexes.filter((idx) => idx.table_name === table().name.name);
|
||||
props.schemas.indexes.filter((idx) => {
|
||||
const tbl = table();
|
||||
return (
|
||||
(idx.name.database_schema ?? "main") ==
|
||||
(tbl.name.database_schema ?? "main") &&
|
||||
idx.table_name === tbl.name.name
|
||||
);
|
||||
});
|
||||
const triggers = () =>
|
||||
props.schemas.triggers.filter(
|
||||
(trig) => trig.table_name === table().name.name,
|
||||
@@ -973,7 +980,7 @@ const sheetMaxWidth = "sm:max-w-[520px]";
|
||||
const indexColumns = [
|
||||
{
|
||||
header: "name",
|
||||
accessorKey: "name",
|
||||
accessorFn: (index: TableIndex) => index.name.name,
|
||||
},
|
||||
{
|
||||
header: "columns",
|
||||
|
||||
Reference in New Issue
Block a user