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
5e1148e4
Commit
5e1148e4
authored
Nov 25, 2019
by
Brandon Labuschagne
Committed by
Mike Greiling
Nov 25, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Default cycle analytics duration chart stage filter to all items selected
parent
4dff571a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
56 deletions
+61
-56
ee/app/assets/javascripts/analytics/cycle_analytics/components/stage_dropdown_filter.vue
...tics/cycle_analytics/components/stage_dropdown_filter.vue
+21
-17
ee/spec/frontend/analytics/cycle_analytics/components/stage_dropdown_filter_spec.js
.../cycle_analytics/components/stage_dropdown_filter_spec.js
+35
-35
locale/gitlab.pot
locale/gitlab.pot
+5
-4
No files found.
ee/app/assets/javascripts/analytics/cycle_analytics/components/stage_dropdown_filter.vue
View file @
5e1148e4
<
script
>
import
{
sprintf
,
s__
,
n__
}
from
'
~/locale
'
;
import
{
sprintf
,
s__
}
from
'
~/locale
'
;
import
$
from
'
jquery
'
;
import
_
from
'
underscore
'
;
import
Icon
from
'
~/vue_shared/components/icon.vue
'
;
import
{
GlButton
}
from
'
@gitlab/ui
'
;
import
{
capitalizeFirstCharacter
}
from
'
~/lib/utils/text_utility
'
;
export
default
{
name
:
'
StageDropdownFilter
'
,
...
...
@@ -25,21 +24,26 @@ export default {
},
data
()
{
return
{
selectedStages
:
[]
,
selectedStages
:
this
.
stages
,
};
},
computed
:
{
selectedStagesLabel
()
{
return
this
.
selectedStages
.
length
?
sprintf
(
n__
(
'
CycleAnalytics|%{stageName}
'
,
'
CycleAnalytics|%d stages selected
'
,
this
.
selectedStages
.
length
,
),
{
stageName
:
capitalizeFirstCharacter
(
this
.
selectedStages
[
0
].
name
)
},
)
:
s__
(
'
CycleAnalytics|All stages
'
);
const
{
stages
,
selectedStages
}
=
this
;
if
(
selectedStages
.
length
===
stages
.
length
)
{
return
s__
(
'
CycleAnalytics|All stages
'
);
}
if
(
selectedStages
.
length
>
1
)
{
return
sprintf
(
s__
(
'
CycleAnalytics|%{stageCount} stages selected
'
),
{
stageCount
:
selectedStages
.
length
,
});
}
if
(
selectedStages
.
length
===
1
)
{
return
selectedStages
[
0
].
title
;
}
return
s__
(
'
CycleAnalytics|No stages selected
'
);
},
},
mounted
()
{
...
...
@@ -49,14 +53,14 @@ export default {
clicked
:
this
.
onClick
.
bind
(
this
),
data
:
this
.
formatData
.
bind
(
this
),
renderRow
:
group
=>
this
.
rowTemplate
(
group
),
text
:
stage
=>
stage
.
nam
e
,
text
:
stage
=>
stage
.
titl
e
,
});
},
methods
:
{
setSelectedStages
(
selectedObj
,
isMarking
)
{
this
.
selectedStages
=
isMarking
?
this
.
selectedStages
.
concat
([
selectedObj
])
:
this
.
selectedStages
.
filter
(
stage
=>
stage
.
name
!==
selectedObj
.
nam
e
);
:
this
.
selectedStages
.
filter
(
stage
=>
stage
.
title
!==
selectedObj
.
titl
e
);
},
onClick
({
selectedObj
,
e
,
isMarking
})
{
e
.
preventDefault
();
...
...
@@ -69,8 +73,8 @@ export default {
rowTemplate
(
stage
)
{
return
`
<li>
<a href='#' class='dropdown-menu-link'>
${
_
.
escape
(
capitalizeFirstCharacter
(
stage
.
name
)
)}
<a href='#' class='dropdown-menu-link
is-active
'>
${
_
.
escape
(
stage
.
title
)}
</a>
</li>
`
;
...
...
ee/spec/frontend/analytics/cycle_analytics/components/stage_dropdown_filter_spec.js
View file @
5e1148e4
...
...
@@ -10,13 +10,13 @@ jest.mock('~/api', () => ({
const
stages
=
[
{
name
:
'
i
ssue
'
,
title
:
'
I
ssue
'
,
},
{
name
:
'
p
lan
'
,
title
:
'
P
lan
'
,
},
{
name
:
'
c
ode
'
,
title
:
'
C
ode
'
,
},
];
...
...
@@ -34,10 +34,11 @@ describe('StageDropdownFilter component', () => {
afterEach
(()
=>
{
wrapper
.
destroy
();
wrapper
=
null
;
});
beforeEach
(()
=>
{
createComponent
(
{
multiSelect
:
false
}
);
createComponent
();
});
const
findDropdown
=
()
=>
wrapper
.
find
(
'
.dropdown
'
);
...
...
@@ -55,43 +56,42 @@ describe('StageDropdownFilter component', () => {
return
wrapper
.
vm
.
$nextTick
();
});
it
(
'
should add to selection when new stage is clicked
'
,
()
=>
{
findDropdownItems
()
.
at
(
0
)
.
trigger
(
'
click
'
);
describe
(
'
clicking a selected stage
'
,
()
=>
{
it
(
'
should remove from selection
'
,
()
=>
{
const
item
=
findDropdownItems
().
at
(
0
);
findDropdownItems
()
.
at
(
1
)
.
trigger
(
'
click
'
);
item
.
trigger
(
'
click
'
);
expect
(
wrapper
.
emittedByOrder
()).
toEqual
([
{
name
:
'
selected
'
,
args
:
[[
stages
[
0
]]],
},
{
name
:
'
selected
'
,
args
:
[[
stages
[
0
],
stages
[
1
]]],
args
:
[[
stages
[
1
],
stages
[
2
]]],
},
]);
});
});
it
(
'
should remove from selection when clicked again
'
,
()
=>
{
const
item
=
findDropdownItems
().
at
(
0
);
describe
(
'
clicking a deselected stage
'
,
()
=>
{
it
(
'
should add to selection
'
,
()
=>
{
findDropdownItems
()
.
at
(
0
)
.
trigger
(
'
click
'
);
item
.
trigger
(
'
click
'
);
item
.
trigger
(
'
click
'
);
findDropdownItems
()
.
at
(
0
)
.
trigger
(
'
click
'
);
expect
(
wrapper
.
emittedByOrder
()).
toEqual
([
{
name
:
'
selected
'
,
args
:
[[
stages
[
0
]]],
args
:
[[
stages
[
1
],
stages
[
2
]]],
},
{
name
:
'
selected
'
,
args
:
[[
]],
args
:
[[
stages
[
1
],
stages
[
2
],
stages
[
0
]
]],
},
]);
});
});
});
});
locale/gitlab.pot
View file @
5e1148e4
...
...
@@ -5257,14 +5257,15 @@ msgid_plural "CycleAnalytics|%d projects selected"
msgstr[0] ""
msgstr[1] ""
msgid "CycleAnalytics|%{stageName}"
msgid_plural "CycleAnalytics|%d stages selected"
msgstr[0] ""
msgstr[1] ""
msgid "CycleAnalytics|%{stageCount} stages selected"
msgstr ""
msgid "CycleAnalytics|All stages"
msgstr ""
msgid "CycleAnalytics|No stages selected"
msgstr ""
msgid "CycleAnalytics|Stages"
msgstr ""
...
...
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