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
d1513896
Commit
d1513896
authored
Jan 21, 2021
by
Taurie Davis
Committed by
Brandon Labuschagne
Jan 29, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate health status dropdown to use gitlab ui
Updates FE by using constant and reference from $options
parent
3cce9517
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
79 additions
and
115 deletions
+79
-115
ee/app/assets/javascripts/sidebar/components/status/health_status_dropdown.vue
...ipts/sidebar/components/status/health_status_dropdown.vue
+34
-64
ee/app/assets/javascripts/sidebar/components/status/status.vue
...p/assets/javascripts/sidebar/components/status/status.vue
+26
-41
ee/app/assets/javascripts/sidebar/constants.js
ee/app/assets/javascripts/sidebar/constants.js
+8
-1
ee/changelogs/unreleased/233598-health-status-sidebar-dropdown.yml
...logs/unreleased/233598-health-status-sidebar-dropdown.yml
+5
-0
ee/spec/features/issues/bulk_assignment_health_status_spec.rb
...pec/features/issues/bulk_assignment_health_status_spec.rb
+1
-1
ee/spec/frontend/sidebar/components/status/status_spec.js
ee/spec/frontend/sidebar/components/status/status_spec.js
+5
-5
locale/gitlab.pot
locale/gitlab.pot
+0
-3
No files found.
ee/app/assets/javascripts/sidebar/components/status/health_status_dropdown.vue
View file @
d1513896
<
script
>
<
script
>
import
{
import
{
GlDropdownItem
,
GlDropdown
,
GlDropdownDivider
}
from
'
@gitlab/ui
'
;
GlButton
,
import
{
healthStatusTextMap
,
I18N_DROPDOWN
}
from
'
../../constants
'
;
GlDeprecatedDropdownItem
,
GlDeprecatedDropdown
,
GlDeprecatedDropdownDivider
,
}
from
'
@gitlab/ui
'
;
import
{
s__
}
from
'
~/locale
'
;
import
{
healthStatusTextMap
}
from
'
../../constants
'
;
export
default
{
export
default
{
components
:
{
components
:
{
GlButton
,
GlDropdown
,
GlDeprecatedDropdown
,
GlDropdownItem
,
GlDeprecatedDropdownItem
,
GlDropdownDivider
,
GlDeprecatedDropdownDivider
,
},
},
props
:
{
props
:
{
isEditable
:
{
isEditable
:
{
...
@@ -44,23 +37,16 @@ export default {
...
@@ -44,23 +37,16 @@ export default {
},
},
computed
:
{
computed
:
{
statusText
()
{
statusText
()
{
return
this
.
status
?
healthStatusTextMap
[
this
.
status
]
:
s__
(
'
Sidebar|None
'
)
;
return
this
.
status
?
healthStatusTextMap
[
this
.
status
]
:
this
.
$options
.
i18n
.
noneText
;
},
},
dropdownText
()
{
dropdownText
()
{
if
(
this
.
status
===
null
)
{
if
(
this
.
status
===
null
)
{
return
s__
(
'
No status
'
)
;
return
this
.
$options
.
i18n
.
noStatusText
;
}
}
return
this
.
status
?
healthStatusTextMap
[
this
.
status
]
:
s__
(
'
Select health status
'
);
return
this
.
status
},
?
healthStatusTextMap
[
this
.
status
]
tooltipText
()
{
:
this
.
$options
.
i18n
.
selectPlaceholderText
;
let
tooltipText
=
s__
(
'
Sidebar|Health status
'
);
if
(
this
.
status
)
{
tooltipText
+=
`:
${
this
.
statusText
}
`
;
}
return
tooltipText
;
},
},
},
},
watch
:
{
watch
:
{
...
@@ -81,56 +67,40 @@ export default {
...
@@ -81,56 +67,40 @@ export default {
return
this
.
status
===
status
;
return
this
.
status
===
status
;
},
},
},
},
i18n
:
I18N_DROPDOWN
,
};
};
</
script
>
</
script
>
<
template
>
<
template
>
<div
class=
"dropdown
dropdown-menu-selectable
"
>
<div
class=
"dropdown"
>
<gl-d
eprecated-d
ropdown
<gl-dropdown
ref=
"dropdown"
ref=
"dropdown"
class=
"w-100"
class=
"gl-w-full"
:header-text=
"$options.i18n.dropdownHeaderText"
:text=
"dropdownText"
:text=
"dropdownText"
@
keydown.esc.native=
"hideDropdown"
@
keydown.esc.native=
"hideDropdown"
@
hide=
"hideDropdown"
@
hide=
"hideDropdown"
>
>
<div
class=
"dropdown-title gl-display-flex"
>
<gl-dropdown-item
<span
class=
"health-title gl-ml-auto"
>
{{
s__
(
'
Sidebar|Assign health status
'
)
}}
</span>
:is-check-item=
"true"
<gl-button
:is-checked=
"isSelected(null)"
:aria-label=
"__('Close')"
@
click=
"handleDropdownClick(null)"
variant=
"link"
class=
"dropdown-title-button dropdown-menu-close gl-ml-auto gl-text-gray-200!"
icon=
"close"
@
click=
"hideDropdown"
/>
</div>
<div
class=
"dropdown-content dropdown-body"
>
<gl-deprecated-dropdown-item
@
click=
"handleDropdownClick(null)"
>
<gl-button
variant=
"link"
class=
"dropdown-item health-dropdown-item"
:class=
"
{ 'is-active': isSelected(null) }"
>
>
{{
s__
(
'
Sidebar|No status
'
)
}}
{{
$options
.
i18n
.
noStatusText
}}
</gl-button>
</gl-dropdown-item>
</gl-deprecated-dropdown-item>
<gl-deprecated-dropdown-divider
class=
"divider health-divider"
/>
<gl-dropdown-divider
/>
<gl-deprecated
-dropdown-item
<gl
-dropdown-item
v-for=
"option in statusOptions"
v-for=
"option in statusOptions"
:key=
"option.key"
:key=
"option.key"
:is-check-item=
"true"
:is-checked=
"isSelected(option.key)"
data-testid=
"health-status-dropdown-item"
@
click=
"handleDropdownClick(option.key)"
@
click=
"handleDropdownClick(option.key)"
>
<gl-button
variant=
"link"
class=
"dropdown-item health-dropdown-item"
:class=
"
{ 'is-active': isSelected(option.key) }"
>
>
{{
option
.
value
}}
{{
option
.
value
}}
</gl-button>
</gl-dropdown-item>
</gl-deprecated-dropdown-item>
</gl-dropdown>
</div>
</gl-deprecated-dropdown>
</div>
</div>
</
template
>
</
template
>
ee/app/assets/javascripts/sidebar/components/status/status.vue
View file @
d1513896
...
@@ -10,7 +10,7 @@ import {
...
@@ -10,7 +10,7 @@ import {
}
from
'
@gitlab/ui
'
;
}
from
'
@gitlab/ui
'
;
import
Tracking
from
'
~/tracking
'
;
import
Tracking
from
'
~/tracking
'
;
import
{
s__
}
from
'
~/locale
'
;
import
{
s__
}
from
'
~/locale
'
;
import
{
healthStatusTextMap
}
from
'
../../constants
'
;
import
{
healthStatusTextMap
,
I18N_DROPDOWN
}
from
'
../../constants
'
;
export
default
{
export
default
{
directives
:
{
directives
:
{
...
@@ -62,10 +62,12 @@ export default {
...
@@ -62,10 +62,12 @@ export default {
return
this
.
isEditable
&&
this
.
status
;
return
this
.
isEditable
&&
this
.
status
;
},
},
statusText
()
{
statusText
()
{
return
this
.
status
?
healthStatusTextMap
[
this
.
status
]
:
s__
(
'
Sidebar|None
'
)
;
return
this
.
status
?
healthStatusTextMap
[
this
.
status
]
:
this
.
$options
.
i18n
.
noneText
;
},
},
dropdownText
()
{
dropdownText
()
{
return
this
.
status
?
healthStatusTextMap
[
this
.
status
]
:
s__
(
'
Select health status
'
);
return
this
.
status
?
healthStatusTextMap
[
this
.
status
]
:
this
.
$options
.
i18n
.
selectPlaceholderText
;
},
},
statusTooltip
()
{
statusTooltip
()
{
let
tooltipText
=
s__
(
'
Sidebar|Health status
'
);
let
tooltipText
=
s__
(
'
Sidebar|Health status
'
);
...
@@ -137,6 +139,7 @@ export default {
...
@@ -137,6 +139,7 @@ export default {
}
}
},
},
},
},
i18n
:
I18N_DROPDOWN
,
};
};
</
script
>
</
script
>
...
@@ -173,61 +176,43 @@ export default {
...
@@ -173,61 +176,43 @@ export default {
<div
<div
data-testid=
"dropdownWrapper"
data-testid=
"dropdownWrapper"
class=
"dropdown
dropdown-menu-selectable
"
class=
"dropdown"
:class=
"
{ show: isDropdownShowing, 'gl-display-none': !isDropdownShowing }"
:class=
"
{ show: isDropdownShowing, 'gl-display-none': !isDropdownShowing }"
>
>
<gl-dropdown
<gl-dropdown
ref=
"dropdown"
ref=
"dropdown"
class=
"gl-w-full"
class=
"gl-w-full"
:header-text=
"$options.i18n.dropdownHeaderText"
:text=
"dropdownText"
:text=
"dropdownText"
@
keydown.esc.native=
"hideDropdown"
@
keydown.esc.native=
"hideDropdown"
@
hide=
"hideDropdown"
@
hide=
"hideDropdown"
>
>
<div
class=
"dropdown-title gl-display-flex"
>
<gl-dropdown-item
<span
class=
"health-title gl-ml-auto"
>
{{
s__
(
'
Sidebar|Assign health status
'
)
}}
</span>
:is-check-item=
"true"
<gl-button
:is-checked=
"isSelected(null)"
:aria-label=
"__('Close')"
@
click=
"handleDropdownClick(null)"
variant=
"link"
class=
"dropdown-title-button dropdown-menu-close gl-ml-auto gl-text-gray-200!"
icon=
"close"
@
click=
"hideDropdown"
/>
</div>
<div
class=
"dropdown-content dropdown-body"
>
<gl-dropdown-item
@
click=
"handleDropdownClick(null)"
>
<gl-button
variant=
"link"
class=
"dropdown-item health-dropdown-item gl-px-8!"
:class=
"
{ 'is-active': isSelected(null) }"
>
>
{{
s__
(
'
Sidebar|No status
'
)
}}
{{
$options
.
i18n
.
noStatusText
}}
</gl-button>
</gl-dropdown-item>
</gl-dropdown-item>
<gl-dropdown-divider
class=
"divider health-divider"
/>
<gl-dropdown-divider
/>
<gl-dropdown-item
<gl-dropdown-item
v-for=
"option in statusOptions"
v-for=
"option in statusOptions"
:key=
"option.key"
:key=
"option.key"
:is-check-item=
"true"
:is-checked=
"isSelected(option.key)"
@
click=
"handleDropdownClick(option.key)"
@
click=
"handleDropdownClick(option.key)"
>
<gl-button
variant=
"link"
class=
"dropdown-item health-dropdown-item gl-px-8!"
:class=
"
{ 'is-active': isSelected(option.key) }"
>
>
{{
option
.
value
}}
{{
option
.
value
}}
</gl-button>
</gl-dropdown-item>
</gl-dropdown-item>
</div>
</gl-dropdown>
</gl-dropdown>
</div>
</div>
<gl-loading-icon
v-if=
"isFetching"
:inline=
"true"
/>
<gl-loading-icon
v-if=
"isFetching"
:inline=
"true"
/>
<p
v-else-if=
"!isDropdownShowing"
class=
"value gl-m-0"
:class=
"
{ 'no-value': !status }">
<p
v-else-if=
"!isDropdownShowing"
class=
"value gl-m-0"
:class=
"
{ 'no-value': !status }">
<span
v-if=
"status"
class=
"text-plain gl-font-weight-bold"
>
{{
statusText
}}
</span>
<span
v-if=
"status"
class=
"text-plain gl-font-weight-bold"
>
{{
statusText
}}
</span>
<span
v-else
>
{{
__
(
'
None
'
)
}}
</span>
<span
v-else
>
{{
$options
.
i18n
.
noneText
}}
</span>
</p>
</p>
</div>
</div>
</div>
</div>
...
...
ee/app/assets/javascripts/sidebar/constants.js
View file @
d1513896
import
{
__
}
from
'
~/locale
'
;
import
{
s__
,
__
}
from
'
~/locale
'
;
export
const
healthStatus
=
{
export
const
healthStatus
=
{
ON_TRACK
:
'
onTrack
'
,
ON_TRACK
:
'
onTrack
'
,
...
@@ -29,3 +29,10 @@ export const healthStatusForRestApi = {
...
@@ -29,3 +29,10 @@ export const healthStatusForRestApi = {
};
};
export
const
MAX_DISPLAY_WEIGHT
=
99999
;
export
const
MAX_DISPLAY_WEIGHT
=
99999
;
export
const
I18N_DROPDOWN
=
{
dropdownHeaderText
:
s__
(
'
Sidebar|Assign health status
'
),
noStatusText
:
s__
(
'
Sidebar|No status
'
),
noneText
:
s__
(
'
Sidebar|None
'
),
selectPlaceholderText
:
s__
(
'
Select health status
'
),
};
ee/changelogs/unreleased/233598-health-status-sidebar-dropdown.yml
0 → 100644
View file @
d1513896
---
title
:
Migrate health status dropdown to use gitlab ui
merge_request
:
52273
author
:
type
:
changed
ee/spec/features/issues/bulk_assignment_health_status_spec.rb
View file @
d1513896
...
@@ -113,7 +113,7 @@ RSpec.describe 'Issues > Health status bulk assignment' do
...
@@ -113,7 +113,7 @@ RSpec.describe 'Issues > Health status bulk assignment' do
page
.
within
(
'.issues-bulk-update'
)
do
page
.
within
(
'.issues-bulk-update'
)
do
click_button
'Select health status'
click_button
'Select health status'
items
.
map
do
|
item
|
items
.
map
do
|
item
|
find
(
'
.gl-button-text
'
,
text:
item
).
click
find
(
'
[data-testid="health-status-dropdown-item"]
'
,
text:
item
).
click
end
end
end
end
end
end
...
...
ee/spec/frontend/sidebar/components/status/status_spec.js
View file @
d1513896
import
{
GlDropdown
,
GlDropdownItem
,
GlLoadingIcon
}
from
'
@gitlab/ui
'
;
import
{
GlDropdown
,
GlDropdownItem
,
GlLoadingIcon
}
from
'
@gitlab/ui
'
;
import
{
mount
,
shallowMount
}
from
'
@vue/test-utils
'
;
import
{
mount
,
shallowMount
}
from
'
@vue/test-utils
'
;
import
Status
from
'
ee/sidebar/components/status/status.vue
'
;
import
Status
from
'
ee/sidebar/components/status/status.vue
'
;
import
{
healthStatus
,
healthStatusTextMap
}
from
'
ee/sidebar/constants
'
;
import
{
healthStatus
,
healthStatusTextMap
,
I18N_DROPDOWN
}
from
'
ee/sidebar/constants
'
;
import
{
createMockDirective
,
getBinding
}
from
'
helpers/vue_mock_directive
'
;
import
{
createMockDirective
,
getBinding
}
from
'
helpers/vue_mock_directive
'
;
const
getStatusText
=
(
wrapper
)
=>
wrapper
.
find
(
'
.value .text-plain
'
).
text
();
const
getStatusText
=
(
wrapper
)
=>
wrapper
.
find
(
'
.value .text-plain
'
).
text
();
...
@@ -182,7 +182,7 @@ describe('Status', () => {
...
@@ -182,7 +182,7 @@ describe('Status', () => {
});
});
it
(
'
shows "None"
'
,
()
=>
{
it
(
'
shows "None"
'
,
()
=>
{
expect
(
wrapper
.
find
(
'
.no-value
'
).
text
()).
toBe
(
'
None
'
);
expect
(
wrapper
.
find
(
'
.no-value
'
).
text
()).
toBe
(
I18N_DROPDOWN
.
noneText
);
});
});
it
(
'
shows "Status" in the tooltip
'
,
()
=>
{
it
(
'
shows "Status" in the tooltip
'
,
()
=>
{
...
@@ -258,9 +258,9 @@ describe('Status', () => {
...
@@ -258,9 +258,9 @@ describe('Status', () => {
});
});
it
(
'
shows text to ask the user to pick an option
'
,
()
=>
{
it
(
'
shows text to ask the user to pick an option
'
,
()
=>
{
const
message
=
'
Assign health status
'
;
expect
(
getDropdownElement
(
wrapper
).
props
(
'
headerText
'
)).
toBe
(
I18N_DROPDOWN
.
dropdownHeaderText
,
expect
(
getDropdownElement
(
wrapper
).
find
(
'
.health-title
'
).
text
()).
toContain
(
message
);
);
});
});
it
(
'
hides form when the `edit` button is clicked
'
,
async
()
=>
{
it
(
'
hides form when the `edit` button is clicked
'
,
async
()
=>
{
...
...
locale/gitlab.pot
View file @
d1513896
...
@@ -19516,9 +19516,6 @@ msgstr ""
...
@@ -19516,9 +19516,6 @@ msgstr ""
msgid "No start date"
msgid "No start date"
msgstr ""
msgstr ""
msgid "No status"
msgstr ""
msgid "No template"
msgid "No template"
msgstr ""
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