51 lines
2.0 KiB
TypeScript
51 lines
2.0 KiB
TypeScript
import type { IServiceStatus, IIncidentDetails, IStatusPageConfig, IMonitorFormData, IIncidentFormData } from '../interfaces/index.js';
|
|
type TStateChangeListener<T> = (data: T) => void;
|
|
/**
|
|
* Simple observable implementation for state changes
|
|
*/
|
|
declare class SimpleObservable<T> {
|
|
private listeners;
|
|
subscribe(listener: TStateChangeListener<T>): () => void;
|
|
next(value: T): void;
|
|
}
|
|
/**
|
|
* Centralized state management for the admin dashboard.
|
|
* Handles cross-view data passing and state synchronization.
|
|
*/
|
|
export declare class AdminState {
|
|
monitors$: SimpleObservable<IServiceStatus[]>;
|
|
incidents$: SimpleObservable<IIncidentDetails[]>;
|
|
config$: SimpleObservable<IStatusPageConfig>;
|
|
private _monitors;
|
|
private _incidents;
|
|
private _config;
|
|
private _selectedMonitor;
|
|
private _selectedIncident;
|
|
get monitors(): IServiceStatus[];
|
|
set monitors(value: IServiceStatus[]);
|
|
get incidents(): IIncidentDetails[];
|
|
set incidents(value: IIncidentDetails[]);
|
|
get config(): IStatusPageConfig | null;
|
|
set config(value: IStatusPageConfig | null);
|
|
setSelectedMonitor(monitor: IServiceStatus | null): void;
|
|
getSelectedMonitor(): IServiceStatus | null;
|
|
clearSelectedMonitor(): void;
|
|
setSelectedIncident(incident: IIncidentDetails | null): void;
|
|
getSelectedIncident(): IIncidentDetails | null;
|
|
clearSelectedIncident(): void;
|
|
getCategories(): string[];
|
|
getAvailableServices(): IServiceStatus[];
|
|
getMonitorById(id: string): IServiceStatus | undefined;
|
|
getIncidentById(id: string): IIncidentDetails | undefined;
|
|
getActiveIncidents(): IIncidentDetails[];
|
|
getPastIncidents(): IIncidentDetails[];
|
|
addMonitor(monitor: IServiceStatus): void;
|
|
updateMonitor(id: string, data: Partial<IMonitorFormData>): void;
|
|
deleteMonitor(id: string): void;
|
|
addIncident(incident: IIncidentDetails): void;
|
|
updateIncident(id: string, data: Partial<IIncidentFormData>): void;
|
|
deleteIncident(id: string): void;
|
|
}
|
|
export declare const adminState: AdminState;
|
|
export {};
|