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
a2cba668
Commit
a2cba668
authored
Jan 31, 2019
by
Dominik Prokop
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not render time region line or fill if colors not provided
parent
7e1b6f59
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
4 deletions
+23
-4
public/app/plugins/panel/graph/specs/time_region_manager.test.ts
+19
-0
public/app/plugins/panel/graph/time_region_manager.ts
+4
-4
No files found.
public/app/plugins/panel/graph/specs/time_region_manager.test.ts
View file @
a2cba668
...
...
@@ -43,6 +43,25 @@ describe('TimeRegionManager', () => {
});
}
describe
(
'When colors missing in config'
,
()
=>
{
plotOptionsScenario
(
'should not throw an error when fillColor is undefined'
,
ctx
=>
{
const
regions
=
[
{
fromDayOfWeek
:
1
,
toDayOfWeek
:
1
,
fill
:
true
,
line
:
true
,
lineColor
:
'#ffffff'
,
colorMode
:
'custom'
},
];
const
from
=
moment
(
'2018-01-01T00:00:00+01:00'
);
const
to
=
moment
(
'2018-01-01T23:59:00+01:00'
);
expect
(()
=>
ctx
.
setup
(
regions
,
from
,
to
)).
not
.
toThrow
();
});
plotOptionsScenario
(
'should not throw an error when lineColor is undefined'
,
ctx
=>
{
const
regions
=
[
{
fromDayOfWeek
:
1
,
toDayOfWeek
:
1
,
fill
:
true
,
fillColor
:
'#ffffff'
,
line
:
true
,
colorMode
:
'custom'
},
];
const
from
=
moment
(
'2018-01-01T00:00:00+01:00'
);
const
to
=
moment
(
'2018-01-01T23:59:00+01:00'
);
expect
(()
=>
ctx
.
setup
(
regions
,
from
,
to
)).
not
.
toThrow
();
});
});
describe
(
'When creating plot markings using local time'
,
()
=>
{
plotOptionsScenario
(
'for day of week region'
,
ctx
=>
{
const
regions
=
[{
fromDayOfWeek
:
1
,
toDayOfWeek
:
1
,
fill
:
true
,
line
:
true
,
colorMode
:
'red'
}];
...
...
public/app/plugins/panel/graph/time_region_manager.ts
View file @
a2cba668
...
...
@@ -50,8 +50,8 @@ function getColor(timeRegion, theme: GrafanaTheme): TimeRegionColorDefinition {
if
(
timeRegion
.
colorMode
===
'custom'
)
{
return
{
fill
:
getColorFromHexRgbOrName
(
timeRegion
.
fillColor
,
theme
)
,
line
:
getColorFromHexRgbOrName
(
timeRegion
.
lineColor
,
theme
)
,
fill
:
timeRegion
.
fill
&&
timeRegion
.
fillColor
?
getColorFromHexRgbOrName
(
timeRegion
.
fillColor
,
theme
)
:
null
,
line
:
timeRegion
.
line
&&
timeRegion
.
lineColor
?
getColorFromHexRgbOrName
(
timeRegion
.
lineColor
,
theme
)
:
null
,
};
}
...
...
@@ -62,8 +62,8 @@ function getColor(timeRegion, theme: GrafanaTheme): TimeRegionColorDefinition {
}
return
{
fill
:
getColorFromHexRgbOrName
(
colorMode
.
color
.
fill
,
theme
)
,
line
:
getColorFromHexRgbOrName
(
colorMode
.
color
.
line
,
theme
)
,
fill
:
timeRegion
.
fill
?
getColorFromHexRgbOrName
(
colorMode
.
color
.
fill
,
theme
)
:
null
,
line
:
timeRegion
.
fill
?
getColorFromHexRgbOrName
(
colorMode
.
color
.
line
,
theme
)
:
null
,
};
}
...
...
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