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
c416b090
Commit
c416b090
authored
Aug 07, 2014
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more work on overview panel
parent
f144593c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
57 deletions
+17
-57
src/app/panels/overview/module.html
+6
-1
src/app/panels/overview/module.js
+8
-20
src/test/specs/overview-ctrl-specs.js
+3
-36
No files found.
src/app/panels/overview/module.html
View file @
c416b090
...
...
@@ -3,7 +3,12 @@
ng-class=
"{'panel-fullscreen': fullscreen}"
>
<h2>
hello
</h2>
<div
class=
"overview-series-list"
>
<div
class=
"overview-series-item"
ng-repeat=
"series in series"
>
<h2>
{{series.info.alias}}
</h2>
<strong>
{{series.info.avg}} Avg
</strong>
</div>
</div>
<div
class=
"clearfix"
></div>
<div
class=
"panel-full-edit-tabs"
ng-if=
"editMode"
>
...
...
src/app/panels/overview/module.js
View file @
c416b090
...
...
@@ -2,9 +2,10 @@ define([
'angular'
,
'app'
,
'underscore'
,
'services/panelSrv'
'../graph/timeSeries'
,
'services/panelSrv'
,
],
function
(
angular
,
app
,
_
)
{
function
(
angular
,
app
,
_
,
timeSeries
)
{
'use strict'
;
var
module
=
angular
.
module
(
'grafana.panels.overview'
,
[]);
...
...
@@ -69,39 +70,26 @@ function (angular, app, _) {
$scope
.
dataHandler
=
function
(
results
)
{
$scope
.
panelMeta
.
loading
=
false
;
var
data
=
_
.
map
(
results
.
data
,
$scope
.
seriesHandler
);
$scope
.
render
(
data
);
$scope
.
series
=
_
.
map
(
results
.
data
,
$scope
.
seriesHandler
);
console
.
log
(
$scope
.
series
);
};
$scope
.
seriesHandler
=
function
(
seriesData
,
index
)
{
$scope
.
seriesHandler
=
function
(
seriesData
)
{
var
datapoints
=
seriesData
.
datapoints
;
var
alias
=
seriesData
.
target
;
var
color
=
$scope
.
panel
.
aliasColors
[
alias
]
||
$scope
.
colors
[
index
];
var
yaxis
=
$scope
.
panel
.
aliasYAxis
[
alias
]
||
1
;
var
seriesInfo
=
{
alias
:
alias
,
color
:
color
,
enable
:
true
,
yaxis
:
yaxis
};
$scope
.
legend
.
push
(
seriesInfo
);
var
series
=
new
timeSeries
.
ZeroFilled
({
datapoints
:
datapoints
,
info
:
seriesInfo
,
});
if
(
datapoints
&&
datapoints
.
length
>
0
)
{
var
last
=
moment
.
utc
(
datapoints
[
datapoints
.
length
-
1
][
1
]
*
1000
);
var
from
=
moment
.
utc
(
$scope
.
range
.
from
);
if
(
last
-
from
<
-
10000
)
{
$scope
.
datapointsOutside
=
true
;
}
$scope
.
datapointsCount
+=
datapoints
.
length
;
}
series
.
points
=
series
.
getFlotPairs
(
'connected'
,
'short'
);
return
series
;
};
...
...
src/test/specs/overview-ctrl-specs.js
View file @
c416b090
define
([
'./helpers'
,
'panels/overview/module'
],
function
()
{
],
function
(
helpers
)
{
'use strict'
;
function
ControllerTestContext
()
{
var
self
=
this
;
this
.
datasource
=
{};
this
.
datasourceSrv
=
{
getMetricSources
:
function
()
{},
get
:
function
()
{
return
self
.
datasource
;
}
};
this
.
providePhase
=
function
()
{
return
module
(
function
(
$provide
)
{
$provide
.
value
(
'datasourceSrv'
,
self
.
datasourceSrv
);
});
};
this
.
createControllerPhase
=
function
(
controllerName
)
{
return
inject
(
function
(
$controller
,
$rootScope
,
$q
)
{
self
.
scope
=
$rootScope
.
$new
();
self
.
scope
.
panel
=
{};
self
.
scope
.
filter
=
{
timeRange
:
function
()
{}
};
self
.
$q
=
$q
;
self
.
scope
.
skipDataOnInit
=
true
;
self
.
controller
=
$controller
(
controllerName
,
{
$scope
:
self
.
scope
});
});
};
}
describe
(
'OverviewCtrl'
,
function
()
{
var
ctx
=
new
ControllerTestContext
();
var
ctx
=
new
helpers
.
ControllerTestContext
();
beforeEach
(
module
(
'grafana.services'
));
beforeEach
(
module
(
'grafana.panels.overview'
));
...
...
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