Skip to content

Commit e0bc70c

Browse files
authored
feat: add envd version to the template list (#173)
1 parent 38684b8 commit e0bc70c

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed

src/features/dashboard/templates/table-cells.tsx

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
useToast,
88
} from '@/lib/hooks/use-toast'
99
import { cn } from '@/lib/utils'
10+
import { isVersionCompatible } from '@/lib/utils/version'
1011
import {
1112
deleteTemplateAction,
1213
updateTemplateAction,
@@ -284,3 +285,36 @@ export function VisibilityCell({
284285
</span>
285286
)
286287
}
288+
289+
const INVALID_ENVD_VERSION = '0.0.1'
290+
const SDK_V2_MINIMAL_ENVD_VERSION = '0.2.0'
291+
292+
export function EnvdVersionCell({
293+
getValue,
294+
}: CellContext<Template | DefaultTemplate, unknown>) {
295+
const valueString = getValue() as string
296+
const versionValue =
297+
valueString && valueString !== INVALID_ENVD_VERSION ? valueString : null
298+
299+
const isNotV2Compatible = versionValue
300+
? isVersionCompatible(versionValue, SDK_V2_MINIMAL_ENVD_VERSION) === false
301+
: false
302+
return (
303+
<div
304+
className={cn(
305+
'text-fg-tertiary whitespace-nowrap font-mono flex flex-row gap-1.5',
306+
{
307+
'text-accent-error-highlight': isNotV2Compatible,
308+
}
309+
)}
310+
>
311+
{versionValue ?? 'N/A'}
312+
{isNotV2Compatible && (
313+
<HelpTooltip>
314+
The envd version is not compatible with the SDK v2. To update the envd
315+
version, you need to rebuild the template.
316+
</HelpTooltip>
317+
)}
318+
</div>
319+
)
320+
}

src/features/dashboard/templates/table-config.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
ActionsCell,
1717
CpuCell,
1818
CreatedAtCell,
19+
EnvdVersionCell,
1920
MemoryCell,
2021
TemplateIdCell,
2122
TemplateNameCell,
@@ -138,6 +139,14 @@ export const useColumns = (deps: unknown[]) => {
138139
enableSorting: false,
139140
filterFn: 'equals',
140141
},
142+
{
143+
accessorKey: 'envdVersion',
144+
header: 'Envd Version',
145+
size: 125,
146+
minSize: 70,
147+
cell: EnvdVersionCell,
148+
enableSorting: false,
149+
},
141150
],
142151
deps
143152
)

0 commit comments

Comments
 (0)