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
939e957f
Commit
939e957f
authored
Aug 20, 2014
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made regex match work for per series overrides, #425, #700
parent
062fe720
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
9 deletions
+41
-9
src/app/directives/grafanaGraph.js
+11
-1
src/app/panels/graph/seriesOverridesCtrl.js
+7
-7
src/app/panels/graph/styleEditor.html
+1
-1
src/test/specs/grafanaGraph-specs.js
+14
-0
src/test/specs/seriesOverridesCtrl-specs.js
+8
-0
No files found.
src/app/directives/grafanaGraph.js
View file @
939e957f
...
...
@@ -183,6 +183,16 @@ function (angular, $, kbn, moment, _) {
}
}
function
matchSeriesOverride
(
aliasOrRegex
,
seriesAlias
)
{
if
(
aliasOrRegex
[
0
]
===
'/'
)
{
var
match
=
aliasOrRegex
.
match
(
new
RegExp
(
'^/(.*?)/(g?i?m?y?)$'
));
var
regex
=
new
RegExp
(
match
[
1
],
match
[
2
]);
return
seriesAlias
.
match
(
regex
)
!=
null
;
}
return
aliasOrRegex
===
seriesAlias
;
}
function
applySeriesOverrideOptions
(
series
)
{
series
.
lines
=
{};
series
.
points
=
{};
...
...
@@ -191,7 +201,7 @@ function (angular, $, kbn, moment, _) {
for
(
var
i
=
0
;
i
<
scope
.
panel
.
seriesOverrides
.
length
;
i
++
)
{
var
override
=
scope
.
panel
.
seriesOverrides
[
i
];
if
(
override
.
alias
!==
series
.
info
.
alias
)
{
if
(
!
matchSeriesOverride
(
override
.
alias
,
series
.
info
.
alias
)
)
{
continue
;
}
if
(
override
.
lines
!==
void
0
)
{
series
.
lines
.
show
=
override
.
lines
;
}
...
...
src/app/panels/graph/seriesOverridesCtrl.js
View file @
939e957f
...
...
@@ -47,13 +47,13 @@ define([
$scope
.
updateCurrentOverrides
=
function
()
{
$scope
.
currentOverrides
=
[];
_
.
each
(
$scope
.
overrideMenu
,
function
(
option
)
{
if
(
!
_
.
isUndefined
(
$scope
.
override
[
option
.
propertyName
]))
{
$scope
.
currentOverrides
.
push
({
name
:
option
.
text
,
propertyName
:
option
.
propertyName
,
value
:
String
(
$scope
.
override
[
option
.
propertyName
])
});
}
var
value
=
$scope
.
override
[
option
.
propertyName
];
if
(
_
.
isUndefined
(
value
))
{
return
;
}
$scope
.
currentOverrides
.
push
({
name
:
option
.
text
,
propertyName
:
option
.
propertyName
,
value
:
String
(
value
)
}
);
});
};
...
...
src/app/panels/graph/styleEditor.html
View file @
939e957f
...
...
@@ -65,7 +65,7 @@
<div
class=
"editor-row"
>
<div
class=
"section"
>
<h5>
Series specific overrides
</h5>
<h5>
Series specific overrides
<tip>
Regex match example: /server[0-3]/i
</tip>
</h5>
<div
class=
"grafana-target"
ng-repeat=
"override in panel.seriesOverrides"
ng-controller=
"SeriesOverridesCtrl"
>
<div
class=
"grafana-target-inner-wrapper"
>
...
...
src/test/specs/grafanaGraph-specs.js
View file @
939e957f
...
...
@@ -143,7 +143,21 @@ define([
});
});
graphScenario
(
'override match on regex'
,
function
(
ctx
)
{
ctx
.
setup
(
function
(
scope
,
data
)
{
scope
.
panel
.
lines
=
true
;
scope
.
panel
.
seriesOverrides
=
[
{
alias
:
'/.*01/'
,
lines
:
false
}
];
data
[
1
].
info
.
alias
=
'test_01'
;
});
it
(
'should match second series and set pointradius, and set steppedLine'
,
function
()
{
expect
(
ctx
.
plotData
[
0
].
lines
.
show
).
to
.
be
(
undefined
);
expect
(
ctx
.
plotData
[
1
].
lines
.
show
).
to
.
be
(
false
);
});
});
});
});
...
...
src/test/specs/seriesOverridesCtrl-specs.js
View file @
939e957f
...
...
@@ -37,6 +37,14 @@ define([
});
});
describe
(
'When removing overide'
,
function
()
{
it
(
'click should include option and value index'
,
function
()
{
ctx
.
scope
.
setOverride
(
1
,
0
);
ctx
.
scope
.
removeOverride
({
propertyName
:
'lines'
});
expect
(
ctx
.
scope
.
currentOverrides
.
length
).
to
.
be
(
0
);
});
});
});
});
...
...
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