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:
@@ -16,7 +16,7 @@ import { updateLocation } from 'app/core/actions';
|
||||
|
||||
// Types
|
||||
import { DashboardModel } from '../../state';
|
||||
import { StoreState } from 'app/types';
|
||||
import { StoreState, CoreEvents } from 'app/types';
|
||||
|
||||
export interface OwnProps {
|
||||
dashboard: DashboardModel;
|
||||
@@ -43,11 +43,11 @@ export class DashNav extends PureComponent<Props> {
|
||||
}
|
||||
|
||||
onDahboardNameClick = () => {
|
||||
appEvents.emit('show-dash-search');
|
||||
appEvents.emit(CoreEvents.showDashSearch);
|
||||
};
|
||||
|
||||
onFolderNameClick = () => {
|
||||
appEvents.emit('show-dash-search', {
|
||||
appEvents.emit(CoreEvents.showDashSearch, {
|
||||
query: 'folder:current',
|
||||
});
|
||||
};
|
||||
@@ -67,7 +67,7 @@ export class DashNav extends PureComponent<Props> {
|
||||
};
|
||||
|
||||
onToggleTVMode = () => {
|
||||
appEvents.emit('toggle-kiosk-mode');
|
||||
appEvents.emit(CoreEvents.toggleKioskMode);
|
||||
};
|
||||
|
||||
onSave = () => {
|
||||
@@ -112,7 +112,7 @@ export class DashNav extends PureComponent<Props> {
|
||||
modalScope.tabIndex = 0;
|
||||
modalScope.dashboard = this.props.dashboard;
|
||||
|
||||
appEvents.emit('show-modal', {
|
||||
appEvents.emit(CoreEvents.showModal, {
|
||||
src: 'public/app/features/dashboard/components/ShareModal/template.html',
|
||||
scope: modalScope,
|
||||
});
|
||||
|
||||
@@ -4,7 +4,7 @@ import { dateMath } from '@grafana/data';
|
||||
|
||||
// Types
|
||||
import { DashboardModel } from '../../state';
|
||||
import { LocationState } from 'app/types';
|
||||
import { LocationState, CoreEvents } from 'app/types';
|
||||
import { TimeRange, TimeOption, RawTimeRange } from '@grafana/data';
|
||||
|
||||
// State
|
||||
@@ -43,10 +43,10 @@ export class DashNavTimeControls extends Component<Props> {
|
||||
};
|
||||
|
||||
onMoveBack = () => {
|
||||
this.$rootScope.appEvent('shift-time', -1);
|
||||
this.$rootScope.appEvent(CoreEvents.shiftTime, -1);
|
||||
};
|
||||
onMoveForward = () => {
|
||||
this.$rootScope.appEvent('shift-time', 1);
|
||||
this.$rootScope.appEvent(CoreEvents.shiftTime, 1);
|
||||
};
|
||||
|
||||
onChangeTimePicker = (timeRange: TimeRange) => {
|
||||
@@ -65,7 +65,7 @@ export class DashNavTimeControls extends Component<Props> {
|
||||
};
|
||||
|
||||
onZoom = () => {
|
||||
this.$rootScope.appEvent('zoom-out', 2);
|
||||
this.$rootScope.appEvent(CoreEvents.zoomOut, 2);
|
||||
};
|
||||
|
||||
setActiveTimeOption = (timeOptions: TimeOption[], rawTimeRange: RawTimeRange): TimeOption[] => {
|
||||
|
||||
Reference in New Issue
Block a user