Replace global with apps and dashboard app properties

This commit is contained in:
Chris Wanstrath 2026-03-01 09:48:36 -08:00
parent c7f8f09ba9
commit 52cf99b56d
6 changed files with 15 additions and 12 deletions

View File

@ -45,8 +45,8 @@ const OpenEmojiPicker = define('OpenEmojiPicker', {
}) })
export function AppDetail({ app, render }: { app: App, render: () => void }) { export function AppDetail({ app, render }: { app: App, render: () => void }) {
// Find global tools (shown as tabs on every app) // Find tools that show on app pages (apps !== false)
const tools = apps.filter(a => a.tool && a.global) const tools = apps.filter(a => a.tool && a.apps !== false)
const selectedTab = getSelectedTab(app.name) const selectedTab = getSelectedTab(app.name)
return ( return (

View File

@ -16,8 +16,8 @@ export function Nav({ app, render }: { app: App; render: () => void }) {
navigate(tab === 'overview' ? `/app/${app.name}` : `/app/${app.name}/${tab}`) navigate(tab === 'overview' ? `/app/${app.name}` : `/app/${app.name}/${tab}`)
} }
// Find global tools (shown as tabs on every app) // Find tools that show on app pages (apps !== false)
const tools = apps.filter(a => a.tool && a.global) const tools = apps.filter(a => a.tool && a.apps !== false)
const titlecase = (s: string) => s.split(' ').map(part => part[0]?.toUpperCase() + part.slice(1)) const titlecase = (s: string) => s.split(' ').map(part => part[0]?.toUpperCase() + part.slice(1))
return ( return (

View File

@ -10,7 +10,7 @@ const render = () => {
renderApp(<Dashboard render={render} />, document.getElementById('app')!) renderApp(<Dashboard render={render} />, document.getElementById('app')!)
// Update tool iframes after DOM settles // Update tool iframes after DOM settles
requestAnimationFrame(() => { requestAnimationFrame(() => {
const tools = apps.filter(a => a.tool && a.global) const tools = apps.filter(a => a.tool && a.apps !== false)
updateToolIframes(getSelectedTab(selectedApp), tools, selectedApp) updateToolIframes(getSelectedTab(selectedApp), tools, selectedApp)
}) })
} }

View File

@ -26,9 +26,9 @@ function convert(app: BackendApp): SharedApp {
router.sse('/stream', (send) => { router.sse('/stream', (send) => {
const broadcast = () => { const broadcast = () => {
const apps: SharedApp[] = allApps().map(({ const apps: SharedApp[] = allApps().map(({
name, state, icon, error, port, started, logs, tool, global: global_, tunnelEnabled, tunnelUrl name, state, icon, error, port, started, logs, tool, apps: apps_, dashboard, tunnelEnabled, tunnelUrl
}) => ({ }) => ({
name, state, icon, error, port, started, logs, tool, global: global_, tunnelEnabled, tunnelUrl, name, state, icon, error, port, started, logs, tool, apps: apps_, dashboard, tunnelEnabled, tunnelUrl,
})) }))
send(apps) send(apps)
} }

View File

@ -159,8 +159,9 @@ export function registerApp(dir: string) {
const state: AppState = error ? 'invalid' : 'stopped' const state: AppState = error ? 'invalid' : 'stopped'
const icon = pkg.toes?.icon ?? DEFAULT_EMOJI const icon = pkg.toes?.icon ?? DEFAULT_EMOJI
const tool = pkg.toes?.tool const tool = pkg.toes?.tool
const global_ = pkg.toes?.global const apps = pkg.toes?.apps
_apps.set(dir, { name: dir, state, icon, error, tool, global: global_ }) const dashboard = pkg.toes?.dashboard
_apps.set(dir, { name: dir, state, icon, error, tool, apps, dashboard })
update() update()
emit({ type: 'app:create', app: dir }) emit({ type: 'app:create', app: dir })
if (!error) { if (!error) {
@ -380,8 +381,9 @@ function discoverApps() {
const state: AppState = error ? 'invalid' : 'stopped' const state: AppState = error ? 'invalid' : 'stopped'
const icon = pkg.toes?.icon ?? DEFAULT_EMOJI const icon = pkg.toes?.icon ?? DEFAULT_EMOJI
const tool = pkg.toes?.tool const tool = pkg.toes?.tool
const global_ = pkg.toes?.global const apps = pkg.toes?.apps
_apps.set(dir, { name: dir, state, icon, error, tool, global: global_ }) const dashboard = pkg.toes?.dashboard
_apps.set(dir, { name: dir, state, icon, error, tool, apps, dashboard })
} }
update() update()
} }

View File

@ -28,7 +28,8 @@ export type App = {
started?: number started?: number
logs?: LogLine[] logs?: LogLine[]
tool?: boolean | string tool?: boolean | string
global?: boolean apps?: boolean
dashboard?: boolean
tunnelEnabled?: boolean tunnelEnabled?: boolean
tunnelUrl?: string tunnelUrl?: string
} }