|
1 | 1 | import type { ProvisionerDaemon, ProvisionerKey } from "api/typesGenerated";
|
2 | 2 | import { Button } from "components/Button/Button";
|
3 | 3 | import { CopyButton } from "components/CopyButton/CopyButton";
|
4 |
| -import { TableCell, TableRow } from "components/Table/Table"; |
| 4 | +import { |
| 5 | + Table, |
| 6 | + TableCell, |
| 7 | + TableHead, |
| 8 | + TableHeader, |
| 9 | + TableRow, |
| 10 | +} from "components/Table/Table"; |
5 | 11 | import { ChevronDownIcon, ChevronRightIcon } from "lucide-react";
|
6 | 12 | import { ProvisionerTag } from "modules/provisioners/ProvisionerTags";
|
| 13 | +import { LastConnectionHead } from "pages/OrganizationSettingsPage/OrganizationProvisionersPage/LastConnectionHead"; |
| 14 | +import { ProvisionerRow } from "pages/OrganizationSettingsPage/OrganizationProvisionersPage/ProvisionerRow"; |
7 | 15 | import { type FC, useState } from "react";
|
8 |
| -import { Link as RouterLink } from "react-router-dom"; |
9 | 16 | import { cn } from "utils/cn";
|
10 | 17 | import { relativeTime } from "utils/time";
|
11 | 18 |
|
12 | 19 | type ProvisionerKeyRowProps = {
|
13 | 20 | readonly provisionerKey: ProvisionerKey;
|
14 | 21 | readonly provisioners: readonly ProvisionerDaemon[];
|
| 22 | + readonly buildVersion: string | undefined; |
15 | 23 | defaultIsOpen: boolean;
|
16 | 24 | };
|
17 | 25 |
|
18 | 26 | export const ProvisionerKeyRow: FC<ProvisionerKeyRowProps> = ({
|
19 | 27 | provisionerKey,
|
20 | 28 | provisioners,
|
| 29 | + buildVersion, |
21 | 30 | defaultIsOpen = false,
|
22 | 31 | }) => {
|
23 | 32 | const [isOpen, setIsOpen] = useState(defaultIsOpen);
|
@@ -61,33 +70,38 @@ export const ProvisionerKeyRow: FC<ProvisionerKeyRowProps> = ({
|
61 | 70 |
|
62 | 71 | {isOpen && (
|
63 | 72 | <TableRow>
|
64 |
| - <TableCell colSpan={999} className="p-4 border-t-0"> |
| 73 | + <TableCell colSpan={999} className="p-0"> |
65 | 74 | {provisioners.length === 0 ? (
|
66 |
| - <span className="text-muted-foreground"> |
67 |
| - No provisioners found for this key. |
68 |
| - </span> |
| 75 | + <TableRow> |
| 76 | + <TableCell colSpan={999} className="p-4 border-t-0"> |
| 77 | + <span className="text-muted-foreground"> |
| 78 | + No provisioners found for this key. |
| 79 | + </span> |
| 80 | + </TableCell> |
| 81 | + </TableRow> |
69 | 82 | ) : (
|
70 |
| - <dl> |
71 |
| - <dt>Provisioners:</dt> |
72 |
| - {provisioners.map((provisioner) => ( |
73 |
| - <dd key={provisioner.id}> |
74 |
| - <span className="font-mono text-content-primary"> |
75 |
| - {provisioner.name} ({provisioner.id}){" "} |
76 |
| - </span> |
77 |
| - <CopyButton |
78 |
| - text={provisioner.id} |
79 |
| - label="Copy provisioner ID" |
80 |
| - /> |
81 |
| - <Button size="xs" variant="outline" asChild> |
82 |
| - <RouterLink |
83 |
| - to={`../provisioners?${new URLSearchParams({ ids: provisioner.id })}`} |
84 |
| - > |
85 |
| - View provisioner |
86 |
| - </RouterLink> |
87 |
| - </Button> |
88 |
| - </dd> |
| 83 | + <Table> |
| 84 | + <TableHeader> |
| 85 | + <TableRow> |
| 86 | + <TableHead>Name</TableHead> |
| 87 | + <TableHead>Key</TableHead> |
| 88 | + <TableHead>Version</TableHead> |
| 89 | + <TableHead>Status</TableHead> |
| 90 | + <TableHead>Tags</TableHead> |
| 91 | + <TableHead> |
| 92 | + <LastConnectionHead /> |
| 93 | + </TableHead> |
| 94 | + </TableRow> |
| 95 | + </TableHeader> |
| 96 | + {provisioners.map((p) => ( |
| 97 | + <ProvisionerRow |
| 98 | + key={p.id} |
| 99 | + buildVersion={buildVersion} |
| 100 | + provisioner={p} |
| 101 | + defaultIsOpen={false} |
| 102 | + /> |
89 | 103 | ))}
|
90 |
| - </dl> |
| 104 | + </Table> |
91 | 105 | )}
|
92 | 106 | </TableCell>
|
93 | 107 | </TableRow>
|
|
0 commit comments