import nsToConvertorMap from '../const/convertorMap'; import { meterMap } from '../const/map'; export type MetricsType = keyof typeof meterMap & string; export interface MonitorData { start_time: string; end_time: string; min_value: number | string; max_value: number | string; avg_value: number | string; sum_value: number | string; } export type DimensionType = 'maxValue' | 'minValue' | 'avgValue'; export interface MonitorDataResponse { monitor_data: MonitorData[]; resource_id: string; metric_name: MetricsType; metric_cn_name: string; metric_unit: string; create_time: string; user_id: string; description: string; step: number; tags: string; disk_total?: string; disk_used?: string; } export interface RespData { data?: MonitorDataResponse[] | []; [x: string]: any; } export type NameSpaceType = keyof typeof nsToConvertorMap; export interface Opts { namespace?: string; dateFormat?: string; precision?: number; labelByTag?: string; seriesByTag?: string; labelPrefix?: string; echarts?: Record; seriesCharts?: Record; metrics?: Partial>>; byteTrasnform?: boolean; lang?: 'zh-cn' | 'en'; showMaxMinMetrics?: string[]; legendTruncateLength?: number; dimension?: DimensionType; extraData?: { meter: string; field: string; }[]; } export interface FormateDate { time: string | number; avgValue: any; maxValue: any; minValue: any; [x: string]: any; } export interface DataValue { data: FormateDate[]; label: string; unit?: string; metric_name: string; meter_type: string; tags: string; originTags?: string; step: number; } export interface Data { key: string; value: DataValue[]; } export interface EchartData { xAxis: { data: string[]; }; series: { name: string; type: string; data: { name: string | number; value: number | null | string; }[]; [x: string]: any; }[]; legend?: { data: string[]; }; } export interface LineResultValue { echartData: EchartData; attrs: Pick[]; tags: string; } export interface LineResult { key: string; value: LineResultValue[]; } export interface Tags { [x: string]: string[]; } export type GetResultProps = { key?: string; searchWords?: string[]; }; export type Result = { value: Record<'tags', string | undefined>[]; key: string; };