mirror of
https://github.com/grafana/grafana.git
synced 2025-08-01 21:32:14 +08:00
Types: Adds type safety to appEvents (#19418)
* Types: Add type safety to appEvents
This commit is contained in:
@ -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',
|
||||
|
Reference in New Issue
Block a user