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
3ac306a7
Commit
3ac306a7
authored
Jun 28, 2017
by
Daniel Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
playlist: fixes #6727. Remember Kiosk mode
parent
91ad2605
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
7 deletions
+36
-7
public/app/features/playlist/playlist_srv.ts
+36
-7
No files found.
public/app/features/playlist/playlist_srv.ts
View file @
3ac306a7
...
...
@@ -3,6 +3,7 @@
import
angular
from
'angular'
;
import
coreModule
from
'../../core/core_module'
;
import
kbn
from
'app/core/utils/kbn'
;
import
appEvents
from
'app/core/app_events'
;
class
PlaylistSrv
{
private
cancelPromise
:
any
;
...
...
@@ -14,7 +15,13 @@ class PlaylistSrv {
public
isPlaying
:
boolean
;
/** @ngInject */
constructor
(
private
$rootScope
:
any
,
private
$location
:
any
,
private
$timeout
:
any
,
private
backendSrv
:
any
)
{
}
constructor
(
private
$rootScope
:
any
,
private
$location
:
any
,
private
$timeout
:
any
,
private
backendSrv
:
any
,
private
$routeParams
:
any
)
{
}
next
()
{
this
.
$timeout
.
cancel
(
this
.
cancelPromise
);
...
...
@@ -22,14 +29,32 @@ class PlaylistSrv {
var
playedAllDashboards
=
this
.
index
>
this
.
dashboards
.
length
-
1
;
if
(
playedAllDashboards
)
{
window
.
location
.
href
=
this
.
startUrl
;
}
else
{
var
dash
=
this
.
dashboards
[
this
.
index
];
this
.
$location
.
url
(
'dashboard/'
+
dash
.
uri
);
window
.
location
.
href
=
this
.
getUrlWithKioskMode
();
return
;
}
var
dash
=
this
.
dashboards
[
this
.
index
];
this
.
$location
.
url
(
'dashboard/'
+
dash
.
uri
);
this
.
index
++
;
this
.
cancelPromise
=
this
.
$timeout
(()
=>
this
.
next
(),
this
.
interval
);
}
getUrlWithKioskMode
()
{
const
inKioskMode
=
document
.
body
.
classList
.
contains
(
'page-kiosk-mode'
);
this
.
index
++
;
this
.
cancelPromise
=
this
.
$timeout
(()
=>
this
.
next
(),
this
.
interval
);
// check if should add kiosk query param
if
(
inKioskMode
&&
this
.
startUrl
.
indexOf
(
'kiosk'
)
===
-
1
)
{
return
this
.
startUrl
+
'?kiosk=true'
;
}
// check if should remove kiosk query param
if
(
!
inKioskMode
)
{
return
this
.
startUrl
.
split
(
"?"
)[
0
];
}
// already has kiosk query param, just return startUrl
return
this
.
startUrl
;
}
prev
()
{
...
...
@@ -45,6 +70,10 @@ class PlaylistSrv {
this
.
playlistId
=
playlistId
;
this
.
isPlaying
=
true
;
if
(
this
.
$routeParams
.
kiosk
)
{
appEvents
.
emit
(
'toggle-kiosk-mode'
);
}
this
.
backendSrv
.
get
(
`/api/playlists/
${
playlistId
}
`
).
then
(
playlist
=>
{
this
.
backendSrv
.
get
(
`/api/playlists/
${
playlistId
}
/dashboards`
).
then
(
dashboards
=>
{
this
.
dashboards
=
dashboards
;
...
...
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