Moved view state srv to services
This commit is contained in:
@@ -7,7 +7,6 @@ import './save_provisioned_modal';
|
||||
import './shareModalCtrl';
|
||||
import './share_snapshot_ctrl';
|
||||
import './dashboard_srv';
|
||||
import './view_state_srv';
|
||||
import './validation_srv';
|
||||
import './time_srv';
|
||||
import './unsaved_changes_srv';
|
||||
@@ -18,6 +17,11 @@ import './repeat_option/repeat_option';
|
||||
import './dashgrid/DashboardGridDirective';
|
||||
import './dashgrid/RowOptions';
|
||||
import './panellinks/module';
|
||||
|
||||
// Services
|
||||
import './services/DashboardViewStateSrv';
|
||||
|
||||
// Components
|
||||
import './components/DashLinks';
|
||||
import './components/DashExportModal';
|
||||
import './components/DashNav';
|
||||
|
||||
+3
-5
@@ -1,7 +1,5 @@
|
||||
//import { describe, beforeEach, it, expect, angularMocks } from 'test/lib/common';
|
||||
import 'app/features/dashboard/view_state_srv';
|
||||
import config from 'app/core/config';
|
||||
import { DashboardViewState } from '../view_state_srv';
|
||||
import { DashboardViewStateSrv } from './DashboardViewStateSrv';
|
||||
import { DashboardModel } from '../dashboard_model';
|
||||
|
||||
describe('when updating view state', () => {
|
||||
@@ -33,7 +31,7 @@ describe('when updating view state', () => {
|
||||
location.search = jest.fn(() => {
|
||||
return { fullscreen: true, edit: true, panelId: 1 };
|
||||
});
|
||||
viewState = new DashboardViewState($scope, location, {});
|
||||
viewState = new DashboardViewStateSrv($scope, location, {});
|
||||
});
|
||||
|
||||
it('should update querystring and view state', () => {
|
||||
@@ -55,7 +53,7 @@ describe('when updating view state', () => {
|
||||
|
||||
describe('to fullscreen false', () => {
|
||||
beforeEach(() => {
|
||||
viewState = new DashboardViewState($scope, location, {});
|
||||
viewState = new DashboardViewStateSrv($scope, location, {});
|
||||
});
|
||||
it('should remove params from query string', () => {
|
||||
viewState.update({ fullscreen: true, panelId: 1, edit: true });
|
||||
+3
-3
@@ -2,11 +2,11 @@ import angular from 'angular';
|
||||
import _ from 'lodash';
|
||||
import config from 'app/core/config';
|
||||
import appEvents from 'app/core/app_events';
|
||||
import { DashboardModel } from './dashboard_model';
|
||||
import { DashboardModel } from '../dashboard_model';
|
||||
|
||||
// represents the transient view state
|
||||
// like fullscreen panel & edit
|
||||
export class DashboardViewState {
|
||||
export class DashboardViewStateSrv {
|
||||
state: any;
|
||||
panelScopes: any;
|
||||
$scope: any;
|
||||
@@ -168,7 +168,7 @@ export class DashboardViewState {
|
||||
export function dashboardViewStateSrv($location, $timeout) {
|
||||
return {
|
||||
create: $scope => {
|
||||
return new DashboardViewState($scope, $location, $timeout);
|
||||
return new DashboardViewStateSrv($scope, $location, $timeout);
|
||||
},
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user