Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
874792df
Commit
874792df
authored
Jan 23, 2019
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved view state srv to services
parent
ec37f847
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
9 deletions
+11
-9
public/app/features/dashboard/index.ts
+5
-1
public/app/features/dashboard/services/DashboardViewStateSrv.test.ts
+3
-5
public/app/features/dashboard/services/DashboardViewStateSrv.ts
+3
-3
No files found.
public/app/features/dashboard/index.ts
View file @
874792df
...
@@ -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'
;
...
...
public/app/features/dashboard/s
pecs/viewstate_s
rv.test.ts
→
public/app/features/dashboard/s
ervices/DashboardViewStateS
rv.test.ts
View file @
874792df
//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_s
rv'
;
import
{
DashboardViewState
Srv
}
from
'./DashboardViewStateS
rv'
;
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
DashboardViewState
Srv
(
$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
DashboardViewState
Srv
(
$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
});
...
...
public/app/features/dashboard/
view_state_s
rv.ts
→
public/app/features/dashboard/
services/DashboardViewStateS
rv.ts
View file @
874792df
...
@@ -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
DashboardViewState
Srv
{
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
DashboardViewState
Srv
(
$scope
,
$location
,
$timeout
);
},
},
};
};
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment