forked from defunkt/toes
Add global field to filter tool tabs
This commit is contained in:
parent
2046af1407
commit
c7f8f09ba9
|
|
@ -45,8 +45,8 @@ const OpenEmojiPicker = define('OpenEmojiPicker', {
|
|||
})
|
||||
|
||||
export function AppDetail({ app, render }: { app: App, render: () => void }) {
|
||||
// Find all tools
|
||||
const tools = apps.filter(a => a.tool)
|
||||
// Find global tools (shown as tabs on every app)
|
||||
const tools = apps.filter(a => a.tool && a.global)
|
||||
const selectedTab = getSelectedTab(app.name)
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ export function Nav({ app, render }: { app: App; render: () => void }) {
|
|||
navigate(tab === 'overview' ? `/app/${app.name}` : `/app/${app.name}/${tab}`)
|
||||
}
|
||||
|
||||
// Find all tools
|
||||
const tools = apps.filter(a => a.tool)
|
||||
// Find global tools (shown as tabs on every app)
|
||||
const tools = apps.filter(a => a.tool && a.global)
|
||||
const titlecase = (s: string) => s.split(' ').map(part => part[0]?.toUpperCase() + part.slice(1))
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ const render = () => {
|
|||
renderApp(<Dashboard render={render} />, document.getElementById('app')!)
|
||||
// Update tool iframes after DOM settles
|
||||
requestAnimationFrame(() => {
|
||||
const tools = apps.filter(a => a.tool)
|
||||
const tools = apps.filter(a => a.tool && a.global)
|
||||
updateToolIframes(getSelectedTab(selectedApp), tools, selectedApp)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,9 +26,9 @@ function convert(app: BackendApp): SharedApp {
|
|||
router.sse('/stream', (send) => {
|
||||
const broadcast = () => {
|
||||
const apps: SharedApp[] = allApps().map(({
|
||||
name, state, icon, error, port, started, logs, tool, tunnelEnabled, tunnelUrl
|
||||
name, state, icon, error, port, started, logs, tool, global: global_, tunnelEnabled, tunnelUrl
|
||||
}) => ({
|
||||
name, state, icon, error, port, started, logs, tool, tunnelEnabled, tunnelUrl,
|
||||
name, state, icon, error, port, started, logs, tool, global: global_, tunnelEnabled, tunnelUrl,
|
||||
}))
|
||||
send(apps)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -159,7 +159,8 @@ export function registerApp(dir: string) {
|
|||
const state: AppState = error ? 'invalid' : 'stopped'
|
||||
const icon = pkg.toes?.icon ?? DEFAULT_EMOJI
|
||||
const tool = pkg.toes?.tool
|
||||
_apps.set(dir, { name: dir, state, icon, error, tool })
|
||||
const global_ = pkg.toes?.global
|
||||
_apps.set(dir, { name: dir, state, icon, error, tool, global: global_ })
|
||||
update()
|
||||
emit({ type: 'app:create', app: dir })
|
||||
if (!error) {
|
||||
|
|
@ -379,7 +380,8 @@ function discoverApps() {
|
|||
const state: AppState = error ? 'invalid' : 'stopped'
|
||||
const icon = pkg.toes?.icon ?? DEFAULT_EMOJI
|
||||
const tool = pkg.toes?.tool
|
||||
_apps.set(dir, { name: dir, state, icon, error, tool })
|
||||
const global_ = pkg.toes?.global
|
||||
_apps.set(dir, { name: dir, state, icon, error, tool, global: global_ })
|
||||
}
|
||||
update()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ export type App = {
|
|||
started?: number
|
||||
logs?: LogLine[]
|
||||
tool?: boolean | string
|
||||
global?: boolean
|
||||
tunnelEnabled?: boolean
|
||||
tunnelUrl?: string
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user