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
9c1bbbaa
Commit
9c1bbbaa
authored
Sep 30, 2019
by
Laura Montemayor
Committed by
Filipa Lacerda
Sep 30, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allows average and max legend text in time series wrapper to be overwritten by props
parent
d65bca6d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
2 deletions
+36
-2
app/assets/javascripts/monitoring/components/charts/time_series.vue
.../javascripts/monitoring/components/charts/time_series.vue
+13
-2
changelogs/unreleased/internationalization-time-series-wrapper.yml
...s/unreleased/internationalization-time-series-wrapper.yml
+5
-0
locale/gitlab.pot
locale/gitlab.pot
+6
-0
spec/javascripts/monitoring/charts/time_series_spec.js
spec/javascripts/monitoring/charts/time_series_spec.js
+12
-0
No files found.
app/assets/javascripts/monitoring/components/charts/time_series.vue
View file @
9c1bbbaa
<
script
>
import
{
__
}
from
'
~/locale
'
;
import
{
s__
,
__
}
from
'
~/locale
'
;
import
{
GlLink
,
GlButton
}
from
'
@gitlab/ui
'
;
import
{
GlAreaChart
,
GlLineChart
,
GlChartSeriesLabel
}
from
'
@gitlab/ui/dist/charts
'
;
import
dateFormat
from
'
dateformat
'
;
...
...
@@ -52,6 +52,16 @@ export default {
required
:
false
,
default
:
()
=>
[],
},
legendAverageText
:
{
type
:
String
,
required
:
false
,
default
:
s__
(
'
Metrics|Avg
'
),
},
legendMaxText
:
{
type
:
String
,
required
:
false
,
default
:
s__
(
'
Metrics|Max
'
),
},
},
data
()
{
return
{
...
...
@@ -260,7 +270,6 @@ export default {
<slot></slot>
</div>
</div>
<component
:is=
"glChartComponent"
ref=
"chart"
...
...
@@ -271,6 +280,8 @@ export default {
:thresholds=
"thresholds"
:width=
"width"
:height=
"height"
:average-text=
"legendAverageText"
:max-text=
"legendMaxText"
@
updated=
"onChartUpdated"
>
<template
v-if=
"tooltip.isDeployment"
>
...
...
changelogs/unreleased/internationalization-time-series-wrapper.yml
0 → 100644
View file @
9c1bbbaa
---
title
:
Provides internationalization support to chart legends
merge_request
:
16832
author
:
type
:
added
locale/gitlab.pot
View file @
9c1bbbaa
...
...
@@ -9858,6 +9858,9 @@ msgstr ""
msgid "Metrics|Add metric"
msgstr ""
msgid "Metrics|Avg"
msgstr ""
msgid "Metrics|Check out the CI/CD documentation on deploying to an environment"
msgstr ""
...
...
@@ -9888,6 +9891,9 @@ msgstr ""
msgid "Metrics|Legend label (optional)"
msgstr ""
msgid "Metrics|Max"
msgstr ""
msgid "Metrics|Must be a valid PromQL query."
msgstr ""
...
...
spec/javascripts/monitoring/charts/time_series_spec.js
View file @
9c1bbbaa
...
...
@@ -60,6 +60,18 @@ describe('Time series component', () => {
expect
(
timeSeriesChart
.
find
(
'
.js-graph-widgets
'
).
text
()).
toBe
(
mockWidgets
);
});
it
(
'
allows user to override max value label text using prop
'
,
()
=>
{
timeSeriesChart
.
setProps
({
legendMaxText
:
'
legendMaxText
'
});
expect
(
timeSeriesChart
.
props
().
legendMaxText
).
toBe
(
'
legendMaxText
'
);
});
it
(
'
allows user to override average value label text using prop
'
,
()
=>
{
timeSeriesChart
.
setProps
({
legendAverageText
:
'
averageText
'
});
expect
(
timeSeriesChart
.
props
().
legendAverageText
).
toBe
(
'
averageText
'
);
});
describe
(
'
methods
'
,
()
=>
{
describe
(
'
formatTooltipText
'
,
()
=>
{
const
mockDate
=
deploymentData
[
0
].
created_at
;
...
...
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