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
3b4d3e34
Commit
3b4d3e34
authored
Mar 27, 2018
by
Jose Ivan Vargas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
formatting fixes
parent
bbe8eb2d
Changes
2
Show 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 @
3b4d3e34
...
@@ -23,26 +23,15 @@ export default {
...
@@ -23,26 +23,15 @@ export default {
methods
:
{
methods
:
{
formatMetricUsage
(
series
)
{
formatMetricUsage
(
series
)
{
const
value
=
const
value
=
series
.
values
[
this
.
currentDataIndex
]
&&
series
.
values
[
this
.
currentDataIndex
]
&&
series
.
values
[
this
.
currentDataIndex
].
value
;
series
.
values
[
this
.
currentDataIndex
].
value
;
if
(
isNaN
(
value
))
{
if
(
isNaN
(
value
))
{
return
'
-
'
;
return
'
-
'
;
}
}
return
`
${
formatRelevantDigits
(
value
)}
${
this
.
unitOfDisplay
}
`
;
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
)
{
summaryMetrics
(
series
)
{
return
`Avg:
${
formatRelevantDigits
(
series
.
average
)}
${
this
.
unitOfDisplay
}
,
return
`Avg:
${
formatRelevantDigits
(
series
.
average
)}
· Max:
${
formatRelevantDigits
(
series
.
max
)}
`
;
Max:
${
formatRelevantDigits
(
series
.
max
)}
${
this
.
unitOfDisplay
}
`
;
},
},
strokeDashArray
(
type
)
{
strokeDashArray
(
type
)
{
...
@@ -80,10 +69,18 @@ export default {
...
@@ -80,10 +69,18 @@ export default {
class=
"legend-metric-title"
class=
"legend-metric-title"
v-if=
"timeSeries.length > 1"
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>
<td
v-else
>
<td
v-else
>
{{
legendTitle
}}
{{
formatMetricUsage
(
series
)
}}
,
{{
summaryMetrics
(
series
)
}}
<strong>
{{ legendTitle }}
</strong>
{{ formatMetricUsage(series) }} {{ summaryMetrics(series) }}
</td>
</td>
</tr>
</tr>
</table>
</table>
...
...
spec/javascripts/monitoring/graph/legend_spec.js
View file @
3b4d3e34
...
@@ -2,14 +2,9 @@ import Vue from 'vue';
...
@@ -2,14 +2,9 @@ import Vue from 'vue';
import
GraphLegend
from
'
~/monitoring/components/graph/legend.vue
'
;
import
GraphLegend
from
'
~/monitoring/components/graph/legend.vue
'
;
import
createTimeSeries
from
'
~/monitoring/utils/multiple_time_series
'
;
import
createTimeSeries
from
'
~/monitoring/utils/multiple_time_series
'
;
import
mountComponent
from
'
spec/helpers/vue_mount_component_helper
'
;
import
mountComponent
from
'
spec/helpers/vue_mount_component_helper
'
;
import
{
import
{
singleRowMetricsMultipleSeries
,
convertDatesMultipleSeries
}
from
'
../mock_data
'
;
singleRowMetricsMultipleSeries
,
convertDatesMultipleSeries
,
}
from
'
../mock_data
'
;
const
convertedMetrics
=
convertDatesMultipleSeries
(
const
convertedMetrics
=
convertDatesMultipleSeries
(
singleRowMetricsMultipleSeries
);
singleRowMetricsMultipleSeries
,
);
const
defaultValuesComponent
=
{};
const
defaultValuesComponent
=
{};
...
@@ -77,9 +72,7 @@ describe('Legend Component', () => {
...
@@ -77,9 +72,7 @@ describe('Legend Component', () => {
});
});
it
(
'
should container the same number of rows in the table as time series
'
,
()
=>
{
it
(
'
should container the same number of rows in the table as time series
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelectorAll
(
'
.prometheus-table tr
'
).
length
).
toEqual
(
expect
(
vm
.
$el
.
querySelectorAll
(
'
.prometheus-table tr
'
).
length
).
toEqual
(
vm
.
timeSeries
.
length
);
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