mirror of
https://github.com/tale/headplane.git
synced 2026-08-29 08:27:08 +00:00
fix: show tags on machine page
This commit is contained in:
@@ -47,9 +47,13 @@ export async function loader({
|
|||||||
|
|
||||||
const lookup = await context.agents?.lookup([machine.node.nodeKey]);
|
const lookup = await context.agents?.lookup([machine.node.nodeKey]);
|
||||||
const [node] = mapNodes([machine.node], lookup);
|
const [node] = mapNodes([machine.node], lookup);
|
||||||
|
const tags = Array.from(
|
||||||
|
new Set([...node.validTags, ...node.forcedTags]),
|
||||||
|
).sort();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
node,
|
node,
|
||||||
|
tags,
|
||||||
users,
|
users,
|
||||||
magic,
|
magic,
|
||||||
agent: context.agents?.agentID(),
|
agent: context.agents?.agentID(),
|
||||||
@@ -62,7 +66,8 @@ export async function action(request: ActionFunctionArgs) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function Page() {
|
export default function Page() {
|
||||||
const { node, magic, users, agent, stats } = useLoaderData<typeof loader>();
|
const { node, tags, magic, users, agent, stats } =
|
||||||
|
useLoaderData<typeof loader>();
|
||||||
const [showRouting, setShowRouting] = useState(false);
|
const [showRouting, setShowRouting] = useState(false);
|
||||||
|
|
||||||
const uiTags = useMemo(() => {
|
const uiTags = useMemo(() => {
|
||||||
@@ -113,7 +118,7 @@ export default function Page() {
|
|||||||
</p>
|
</p>
|
||||||
<div className="flex gap-1 mt-1 mb-8">
|
<div className="flex gap-1 mt-1 mb-8">
|
||||||
{mapTagsToComponents(node, uiTags)}
|
{mapTagsToComponents(node, uiTags)}
|
||||||
{node.validTags.map((tag) => (
|
{tags.map((tag) => (
|
||||||
<Chip key={tag} text={tag} />
|
<Chip key={tag} text={tag} />
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user