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
b2f9f81e
Commit
b2f9f81e
authored
Aug 20, 2014
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved yaxis override from aliasYAxis map to the new seriesOverride array
parent
939e957f
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
80 additions
and
37 deletions
+80
-37
src/app/directives/grafanaGraph.js
+4
-0
src/app/panels/graph/module.js
+6
-6
src/app/panels/graph/seriesOverridesCtrl.js
+1
-0
src/app/services/dashboard/dashboardSrv.js
+46
-29
src/test/specs/dashboardSrv-specs.js
+7
-1
src/test/specs/grafanaGraph-specs.js
+16
-1
No files found.
src/app/directives/grafanaGraph.js
View file @
b2f9f81e
...
...
@@ -212,6 +212,10 @@ function (angular, $, kbn, moment, _) {
if
(
override
.
linewidth
!==
void
0
)
{
series
.
lines
.
lineWidth
=
override
.
linewidth
;
}
if
(
override
.
pointradius
!==
void
0
)
{
series
.
points
.
radius
=
override
.
pointradius
;
}
if
(
override
.
steppedLine
!==
void
0
)
{
series
.
lines
.
steps
=
override
.
steppedLine
;
}
if
(
override
.
yaxis
!==
void
0
)
{
series
.
yaxis
=
override
.
yaxis
;
series
.
info
.
yaxis
=
override
.
yaxis
;
}
}
}
...
...
src/app/panels/graph/module.js
View file @
b2f9f81e
...
...
@@ -166,7 +166,6 @@ function (angular, app, $, _, kbn, moment, TimeSeries) {
targets
:
[{}],
aliasColors
:
{},
aliasYAxis
:
{},
seriesOverrides
:
[],
};
...
...
@@ -247,13 +246,10 @@ function (angular, app, $, _, kbn, moment, TimeSeries) {
var
datapoints
=
seriesData
.
datapoints
;
var
alias
=
seriesData
.
target
;
var
color
=
$scope
.
panel
.
aliasColors
[
alias
]
||
$rootScope
.
colors
[
index
];
var
yaxis
=
$scope
.
panel
.
aliasYAxis
[
alias
]
||
1
;
var
seriesInfo
=
{
alias
:
alias
,
color
:
color
,
enable
:
true
,
yaxis
:
yaxis
};
$scope
.
legend
.
push
(
seriesInfo
);
...
...
@@ -336,8 +332,12 @@ function (angular, app, $, _, kbn, moment, TimeSeries) {
};
$scope
.
toggleYAxis
=
function
(
info
)
{
info
.
yaxis
=
info
.
yaxis
===
2
?
1
:
2
;
$scope
.
panel
.
aliasYAxis
[
info
.
alias
]
=
info
.
yaxis
;
var
override
=
_
.
findWhere
(
$scope
.
panel
.
seriesOverrides
,
{
alias
:
info
.
alias
});
if
(
!
override
)
{
override
=
{
alias
:
info
.
alias
};
$scope
.
panel
.
seriesOverrides
.
push
(
override
);
}
override
.
yaxis
=
info
.
yaxis
===
2
?
1
:
2
;
$scope
.
render
();
};
...
...
src/app/panels/graph/seriesOverridesCtrl.js
View file @
b2f9f81e
...
...
@@ -65,6 +65,7 @@ define([
$scope
.
addOverrideOption
(
'Points'
,
'points'
,
[
true
,
false
]);
$scope
.
addOverrideOption
(
'Points Radius'
,
'pointradius'
,
[
1
,
2
,
3
,
4
,
5
]);
$scope
.
addOverrideOption
(
'Stack'
,
'stack'
,
[
true
,
false
]);
$scope
.
addOverrideOption
(
'Y-axis'
,
'yaxis'
,
[
1
,
2
]);
$scope
.
updateCurrentOverrides
();
});
...
...
src/app/services/dashboard/dashboardSrv.js
View file @
b2f9f81e
...
...
@@ -144,33 +144,17 @@ function (angular, $, kbn, _, moment) {
};
p
.
updateSchema
=
function
(
old
)
{
var
i
,
j
,
row
,
panel
;
var
oldVersion
=
this
.
version
;
this
.
version
=
3
;
var
panelUpgrades
=
[];
this
.
version
=
4
;
if
(
oldVersion
===
3
)
{
if
(
oldVersion
===
4
)
{
return
;
}
// Version 3 schema changes
// ensure panel ids
var
maxId
=
this
.
getNextPanelId
();
for
(
i
=
0
;
i
<
this
.
rows
.
length
;
i
++
)
{
row
=
this
.
rows
[
i
];
for
(
j
=
0
;
j
<
row
.
panels
.
length
;
j
++
)
{
panel
=
row
.
panels
[
j
];
if
(
!
panel
.
id
)
{
panel
.
id
=
maxId
;
maxId
+=
1
;
}
}
}
if
(
oldVersion
===
2
)
{
return
;
}
// version 2 schema changes
if
(
oldVersion
<
2
)
{
// Version 2 schema changes
if
(
old
.
services
)
{
if
(
old
.
services
.
filter
)
{
this
.
time
=
old
.
services
.
filter
.
time
;
...
...
@@ -179,19 +163,18 @@ function (angular, $, kbn, _, moment) {
delete
this
.
services
;
}
for
(
i
=
0
;
i
<
this
.
rows
.
length
;
i
++
)
{
row
=
this
.
rows
[
i
];
for
(
j
=
0
;
j
<
row
.
panels
.
length
;
j
++
)
{
panel
=
row
.
panels
[
j
];
panelUpgrades
.
push
(
function
(
panel
)
{
// rename panel type
if
(
panel
.
type
===
'graphite'
)
{
panel
.
type
=
'graph'
;
}
if
(
panel
.
type
===
'graph'
)
{
if
(
_
.
isBoolean
(
panel
.
legend
))
{
panel
.
legend
=
{
show
:
panel
.
legend
};
if
(
panel
.
type
!==
'graph'
)
{
return
;
}
if
(
_
.
isBoolean
(
panel
.
legend
))
{
panel
.
legend
=
{
show
:
panel
.
legend
};
}
if
(
panel
.
grid
)
{
if
(
panel
.
grid
.
min
)
{
panel
.
grid
.
leftMin
=
panel
.
grid
.
min
;
...
...
@@ -213,11 +196,45 @@ function (angular, $, kbn, _, moment) {
panel
.
y_formats
[
1
]
=
panel
.
y2_format
;
delete
panel
.
y2_format
;
}
});
}
// schema version 3 changes
if
(
oldVersion
<
3
)
{
// ensure panel ids
var
maxId
=
this
.
getNextPanelId
();
panelUpgrades
.
push
(
function
(
panel
)
{
if
(
!
panel
.
id
)
{
panel
.
id
=
maxId
;
maxId
+=
1
;
}
});
}
this
.
version
=
3
;
// schema version 4 changes
if
(
oldVersion
<
4
)
{
// move aliasYAxis changes
panelUpgrades
.
push
(
function
(
panel
)
{
if
(
panel
.
type
!==
'graph'
)
{
return
;
}
_
.
each
(
panel
.
aliasYAxis
,
function
(
value
,
key
)
{
panel
.
seriesOverrides
=
[{
alias
:
key
,
yaxis
:
value
}];
});
delete
panel
.
aliasYAxis
;
});
}
if
(
panelUpgrades
.
length
===
0
)
{
return
;
}
for
(
var
i
=
0
;
i
<
this
.
rows
.
length
;
i
++
)
{
var
row
=
this
.
rows
[
i
];
for
(
var
j
=
0
;
j
<
row
.
panels
.
length
;
j
++
)
{
for
(
var
k
=
0
;
k
<
panelUpgrades
.
length
;
k
++
)
{
panelUpgrades
[
k
](
row
.
panels
[
j
]);
}
}
}
};
return
{
...
...
src/test/specs/dashboardSrv-specs.js
View file @
b2f9f81e
...
...
@@ -97,6 +97,7 @@ define([
{
type
:
'graphite'
,
legend
:
true
,
aliasYAxis
:
{
test
:
2
},
grid
:
{
min
:
1
,
max
:
10
}
}
]
...
...
@@ -134,8 +135,13 @@ define([
expect
(
graph
.
grid
.
leftMax
).
to
.
be
(
10
);
});
it
(
'move aliasYAxis to series override'
,
function
()
{
expect
(
graph
.
seriesOverrides
[
0
].
alias
).
to
.
be
(
"test"
);
expect
(
graph
.
seriesOverrides
[
0
].
yaxis
).
to
.
be
(
2
);
});
it
(
'dashboard schema version should be set to latest'
,
function
()
{
expect
(
model
.
version
).
to
.
be
(
3
);
expect
(
model
.
version
).
to
.
be
(
4
);
});
});
...
...
src/test/specs/grafanaGraph-specs.js
View file @
b2f9f81e
...
...
@@ -153,12 +153,27 @@ define([
data
[
1
].
info
.
alias
=
'test_01'
;
});
it
(
'should match second series
and set pointradius, and set steppedLine
'
,
function
()
{
it
(
'should match second series'
,
function
()
{
expect
(
ctx
.
plotData
[
0
].
lines
.
show
).
to
.
be
(
undefined
);
expect
(
ctx
.
plotData
[
1
].
lines
.
show
).
to
.
be
(
false
);
});
});
graphScenario
(
'override series y-axis'
,
function
(
ctx
)
{
ctx
.
setup
(
function
(
scope
,
data
)
{
scope
.
panel
.
lines
=
true
;
scope
.
panel
.
seriesOverrides
=
[
{
alias
:
'test'
,
yaxis
:
2
}
];
data
[
1
].
info
.
alias
=
'test'
;
});
it
(
'should match second series and set yaxis'
,
function
()
{
expect
(
ctx
.
plotData
[
1
].
yaxis
).
to
.
be
(
2
);
});
});
});
});
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