Spaces:
Running
Running
Delete console/src/pages/WorkspaceSettingsPage.tsx
Browse files
console/src/pages/WorkspaceSettingsPage.tsx
DELETED
|
@@ -1,27 +0,0 @@
|
|
| 1 |
-
import { useEffect, useState } from "react";
|
| 2 |
-
import { Button, Field, FieldLabel, StatusIndicator } from "lumen-ui-kit";
|
| 3 |
-
import { PageFrame } from "../components/Workbench";
|
| 4 |
-
import { useWorkspace } from "../workspaces/WorkspaceProvider";
|
| 5 |
-
|
| 6 |
-
export default function WorkspaceSettingsPage() {
|
| 7 |
-
const { activeWorkspace, canManageWorkspaces, updateWorkspace } = useWorkspace();
|
| 8 |
-
const [name, setName] = useState(activeWorkspace?.display_name ?? "");
|
| 9 |
-
const [description, setDescription] = useState(activeWorkspace?.description ?? "");
|
| 10 |
-
const [message, setMessage] = useState<string | null>(null);
|
| 11 |
-
useEffect(() => { setName(activeWorkspace?.display_name ?? ""); setDescription(activeWorkspace?.description ?? ""); }, [activeWorkspace]);
|
| 12 |
-
if (!activeWorkspace) return null;
|
| 13 |
-
async function save() {
|
| 14 |
-
setMessage(null);
|
| 15 |
-
try { await updateWorkspace({ display_name: name, description }); setMessage("Workspace settings saved."); }
|
| 16 |
-
catch (reason) { setMessage(reason instanceof Error ? reason.message : "Unable to save settings"); }
|
| 17 |
-
}
|
| 18 |
-
return <PageFrame className="overflow-auto"><div className="mx-auto flex max-w-3xl flex-col gap-5 p-6">
|
| 19 |
-
<div><h1 className="text-2xl font-semibold">Workspace settings</h1><p className="text-lumen-muted-foreground">Metadata and stable integration endpoints.</p></div>
|
| 20 |
-
<Field><FieldLabel htmlFor="settings-name">Display name</FieldLabel><input id="settings-name" className="rounded border p-2" value={name} disabled={!canManageWorkspaces} onChange={(e) => setName(e.target.value)} /></Field>
|
| 21 |
-
<Field><FieldLabel htmlFor="settings-description">Description</FieldLabel><textarea id="settings-description" className="rounded border p-2" value={description} disabled={!canManageWorkspaces} onChange={(e) => setDescription(e.target.value)} /></Field>
|
| 22 |
-
{[['Slug', activeWorkspace.slug], ['Brain ID', activeWorkspace.brain_id], ['Native API', activeWorkspace.api_base_url], ['Native OpenAPI', `${activeWorkspace.api_base_url}/openapi.json`], ['Agent API', activeWorkspace.api_base_url.replace(/\/api$/, '/agent')], ['Agent OpenAPI', activeWorkspace.api_base_url.replace(/\/api$/, '/agent/openapi.json')], ['MCP endpoint', activeWorkspace.api_base_url.replace(/\/api$/, '/mcp')], ['Console URL', activeWorkspace.console_url]].map(([label, value]) => <div key={label}><div className="text-sm font-medium">{label}</div><div className="flex gap-2"><code className="min-w-0 flex-1 overflow-x-auto rounded bg-lumen-surface p-2">{value}</code><Button type="button" size="small" variant="secondary" onClick={() => void navigator.clipboard.writeText(value)}>Copy</Button></div></div>)}
|
| 23 |
-
<div><span className="mr-2 text-sm font-medium">Status</span><StatusIndicator status={activeWorkspace.archived ? "warning" : "success"}>{activeWorkspace.archived ? "Archived" : "Active"}</StatusIndicator></div>
|
| 24 |
-
{canManageWorkspaces ? <div className="flex gap-2"><Button onClick={() => void save()}>Save changes</Button><Button variant="secondary" onClick={() => void updateWorkspace({ archived: !activeWorkspace.archived })}>{activeWorkspace.archived ? "Restore" : "Archive"}</Button></div> : null}
|
| 25 |
-
{message ? <p role="status">{message}</p> : null}
|
| 26 |
-
</div></PageFrame>;
|
| 27 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|