CI / changes (push) Successful in 10s
CI / commitlint (push) Has been skipped
CI / openapi (push) Successful in 27s
CI / web (push) Successful in 38s
CI / go (push) Successful in 2m36s
CI / bird2 (push) Successful in 15s
CI / release (push) Failing after 3m7s
Refactored the project structure to support a monorepo setup, moving the web application to `apps/web/` and updating related configurations. Adjusted pre-commit hooks to use `pnpm` for linting and formatting. Updated CI workflows to reflect the new directory structure and dependencies. Removed legacy files and configurations from the previous `web/` directory, streamlining the project for better maintainability and clarity.
45 lines
1.3 KiB
TypeScript
45 lines
1.3 KiB
TypeScript
import { healthQueryOptions } from './health.js';
|
|
import { modulesQueryOptions } from './modules.js';
|
|
import { jobsQueryOptions, revisionsQueryOptions } from './operations.js';
|
|
import { peersQueryOptions, speakersQueryOptions } from './network.js';
|
|
|
|
export type DashboardSnapshot = {
|
|
healthy: boolean;
|
|
modulesCount: number;
|
|
revisionsCount: number;
|
|
peersCount: number;
|
|
speakersCount: number;
|
|
runningJobs: number;
|
|
};
|
|
|
|
export const dashboardKeys = {
|
|
all: ['dashboard'] as const,
|
|
stats: ['dashboard', 'stats'] as const
|
|
};
|
|
|
|
export function dashboardStatsQueryOptions() {
|
|
return {
|
|
queryKey: dashboardKeys.stats,
|
|
queryFn: async (): Promise<DashboardSnapshot> => {
|
|
const [health, modules, revisions, peers, speakers, jobs] = await Promise.all([
|
|
healthQueryOptions().queryFn(),
|
|
modulesQueryOptions(200).queryFn(),
|
|
revisionsQueryOptions(50).queryFn(),
|
|
peersQueryOptions(200).queryFn(),
|
|
speakersQueryOptions(200).queryFn(),
|
|
jobsQueryOptions(50).queryFn()
|
|
]);
|
|
const runningJobs = jobs.items.filter((j) => j.status === 'running').length;
|
|
return {
|
|
healthy: health.ok,
|
|
modulesCount: modules.items.length,
|
|
revisionsCount: revisions.items.length,
|
|
peersCount: peers.items.length,
|
|
speakersCount: speakers.items.length,
|
|
runningJobs
|
|
};
|
|
},
|
|
staleTime: 15_000
|
|
};
|
|
}
|