Commit 874792df by Torkel Ödegaard

Moved view state srv to services

parent ec37f847
...@@ -7,7 +7,6 @@ import './save_provisioned_modal'; ...@@ -7,7 +7,6 @@ import './save_provisioned_modal';
import './shareModalCtrl'; import './shareModalCtrl';
import './share_snapshot_ctrl'; import './share_snapshot_ctrl';
import './dashboard_srv'; import './dashboard_srv';
import './view_state_srv';
import './validation_srv'; import './validation_srv';
import './time_srv'; import './time_srv';
import './unsaved_changes_srv'; import './unsaved_changes_srv';
...@@ -18,6 +17,11 @@ import './repeat_option/repeat_option'; ...@@ -18,6 +17,11 @@ import './repeat_option/repeat_option';
import './dashgrid/DashboardGridDirective'; import './dashgrid/DashboardGridDirective';
import './dashgrid/RowOptions'; import './dashgrid/RowOptions';
import './panellinks/module'; import './panellinks/module';
// Services
import './services/DashboardViewStateSrv';
// Components
import './components/DashLinks'; import './components/DashLinks';
import './components/DashExportModal'; import './components/DashExportModal';
import './components/DashNav'; import './components/DashNav';
......
//import { describe, beforeEach, it, expect, angularMocks } from 'test/lib/common';
import 'app/features/dashboard/view_state_srv';
import config from 'app/core/config'; import config from 'app/core/config';
import { DashboardViewState } from '../view_state_srv'; import { DashboardViewStateSrv } from './DashboardViewStateSrv';
import { DashboardModel } from '../dashboard_model'; import { DashboardModel } from '../dashboard_model';
describe('when updating view state', () => { describe('when updating view state', () => {
...@@ -33,7 +31,7 @@ describe('when updating view state', () => { ...@@ -33,7 +31,7 @@ describe('when updating view state', () => {
location.search = jest.fn(() => { location.search = jest.fn(() => {
return { fullscreen: true, edit: true, panelId: 1 }; return { fullscreen: true, edit: true, panelId: 1 };
}); });
viewState = new DashboardViewState($scope, location, {}); viewState = new DashboardViewStateSrv($scope, location, {});
}); });
it('should update querystring and view state', () => { it('should update querystring and view state', () => {
...@@ -55,7 +53,7 @@ describe('when updating view state', () => { ...@@ -55,7 +53,7 @@ describe('when updating view state', () => {
describe('to fullscreen false', () => { describe('to fullscreen false', () => {
beforeEach(() => { beforeEach(() => {
viewState = new DashboardViewState($scope, location, {}); viewState = new DashboardViewStateSrv($scope, location, {});
}); });
it('should remove params from query string', () => { it('should remove params from query string', () => {
viewState.update({ fullscreen: true, panelId: 1, edit: true }); viewState.update({ fullscreen: true, panelId: 1, edit: true });
......
...@@ -2,11 +2,11 @@ import angular from 'angular'; ...@@ -2,11 +2,11 @@ import angular from 'angular';
import _ from 'lodash'; import _ from 'lodash';
import config from 'app/core/config'; import config from 'app/core/config';
import appEvents from 'app/core/app_events'; import appEvents from 'app/core/app_events';
import { DashboardModel } from './dashboard_model'; import { DashboardModel } from '../dashboard_model';
// represents the transient view state // represents the transient view state
// like fullscreen panel & edit // like fullscreen panel & edit
export class DashboardViewState { export class DashboardViewStateSrv {
state: any; state: any;
panelScopes: any; panelScopes: any;
$scope: any; $scope: any;
...@@ -168,7 +168,7 @@ export class DashboardViewState { ...@@ -168,7 +168,7 @@ export class DashboardViewState {
export function dashboardViewStateSrv($location, $timeout) { export function dashboardViewStateSrv($location, $timeout) {
return { return {
create: $scope => { create: $scope => {
return new DashboardViewState($scope, $location, $timeout); return new DashboardViewStateSrv($scope, $location, $timeout);
}, },
}; };
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment