|
1 | 1 | import type { ProvisionerDaemon } from "api/typesGenerated";
|
2 | 2 | import { Badge } from "components/Badge/Badge";
|
3 | 3 | import { Button } from "components/Button/Button";
|
| 4 | +import { Checkbox } from "components/Checkbox/Checkbox"; |
4 | 5 | import { EmptyState } from "components/EmptyState/EmptyState";
|
5 | 6 | import { Link } from "components/Link/Link";
|
6 | 7 | import { Loader } from "components/Loader/Loader";
|
@@ -32,6 +33,7 @@ import { ProvisionerRow } from "./ProvisionerRow";
|
32 | 33 |
|
33 | 34 | type ProvisionersFilter = {
|
34 | 35 | ids: string;
|
| 36 | + offline: boolean; |
35 | 37 | };
|
36 | 38 |
|
37 | 39 | interface OrganizationProvisionersPageViewProps {
|
@@ -102,70 +104,79 @@ export const OrganizationProvisionersPageView: FC<
|
102 | 104 | documentationLink={docs("/")}
|
103 | 105 | />
|
104 | 106 | ) : (
|
105 |
| - <Table> |
106 |
| - <TableHeader> |
107 |
| - <TableRow> |
108 |
| - <TableHead>Name</TableHead> |
109 |
| - <TableHead>Key</TableHead> |
110 |
| - <TableHead>Version</TableHead> |
111 |
| - <TableHead>Status</TableHead> |
112 |
| - <TableHead>Tags</TableHead> |
113 |
| - <TableHead> |
114 |
| - <LastConnectionHead /> |
115 |
| - </TableHead> |
116 |
| - </TableRow> |
117 |
| - </TableHeader> |
118 |
| - <TableBody> |
119 |
| - {provisioners ? ( |
120 |
| - provisioners.length > 0 ? ( |
121 |
| - provisioners.map((provisioner) => ( |
122 |
| - <ProvisionerRow |
123 |
| - provisioner={provisioner} |
124 |
| - key={provisioner.id} |
125 |
| - buildVersion={buildVersion} |
126 |
| - defaultIsOpen={filter.ids.includes(provisioner.id)} |
127 |
| - /> |
128 |
| - )) |
129 |
| - ) : ( |
| 107 | + <><div className="flex items-center gap-2 mb-6"> |
| 108 | + <Checkbox |
| 109 | + id="offline-filter" |
| 110 | + checked={filter.offline} |
| 111 | + onCheckedChange={(checked) => { |
| 112 | + onFilterChange({ |
| 113 | + ...filter, |
| 114 | + offline: checked === true, |
| 115 | + }); |
| 116 | + } } /> |
| 117 | + <label |
| 118 | + htmlFor="offline-filter" |
| 119 | + className="text-sm font-medium leading-none" |
| 120 | + > |
| 121 | + Include offline provisioners |
| 122 | + </label> |
| 123 | + </div><Table> |
| 124 | + <TableHeader> |
130 | 125 | <TableRow>
|
131 |
| - <TableCell colSpan={999}> |
132 |
| - <EmptyState |
133 |
| - message="No provisioners found" |
134 |
| - description="A provisioner is required before you can create templates and workspaces. You can connect your first provisioner by following our documentation." |
135 |
| - cta={ |
136 |
| - <Button size="sm" asChild> |
137 |
| - <a href={docs("/admin/provisioners")}> |
138 |
| - Create a provisioner |
139 |
| - <SquareArrowOutUpRightIcon /> |
140 |
| - </a> |
141 |
| - </Button> |
142 |
| - } |
143 |
| - /> |
144 |
| - </TableCell> |
| 126 | + <TableHead>Name</TableHead> |
| 127 | + <TableHead>Key</TableHead> |
| 128 | + <TableHead>Version</TableHead> |
| 129 | + <TableHead>Status</TableHead> |
| 130 | + <TableHead>Tags</TableHead> |
| 131 | + <TableHead> |
| 132 | + <LastConnectionHead /> |
| 133 | + </TableHead> |
145 | 134 | </TableRow>
|
146 |
| - ) |
147 |
| - ) : error ? ( |
148 |
| - <TableRow> |
149 |
| - <TableCell colSpan={999}> |
150 |
| - <EmptyState |
151 |
| - message="Error loading the provisioner jobs" |
152 |
| - cta={ |
153 |
| - <Button onClick={onRetry} size="sm"> |
154 |
| - Retry |
155 |
| - </Button> |
156 |
| - } |
157 |
| - /> |
158 |
| - </TableCell> |
159 |
| - </TableRow> |
160 |
| - ) : ( |
161 |
| - <TableRow> |
162 |
| - <TableCell colSpan={999}> |
163 |
| - <Loader /> |
164 |
| - </TableCell> |
165 |
| - </TableRow> |
166 |
| - )} |
167 |
| - </TableBody> |
168 |
| - </Table> |
| 135 | + </TableHeader> |
| 136 | + <TableBody> |
| 137 | + {provisioners ? ( |
| 138 | + provisioners.length > 0 ? ( |
| 139 | + provisioners.map((provisioner) => ( |
| 140 | + <ProvisionerRow |
| 141 | + provisioner={provisioner} |
| 142 | + key={provisioner.id} |
| 143 | + buildVersion={buildVersion} |
| 144 | + defaultIsOpen={filter.ids.includes(provisioner.id)} /> |
| 145 | + )) |
| 146 | + ) : ( |
| 147 | + <TableRow> |
| 148 | + <TableCell colSpan={999}> |
| 149 | + <EmptyState |
| 150 | + message="No provisioners found" |
| 151 | + description="A provisioner is required before you can create templates and workspaces. You can connect your first provisioner by following our documentation." |
| 152 | + cta={<Button size="sm" asChild> |
| 153 | + <a href={docs("/admin/provisioners")}> |
| 154 | + Create a provisioner |
| 155 | + <SquareArrowOutUpRightIcon /> |
| 156 | + </a> |
| 157 | + </Button>} /> |
| 158 | + </TableCell> |
| 159 | + </TableRow> |
| 160 | + ) |
| 161 | + ) : error ? ( |
| 162 | + <TableRow> |
| 163 | + <TableCell colSpan={999}> |
| 164 | + <EmptyState |
| 165 | + message="Error loading the provisioner jobs" |
| 166 | + cta={<Button onClick={onRetry} size="sm"> |
| 167 | + Retry |
| 168 | + </Button>} /> |
| 169 | + </TableCell> |
| 170 | + </TableRow> |
| 171 | + ) : ( |
| 172 | + <TableRow> |
| 173 | + <TableCell colSpan={999}> |
| 174 | + <Loader /> |
| 175 | + </TableCell> |
| 176 | + </TableRow> |
| 177 | + )} |
| 178 | + </TableBody> |
| 179 | + </Table></> |
169 | 180 | )}
|
170 | 181 | </section>
|
171 | 182 | );
|
|
0 commit comments