feat(v0.6): remove standalone Manage page — manage sessions on the Sessions view
The Sessions chooser already shows every running session with a live thumbnail and Open + New session, so fold delete into it and drop the separate page: - add a Kill ✕ button to each session card (DELETE /live-sessions/:id + refresh), reusing makePreviewCard's extraActions and the existing .mg-kill style - remove public/manage.html + public/manage.ts and the esbuild manage entry - remove the 🗂 toolbar button (main.ts) and the 🗂 Manage header link (launcher.ts) Backend DELETE/preview routes stay (used by the launcher kill, thumbnails, and the project pages). Frontend + build-config only. Verified: full suite 453 green, web typecheck clean, build:web emits only main (no manage.* artifacts), and in-browser the Sessions cards have Open + Kill (2→1 on kill), no Manage entry, and GET /manage.html → 404.
This commit is contained in:
@@ -45,9 +45,7 @@ export function mountLauncher(host: HTMLElement, hooks: LauncherHooks): Launcher
|
||||
const actions = el('div', 'launcher-actions')
|
||||
const newBtn = el('button', 'launcher-new', '+ New session')
|
||||
newBtn.addEventListener('click', () => hooks.onNew())
|
||||
const manage = el('a', 'mg-btn', '🗂 Manage') as HTMLAnchorElement
|
||||
manage.href = '/manage.html'
|
||||
actions.append(newBtn, manage)
|
||||
actions.append(newBtn)
|
||||
head.append(sub, actions)
|
||||
root.append(head)
|
||||
|
||||
@@ -57,8 +55,20 @@ export function mountLauncher(host: HTMLElement, hooks: LauncherHooks): Launcher
|
||||
const cards = new Map<string, PreviewCard>()
|
||||
let timer: ReturnType<typeof setInterval> | null = null
|
||||
|
||||
/** Kill a session (DELETE /live-sessions/:id) then refresh the grid. */
|
||||
async function killOne(id: string): Promise<void> {
|
||||
await fetch(`/live-sessions/${encodeURIComponent(id)}`, { method: 'DELETE' }).catch(() => {})
|
||||
void refresh()
|
||||
}
|
||||
|
||||
function makeCard(s: LiveSessionInfo): PreviewCard {
|
||||
return makePreviewCard(s, { onOpen: (id) => hooks.onOpen(id) })
|
||||
const kill = el('button', 'mg-kill', 'Kill ✕')
|
||||
kill.title = 'Kill this session'
|
||||
kill.addEventListener('click', () => void killOne(s.id))
|
||||
return makePreviewCard(s, {
|
||||
onOpen: (id) => hooks.onOpen(id),
|
||||
extraActions: () => [kill],
|
||||
})
|
||||
}
|
||||
|
||||
async function refresh(): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user