chore: push disabled local-agent code
This commit is contained in:
parent
de9a938da2
commit
325e9ba43d
11 changed files with 147 additions and 11 deletions
44
app/routes/settings/local-agent.tsx
Normal file
44
app/routes/settings/local-agent.tsx
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
import { useMemo } from 'react';
|
||||
import { useLoaderData, type LoaderFunctionArgs } from 'react-router';
|
||||
import { getSession, commitSession } from '~/utils/sessions.server'
|
||||
import { queryAgent } from '~/utils/ws-agent'
|
||||
import AgentManagement from './components/agent/manage'
|
||||
|
||||
export async function loader({ request, context }: LoaderFunctionArgs) {
|
||||
const { ws, wsAuthKey } = context;
|
||||
const session = await getSession(request.headers.get('Cookie'));
|
||||
const onboarding = session.get('agent_onboarding') ?? false;
|
||||
|
||||
const nodeKey = 'nodekey:542dad28354eb8d51e240aada7adf0222ba3ecc74af0bbd56123f03eefdb391b'
|
||||
const stats = await queryAgent([nodeKey]);
|
||||
|
||||
return {
|
||||
configured: wsAuthKey !== undefined,
|
||||
onboarding,
|
||||
stats: stats[nodeKey]
|
||||
}
|
||||
}
|
||||
|
||||
export default function Page() {
|
||||
const data = useLoaderData<typeof loader>();
|
||||
|
||||
// Whether we show the onboarding or management UI
|
||||
const management = useMemo(() => {
|
||||
return data.configured && (data.onboarding === false)
|
||||
}, [data.configured, data.onboarding]);
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-8 max-w-screen-lg">
|
||||
{management ? (
|
||||
<AgentManagement
|
||||
reachable={true}
|
||||
hostInfo={data.stats}
|
||||
/>
|
||||
) : (
|
||||
<div>
|
||||
<h1>Local Agent Coming Soon</h1>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue