diff --git a/public/app/core/reducers/navModel.ts b/public/app/core/reducers/navModel.ts
index c00441c4881..4e9a7f8e434 100644
--- a/public/app/core/reducers/navModel.ts
+++ b/public/app/core/reducers/navModel.ts
@@ -12,7 +12,6 @@ function getNotFoundModel(): NavModel {
};
return {
- breadcrumbs: [node],
node: node,
main: node,
};
@@ -53,7 +52,6 @@ const navModelReducer = (state = initialState, action: Action): NavModel => {
return {
main: main,
node: node,
- breadcrumbs: [],
};
}
}
diff --git a/public/app/features/admin/containers/ServerStats.test.tsx b/public/app/features/admin/containers/ServerStats.test.tsx
index a329a47527d..a89e78cb4ba 100644
--- a/public/app/features/admin/containers/ServerStats.test.tsx
+++ b/public/app/features/admin/containers/ServerStats.test.tsx
@@ -1,26 +1,18 @@
import React from 'react';
import renderer from 'react-test-renderer';
import { ServerStats } from './ServerStats';
-import { RootStore } from 'app/stores/RootStore/RootStore';
-import { backendSrv, createNavTree } from 'test/mocks/common';
+import { initNav } from 'test/mocks/common';
+import { ServerStat } from '../apis';
describe('ServerStats', () => {
it('Should render table with stats', done => {
- backendSrv.get.mockReturnValue(
- Promise.resolve({
- dashboards: 10,
- })
- );
+ const stats: ServerStat[] = [{ name: 'test', value: 'asd' }];
- const store = RootStore.create(
- {},
- {
- backendSrv: backendSrv,
- navTree: createNavTree('cfg', 'admin', 'server-stats'),
- }
- );
+ let getServerStats = () => {
+ return Promise.resolve(stats);
+ };
- const page = renderer.create();
+ const page = renderer.create();
setTimeout(() => {
expect(page.toJSON()).toMatchSnapshot();
diff --git a/public/app/features/admin/containers/ServerStats.tsx b/public/app/features/admin/containers/ServerStats.tsx
index 7e96dcf4e0e..29611696efa 100644
--- a/public/app/features/admin/containers/ServerStats.tsx
+++ b/public/app/features/admin/containers/ServerStats.tsx
@@ -1,4 +1,4 @@
-import React from 'react';
+import React, { PureComponent } from 'react';
import { hot } from 'react-hot-loader';
import { connect } from 'react-redux';
import { initNav } from 'app/core/actions';
@@ -14,7 +14,7 @@ interface State {
stats: ServerStat[];
}
-export class ServerStats extends React.Component {
+export class ServerStats extends PureComponent {
constructor(props) {
super(props);
diff --git a/public/app/features/alerting/containers/AlertRuleList.test.tsx b/public/app/features/alerting/AlertRuleList.test.tsx
similarity index 100%
rename from public/app/features/alerting/containers/AlertRuleList.test.tsx
rename to public/app/features/alerting/AlertRuleList.test.tsx
diff --git a/public/app/features/alerting/containers/AlertRuleList.tsx b/public/app/features/alerting/AlertRuleList.tsx
similarity index 99%
rename from public/app/features/alerting/containers/AlertRuleList.tsx
rename to public/app/features/alerting/AlertRuleList.tsx
index 3c64f490db4..e2e6d1a719a 100644
--- a/public/app/features/alerting/containers/AlertRuleList.tsx
+++ b/public/app/features/alerting/AlertRuleList.tsx
@@ -7,7 +7,7 @@ import appEvents from 'app/core/app_events';
import Highlighter from 'react-highlight-words';
import { initNav, updateLocation } from 'app/core/actions';
import { ContainerProps } from 'app/types';
-import { getAlertRules, AlertRule } from '../apis';
+import { getAlertRules, AlertRule } from './state/apis';
interface Props extends ContainerProps {
updateLocation: typeof updateLocation;
diff --git a/public/app/features/alerting/alert_tab_ctrl.ts b/public/app/features/alerting/AlertTabCtrl.ts
similarity index 99%
rename from public/app/features/alerting/alert_tab_ctrl.ts
rename to public/app/features/alerting/AlertTabCtrl.ts
index a25d37913d4..040b293b244 100644
--- a/public/app/features/alerting/alert_tab_ctrl.ts
+++ b/public/app/features/alerting/AlertTabCtrl.ts
@@ -1,7 +1,7 @@
import _ from 'lodash';
-import { ThresholdMapper } from './threshold_mapper';
+import { ThresholdMapper } from './state/ThresholdMapper';
import { QueryPart } from 'app/core/components/query_part/query_part';
-import alertDef from './alert_def';
+import alertDef from './state/alertDef';
import config from 'app/core/config';
import appEvents from 'app/core/app_events';
diff --git a/public/app/features/alerting/notification_edit_ctrl.ts b/public/app/features/alerting/NotificationsEditCtrl.ts
similarity index 100%
rename from public/app/features/alerting/notification_edit_ctrl.ts
rename to public/app/features/alerting/NotificationsEditCtrl.ts
diff --git a/public/app/features/alerting/notifications_list_ctrl.ts b/public/app/features/alerting/NotificationsListCtrl.ts
similarity index 100%
rename from public/app/features/alerting/notifications_list_ctrl.ts
rename to public/app/features/alerting/NotificationsListCtrl.ts
diff --git a/public/app/features/alerting/containers/__snapshots__/AlertRuleList.test.tsx.snap b/public/app/features/alerting/__snapshots__/AlertRuleList.test.tsx.snap
similarity index 100%
rename from public/app/features/alerting/containers/__snapshots__/AlertRuleList.test.tsx.snap
rename to public/app/features/alerting/__snapshots__/AlertRuleList.test.tsx.snap
diff --git a/public/app/features/alerting/all.ts b/public/app/features/alerting/all.ts
deleted file mode 100644
index 91d3a4109e7..00000000000
--- a/public/app/features/alerting/all.ts
+++ /dev/null
@@ -1,2 +0,0 @@
-import './notifications_list_ctrl';
-import './notification_edit_ctrl';
diff --git a/public/app/features/alerting/specs/threshold_mapper.test.ts b/public/app/features/alerting/state/ThresholdMapper.test.ts
similarity index 97%
rename from public/app/features/alerting/specs/threshold_mapper.test.ts
rename to public/app/features/alerting/state/ThresholdMapper.test.ts
index 922d9c8787e..d8ab54234cd 100644
--- a/public/app/features/alerting/specs/threshold_mapper.test.ts
+++ b/public/app/features/alerting/state/ThresholdMapper.test.ts
@@ -1,6 +1,6 @@
import { describe, it, expect } from 'test/lib/common';
-import { ThresholdMapper } from '../threshold_mapper';
+import { ThresholdMapper } from './threshold_mapper';
describe('ThresholdMapper', () => {
describe('with greater than evaluator', () => {
diff --git a/public/app/features/alerting/threshold_mapper.ts b/public/app/features/alerting/state/ThresholdMapper.ts
similarity index 100%
rename from public/app/features/alerting/threshold_mapper.ts
rename to public/app/features/alerting/state/ThresholdMapper.ts
diff --git a/public/app/features/alerting/alert_def.ts b/public/app/features/alerting/state/alertDef.ts
similarity index 100%
rename from public/app/features/alerting/alert_def.ts
rename to public/app/features/alerting/state/alertDef.ts
diff --git a/public/app/features/alerting/apis/index.ts b/public/app/features/alerting/state/apis.ts
similarity index 97%
rename from public/app/features/alerting/apis/index.ts
rename to public/app/features/alerting/state/apis.ts
index ebfdbd34024..44cadc05215 100644
--- a/public/app/features/alerting/apis/index.ts
+++ b/public/app/features/alerting/state/apis.ts
@@ -1,5 +1,5 @@
import { getBackendSrv } from 'app/core/services/backend_srv';
-import alertDef from '../alert_def';
+import alertDef from './alertDef';
import moment from 'moment';
export interface AlertRule {
diff --git a/public/app/features/all.ts b/public/app/features/all.ts
index df987a8b59b..065f399cae3 100644
--- a/public/app/features/all.ts
+++ b/public/app/features/all.ts
@@ -9,5 +9,6 @@ import './snapshot/all';
import './panel/all';
import './org/all';
import './admin/admin';
-import './alerting/all';
+import './alerting/NotificationsEditCtrl';
+import './alerting/NotificationsListCtrl';
import './styleguide/styleguide';
diff --git a/public/app/features/annotations/annotation_tooltip.ts b/public/app/features/annotations/annotation_tooltip.ts
index ed2d797b7bf..0cb0c6a9419 100644
--- a/public/app/features/annotations/annotation_tooltip.ts
+++ b/public/app/features/annotations/annotation_tooltip.ts
@@ -1,7 +1,7 @@
import _ from 'lodash';
import $ from 'jquery';
import coreModule from 'app/core/core_module';
-import alertDef from '../alerting/alert_def';
+import alertDef from '../alerting/state/alertDef';
/** @ngInject **/
export function annotationTooltipDirective($sanitize, dashboardSrv, contextSrv, $compile) {
diff --git a/public/app/plugins/panel/alertlist/module.ts b/public/app/plugins/panel/alertlist/module.ts
index b171f590e94..f5a23f4748b 100644
--- a/public/app/plugins/panel/alertlist/module.ts
+++ b/public/app/plugins/panel/alertlist/module.ts
@@ -1,6 +1,6 @@
import _ from 'lodash';
import moment from 'moment';
-import alertDef from '../../../features/alerting/alert_def';
+import alertDef from '../../../features/alerting/state/alertDef';
import { PanelCtrl } from 'app/plugins/sdk';
import * as dateMath from 'app/core/utils/datemath';
diff --git a/public/app/plugins/sdk.ts b/public/app/plugins/sdk.ts
index 2734426bd19..0f183271495 100644
--- a/public/app/plugins/sdk.ts
+++ b/public/app/plugins/sdk.ts
@@ -1,7 +1,7 @@
import { PanelCtrl } from 'app/features/panel/panel_ctrl';
import { MetricsPanelCtrl } from 'app/features/panel/metrics_panel_ctrl';
import { QueryCtrl } from 'app/features/panel/query_ctrl';
-import { alertTab } from 'app/features/alerting/alert_tab_ctrl';
+import { alertTab } from 'app/features/alerting/AlertTabCtrl';
import { loadPluginCss } from 'app/features/plugins/plugin_loader';
export { PanelCtrl, MetricsPanelCtrl, QueryCtrl, alertTab, loadPluginCss };
diff --git a/public/app/routes/routes.ts b/public/app/routes/routes.ts
index 7b1e223afe5..dfd215f7056 100644
--- a/public/app/routes/routes.ts
+++ b/public/app/routes/routes.ts
@@ -2,7 +2,7 @@ import './dashboard_loaders';
import './ReactContainer';
import ServerStats from 'app/features/admin/containers/ServerStats';
-import AlertRuleList from 'app/features/alerting/containers/AlertRuleList';
+import AlertRuleList from 'app/features/alerting/AlertRuleList';
import FolderSettings from 'app/containers/ManageDashboards/FolderSettings';
import FolderPermissions from 'app/containers/ManageDashboards/FolderPermissions';
import TeamPages from 'app/containers/Teams/TeamPages';
diff --git a/public/app/stores/AlertListStore/helpers.ts b/public/app/stores/AlertListStore/helpers.ts
index c460a697967..4d1ddcc30e0 100644
--- a/public/app/stores/AlertListStore/helpers.ts
+++ b/public/app/stores/AlertListStore/helpers.ts
@@ -1,5 +1,5 @@
import moment from 'moment';
-import alertDef from 'app/features/alerting/alert_def';
+import alertDef from 'app/features/alerting/state/alertDef';
export function setStateFields(rule, state) {
const stateModel = alertDef.getStateDisplayModel(state);
diff --git a/public/app/types/container.ts b/public/app/types/container.ts
index 174bc0c8460..98b5248fdd6 100644
--- a/public/app/types/container.ts
+++ b/public/app/types/container.ts
@@ -1,6 +1,7 @@
import { NavModel } from './navModel';
+import { initNav } from 'app/core/actions';
export interface ContainerProps {
navModel: NavModel;
- initNav: (...args: string[]) => void;
+ initNav: typeof initNav;
}
diff --git a/public/app/types/navModel.ts b/public/app/types/navModel.ts
index e1a4265847c..9464858f967 100644
--- a/public/app/types/navModel.ts
+++ b/public/app/types/navModel.ts
@@ -9,11 +9,11 @@ export interface NavModelItem {
hideFromTabs?: boolean;
divider?: boolean;
children?: NavModelItem[];
+ breadcrumbs?: NavModelItem[];
target?: string;
}
export interface NavModel {
- breadcrumbs: NavModelItem[];
main: NavModelItem;
node: NavModelItem;
}
diff --git a/public/test/mocks/common.ts b/public/test/mocks/common.ts
index 64d12fdf725..5350636573d 100644
--- a/public/test/mocks/common.ts
+++ b/public/test/mocks/common.ts
@@ -1,3 +1,5 @@
+import { NavModel, NavModelItem } from 'app/types';
+
export const backendSrv = {
get: jest.fn(),
getDashboard: jest.fn(),
@@ -17,3 +19,30 @@ export function createNavTree(...args) {
return root;
}
+
+export function getNavModel(title: string, tabs: string[]): NavModel {
+ const node: NavModelItem = {
+ id: title,
+ text: title,
+ icon: 'fa fa-fw fa-warning',
+ subTitle: 'subTitle',
+ url: title,
+ children: [],
+ breadcrumbs: [],
+ };
+
+ for (let tab of tabs) {
+ node.children.push({
+ id: tab,
+ icon: 'icon',
+ subTitle: 'subTitle',
+ url: title,
+ text: title,
+ });
+ }
+
+ return {
+ node: node,
+ main: node,
+ };
+}