import { DatasourceType } from '@corpglory/tsdb-kit'; export interface DataSourceRef { /** The plugin type-id */ type?: string; /** Specific datasource instance */ uid?: string; } export interface DataQuery { /** * A - Z */ refId: string; /** * true if query is disabled (ie should not be returned to the dashboard) */ hide?: boolean; /** * Unique, guid like, string used in explore mode */ key?: string; /** * Specify the query flavor */ queryType?: string; /** * For mixed data sources the selected datasource is on the query level. * For non mixed scenarios this is undefined. */ datasource?: DataSourceRef | null; } /** * Data Source instance edit model. This is returned from: * /api/datasources */ export interface DataSourceSettings { id: number; uid: string; orgId: number; name: string; typeLogoUrl: string; type: DatasourceType; typeName: string; access: string; url: string; user: string; database: string; basicAuth: boolean; basicAuthUser: string; isDefault: boolean; jsonData: any; secureJsonData?: any; secureJsonFields: any; readOnly: boolean; withCredentials: boolean; version?: number; accessControl?: any; } export interface PanelModel { /** ID of the panel within the current dashboard */ id: number; /** Panel title */ title?: string; /** Description */ description?: string; /** Panel options */ options: any; /** Field options configuration */ fieldConfig: any; /** Version of the panel plugin */ pluginVersion?: string; /** The datasource used in all targets */ datasource?: DataSourceRef | null; /** The queries in a panel */ targets?: DataQuery[]; /** alerting v1 object */ alert?: any; } export enum ExportStatus { EXPORTING = 'exporting', FINISHED = 'finished', ERROR = 'error', } export type ExportProgress = { time: number; exportedRowsCount: number; progress: number; status: ExportStatus; errorMessage?: string; }; export type ExportTask = { dashboardUid: string; username: string; queries: DashboardQuery[]; timeRange: { from: number; to: number; }; csvDelimiter: string; progress?: ExportProgress; id?: string; filename?: string; }; export type DashboardQuery = { selected: boolean; target: DataQuery; panel: PanelModel; datasource: DataSourceSettings; };