Commit 7d9a2a7f authored by Coung Ngo's avatar Coung Ngo

Add ability to remove health status

Added the ability to remove the health status
in the issue sidebar
parent d3b5da67
...@@ -168,15 +168,15 @@ requires [GraphQL](../../../api/graphql/index.md) to be enabled. ...@@ -168,15 +168,15 @@ requires [GraphQL](../../../api/graphql/index.md) to be enabled.
### Status **(ULTIMATE)** ### Status **(ULTIMATE)**
> [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/36427) in [GitLab Ultimate](https://about.gitlab.com/pricing/) 12.9. > [Introduced](https://gitlab.com/gitlab-org/gitlab/issues/36427) in [GitLab Ultimate](https://about.gitlab.com/pricing/) 12.10.
To help you track the status of your issues, you can assign a status to each issue to flag work that's progressing as planned or needs attention to keep on schedule: To help you track the status of your issues, you can assign a status to each issue to flag work that's progressing as planned or needs attention to keep on schedule:
- `On track` (green) - **On track** (green)
- `Needs attention` (amber) - **Needs attention** (amber)
- `At risk` (red) - **At risk** (red)
!["On track" health status on an issue](img/issue_health_status_v12_9.png) !["On track" health status on an issue](img/issue_health_status_v12_10.png)
--- ---
......
...@@ -47,6 +47,9 @@ export default { ...@@ -47,6 +47,9 @@ export default {
}; };
}, },
computed: { computed: {
canRemoveStatus() {
return this.isEditable && this.status;
},
statusText() { statusText() {
return this.status ? healthStatusTextMap[this.status] : s__('Sidebar|None'); return this.status ? healthStatusTextMap[this.status] : s__('Sidebar|None');
}, },
...@@ -80,6 +83,9 @@ export default { ...@@ -80,6 +83,9 @@ export default {
toggleFormDropdown() { toggleFormDropdown() {
this.isFormShowing = !this.isFormShowing; this.isFormShowing = !this.isFormShowing;
}, },
removeStatus() {
this.$emit('onFormSubmit', null);
},
}, },
}; };
</script> </script>
...@@ -148,6 +154,12 @@ export default { ...@@ -148,6 +154,12 @@ export default {
:class="statusColor" :class="statusColor"
/> />
{{ statusText }} {{ statusText }}
<template v-if="canRemoveStatus">
<span class="text-secondary" aria-hidden="true">-</span>
<button class="btn-link text-secondary" @click="removeStatus">
{{ __('remove status') }}
</button>
</template>
</p> </p>
</div> </div>
</div> </div>
......
...@@ -12,6 +12,8 @@ const getStatusIconCssClasses = wrapper => wrapper.find('[name="severity-low"]') ...@@ -12,6 +12,8 @@ const getStatusIconCssClasses = wrapper => wrapper.find('[name="severity-low"]')
const getEditButton = wrapper => wrapper.find({ ref: 'editButton' }); const getEditButton = wrapper => wrapper.find({ ref: 'editButton' });
const getRemoveStatusButton = wrapper => wrapper.find('.value .btn-link');
const getEditForm = wrapper => wrapper.find('form'); const getEditForm = wrapper => wrapper.find('form');
const getRadioInputs = wrapper => wrapper.findAll('input[type="radio"]'); const getRadioInputs = wrapper => wrapper.findAll('input[type="radio"]');
...@@ -87,6 +89,43 @@ describe('Status', () => { ...@@ -87,6 +89,43 @@ describe('Status', () => {
}); });
}); });
describe('remove status button', () => {
it('is hidden when there is no status', () => {
const props = {
isEditable: true,
status: '',
};
shallowMountStatus(props);
expect(getRemoveStatusButton(wrapper).exists()).toBe(false);
});
it('is displayed when there is a status', () => {
const props = {
isEditable: true,
status: healthStatus.AT_RISK,
};
shallowMountStatus(props);
expect(getRemoveStatusButton(wrapper).exists()).toBe(true);
});
it('emits an onFormSubmit event with argument null when clicked', () => {
const props = {
isEditable: true,
status: healthStatus.AT_RISK,
};
shallowMountStatus(props);
getRemoveStatusButton(wrapper).trigger('click');
expect(wrapper.emitted().onFormSubmit[0]).toEqual([null]);
});
});
describe('status text', () => { describe('status text', () => {
describe('when no value is provided for status', () => { describe('when no value is provided for status', () => {
beforeEach(() => { beforeEach(() => {
......
...@@ -24701,6 +24701,9 @@ msgstr "" ...@@ -24701,6 +24701,9 @@ msgstr ""
msgid "remove due date" msgid "remove due date"
msgstr "" msgstr ""
msgid "remove status"
msgstr ""
msgid "remove weight" msgid "remove weight"
msgstr "" msgstr ""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment