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
3baaf2c3
Commit
3baaf2c3
authored
Feb 04, 2019
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added handling of kiosk mode
parent
fdeea914
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
28 deletions
+29
-28
public/app/features/dashboard/state/DashboardModel.ts
+4
-7
public/app/features/dashboard/state/initDashboard.ts
+22
-18
public/app/routes/routes.ts
+2
-2
public/app/types/dashboard.ts
+1
-1
No files found.
public/app/features/dashboard/state/DashboardModel.ts
View file @
3baaf2c3
...
...
@@ -15,6 +15,7 @@ import sortByKeys from 'app/core/utils/sort_by_keys';
import
{
PanelModel
}
from
'./PanelModel'
;
import
{
DashboardMigrator
}
from
'./DashboardMigrator'
;
import
{
TimeRange
}
from
'@grafana/ui/src'
;
import
{
UrlQueryValue
}
from
'app/types'
;
export
class
DashboardModel
{
id
:
any
;
...
...
@@ -867,11 +868,7 @@ export class DashboardModel {
return
!
_
.
isEqual
(
updated
,
this
.
originalTemplating
);
}
autoFitPanels
(
viewHeight
:
number
)
{
if
(
!
this
.
meta
.
autofitpanels
)
{
return
;
}
autoFitPanels
(
viewHeight
:
number
,
kioskMode
?:
UrlQueryValue
)
{
const
currentGridHeight
=
Math
.
max
(
...
this
.
panels
.
map
(
panel
=>
{
return
panel
.
gridPos
.
h
+
panel
.
gridPos
.
y
;
...
...
@@ -885,12 +882,12 @@ export class DashboardModel {
let
visibleHeight
=
viewHeight
-
navbarHeight
-
margin
;
// Remove submenu height if visible
if
(
this
.
meta
.
submenuEnabled
&&
!
this
.
meta
.
kiosk
)
{
if
(
this
.
meta
.
submenuEnabled
&&
!
kioskMode
)
{
visibleHeight
-=
submenuHeight
;
}
// add back navbar height
if
(
this
.
meta
.
kiosk
===
'b
'
)
{
if
(
kioskMode
===
'tv
'
)
{
visibleHeight
+=
55
;
}
...
...
public/app/features/dashboard/state/initDashboard.ts
View file @
3baaf2c3
...
...
@@ -56,10 +56,6 @@ export function initDashboard({
try
{
switch
(
routeInfo
)
{
// handle old urls with no uid
case
DashboardRouteInfo
.
Old
:
{
redirectToNewUrl
(
urlSlug
,
dispatch
);
return
;
}
case
DashboardRouteInfo
.
Home
:
{
// load home dash
dashDTO
=
await
getBackendSrv
().
get
(
'/api/dashboards/home'
);
...
...
@@ -78,20 +74,27 @@ export function initDashboard({
break
;
}
case
DashboardRouteInfo
.
Normal
:
{
// for old db routes we redirect
if
(
urlType
===
'db'
)
{
redirectToNewUrl
(
urlSlug
,
dispatch
);
return
;
}
const
loaderSrv
=
$injector
.
get
(
'dashboardLoaderSrv'
);
dashDTO
=
await
loaderSrv
.
loadDashboard
(
urlType
,
urlSlug
,
urlUid
);
// check if the current url is correct (might be old slug)
const
dashboardUrl
=
locationUtil
.
stripBaseFromUrl
(
dashDTO
.
meta
.
url
);
const
currentPath
=
getState
().
location
.
path
;
console
.
log
(
'loading dashboard: currentPath'
,
currentPath
);
console
.
log
(
'loading dashboard: dashboardUrl'
,
dashboardUrl
);
if
(
dashDTO
.
meta
.
url
)
{
// check if the current url is correct (might be old slug)
const
dashboardUrl
=
locationUtil
.
stripBaseFromUrl
(
dashDTO
.
meta
.
url
);
const
currentPath
=
getState
().
location
.
path
;
if
(
dashboardUrl
!==
currentPath
)
{
// replace url to not create additional history items and then return so that initDashboard below isn't executed multiple times.
dispatch
(
updateLocation
({
path
:
dashboardUrl
,
partial
:
true
,
replace
:
true
}));
return
;
if
(
dashboardUrl
!==
currentPath
)
{
// replace url to not create additional history items and then return so that initDashboard below isn't executed multiple times.
dispatch
(
updateLocation
({
path
:
dashboardUrl
,
partial
:
true
,
replace
:
true
}));
return
;
}
}
break
;
}
case
DashboardRouteInfo
.
New
:
{
...
...
@@ -129,7 +132,6 @@ export function initDashboard({
const
variableSrv
:
VariableSrv
=
$injector
.
get
(
'variableSrv'
);
const
keybindingSrv
:
KeybindingSrv
=
$injector
.
get
(
'keybindingSrv'
);
const
unsavedChangesSrv
=
$injector
.
get
(
'unsavedChangesSrv'
);
const
viewStateSrv
=
$injector
.
get
(
'dashboardViewStateSrv'
);
const
dashboardSrv
:
DashboardSrv
=
$injector
.
get
(
'dashboardSrv'
);
timeSrv
.
init
(
dashboard
);
...
...
@@ -147,14 +149,16 @@ export function initDashboard({
try
{
dashboard
.
processRepeats
();
dashboard
.
updateSubmenuVisibility
();
dashboard
.
autoFitPanels
(
window
.
innerHeight
);
// handle auto fix experimental feature
const
queryParams
=
getState
().
location
.
query
;
if
(
queryParams
.
autofitpanels
)
{
dashboard
.
autoFitPanels
(
window
.
innerHeight
,
queryParams
.
kiosk
);
}
// init unsaved changes tracking
unsavedChangesSrv
.
init
(
dashboard
,
$scope
);
$scope
.
dashboard
=
dashboard
;
viewStateSrv
.
create
(
$scope
);
// dashboard keybindings should not live in core, this needs a bigger refactoring
// So declaring this here so it can depend on the removePanel util function
// Long term onRemovePanel should be handled via react prop callback
...
...
public/app/routes/routes.ts
View file @
3baaf2c3
...
...
@@ -62,7 +62,7 @@ export function setupAngularRoutes($routeProvider, $locationProvider) {
.
when
(
'/dashboard/:type/:slug'
,
{
template
:
'<react-container />'
,
pageClass
:
'page-dashboard'
,
routeInfo
:
DashboardRouteInfo
.
Old
,
routeInfo
:
DashboardRouteInfo
.
Normal
,
reloadOnSearch
:
false
,
resolve
:
{
component
:
()
=>
DashboardPage
,
...
...
@@ -88,7 +88,7 @@ export function setupAngularRoutes($routeProvider, $locationProvider) {
.
when
(
'/dashboard-solo/:type/:slug'
,
{
template
:
'<react-container />'
,
pageClass
:
'dashboard-solo'
,
routeInfo
:
DashboardRouteInfo
.
Old
,
routeInfo
:
DashboardRouteInfo
.
Normal
,
resolve
:
{
component
:
()
=>
SoloPanelPage
,
},
...
...
public/app/types/dashboard.ts
View file @
3baaf2c3
...
...
@@ -8,10 +8,10 @@ export interface MutableDashboard {
}
export
enum
DashboardRouteInfo
{
Old
=
'old-dashboard'
,
Home
=
'home-dashboard'
,
New
=
'new-dashboard'
,
Normal
=
'normal-dashboard'
,
Scripted
=
'scripted-dashboard'
,
}
export
enum
DashboardLoadingState
{
...
...
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