/usr/share/grafana/public/app/plugins/datasource/loki/components
import { DateTime, isDateTime, TimeRange } from '@grafana/data'; import { LokiQueryType } from '../types'; /** * This function compares two time values. If the first is absolute, it compares them using `DateTime.isSame`. * * @param {(DateTime | string)} time1 * @param {(DateTime | string | undefined)} time2 */ function compareTime(time1: DateTime | string | undefined, time2: DateTime | string | undefined) { if (!time1 || !time2) { return false; } const isAbsolute = isDateTime(time1); if (isAbsolute) { return time1.isSame(time2); } return time1 === time2; } export function shouldUpdateStats( query: string, prevQuery: string | undefined, timeRange: TimeRange | undefined, prevTimeRange: TimeRange | undefined, queryType: LokiQueryType | undefined, prevQueryType: LokiQueryType | undefined ): boolean { if (prevQuery === undefined || query.trim() !== prevQuery.trim() || queryType !== prevQueryType) { return true; } if ( compareTime(timeRange?.raw.from, prevTimeRange?.raw.from) && compareTime(timeRange?.raw.to, prevTimeRange?.raw.to) ) { return false; } return true; }
.
Edit
..
Edit
AnnotationsQueryEditor.tsx
Edit
LokiCheatSheet.test.tsx
Edit
LokiCheatSheet.tsx
Edit
LokiContextUi.test.tsx
Edit
LokiContextUi.tsx
Edit
LokiLabelBrowser.test.tsx
Edit
LokiLabelBrowser.tsx
Edit
LokiOptionFields.test.tsx
Edit
LokiOptionFields.tsx
Edit
LokiQueryEditor.test.tsx
Edit
LokiQueryEditor.tsx
Edit
LokiQueryEditorByApp.test.tsx
Edit
LokiQueryEditorByApp.tsx
Edit
LokiQueryEditorForAlerting.tsx
Edit
LokiQueryField.test.tsx
Edit
LokiQueryField.tsx
Edit
VariableQueryEditor.test.tsx
Edit
VariableQueryEditor.tsx
Edit
monaco-query-field
Edit
stats.test.ts
Edit
stats.ts
Edit
types.ts
Edit