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
d46e612c
Commit
d46e612c
authored
Aug 12, 2014
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Working on linking to panels, #576, #672
parent
c48df852
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
60 additions
and
22 deletions
+60
-22
src/app/controllers/dash.js
+4
-0
src/app/panels/graph/module.js
+2
-16
src/app/routes/dashboard-from-db.js
+7
-1
src/app/services/dashboard/dashboardSrv.js
+23
-4
src/app/services/panelSrv.js
+23
-0
src/test/specs/dashboardSrv-specs.js
+1
-1
No files found.
src/app/controllers/dash.js
View file @
d46e612c
...
@@ -49,6 +49,10 @@ function (angular, $, config, _) {
...
@@ -49,6 +49,10 @@ function (angular, $, config, _) {
dashboardKeybindings
.
shortcuts
(
$scope
);
dashboardKeybindings
.
shortcuts
(
$scope
);
if
(
$scope
.
dashboard
.
$state
.
panelId
)
{
$rootScope
.
fullscreen
=
true
;
}
$scope
.
emitAppEvent
(
"dashboard-loaded"
,
$scope
.
dashboard
);
$scope
.
emitAppEvent
(
"dashboard-loaded"
,
$scope
.
dashboard
);
};
};
...
...
src/app/panels/graph/module.js
View file @
d46e612c
...
@@ -188,13 +188,7 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
...
@@ -188,13 +188,7 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
_
.
defaults
(
$scope
.
panel
.
grid
,
_d
.
grid
);
_
.
defaults
(
$scope
.
panel
.
grid
,
_d
.
grid
);
_
.
defaults
(
$scope
.
panel
.
legend
,
_d
.
legend
);
_
.
defaults
(
$scope
.
panel
.
legend
,
_d
.
legend
);
$scope
.
init
=
function
()
{
$scope
.
hiddenSeries
=
{};
panelSrv
.
init
(
$scope
);
$scope
.
hiddenSeries
=
{};
if
(
!
$scope
.
skipDataOnInit
)
{
$scope
.
get_data
();
}
};
$scope
.
updateTimeRange
=
function
()
{
$scope
.
updateTimeRange
=
function
()
{
$scope
.
range
=
$scope
.
filter
.
timeRange
();
$scope
.
range
=
$scope
.
filter
.
timeRange
();
...
@@ -210,10 +204,6 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
...
@@ -210,10 +204,6 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
};
};
$scope
.
get_data
=
function
()
{
$scope
.
get_data
=
function
()
{
delete
$scope
.
panel
.
error
;
$scope
.
panelMeta
.
loading
=
true
;
$scope
.
updateTimeRange
();
$scope
.
updateTimeRange
();
var
metricsQuery
=
{
var
metricsQuery
=
{
...
@@ -297,10 +287,6 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
...
@@ -297,10 +287,6 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
return
series
;
return
series
;
};
};
$scope
.
otherPanelInFullscreenMode
=
function
()
{
return
$rootScope
.
fullscreen
&&
!
$scope
.
fullscreen
;
};
$scope
.
render
=
function
(
data
)
{
$scope
.
render
=
function
(
data
)
{
$scope
.
$emit
(
'render'
,
data
);
$scope
.
$emit
(
'render'
,
data
);
};
};
...
@@ -371,7 +357,7 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
...
@@ -371,7 +357,7 @@ function (angular, app, $, _, kbn, moment, timeSeries) {
$scope
.
render
();
$scope
.
render
();
};
};
$scope
.
init
(
);
panelSrv
.
init
(
$scope
);
});
});
});
});
src/app/routes/dashboard-from-db.js
View file @
d46e612c
...
@@ -8,7 +8,7 @@ function (angular) {
...
@@ -8,7 +8,7 @@ function (angular) {
module
.
config
(
function
(
$routeProvider
)
{
module
.
config
(
function
(
$routeProvider
)
{
$routeProvider
$routeProvider
.
when
(
'/dashboard/db/:id'
,
{
.
when
(
'/dashboard/db/:id
/:panelId?
'
,
{
templateUrl
:
'app/partials/dashboard.html'
,
templateUrl
:
'app/partials/dashboard.html'
,
controller
:
'DashFromDBProvider'
,
controller
:
'DashFromDBProvider'
,
})
})
...
@@ -29,7 +29,13 @@ function (angular) {
...
@@ -29,7 +29,13 @@ function (angular) {
db
.
getDashboard
(
$routeParams
.
id
,
isTemp
)
db
.
getDashboard
(
$routeParams
.
id
,
isTemp
)
.
then
(
function
(
dashboard
)
{
.
then
(
function
(
dashboard
)
{
dashboard
.
$state
=
{
panelId
:
parseInt
(
$routeParams
.
panelId
)
};
$scope
.
emitAppEvent
(
'setup-dashboard'
,
dashboard
);
$scope
.
emitAppEvent
(
'setup-dashboard'
,
dashboard
);
}).
then
(
null
,
function
(
error
)
{
}).
then
(
null
,
function
(
error
)
{
alertSrv
.
set
(
'Error'
,
error
,
'error'
);
alertSrv
.
set
(
'Error'
,
error
,
'error'
);
});
});
...
...
src/app/services/dashboard/dashboardSrv.js
View file @
d46e612c
...
@@ -29,6 +29,8 @@ function (angular, $, kbn, _) {
...
@@ -29,6 +29,8 @@ function (angular, $, kbn, _) {
this
.
time
=
data
.
time
||
{
from
:
'now-6h'
,
to
:
'now'
};
this
.
time
=
data
.
time
||
{
from
:
'now-6h'
,
to
:
'now'
};
this
.
templating
=
data
.
templating
||
{
list
:
[]
};
this
.
templating
=
data
.
templating
||
{
list
:
[]
};
this
.
refresh
=
data
.
refresh
;
this
.
refresh
=
data
.
refresh
;
this
.
version
=
data
.
version
||
0
;
this
.
$state
=
data
.
$state
;
if
(
this
.
nav
.
length
===
0
)
{
if
(
this
.
nav
.
length
===
0
)
{
this
.
nav
.
push
({
type
:
'timepicker'
});
this
.
nav
.
push
({
type
:
'timepicker'
});
...
@@ -75,12 +77,30 @@ function (angular, $, kbn, _) {
...
@@ -75,12 +77,30 @@ function (angular, $, kbn, _) {
p
.
updateSchema
=
function
(
old
)
{
p
.
updateSchema
=
function
(
old
)
{
var
i
,
j
,
row
,
panel
;
var
i
,
j
,
row
,
panel
;
var
isChanged
=
false
;
var
oldVersion
=
this
.
version
;
this
.
version
=
3
;
if
(
this
.
version
===
2
)
{
if
(
oldVersion
===
3
)
{
return
;
return
;
}
}
// Version 3 schema changes
// ensure panel ids
var
panelId
=
1
;
for
(
i
=
0
;
i
<
this
.
rows
.
length
;
i
++
)
{
row
=
this
.
rows
[
i
];
for
(
j
=
0
;
j
<
row
.
panels
.
length
;
j
++
)
{
panel
=
row
.
panels
[
j
];
panel
.
id
=
panelId
;
panelId
+=
1
;
}
}
if
(
oldVersion
===
2
)
{
return
;
}
// Version 2 schema changes
if
(
old
.
services
)
{
if
(
old
.
services
)
{
if
(
old
.
services
.
filter
)
{
if
(
old
.
services
.
filter
)
{
this
.
time
=
old
.
services
.
filter
.
time
;
this
.
time
=
old
.
services
.
filter
.
time
;
...
@@ -95,7 +115,6 @@ function (angular, $, kbn, _) {
...
@@ -95,7 +115,6 @@ function (angular, $, kbn, _) {
panel
=
row
.
panels
[
j
];
panel
=
row
.
panels
[
j
];
if
(
panel
.
type
===
'graphite'
)
{
if
(
panel
.
type
===
'graphite'
)
{
panel
.
type
=
'graph'
;
panel
.
type
=
'graph'
;
isChanged
=
true
;
}
}
if
(
panel
.
type
===
'graph'
)
{
if
(
panel
.
type
===
'graph'
)
{
...
@@ -128,7 +147,7 @@ function (angular, $, kbn, _) {
...
@@ -128,7 +147,7 @@ function (angular, $, kbn, _) {
}
}
}
}
this
.
version
=
2
;
this
.
version
=
3
;
};
};
return
{
return
{
...
...
src/app/services/panelSrv.js
View file @
d46e612c
...
@@ -153,6 +153,10 @@ function (angular, _, $) {
...
@@ -153,6 +153,10 @@ function (angular, _, $) {
$scope
.
enterFullscreenMode
({
edit
:
false
});
$scope
.
enterFullscreenMode
({
edit
:
false
});
};
};
$scope
.
otherPanelInFullscreenMode
=
function
()
{
return
$rootScope
.
fullscreen
&&
!
$scope
.
fullscreen
;
};
// Post init phase
// Post init phase
$scope
.
fullscreen
=
false
;
$scope
.
fullscreen
=
false
;
$scope
.
editor
=
{
index
:
1
};
$scope
.
editor
=
{
index
:
1
};
...
@@ -162,6 +166,25 @@ function (angular, _, $) {
...
@@ -162,6 +166,25 @@ function (angular, _, $) {
$scope
.
datasources
=
datasourceSrv
.
getMetricSources
();
$scope
.
datasources
=
datasourceSrv
.
getMetricSources
();
$scope
.
setDatasource
(
$scope
.
panel
.
datasource
);
$scope
.
setDatasource
(
$scope
.
panel
.
datasource
);
// if ($scope.dashboard.$state.panelId === $scope.panel.id) {
// $scope.enterFullscreenMode({edit: false});
// }
if
(
$scope
.
get_data
)
{
var
panel_get_data
=
$scope
.
get_data
;
$scope
.
get_data
=
function
()
{
if
(
$scope
.
otherPanelInFullscreenMode
())
{
return
;
}
delete
$scope
.
panel
.
error
;
$scope
.
panelMeta
.
loading
=
true
;
panel_get_data
();
};
if
(
!
$scope
.
skipDataOnInit
)
{
$scope
.
get_data
();
}
}
};
};
});
});
...
...
src/test/specs/dashboardSrv-specs.js
View file @
d46e612c
...
@@ -73,7 +73,7 @@ define([
...
@@ -73,7 +73,7 @@ define([
});
});
it
(
'dashboard schema version should be set to latest'
,
function
()
{
it
(
'dashboard schema version should be set to latest'
,
function
()
{
expect
(
model
.
version
).
to
.
be
(
2
);
expect
(
model
.
version
).
to
.
be
(
3
);
});
});
});
});
...
...
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