@qodalis/angular-cli
Version:
Angular wrapper for the @qodalis CLI terminal engine.
74 lines (73 loc) • 2.19 kB
TypeScript
import { Observable } from 'rxjs';
import { CliEngine } from '@qodalis/cli';
import { CliNotification } from '@qodalis/cli-core';
export interface TabStatus {
executionState: 'idle' | 'running';
lastCommandStatus: 'success' | 'error' | null;
lastCommandName: string | null;
notification: CliNotification | null;
}
export interface ServiceDetail {
name: string;
status: string;
description?: string;
}
export interface ServerDetail {
name: string;
url: string;
connected: boolean;
apiVersion?: string;
commandCount?: number;
}
export interface GlobalStatus {
runningServiceCount: number;
totalServiceCount: number;
serviceDetails: ServiceDetail[];
serverConnectionState: 'connected' | 'disconnected' | 'none';
serverDetails: ServerDetail[];
uptime: number;
}
export declare class CliPanelStatusService {
private tabs;
private activeTabId;
private globalStatus$;
private destroy$;
/** Push to trigger an immediate global status recalculation. */
private globalRefresh$;
/** Cleanup functions for background-service event listeners. */
private bgUnsubscribes;
private globalPollingStarted;
/**
* Register an engine for a specific pane within a tab.
*/
registerEngine(tabId: number, paneId: number, engine: CliEngine): void;
/**
* Unregister all engines for a tab (called on tab close).
*/
unregisterTab(tabId: number): void;
/**
* Set the active tab for global status derivation.
*/
setActiveTab(tabId: number): void;
/**
* Observable of per-tab status.
*/
getTabStatus$(tabId: number): Observable<TabStatus>;
/**
* Observable of global status (from active tab).
*/
getGlobalStatus$(): Observable<GlobalStatus>;
/**
* Clean up all subscriptions.
*/
destroy(): void;
/**
* Hook into an engine's background service events so that
* service start/stop/status-change triggers an immediate refresh.
*/
private listenToBackgroundServices;
private startPollingTab;
private startGlobalPolling;
private computeTabStatus;
private computeGlobalStatus;
}