mirror of
https://github.com/tale/headplane.git
synced 2026-08-28 07:57:03 +00:00
fix: ignore ws_agents if there are no agents connected
This commit is contained in:
@@ -14,7 +14,7 @@ import cn from '~/utils/cn';
|
|||||||
import { hs_getConfig } from '~/utils/config/loader';
|
import { hs_getConfig } from '~/utils/config/loader';
|
||||||
import { pull } from '~/utils/headscale';
|
import { pull } from '~/utils/headscale';
|
||||||
import { getSession } from '~/utils/sessions.server';
|
import { getSession } from '~/utils/sessions.server';
|
||||||
import { hp_getSingleton } from '~server/context/global';
|
import { hp_getSingleton, hp_getSingletonUnsafe } from '~server/context/global';
|
||||||
import { menuAction } from './action';
|
import { menuAction } from './action';
|
||||||
import MenuOptions from './components/menu';
|
import MenuOptions from './components/menu';
|
||||||
import Routes from './dialogs/routes';
|
import Routes from './dialogs/routes';
|
||||||
@@ -45,7 +45,9 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
|
|||||||
routes: routes.routes.filter((route) => route.node.id === params.id),
|
routes: routes.routes.filter((route) => route.node.id === params.id),
|
||||||
users: users.users,
|
users: users.users,
|
||||||
magic,
|
magic,
|
||||||
agent: [...hp_getSingleton('ws_agents').keys()].includes(machine.node.id),
|
agent: [...(hp_getSingletonUnsafe('ws_agents') ?? []).keys()].includes(
|
||||||
|
machine.node.id,
|
||||||
|
),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import { getSession } from '~/utils/sessions.server';
|
|||||||
import Tooltip from '~/components/Tooltip';
|
import Tooltip from '~/components/Tooltip';
|
||||||
import { hs_getConfig } from '~/utils/config/loader';
|
import { hs_getConfig } from '~/utils/config/loader';
|
||||||
import useAgent from '~/utils/useAgent';
|
import useAgent from '~/utils/useAgent';
|
||||||
import { hp_getConfig, hp_getSingleton } from '~server/context/global';
|
import { hp_getConfig, hp_getSingletonUnsafe } from '~server/context/global';
|
||||||
import { menuAction } from './action';
|
import { menuAction } from './action';
|
||||||
import MachineRow from './components/machine';
|
import MachineRow from './components/machine';
|
||||||
import NewMachine from './dialogs/new';
|
import NewMachine from './dialogs/new';
|
||||||
@@ -43,7 +43,7 @@ export async function loader({ request }: LoaderFunctionArgs) {
|
|||||||
magic,
|
magic,
|
||||||
server: context.headscale.url,
|
server: context.headscale.url,
|
||||||
publicServer: context.headscale.public_url,
|
publicServer: context.headscale.public_url,
|
||||||
agents: [...hp_getSingleton('ws_agents').keys()],
|
agents: [...(hp_getSingletonUnsafe('ws_agents') ?? []).keys()],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user