Files
aiops/frontend/src/components/monitor/log-center/unified-query/constants.ts
T

24 lines
961 B
TypeScript

// unified-query/constants.ts — UnifiedQueryPanel 静态常量
// 引擎默认查询语句、徽标配色、默认时间范围
import type { TimeRange } from '../types-v3';
// 默认最近 5 分钟
export const DEFAULT_TIME_RANGE: TimeRange = {
start: new Date(Date.now() - 5 * 60000).toISOString().replace('T', ' ').substring(0, 19),
end: new Date().toISOString().replace('T', ' ').substring(0, 19),
label: 'Last 5 min',
type: 'relative',
};
// 引擎默认查询语句:Loki 用 LogQL / ES 用 Lucene,对齐平台 admin-api 服务
export const DEFAULT_QUERIES: Record<'loki' | 'elasticsearch', string> = {
loki: '{app="admin-api"} |= "INFO"',
elasticsearch: 'app:admin-api',
};
// 引擎徽标:左侧小圆点 + 语言标签
export const ENGINE_BADGE: Record<'loki' | 'elasticsearch', { label: string; dotColor: string }> = {
loki: { label: 'LogQL', dotColor: '#06b6d4' },
elasticsearch: { label: 'Lucene', dotColor: '#22c55e' },
};