Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
af925ecf
Commit
af925ecf
authored
Apr 06, 2018
by
Jose Ivan Vargas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added specs for rendered output, changed the background for stable tracks
parent
443a34e8
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
73 additions
and
14 deletions
+73
-14
app/assets/javascripts/monitoring/components/graph/axis.vue
app/assets/javascripts/monitoring/components/graph/axis.vue
+6
-1
app/assets/javascripts/monitoring/components/graph/legend.vue
...assets/javascripts/monitoring/components/graph/legend.vue
+11
-1
app/assets/javascripts/monitoring/components/graph/track_line.vue
...ts/javascripts/monitoring/components/graph/track_line.vue
+5
-5
app/assets/stylesheets/framework/variables.scss
app/assets/stylesheets/framework/variables.scss
+5
-0
app/assets/stylesheets/pages/environments.scss
app/assets/stylesheets/pages/environments.scss
+9
-0
spec/javascripts/monitoring/graph/track_info_spec.js
spec/javascripts/monitoring/graph/track_info_spec.js
+13
-0
spec/javascripts/monitoring/graph/track_line_spec.js
spec/javascripts/monitoring/graph/track_line_spec.js
+24
-7
No files found.
app/assets/javascripts/monitoring/components/graph/axis.vue
View file @
af925ecf
<
script
>
import
{
convertToSentenceCase
}
from
'
~/lib/utils/text_utility
'
;
import
{
s__
}
from
'
~/locale
'
;
export
default
{
props
:
{
...
...
@@ -74,6 +75,10 @@ export default {
yAxisLabelSentenceCase
()
{
return
`
${
convertToSentenceCase
(
this
.
yAxisLabel
)}
(
${
this
.
unitOfDisplay
}
)`
;
},
timeString
()
{
return
s__
(
'
PrometheusDashboard|Time
'
);
},
},
mounted
()
{
this
.
$nextTick
(()
=>
{
...
...
@@ -131,7 +136,7 @@ export default {
:y=
"yPosition"
dy=
".35em"
>
Time
{{
timeString
}}
</text>
</g>
</
template
>
app/assets/javascripts/monitoring/components/graph/legend.vue
View file @
af925ecf
...
...
@@ -17,6 +17,13 @@ export default {
required
:
true
,
},
},
methods
:
{
isStable
(
track
)
{
return
{
'
prometheus-table-row-highlight
'
:
track
.
trackName
!==
'
Canary
'
&&
track
.
renderCanary
,
};
},
},
};
</
script
>
<
template
>
...
...
@@ -26,6 +33,7 @@ export default {
v-for=
"(series, index) in timeSeries"
:key=
"index"
v-if=
"series.shouldRenderLegend"
:class=
"isStable(series)"
>
<td>
<strong
v-if=
"series.renderCanary"
>
{{
series
.
trackName
}}
</strong>
...
...
@@ -53,7 +61,9 @@ export default {
:track=
"track"
:key=
"`track-line-$
{trackIndex}`"/>
<td
:key=
"`track-info-$
{trackIndex}`">
<track-info
:track=
"track"
/>
<track-info
class=
"legend-metric-title"
:track=
"track"
/>
</td>
</
template
>
</tr>
...
...
app/assets/javascripts/monitoring/components/graph/track_line.vue
View file @
af925ecf
...
...
@@ -7,10 +7,10 @@ export default {
required
:
true
,
},
},
methods
:
{
st
rokeDashArray
(
type
)
{
if
(
t
yp
e
===
'
dashed
'
)
return
'
6, 3
'
;
if
(
t
yp
e
===
'
dotted
'
)
return
'
3, 3
'
;
computed
:
{
st
ylizedLine
(
)
{
if
(
t
his
.
track
.
lineStyl
e
===
'
dashed
'
)
return
'
6, 3
'
;
if
(
t
his
.
track
.
lineStyl
e
===
'
dotted
'
)
return
'
3, 3
'
;
return
null
;
},
},
...
...
@@ -22,7 +22,7 @@ export default {
width=
"15"
height=
"6"
>
<line
:stroke-dasharray=
"st
rokeDashArray(track.lineStyle)
"
:stroke-dasharray=
"st
ylizedLine
"
:stroke=
"track.lineColor"
stroke-width=
"4"
:x1=
"0"
...
...
app/assets/stylesheets/framework/variables.scss
View file @
af925ecf
...
...
@@ -802,3 +802,8 @@ $border-color-settings: #e1e1e1;
Modals
*/
$modal-body-height
:
134px
;
/*
Prometheus
*/
$prometheus-table-row-highlight-color
:
$theme-gray-100
;
app/assets/stylesheets/pages/environments.scss
View file @
af925ecf
...
...
@@ -481,6 +481,11 @@
vertical-align
:
top
;
}
}
.legend-metric-title
{
font-size
:
12px
;
vertical-align
:
middle
;
}
}
.prometheus-svg-container
{
...
...
@@ -570,6 +575,10 @@
}
}
.prometheus-table-row-highlight
{
background-color
:
$prometheus-table-row-highlight-color
;
}
// EE-only
.cluster-health-graphs
{
.prometheus-state
{
...
...
spec/javascripts/monitoring/graph/track_info_spec.js
View file @
af925ecf
...
...
@@ -28,4 +28,17 @@ describe('TrackInfo component', () => {
expect
(
vm
.
summaryMetrics
).
toEqual
(
'
Avg: 0.000 · Max: 0.000
'
);
});
});
describe
(
'
Rendered output
'
,
()
=>
{
beforeEach
(()
=>
{
vm
=
mountComponent
(
Component
,
{
track
:
timeSeries
[
0
]
});
});
it
(
'
contains metric tag and the summary metrics
'
,
()
=>
{
const
metricTag
=
vm
.
$el
.
querySelector
(
'
strong
'
);
expect
(
metricTag
.
textContent
.
trim
()).
toEqual
(
vm
.
track
.
metricTag
);
expect
(
vm
.
$el
.
textContent
).
toContain
(
'
Avg: 0.000 · Max: 0.000
'
);
});
});
});
spec/javascripts/monitoring/graph/track_line_spec.js
View file @
af925ecf
...
...
@@ -20,16 +20,33 @@ describe('TrackLine component', () => {
});
describe
(
'
Computed props
'
,
()
=>
{
beforeEach
(()
=>
{
vm
=
mountComponent
(
Component
,
{
track
:
timeSeries
[
0
]
});
it
(
'
stylizedLine for dashed lineStyles
'
,
()
=>
{
vm
=
mountComponent
(
Component
,
{
track
:
{
...
timeSeries
[
0
],
lineStyle
:
'
dashed
'
}
});
expect
(
vm
.
stylizedLine
).
toEqual
(
'
6, 3
'
);
});
it
(
'
stylizedLine for dotted lineStyles
'
,
()
=>
{
vm
=
mountComponent
(
Component
,
{
track
:
{
...
timeSeries
[
0
],
lineStyle
:
'
dotted
'
}
});
expect
(
vm
.
stylizedLine
).
toEqual
(
'
3, 3
'
);
});
});
describe
(
'
Rendered output
'
,
()
=>
{
it
(
'
has an svg with a line
'
,
()
=>
{
vm
=
mountComponent
(
Component
,
{
track
:
{
...
timeSeries
[
0
]
}
});
const
svgEl
=
vm
.
$el
.
querySelector
(
'
svg
'
);
const
lineEl
=
vm
.
$el
.
querySelector
(
'
svg line
'
);
it
(
'
strokeDashArray
'
,
()
=>
{
const
dashedArray
=
vm
.
strokeDashArray
(
'
dashed
'
);
const
dottedArray
=
vm
.
strokeDashArray
(
'
dotted
'
);
expect
(
svgEl
.
getAttribute
(
'
width
'
)).
toEqual
(
'
15
'
);
expect
(
svgEl
.
getAttribute
(
'
height
'
)).
toEqual
(
'
6
'
);
expect
(
dashedArray
).
toEqual
(
'
6, 3
'
);
expect
(
dottedArray
).
toEqual
(
'
3, 3
'
);
expect
(
lineEl
.
getAttribute
(
'
stroke-width
'
)).
toEqual
(
'
4
'
);
expect
(
lineEl
.
getAttribute
(
'
x1
'
)).
toEqual
(
'
0
'
);
expect
(
lineEl
.
getAttribute
(
'
x2
'
)).
toEqual
(
'
15
'
);
expect
(
lineEl
.
getAttribute
(
'
y1
'
)).
toEqual
(
'
2
'
);
expect
(
lineEl
.
getAttribute
(
'
y2
'
)).
toEqual
(
'
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