diff --git a/app/routes/machines/components/machine-row.tsx b/app/routes/machines/components/machine-row.tsx
index 77e0087..f5c5a1e 100644
--- a/app/routes/machines/components/machine-row.tsx
+++ b/app/routes/machines/components/machine-row.tsx
@@ -71,7 +71,10 @@ export default function MachineRow({
{mapTagsToComponents(node, uiTags)}
- {node.tags.map((tag) => (
+ {node.validTags?.map((tag) => (
+
+ ))}
+ {node.tags?.map((tag) => (
))}
diff --git a/app/routes/machines/dialogs/tags.tsx b/app/routes/machines/dialogs/tags.tsx
index e36156f..d0f2f43 100644
--- a/app/routes/machines/dialogs/tags.tsx
+++ b/app/routes/machines/dialogs/tags.tsx
@@ -21,7 +21,7 @@ export default function Tags({
setIsOpen,
existingTags,
}: TagsProps) {
- const [tags, setTags] = useState(machine.tags);
+ const [tags, setTags] = useState([...machine.forcedTags, ...machine.tags]);
const [tag, setTag] = useState('tag:');
const tagIsInvalid = useMemo(() => {
return tag.length === 0 || !tag.startsWith('tag:') || tags.includes(tag);
diff --git a/app/routes/machines/machine.tsx b/app/routes/machines/machine.tsx
index cf17bba..2bb43ca 100644
--- a/app/routes/machines/machine.tsx
+++ b/app/routes/machines/machine.tsx
@@ -41,7 +41,7 @@ export async function loader({ request, params, context }: Route.LoaderArgs) {
const lookup = await context.agents?.lookup([node.nodeKey]);
const [enhancedNode] = mapNodes([node], lookup);
const tags = Array.from(
- new Set([...node.tags]),
+ new Set([...node.tags, ...node.validTags, ...node.forcedTags]),
).sort();
return {
diff --git a/app/types/Machine.ts b/app/types/Machine.ts
index 3281d67..3e7629a 100644
--- a/app/types/Machine.ts
+++ b/app/types/Machine.ts
@@ -22,6 +22,9 @@ export interface Machine {
| 'REGISTER_METHOD_CLI'
| 'REGISTER_METHOD_OIDC';
+ forcedTags: string[];
+ invalidTags: string[];
+ validTags: string[];
tags: string[];
givenName: string;
online: boolean;
diff --git a/app/utils/node-info.ts b/app/utils/node-info.ts
index e41deca..f34ee02 100644
--- a/app/utils/node-info.ts
+++ b/app/utils/node-info.ts
@@ -54,9 +54,20 @@ export function mapNodes(
}
export function sortNodeTags(nodes: Machine[]): string[] {
- return Array.from(
- new Set(
- nodes.flatMap((node) => node.tags),
- ),
- ).sort();
+ try {
+ return Array.from(
+ new Set(
+ nodes.flatMap((node) => node.tags),
+ ),
+ ).sort();
+ } catch {
+ return Array.from(
+ new Set(
+ nodes.flatMap(({ validTags, forcedTags }) => [
+ ...validTags,
+ ...forcedTags,
+ ]),
+ ),
+ ).sort();
+ }
}