Files
browser/platform_web/contracts/page.ts
T
2026-07-20 16:42:33 +08:00

78 lines
2.0 KiB
TypeScript

import type { ComponentType } from "react";
import type { UserProfileUpdateRequest, UserThemePreferenceRequest, UserThemePreferenceResponse } from "../api/types";
import type { CurrentUserView, WorkspaceCapability } from "./workspace";
import type { OperationTracker } from "../stores/operations";
export type PageId = "home" | "servers" | "serverDetail" | "pluginPage" | "plugins" | "users" | "aiProviders" | "maintenance" | "profileSettings";
export interface PageParams {
serverId?: string;
pluginId?: string;
routeKey?: string;
}
export interface PageRoute {
id: PageId;
label: string;
path: string;
hash: string;
description: string;
requiredCapability: WorkspaceCapability;
showInNav: boolean;
}
export interface PageComponentProps {
session: CurrentUserView;
params: PageParams;
operations: OperationTracker;
onNavigate: (pageId: PageId, params?: PageParams) => void;
onLogout: () => Promise<void>;
onProfileSave: (request: UserProfileUpdateRequest) => Promise<CurrentUserView>;
onThemePreferenceSave: (request: UserThemePreferenceRequest) => Promise<UserThemePreferenceResponse>;
}
export type PageComponent = ComponentType<PageComponentProps>;
export interface PageMetric {
label: string;
value: string;
tone: "neutral" | "success" | "warning";
}
export interface ShellSummaryItem {
label: string;
value: string;
detail: string;
tone: PageMetric["tone"];
}
export interface ServerInstanceView {
id: string;
name: string;
plugin: string;
runEndpoint: string;
state: "draft" | "installing" | "ready" | "running" | "stopped" | "failed" | "deleted";
pendingJobs: number;
latestLog: string;
}
export interface PluginCatalogItem {
id: string;
name: string;
version: string;
serverType: string;
status: "installed" | "disabled" | "invalid" | "updating";
permissions: string[];
bridgeActions: string[];
validation: string;
}
export interface UserAccessView {
id: string;
displayName: string;
status: "active" | "disabled" | "pending";
roles: string[];
review: string;
}