use niceId for client routes

This commit is contained in:
miloschwartz
2025-12-06 20:31:09 -05:00
parent 8a8c0edad3
commit d7e06161a8
22 changed files with 375 additions and 222 deletions

View File

@@ -40,6 +40,7 @@ export type ClientRow = {
userId: string | null;
username: string | null;
userEmail: string | null;
niceId: string;
};
type ClientTableProps = {
@@ -66,7 +67,8 @@ export default function MachineClientsTable({
const defaultMachineColumnVisibility = {
client: false,
subnet: false,
userId: false
userId: false,
niceId: false
};
const refreshData = () => {
@@ -129,8 +131,8 @@ export default function MachineClientsTable({
}
},
{
accessorKey: "userId",
friendlyName: "User",
accessorKey: "niceId",
friendlyName: "Identifier",
header: ({ column }) => {
return (
<Button
@@ -141,54 +143,12 @@ export default function MachineClientsTable({
)
}
>
User
{t("identifier")}
<ArrowUpDown className="ml-2 h-4 w-4" />
</Button>
);
},
cell: ({ row }) => {
const r = row.original;
return r.userId ? (
<Link
href={`/${r.orgId}/settings/access/users/${r.userId}`}
>
<Button variant="outline">
{r.userEmail || r.username || r.userId}
<ArrowUpRight className="ml-2 h-4 w-4" />
</Button>
</Link>
) : (
"-"
);
}
},
// {
// accessorKey: "siteName",
// header: ({ column }) => {
// return (
// <Button
// variant="ghost"
// onClick={() =>
// column.toggleSorting(column.getIsSorted() === "asc")
// }
// >
// Site
// <ArrowUpDown className="ml-2 h-4 w-4" />
// </Button>
// );
// },
// cell: ({ row }) => {
// const r = row.original;
// return (
// <Link href={`/${r.orgId}/settings/sites/${r.siteId}`}>
// <Button variant="outline">
// {r.siteName}
// <ArrowUpRight className="ml-2 h-4 w-4" />
// </Button>
// </Link>
// );
// }
// },
{
accessorKey: "online",
friendlyName: "Connectivity",
@@ -369,7 +329,7 @@ export default function MachineClientsTable({
</DropdownMenuContent>
</DropdownMenu>
<Link
href={`/${clientRow.orgId}/settings/clients/machine/${clientRow.id}`}
href={`/${clientRow.orgId}/settings/clients/machine/${clientRow.niceId}`}
>
<Button variant={"outline"}>
{t("edit")}