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
bce04586
Commit
bce04586
authored
Jan 28, 2022
by
Austin Regnery
Committed by
Martin Wortschack
Jan 28, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update styling of date range indicator
Changelog: changed
parent
3f66aa66
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
48 deletions
+24
-48
app/assets/javascripts/analytics/shared/components/daterange.vue
...ets/javascripts/analytics/shared/components/daterange.vue
+8
-25
locale/gitlab.pot
locale/gitlab.pot
+1
-1
spec/frontend/analytics/shared/components/daterange_spec.js
spec/frontend/analytics/shared/components/daterange_spec.js
+15
-22
No files found.
app/assets/javascripts/analytics/shared/components/daterange.vue
View file @
bce04586
<
script
>
<
script
>
import
{
GlDaterangePicker
,
GlSprintf
,
GlIcon
,
GlTooltipDirective
}
from
'
@gitlab/ui
'
;
import
{
GlDaterangePicker
,
GlSprintf
}
from
'
@gitlab/ui
'
;
import
{
getDayDifference
}
from
'
~/lib/utils/datetime_utility
'
;
import
{
getDayDifference
}
from
'
~/lib/utils/datetime_utility
'
;
import
{
__
,
sprintf
}
from
'
~/locale
'
;
import
{
__
,
sprintf
}
from
'
~/locale
'
;
import
{
OFFSET_DATE_BY_ONE
}
from
'
../constants
'
;
import
{
OFFSET_DATE_BY_ONE
}
from
'
../constants
'
;
...
@@ -8,10 +8,6 @@ export default {
...
@@ -8,10 +8,6 @@ export default {
components
:
{
components
:
{
GlDaterangePicker
,
GlDaterangePicker
,
GlSprintf
,
GlSprintf
,
GlIcon
,
},
directives
:
{
GlTooltip
:
GlTooltipDirective
,
},
},
props
:
{
props
:
{
show
:
{
show
:
{
...
@@ -56,7 +52,7 @@ export default {
...
@@ -56,7 +52,7 @@ export default {
return
{
return
{
maxDateRangeTooltip
:
sprintf
(
maxDateRangeTooltip
:
sprintf
(
__
(
__
(
'
Showing data for workflow items created in this date range. Date range
cannot exceed
%{maxDateRange} days.
'
,
'
Showing data for workflow items created in this date range. Date range
limited to
%{maxDateRange} days.
'
,
),
),
{
{
maxDateRange
:
this
.
maxDateRange
,
maxDateRange
:
this
.
maxDateRange
,
...
@@ -94,28 +90,15 @@ export default {
...
@@ -94,28 +90,15 @@ export default {
:max-date-range=
"maxDateRange"
:max-date-range=
"maxDateRange"
:default-max-date=
"maxDate"
:default-max-date=
"maxDate"
:same-day-selection=
"includeSelectedDate"
:same-day-selection=
"includeSelectedDate"
:tooltip=
"maxDateRangeTooltip"
theme=
"animate-picker"
theme=
"animate-picker"
start-picker-class=
"js-daterange-picker-from gl-display-flex gl-flex-direction-column gl-lg-flex-direction-row gl-lg-align-items-center gl-lg-mr-3 gl-mb-2 gl-lg-mb-0"
start-picker-class=
"js-daterange-picker-from gl-display-flex gl-flex-direction-column gl-lg-flex-direction-row gl-lg-align-items-center gl-lg-mr-3 gl-mb-2 gl-lg-mb-0"
end-picker-class=
"js-daterange-picker-to d-flex flex-column flex-lg-row align-items-lg-center"
end-picker-class=
"js-daterange-picker-to d-flex flex-column flex-lg-row align-items-lg-center
gl-mb-2 gl-lg-mb-0
"
label-class=
"gl-mb-2 gl-lg-mb-0"
label-class=
"gl-mb-2 gl-lg-mb-0"
/>
<div
v-if=
"maxDateRange"
class=
"daterange-indicator d-flex flex-row flex-lg-row align-items-flex-start align-items-lg-center"
>
>
<span
class=
"number-of-days pl-2 pr-1"
>
<gl-sprintf
:message=
"n__('1 day selected', '%d days selected', numberOfDays)"
>
<gl-sprintf
:message=
"n__('1 day selected', '%d days selected', numberOfDays)"
>
<template
#numberOfDays
>
{{
numberOfDays
}}
</
template
>
<template
#numberOfDays
>
{{
numberOfDays
}}
</
template
>
</gl-sprintf>
</gl-sprintf>
</gl-daterange-picker>
</span>
<gl-icon
v-gl-tooltip
data-testid=
"helper-icon"
:title=
"maxDateRangeTooltip"
name=
"question"
:size=
"14"
class=
"text-secondary"
/>
</div>
</div>
</div>
</template>
</template>
locale/gitlab.pot
View file @
bce04586
...
@@ -33106,7 +33106,7 @@ msgstr ""
...
@@ -33106,7 +33106,7 @@ msgstr ""
msgid "Showing data for group '%{group_name}' from Nov 1, 2019 to Dec 31, 2019"
msgid "Showing data for group '%{group_name}' from Nov 1, 2019 to Dec 31, 2019"
msgstr ""
msgstr ""
msgid "Showing data for workflow items created in this date range. Date range
cannot exceed
%{maxDateRange} days."
msgid "Showing data for workflow items created in this date range. Date range
limited to
%{maxDateRange} days."
msgstr ""
msgstr ""
msgid "Showing graphs based on events of the last %{timerange} days."
msgid "Showing graphs based on events of the last %{timerange} days."
...
...
spec/frontend/analytics/shared/components/daterange_spec.js
View file @
bce04586
import
{
GlDaterangePicker
}
from
'
@gitlab/ui
'
;
import
{
GlDaterangePicker
,
GlSprintf
}
from
'
@gitlab/ui
'
;
import
{
mount
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
,
mount
}
from
'
@vue/test-utils
'
;
import
{
nextTick
}
from
'
vue
'
;
import
{
useFakeDate
}
from
'
helpers/fake_date
'
;
import
{
useFakeDate
}
from
'
helpers/fake_date
'
;
import
{
createMockDirective
,
getBinding
}
from
'
helpers/vue_mock_directive
'
;
import
Daterange
from
'
~/analytics/shared/components/daterange.vue
'
;
import
Daterange
from
'
~/analytics/shared/components/daterange.vue
'
;
const
defaultProps
=
{
const
defaultProps
=
{
...
@@ -15,13 +13,13 @@ describe('Daterange component', () => {
...
@@ -15,13 +13,13 @@ describe('Daterange component', () => {
let
wrapper
;
let
wrapper
;
const
factory
=
(
props
=
defaultProps
)
=>
{
const
factory
=
(
props
=
defaultProps
,
mountFn
=
shallowMount
)
=>
{
wrapper
=
mount
(
Daterange
,
{
wrapper
=
mount
Fn
(
Daterange
,
{
propsData
:
{
propsData
:
{
...
defaultProps
,
...
defaultProps
,
...
props
,
...
props
,
},
},
directives
:
{
GlTooltip
:
createMockDirective
()
},
stubs
:
{
GlSprintf
},
});
});
};
};
...
@@ -29,9 +27,8 @@ describe('Daterange component', () => {
...
@@ -29,9 +27,8 @@ describe('Daterange component', () => {
wrapper
.
destroy
();
wrapper
.
destroy
();
});
});
const
findDaterangePicker
=
()
=>
wrapper
.
find
(
GlDaterangePicker
);
const
findDaterangePicker
=
()
=>
wrapper
.
findComponent
(
GlDaterangePicker
);
const
findDateRangeIndicator
=
()
=>
wrapper
.
findComponent
(
GlSprintf
);
const
findDateRangeIndicator
=
()
=>
wrapper
.
find
(
'
.daterange-indicator
'
);
describe
(
'
template
'
,
()
=>
{
describe
(
'
template
'
,
()
=>
{
describe
(
'
when show is false
'
,
()
=>
{
describe
(
'
when show is false
'
,
()
=>
{
...
@@ -44,6 +41,7 @@ describe('Daterange component', () => {
...
@@ -44,6 +41,7 @@ describe('Daterange component', () => {
describe
(
'
when show is true
'
,
()
=>
{
describe
(
'
when show is true
'
,
()
=>
{
it
(
'
renders the daterange picker
'
,
()
=>
{
it
(
'
renders the daterange picker
'
,
()
=>
{
factory
({
show
:
true
});
factory
({
show
:
true
});
expect
(
findDaterangePicker
().
exists
()).
toBe
(
true
);
expect
(
findDaterangePicker
().
exists
()).
toBe
(
true
);
});
});
});
});
...
@@ -54,14 +52,12 @@ describe('Daterange component', () => {
...
@@ -54,14 +52,12 @@ describe('Daterange component', () => {
const
endDate
=
new
Date
(
'
2019-09-30
'
);
const
endDate
=
new
Date
(
'
2019-09-30
'
);
const
minDate
=
new
Date
(
'
2019-06-01
'
);
const
minDate
=
new
Date
(
'
2019-06-01
'
);
factory
({
show
:
true
,
startDate
,
endDate
,
minDate
});
factory
({
show
:
true
,
startDate
,
endDate
,
minDate
},
mount
);
const
input
=
findDaterangePicker
().
find
(
'
input
'
);
const
input
=
findDaterangePicker
().
find
(
'
input
'
);
input
.
setValue
(
'
2019-01-01
'
);
input
.
setValue
(
'
2019-01-01
'
);
input
.
trigger
(
'
change
'
);
await
input
.
trigger
(
'
change
'
);
await
nextTick
();
expect
(
wrapper
.
emitted
().
change
).
toEqual
([[{
startDate
:
minDate
,
endDate
}]]);
expect
(
wrapper
.
emitted
().
change
).
toEqual
([[{
startDate
:
minDate
,
endDate
}]]);
});
});
});
});
...
@@ -76,16 +72,13 @@ describe('Daterange component', () => {
...
@@ -76,16 +72,13 @@ describe('Daterange component', () => {
});
});
it
(
'
displays the correct number of selected days in the indicator
'
,
()
=>
{
it
(
'
displays the correct number of selected days in the indicator
'
,
()
=>
{
expect
(
findDateRangeIndicator
().
find
(
'
span
'
).
text
()).
toBe
(
'
10 days selected
'
);
expect
(
findDateRangeIndicator
().
text
()).
toMatchInterpolatedText
(
'
10 days selected
'
);
});
});
it
(
'
displays a tooltip
'
,
()
=>
{
it
(
'
sets the tooltip
'
,
()
=>
{
const
icon
=
wrapper
.
find
(
'
[data-testid="helper-icon"]
'
);
const
tooltip
=
findDaterangePicker
().
props
(
'
tooltip
'
);
const
tooltip
=
getBinding
(
icon
.
element
,
'
gl-tooltip
'
);
expect
(
tooltip
).
toBe
(
'
Showing data for workflow items created in this date range. Date range limited to 30 days.
'
,
expect
(
tooltip
).
toBeDefined
();
expect
(
icon
.
attributes
(
'
title
'
)).
toBe
(
'
Showing data for workflow items created in this date range. Date range cannot exceed 30 days.
'
,
);
);
});
});
});
});
...
...
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