databuild/databuild/dashboard/index.ts
soaxelbrooke 0f51edb4b8
Some checks failed
/ setup (push) Has been cancelled
Ok finished tweaking ui stuff
2025-07-12 13:31:46 -07:00

41 lines
1.2 KiB
TypeScript

import m from 'mithril';
import { Layout } from './layout';
import {
RecentActivity,
BuildStatus,
PartitionsList,
PartitionStatus,
JobsList,
JobMetrics,
GraphAnalysis
} from './pages';
import { decodePartitionRef } from './utils';
export const appName = "databuild";
// Wrapper components that include layout
const LayoutWrapper = (component: any) => ({
view: (vnode: any) => m(Layout, m(component, vnode.attrs))
});
// Route definitions
const routes = {
'/': LayoutWrapper(RecentActivity),
'/builds/:id': LayoutWrapper(BuildStatus),
'/partitions': LayoutWrapper(PartitionsList),
'/partitions/:base64_ref': LayoutWrapper(PartitionStatus),
'/jobs': LayoutWrapper(JobsList),
'/jobs/:label': LayoutWrapper(JobMetrics),
'/analyze': LayoutWrapper(GraphAnalysis),
};
if (typeof window !== "undefined") {
document.addEventListener("DOMContentLoaded", () => {
// Initialize theme from localStorage
const savedTheme = localStorage.getItem('theme') || 'databuild-light';
document.documentElement.setAttribute('data-theme', savedTheme);
// Set up routing
m.route(document.getElementById('app') as HTMLElement, '/', routes);
});
}