Types: Adds type safety to appEvents (#19418)

* Types: Add type safety to appEvents
This commit is contained in:
kay delaney
2019-10-14 09:27:47 +01:00
committed by GitHub
parent e7c37cc316
commit 99411bf37a
138 changed files with 991 additions and 508 deletions

View File

@ -7,6 +7,8 @@ import PostgresQuery from './postgres_query';
import sqlPart from './sql_part';
import { auto, IQService } from 'angular';
import { TemplateSrv } from 'app/features/templating/template_srv';
import { CoreEvents } from 'app/types';
import { PanelEvents } from '@grafana/ui';
export interface QueryMeta {
sql: string;
@ -99,8 +101,8 @@ export class PostgresQueryCtrl extends QueryCtrl {
this.whereAdd = this.uiSegmentSrv.newPlusButton();
this.groupAdd = this.uiSegmentSrv.newPlusButton();
this.panelCtrl.events.on('data-received', this.onDataReceived.bind(this), $scope);
this.panelCtrl.events.on('data-error', this.onDataError.bind(this), $scope);
this.panelCtrl.events.on(PanelEvents.dataReceived, this.onDataReceived.bind(this), $scope);
this.panelCtrl.events.on(PanelEvents.dataError, this.onDataError.bind(this), $scope);
}
updateRawSqlAndRefresh() {
@ -189,7 +191,7 @@ export class PostgresQueryCtrl extends QueryCtrl {
toggleEditorMode() {
if (this.target.rawQuery) {
appEvents.emit('confirm-modal', {
appEvents.emit(CoreEvents.showConfirmModal, {
title: 'Warning',
text2: 'Switching to query builder may overwrite your raw SQL.',
icon: 'fa-exclamation',