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
4d959b02
Commit
4d959b02
authored
Jul 13, 2020
by
Andrei Stoicescu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prepend date to timestamps on chart axes
- add date to column charts, area charts and line charts
parent
4ac86d14
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
27 additions
and
15 deletions
+27
-15
app/assets/javascripts/monitoring/components/charts/heatmap.vue
...sets/javascripts/monitoring/components/charts/heatmap.vue
+4
-1
app/assets/javascripts/monitoring/components/charts/options.js
...ssets/javascripts/monitoring/components/charts/options.js
+5
-2
app/assets/javascripts/monitoring/components/charts/stacked_column.vue
...vascripts/monitoring/components/charts/stacked_column.vue
+2
-2
app/assets/javascripts/monitoring/format_date.js
app/assets/javascripts/monitoring/format_date.js
+1
-0
changelogs/unreleased/astoicescu-adaptDateFormatOnTimeSeries.yml
...ogs/unreleased/astoicescu-adaptDateFormatOnTimeSeries.yml
+5
-0
spec/frontend/monitoring/components/charts/column_spec.js
spec/frontend/monitoring/components/charts/column_spec.js
+5
-5
spec/frontend/monitoring/components/charts/time_series_spec.js
...frontend/monitoring/components/charts/time_series_spec.js
+5
-5
No files found.
app/assets/javascripts/monitoring/components/charts/heatmap.vue
View file @
4d959b02
...
...
@@ -48,7 +48,10 @@ export default {
return
this
.
result
.
values
.
map
(
val
=>
{
const
[
yLabel
]
=
val
;
return
formatDate
(
new
Date
(
yLabel
),
{
format
:
formats
.
shortTime
,
timezone
:
this
.
timezone
});
return
formatDate
(
new
Date
(
yLabel
),
{
format
:
formats
.
shortTime
,
timezone
:
this
.
timezone
,
});
});
},
result
()
{
...
...
app/assets/javascripts/monitoring/components/charts/options.js
View file @
4d959b02
...
...
@@ -76,11 +76,14 @@ export const getYAxisOptions = ({
};
};
export
const
getTimeAxisOptions
=
({
timezone
=
timezones
.
LOCAL
}
=
{})
=>
({
export
const
getTimeAxisOptions
=
({
timezone
=
timezones
.
LOCAL
,
format
=
formats
.
shortDateTime
,
}
=
{})
=>
({
name
:
__
(
'
Time
'
),
type
:
axisTypes
.
time
,
axisLabel
:
{
formatter
:
date
=>
formatDate
(
date
,
{
format
:
formats
.
shortTime
,
timezone
}),
formatter
:
date
=>
formatDate
(
date
,
{
format
,
timezone
}),
},
axisPointer
:
{
snap
:
false
,
...
...
app/assets/javascripts/monitoring/components/charts/stacked_column.vue
View file @
4d959b02
...
...
@@ -6,7 +6,7 @@ import { chartHeight, legendLayoutTypes } from '../../constants';
import
{
s__
}
from
'
~/locale
'
;
import
{
graphDataValidatorForValues
}
from
'
../../utils
'
;
import
{
getTimeAxisOptions
,
axisTypes
}
from
'
./options
'
;
import
{
timezones
}
from
'
../../format_date
'
;
import
{
formats
,
timezones
}
from
'
../../format_date
'
;
export
default
{
components
:
{
...
...
@@ -97,7 +97,7 @@ export default {
chartOptions
()
{
return
{
xAxis
:
{
...
getTimeAxisOptions
({
timezone
:
this
.
timezone
}),
...
getTimeAxisOptions
({
timezone
:
this
.
timezone
,
format
:
formats
.
shortTime
}),
type
:
this
.
xAxisType
,
},
dataZoom
:
[
this
.
dataZoomConfig
],
...
...
app/assets/javascripts/monitoring/format_date.js
View file @
4d959b02
...
...
@@ -14,6 +14,7 @@ export const timezones = {
export
const
formats
=
{
shortTime
:
'
h:MM TT
'
,
shortDateTime
:
'
m/d h:MM TT
'
,
default
:
'
dd mmm yyyy, h:MMTT (Z)
'
,
};
...
...
changelogs/unreleased/astoicescu-adaptDateFormatOnTimeSeries.yml
0 → 100644
View file @
4d959b02
---
title
:
Add date to x-axes timestamps
merge_request
:
36675
author
:
type
:
changed
spec/frontend/monitoring/components/charts/column_spec.js
View file @
4d959b02
...
...
@@ -63,8 +63,8 @@ describe('Column component', () => {
return
formatter
(
date
);
};
it
(
'
x-axis is formatted correctly in
AM/PM
format
'
,
()
=>
{
expect
(
useXAxisFormatter
(
mockDate
)).
toEqual
(
'
8:00 PM
'
);
it
(
'
x-axis is formatted correctly in
m/d h:MM TT
format
'
,
()
=>
{
expect
(
useXAxisFormatter
(
mockDate
)).
toEqual
(
'
5/26
8:00 PM
'
);
});
describe
(
'
when in PT timezone
'
,
()
=>
{
...
...
@@ -78,17 +78,17 @@ describe('Column component', () => {
it
(
'
by default, values are formatted in PT
'
,
()
=>
{
createWrapper
();
expect
(
useXAxisFormatter
(
mockDate
)).
toEqual
(
'
1:00 PM
'
);
expect
(
useXAxisFormatter
(
mockDate
)).
toEqual
(
'
5/26
1:00 PM
'
);
});
it
(
'
when the chart uses local timezone, y-axis is formatted in PT
'
,
()
=>
{
createWrapper
({
timezone
:
'
LOCAL
'
});
expect
(
useXAxisFormatter
(
mockDate
)).
toEqual
(
'
1:00 PM
'
);
expect
(
useXAxisFormatter
(
mockDate
)).
toEqual
(
'
5/26
1:00 PM
'
);
});
it
(
'
when the chart uses UTC, y-axis is formatted in UTC
'
,
()
=>
{
createWrapper
({
timezone
:
'
UTC
'
});
expect
(
useXAxisFormatter
(
mockDate
)).
toEqual
(
'
8:00 PM
'
);
expect
(
useXAxisFormatter
(
mockDate
)).
toEqual
(
'
5/26
8:00 PM
'
);
});
});
});
...
...
spec/frontend/monitoring/components/charts/time_series_spec.js
View file @
4d959b02
...
...
@@ -527,8 +527,8 @@ describe('Time series component', () => {
return
formatter
(
date
);
};
it
(
'
x-axis is formatted correctly in
AM/PM
format
'
,
()
=>
{
expect
(
useXAxisFormatter
(
mockDate
)).
toEqual
(
'
8:00 PM
'
);
it
(
'
x-axis is formatted correctly in
m/d h:MM TT
format
'
,
()
=>
{
expect
(
useXAxisFormatter
(
mockDate
)).
toEqual
(
'
5/26
8:00 PM
'
);
});
describe
(
'
when in PT timezone
'
,
()
=>
{
...
...
@@ -542,17 +542,17 @@ describe('Time series component', () => {
it
(
'
by default, values are formatted in PT
'
,
()
=>
{
createWrapper
();
expect
(
useXAxisFormatter
(
mockDate
)).
toEqual
(
'
1:00 PM
'
);
expect
(
useXAxisFormatter
(
mockDate
)).
toEqual
(
'
5/26
1:00 PM
'
);
});
it
(
'
when the chart uses local timezone, y-axis is formatted in PT
'
,
()
=>
{
createWrapper
({
timezone
:
'
LOCAL
'
});
expect
(
useXAxisFormatter
(
mockDate
)).
toEqual
(
'
1:00 PM
'
);
expect
(
useXAxisFormatter
(
mockDate
)).
toEqual
(
'
5/26
1:00 PM
'
);
});
it
(
'
when the chart uses UTC, y-axis is formatted in UTC
'
,
()
=>
{
createWrapper
({
timezone
:
'
UTC
'
});
expect
(
useXAxisFormatter
(
mockDate
)).
toEqual
(
'
8:00 PM
'
);
expect
(
useXAxisFormatter
(
mockDate
)).
toEqual
(
'
5/26
8:00 PM
'
);
});
});
});
...
...
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