71 lines
2.2 KiB
TypeScript
71 lines
2.2 KiB
TypeScript
/**
|
|
* Per-type content-tab descriptors for the service page skeleton.
|
|
*
|
|
* Each entry names a tab and its component. The service page renders
|
|
* `[Overview, ...contentTabs(type), Widgets, Config]`.
|
|
*/
|
|
import type { ComponentType } from "react";
|
|
import type { ServiceInstance } from "../../types";
|
|
import { OverviewTab } from "./OverviewTab";
|
|
import { AlertsTab } from "./AlertsTab";
|
|
import { MetricsTab } from "./MetricsTab";
|
|
import { MediaTab } from "./MediaTab";
|
|
import { RequestsTab } from "./RequestsTab";
|
|
import { FilesTab } from "./FilesTab";
|
|
import { ActionsTab } from "./ActionsTab";
|
|
import { JobsTab } from "./JobsTab";
|
|
import { UsersTab } from "./UsersTab";
|
|
import { GroupsTab } from "./GroupsTab";
|
|
import { ApplicationsTab } from "./ApplicationsTab";
|
|
import { MessagingTab } from "./MessagingTab";
|
|
import { QbittorrentTab } from "./QbittorrentTab";
|
|
|
|
export type ServiceTabComponent = ComponentType<{ instance: ServiceInstance }>;
|
|
|
|
export interface ContentTab {
|
|
label: string;
|
|
Component: ServiceTabComponent;
|
|
}
|
|
|
|
/** Overview tab (shared across all service types). */
|
|
export const OVERVIEW_TAB: ContentTab = {
|
|
label: "Overview",
|
|
Component: OverviewTab,
|
|
};
|
|
|
|
/**
|
|
* Returns the type-specific content tabs for a service type.
|
|
* Types with no operational content return `[]` (only Overview + Widgets + Config).
|
|
*/
|
|
export function serviceContentTabs(serviceType: string): ContentTab[] {
|
|
switch (serviceType) {
|
|
case "jellyfin":
|
|
return [
|
|
{ label: "Media", Component: MediaTab },
|
|
{ label: "Requests", Component: RequestsTab },
|
|
];
|
|
case "remote_machine":
|
|
return [
|
|
{ label: "Files", Component: FilesTab },
|
|
{ label: "Actions", Component: ActionsTab },
|
|
];
|
|
case "backups":
|
|
return [{ label: "Jobs", Component: JobsTab }];
|
|
case "authentik":
|
|
return [
|
|
{ label: "Users", Component: UsersTab },
|
|
{ label: "Groups", Component: GroupsTab },
|
|
{ label: "Applications", Component: ApplicationsTab },
|
|
{ label: "Messaging", Component: MessagingTab },
|
|
];
|
|
case "alertmanager":
|
|
return [{ label: "Alerts", Component: AlertsTab }];
|
|
case "prometheus":
|
|
return [{ label: "Metrics", Component: MetricsTab }];
|
|
case "qbittorrent":
|
|
return [{ label: "Speed", Component: QbittorrentTab }];
|
|
default:
|
|
return [];
|
|
}
|
|
}
|