mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Types: Adds type safety to appEvents (#19418)
* Types: Add type safety to appEvents
This commit is contained in:
@@ -4,6 +4,7 @@ import { BackendSrv } from 'app/core/services/backend_srv';
|
||||
import { ILocationService } from 'angular';
|
||||
import { ValidationSrv } from 'app/features/manage-dashboards';
|
||||
import { NavModelSrv } from 'app/core/nav_model_srv';
|
||||
import { AppEvents } from '@grafana/data';
|
||||
|
||||
export default class CreateFolderCtrl {
|
||||
title = '';
|
||||
@@ -28,7 +29,7 @@ export default class CreateFolderCtrl {
|
||||
}
|
||||
|
||||
return this.backendSrv.createFolder({ title: this.title }).then((result: any) => {
|
||||
appEvents.emit('alert-success', ['Folder Created', 'OK']);
|
||||
appEvents.emit(AppEvents.alertSuccess, ['Folder Created', 'OK']);
|
||||
this.$location.url(locationUtil.stripBaseFromUrl(result.url));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import { Input } from '@grafana/ui';
|
||||
import Page from 'app/core/components/Page/Page';
|
||||
import appEvents from 'app/core/app_events';
|
||||
import { getNavModel } from 'app/core/selectors/navModel';
|
||||
import { StoreState, FolderState } from 'app/types';
|
||||
import { StoreState, FolderState, CoreEvents } from 'app/types';
|
||||
import { getFolderByUid, setFolderTitle, saveFolder, deleteFolder } from './state/actions';
|
||||
import { getLoadingNav } from './state/navModel';
|
||||
|
||||
@@ -52,7 +52,7 @@ export class FolderSettingsPage extends PureComponent<Props, State> {
|
||||
evt.stopPropagation();
|
||||
evt.preventDefault();
|
||||
|
||||
appEvents.emit('confirm-modal', {
|
||||
appEvents.emit(CoreEvents.showConfirmModal, {
|
||||
title: 'Delete',
|
||||
text: `Do you want to delete this folder and all its dashboards?`,
|
||||
icon: 'fa-trash',
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
import { updateNavIndex, updateLocation } from 'app/core/actions';
|
||||
import { buildNavModel } from './navModel';
|
||||
import appEvents from 'app/core/app_events';
|
||||
import { AppEvents } from '@grafana/data';
|
||||
|
||||
export enum ActionTypes {
|
||||
LoadFolder = 'LOAD_FOLDER',
|
||||
@@ -71,7 +72,7 @@ export function saveFolder(folder: FolderState): ThunkResult<void> {
|
||||
});
|
||||
|
||||
// this should be redux action at some point
|
||||
appEvents.emit('alert-success', ['Folder saved']);
|
||||
appEvents.emit(AppEvents.alertSuccess, ['Folder saved']);
|
||||
|
||||
dispatch(updateLocation({ path: `${res.url}/settings` }));
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user