mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Annotations: Adds DashboardQueryRunner (#32834)
* WIP: initial commit * Fix: Fixed $timeout call when testing snapshots * Chore: reverts changes to metrics_panel_ctrl.ts * Chore: reverts changes to annotations_srv * Refactor: adds DashboardQueryRunner.run to initdashboard * Refactor: adds run to dashboard model start refresh * Refactor: move to own folder and split up into smaller files * Tests: adds tests for LegacyAnnotationQueryRunner * Tests: adds tests for AnnotationsQueryRunner * Tests: adds tests for SnapshotWorker * Refactor: renames from canRun|run to canWork|work * Tests: adds tests for AlertStatesWorker * Tests: adds tests for AnnotationsWorker * Refactor: renames operators * Refactor: renames operators * Tests: adds tests for DashboardQueryRunner * Refactor: adds mergePanelAndDashboardData function * Tests: fixes broken tests * Chore: Fixes errors after merge with master * Chore: Removes usage of AnnotationSrv from event_editor and initDashboard * WIP: getting annotations and alerts working in graph (snapshot not working) * Refactor: fixes snapshot data for React panels * Refactor: Fixes so snapshots work for Graph * Refactor: moves alert types to grafana-data * Refactor: changes to some for readability * Tests: skipping tests for now, needs rewrite * Refactor: refactors out common static functions to utils * Refactor: fixes resolving annotations from dataframes * Refactor: removes getRunners/Workers functions * Docs: fixes docs errors * Docs: trying to fix doc error * Refactor: changes after PR comments * Refactor: hides everything behind a factory instead * Refactor: adds cancellation between runs and explicitly
This commit is contained in:
@@ -4,7 +4,6 @@ import { backendSrv } from 'app/core/services/backend_srv';
|
||||
import { DashboardSrv, getDashboardSrv } from 'app/features/dashboard/services/DashboardSrv';
|
||||
import { dashboardLoaderSrv } from 'app/features/dashboard/services/DashboardLoaderSrv';
|
||||
import { getTimeSrv, TimeSrv } from 'app/features/dashboard/services/TimeSrv';
|
||||
import { AnnotationsSrv } from 'app/features/annotations/annotations_srv';
|
||||
import { keybindingSrv } from 'app/core/services/keybindingSrv';
|
||||
// Actions
|
||||
import { notifyApp } from 'app/core/actions';
|
||||
@@ -17,7 +16,7 @@ import {
|
||||
dashboardInitSlow,
|
||||
} from './reducers';
|
||||
// Types
|
||||
import { DashboardDTO, DashboardRoutes, StoreState, ThunkDispatch, ThunkResult, DashboardInitPhase } from 'app/types';
|
||||
import { DashboardDTO, DashboardInitPhase, DashboardRoutes, StoreState, ThunkDispatch, ThunkResult } from 'app/types';
|
||||
import { DashboardModel } from './DashboardModel';
|
||||
import { DataQuery, locationUtil } from '@grafana/data';
|
||||
import { initVariablesTransaction } from '../../variables/state/actions';
|
||||
@@ -25,9 +24,9 @@ import { emitDashboardViewEvent } from './analyticsProcessor';
|
||||
import { dashboardWatcher } from 'app/features/live/dashboard/dashboardWatcher';
|
||||
import { locationService } from '@grafana/runtime';
|
||||
import { ChangeTracker } from '../services/ChangeTracker';
|
||||
import { createDashboardQueryRunner } from '../../query/state/DashboardQueryRunner/DashboardQueryRunner';
|
||||
|
||||
export interface InitDashboardArgs {
|
||||
$injector: any;
|
||||
urlUid?: string;
|
||||
urlSlug?: string;
|
||||
urlType?: string;
|
||||
@@ -174,12 +173,12 @@ export function initDashboard(args: InitDashboardArgs): ThunkResult<void> {
|
||||
|
||||
// init services
|
||||
const timeSrv: TimeSrv = getTimeSrv();
|
||||
const annotationsSrv: AnnotationsSrv = args.$injector.get('annotationsSrv');
|
||||
const dashboardSrv: DashboardSrv = getDashboardSrv();
|
||||
const changeTracker = new ChangeTracker();
|
||||
|
||||
timeSrv.init(dashboard);
|
||||
annotationsSrv.init(dashboard);
|
||||
const runner = createDashboardQueryRunner({ dashboard, timeSrv });
|
||||
runner.run({ dashboard, range: timeSrv.timeRange() });
|
||||
|
||||
if (storeState.dashboard.modifiedQueries) {
|
||||
const { panelId, queries } = storeState.dashboard.modifiedQueries;
|
||||
|
||||
Reference in New Issue
Block a user