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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
f4ff62fa
Commit
f4ff62fa
authored
Mar 27, 2018
by
Jose Ivan Vargas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
formatting fixes
parent
657fea86
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
25 deletions
+15
-25
app/assets/javascripts/monitoring/components/graph/legend.vue
...assets/javascripts/monitoring/components/graph/legend.vue
+12
-15
spec/javascripts/monitoring/graph/legend_spec.js
spec/javascripts/monitoring/graph/legend_spec.js
+3
-10
No files found.
app/assets/javascripts/monitoring/components/graph/legend.vue
View file @
f4ff62fa
...
...
@@ -23,26 +23,15 @@ export default {
methods
:
{
formatMetricUsage
(
series
)
{
const
value
=
series
.
values
[
this
.
currentDataIndex
]
&&
series
.
values
[
this
.
currentDataIndex
].
value
;
series
.
values
[
this
.
currentDataIndex
]
&&
series
.
values
[
this
.
currentDataIndex
].
value
;
if
(
isNaN
(
value
))
{
return
'
-
'
;
}
return
`
${
formatRelevantDigits
(
value
)}
${
this
.
unitOfDisplay
}
`
;
},
createSeriesString
(
index
,
series
)
{
if
(
series
.
metricTag
)
{
return
`
${
series
.
metricTag
}
${
this
.
formatMetricUsage
(
series
)}
`
;
}
return
`
${
this
.
legendTitle
}
series
${
index
+
1
}
${
this
.
formatMetricUsage
(
series
,
)}
`
;
},
summaryMetrics
(
series
)
{
return
`Avg:
${
formatRelevantDigits
(
series
.
average
)}
${
this
.
unitOfDisplay
}
,
Max:
${
formatRelevantDigits
(
series
.
max
)}
${
this
.
unitOfDisplay
}
`
;
return
`Avg:
${
formatRelevantDigits
(
series
.
average
)}
· Max:
${
formatRelevantDigits
(
series
.
max
)}
`
;
},
strokeDashArray
(
type
)
{
...
...
@@ -80,10 +69,18 @@ export default {
class=
"legend-metric-title"
v-if=
"timeSeries.length > 1"
>
{{
createSeriesString
(
index
,
series
)
}}
,
{{
summaryMetrics
(
series
)
}}
<template
v-if=
"series.metricTag"
>
<strong>
{{
series
.
metricTag
}}
</strong>
{{
formatMetricUsage
(
series
)
}}
{{
summaryMetrics
(
series
)
}}
</
template
>
<
template
v-else
>
<strong>
{{
legendTitle
}}
</strong>
series
{{
index
+
1
}}
{{
formatMetricUsage
(
series
)
}}
{{
summaryMetrics
(
series
)
}}
</
template
>
</td>
<td
v-else
>
{{
legendTitle
}}
{{
formatMetricUsage
(
series
)
}}
,
{{
summaryMetrics
(
series
)
}}
<strong>
{{ legendTitle }}
</strong>
{{ formatMetricUsage(series) }} {{ summaryMetrics(series) }}
</td>
</tr>
</table>
...
...
spec/javascripts/monitoring/graph/legend_spec.js
View file @
f4ff62fa
...
...
@@ -2,14 +2,9 @@ import Vue from 'vue';
import
GraphLegend
from
'
~/monitoring/components/graph/legend.vue
'
;
import
createTimeSeries
from
'
~/monitoring/utils/multiple_time_series
'
;
import
mountComponent
from
'
spec/helpers/vue_mount_component_helper
'
;
import
{
singleRowMetricsMultipleSeries
,
convertDatesMultipleSeries
,
}
from
'
../mock_data
'
;
import
{
singleRowMetricsMultipleSeries
,
convertDatesMultipleSeries
}
from
'
../mock_data
'
;
const
convertedMetrics
=
convertDatesMultipleSeries
(
singleRowMetricsMultipleSeries
,
);
const
convertedMetrics
=
convertDatesMultipleSeries
(
singleRowMetricsMultipleSeries
);
const
defaultValuesComponent
=
{};
...
...
@@ -77,9 +72,7 @@ describe('Legend Component', () => {
});
it
(
'
should container the same number of rows in the table as time series
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelectorAll
(
'
.prometheus-table tr
'
).
length
).
toEqual
(
vm
.
timeSeries
.
length
,
);
expect
(
vm
.
$el
.
querySelectorAll
(
'
.prometheus-table tr
'
).
length
).
toEqual
(
vm
.
timeSeries
.
length
);
});
});
});
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