mirror of https://github.com/grafana/grafana.git
ux(view/kiosk mode): added view mode and kiosk mode, #6476
This commit is contained in:
parent
0d82fb71ad
commit
d38de2cc8b
|
|
@ -109,6 +109,48 @@ export function grafanaAppDirective(playlistSrv, contextSrv) {
|
|||
$("#tooltip, .tooltip").remove();
|
||||
});
|
||||
|
||||
// handle kiosk mode
|
||||
appEvents.on('toggle-kiosk-mode', () => {
|
||||
body.toggleClass('page-kiosk-mode');
|
||||
});
|
||||
|
||||
// handle in active view state class
|
||||
var lastActivity = new Date().getTime();
|
||||
var activeUser = true;
|
||||
var inActiveTimeLimit = 2 * 60 * 1000;
|
||||
|
||||
function checkForInActiveUser() {
|
||||
if (!activeUser) {
|
||||
return;
|
||||
}
|
||||
// only go to activity low mode on dashboard page
|
||||
if (!body.hasClass('page-dashboard')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((new Date().getTime() - lastActivity) > inActiveTimeLimit) {
|
||||
activeUser = false;
|
||||
body.addClass('user-activity-low');
|
||||
}
|
||||
}
|
||||
|
||||
function userActivityDetected() {
|
||||
lastActivity = new Date().getTime();
|
||||
if (!activeUser) {
|
||||
activeUser = true;
|
||||
body.removeClass('user-activity-low');
|
||||
}
|
||||
}
|
||||
|
||||
body.mousemove(userActivityDetected);
|
||||
body.keydown(userActivityDetected);
|
||||
setInterval(checkForInActiveUser, 1000);
|
||||
|
||||
appEvents.on('toggle-view-mode', () => {
|
||||
lastActivity = 0;
|
||||
checkForInActiveUser();
|
||||
});
|
||||
|
||||
// handle document clicks that should hide things
|
||||
body.click(function(evt) {
|
||||
var target = $(evt.target);
|
||||
|
|
|
|||
|
|
@ -190,6 +190,14 @@ export class KeybindingSrv {
|
|||
this.showDashEditView('settings');
|
||||
});
|
||||
|
||||
this.bind('d k', () => {
|
||||
appEvents.emit('toggle-kiosk-mode');
|
||||
});
|
||||
|
||||
this.bind('d v', () => {
|
||||
appEvents.emit('toggle-view-mode');
|
||||
});
|
||||
|
||||
this.bind('esc', () => {
|
||||
var popups = $('.popover.in');
|
||||
if (popups.length > 0) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
<div dash-class ng-if="dashboard" >
|
||||
<div dash-class ng-if="dashboard">
|
||||
<dashnav></dashnav>
|
||||
|
||||
<div class="dashboard-container">
|
||||
|
|
|
|||
|
|
@ -351,3 +351,14 @@
|
|||
border-left: 0;
|
||||
border-bottom: 1px solid transparent;
|
||||
}
|
||||
|
||||
@mixin hide-controls() {
|
||||
.add-row-panel-hint,
|
||||
.dash-row-menu {
|
||||
display: none;
|
||||
}
|
||||
.resize-panel-handle,
|
||||
.panel-drop-zone {
|
||||
visibility: hidden;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,11 +14,11 @@
|
|||
}
|
||||
|
||||
.playlist-active {
|
||||
.add-row-panel-hint,
|
||||
@include hide-controls();
|
||||
|
||||
.dashnav-refresh-action,
|
||||
.dashnav-zoom-out,
|
||||
.dashnav-action-icons,
|
||||
.dash-row-menu,
|
||||
.dashnav-move-timeframe {
|
||||
display: none;
|
||||
}
|
||||
|
|
@ -29,15 +29,40 @@
|
|||
}
|
||||
|
||||
.hide-controls {
|
||||
.add-row-panel-hint {
|
||||
@include hide-controls();
|
||||
}
|
||||
|
||||
.page-kiosk-mode {
|
||||
@include hide-controls();
|
||||
dashnav {
|
||||
display: none;
|
||||
}
|
||||
.dash-row-menu {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.user-activity-low {
|
||||
@include hide-controls();
|
||||
.dashnav-refresh-action,
|
||||
.dashnav-zoom-out,
|
||||
.dashnav-action-icons,
|
||||
.dashnav-move-timeframe {
|
||||
opacity: 0;
|
||||
transition: opacity 1.5s ease-in-out;
|
||||
}
|
||||
|
||||
// navbar buttons
|
||||
.navbar-inner {
|
||||
background: transparent;
|
||||
transition: background 1.5s ease-in-out;
|
||||
}
|
||||
.navbar-brand-btn,
|
||||
.navbar-page-btn {
|
||||
border: none;
|
||||
background: transparent;
|
||||
.fa, .icon-gf {
|
||||
opacity: 0;
|
||||
transition: opacity 1s ease-in-out;
|
||||
transition: opacity 1.5s ease-in-out;
|
||||
}
|
||||
.resize-panel-handle,
|
||||
.panel-drop-zone {
|
||||
visibility: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue