Commit 48f6165f authored by Justin Ho Tuan Duong's avatar Justin Ho Tuan Duong Committed by Natalia Tepluhina

Remove editing of status on the Jira issue details page

parent 98c1df08
---
name: jira_issue_details_edit_status
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/60092
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/330628
milestone: '14.1'
type: development
group: group::integrations
default_enabled: false
...@@ -5,33 +5,3 @@ export const fetchIssue = async (issuePath) => { ...@@ -5,33 +5,3 @@ export const fetchIssue = async (issuePath) => {
return data; return data;
}); });
}; };
export const fetchIssueStatuses = () => {
// We are using mock data here which should come from the backend
return new Promise((resolve) => {
setTimeout(() => {
// eslint-disable-next-line @gitlab/require-i18n-strings
resolve([{ title: 'In Progress' }, { title: 'Done' }]);
}, 1000);
});
};
export const updateIssue = (issue, { labels = [], status = undefined }) => {
// We are using mock call here which should become a backend call
return new Promise((resolve) => {
setTimeout(() => {
const addedLabels = labels.filter((label) => label.set);
const removedLabelsIds = labels.filter((label) => !label.set).map((label) => label.id);
const finalLabels = [...issue.labels, ...addedLabels].filter(
(label) => !removedLabelsIds.includes(label.id),
);
resolve({
...issue,
...(status ? { status } : {}),
labels: finalLabels,
});
}, 1000);
});
};
...@@ -3,11 +3,10 @@ import { GlAlert, GlBadge, GlLoadingIcon, GlTooltipDirective as GlTooltip } from ...@@ -3,11 +3,10 @@ import { GlAlert, GlBadge, GlLoadingIcon, GlTooltipDirective as GlTooltip } from
import Note from 'ee/external_issues_show/components/note.vue'; import Note from 'ee/external_issues_show/components/note.vue';
import ExternalIssueAlert from 'ee/external_issues_show/components/external_issue_alert.vue'; import ExternalIssueAlert from 'ee/external_issues_show/components/external_issue_alert.vue';
import { fetchIssue, fetchIssueStatuses, updateIssue } from 'ee/integrations/jira/issues_show/api'; import { fetchIssue } from 'ee/integrations/jira/issues_show/api';
import JiraIssueSidebar from 'ee/integrations/jira/issues_show/components/sidebar/jira_issues_sidebar_root.vue'; import JiraIssueSidebar from 'ee/integrations/jira/issues_show/components/sidebar/jira_issues_sidebar_root.vue';
import { IssuableStatus, IssuableStatusText } from '~/issue_show/constants'; import { IssuableStatus, IssuableStatusText } from '~/issue_show/constants';
import createFlash from '~/flash';
import IssuableShow from '~/issuable_show/components/issuable_show_root.vue'; import IssuableShow from '~/issuable_show/components/issuable_show_root.vue';
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
import { s__ } from '~/locale'; import { s__ } from '~/locale';
...@@ -34,11 +33,8 @@ export default { ...@@ -34,11 +33,8 @@ export default {
data() { data() {
return { return {
isLoading: true, isLoading: true,
isLoadingStatus: false,
isUpdatingStatus: false,
errorMessage: null, errorMessage: null,
issue: {}, issue: {},
statuses: [],
}; };
}, },
computed: { computed: {
...@@ -77,41 +73,6 @@ export default { ...@@ -77,41 +73,6 @@ export default {
jiraIssueCommentId(id) { jiraIssueCommentId(id) {
return `jira_note_${id}`; return `jira_note_${id}`;
}, },
onIssueStatusFetch() {
this.isLoadingStatus = true;
fetchIssueStatuses()
.then((response) => {
this.statuses = response;
})
.catch(() => {
createFlash({
message: s__(
'JiraService|Failed to load Jira issue statuses. View the issue in Jira, or reload the page.',
),
});
})
.finally(() => {
this.isLoadingStatus = false;
});
},
onIssueStatusUpdated(status) {
this.isUpdatingStatus = true;
updateIssue(this.issue, { status })
.then((response) => {
this.issue.status = response.status;
})
.catch(() => {
createFlash({
message: s__(
'JiraService|Failed to update Jira issue status. View the issue in Jira, or reload the page.',
),
});
})
.finally(() => {
this.isUpdatingStatus = false;
});
},
}, },
}; };
</script> </script>
...@@ -137,11 +98,6 @@ export default { ...@@ -137,11 +98,6 @@ export default {
<jira-issue-sidebar <jira-issue-sidebar
:sidebar-expanded="sidebarExpanded" :sidebar-expanded="sidebarExpanded"
:issue="issue" :issue="issue"
:is-loading-status="isLoadingStatus"
:is-updating-status="isUpdatingStatus"
:statuses="statuses"
@issue-status-fetch="onIssueStatusFetch"
@issue-status-updated="onIssueStatusUpdated"
@sidebar-toggle="toggleSidebar" @sidebar-toggle="toggleSidebar"
/> />
</template> </template>
......
...@@ -4,10 +4,9 @@ import IssueDueDate from 'ee/external_issues_show/components/sidebar/issue_due_d ...@@ -4,10 +4,9 @@ import IssueDueDate from 'ee/external_issues_show/components/sidebar/issue_due_d
import IssueField from 'ee/external_issues_show/components/sidebar/issue_field.vue'; import IssueField from 'ee/external_issues_show/components/sidebar/issue_field.vue';
import { labelsFilterParam } from 'ee/external_issues_show/constants'; import { labelsFilterParam } from 'ee/external_issues_show/constants';
import { __, s__ } from '~/locale'; import { __ } from '~/locale';
import CopyableField from '~/vue_shared/components/sidebar/copyable_field.vue'; import CopyableField from '~/vue_shared/components/sidebar/copyable_field.vue';
import LabelsSelect from '~/vue_shared/components/sidebar/labels_select_vue/labels_select_root.vue'; import LabelsSelect from '~/vue_shared/components/sidebar/labels_select_vue/labels_select_root.vue';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
export default { export default {
name: 'JiraIssuesSidebar', name: 'JiraIssuesSidebar',
...@@ -18,7 +17,6 @@ export default { ...@@ -18,7 +17,6 @@ export default {
CopyableField, CopyableField,
LabelsSelect, LabelsSelect,
}, },
mixins: [glFeatureFlagsMixin()],
inject: { inject: {
issuesListPath: { issuesListPath: {
default: null, default: null,
...@@ -33,21 +31,6 @@ export default { ...@@ -33,21 +31,6 @@ export default {
type: Object, type: Object,
required: true, required: true,
}, },
isLoadingStatus: {
type: Boolean,
required: false,
default: false,
},
isUpdatingStatus: {
type: Boolean,
required: false,
default: false,
},
statuses: {
type: Array,
required: false,
default: () => [],
},
}, },
computed: { computed: {
assignee() { assignee() {
...@@ -57,47 +40,20 @@ export default { ...@@ -57,47 +40,20 @@ export default {
reference() { reference() {
return this.issue.references?.relative; return this.issue.references?.relative;
}, },
canUpdateStatus() {
return this.glFeatures.jiraIssueDetailsEditStatus;
},
}, },
labelsFilterParam, labelsFilterParam,
i18n: { i18n: {
statusTitle: __('Status'), statusTitle: __('Status'),
statusDropdownEmpty: s__('JiraService|No available statuses'),
statusDropdownTitle: __('Change status'),
referenceName: __('Reference'), referenceName: __('Reference'),
avatarSubLabel: __('Jira user'), avatarSubLabel: __('Jira user'),
}, },
mounted() {
this.sidebarEl = document.querySelector('aside.right-sidebar');
},
methods: { methods: {
toggleSidebar() { expandSidebar() {
this.$emit('sidebar-toggle');
},
afterSidebarTransitioned(callback) {
// Wait for sidebar expand animation to complete
this.sidebarEl.addEventListener('transitionend', callback, { once: true });
},
expandSidebarAndOpenDropdown(dropdownRef = null) {
// Expand the sidebar if not already expanded. // Expand the sidebar if not already expanded.
if (!this.sidebarExpanded) { if (!this.sidebarExpanded) {
this.toggleSidebar(); this.$emit('sidebar-toggle');
}
if (dropdownRef) {
this.afterSidebarTransitioned(() => {
dropdownRef.expand();
});
} }
}, },
onIssueStatusFetch() {
this.$emit('issue-status-fetch');
},
onIssueStatusUpdated(status) {
this.$emit('issue-status-updated', status);
},
}, },
}; };
</script> </script>
...@@ -108,17 +64,9 @@ export default { ...@@ -108,17 +64,9 @@ export default {
<issue-due-date :due-date="issue.dueDate" /> <issue-due-date :due-date="issue.dueDate" />
<issue-field <issue-field
icon="progress" icon="progress"
:can-edit-field="canUpdateStatus"
:dropdown-title="$options.i18n.statusDropdownTitle"
:dropdown-empty="$options.i18n.statusDropdownEmpty"
:items="statuses"
:loading="isLoadingStatus"
:title="$options.i18n.statusTitle" :title="$options.i18n.statusTitle"
:updating="isUpdatingStatus"
:value="issue.status" :value="issue.status"
@expand-sidebar="expandSidebarAndOpenDropdown" @expand-sidebar="expandSidebar"
@issue-field-fetch="onIssueStatusFetch"
@issue-field-updated="onIssueStatusUpdated"
/> />
<labels-select <labels-select
:allow-scoped-labels="true" :allow-scoped-labels="true"
...@@ -127,7 +75,7 @@ export default { ...@@ -127,7 +75,7 @@ export default {
:labels-filter-param="$options.labelsFilterParam" :labels-filter-param="$options.labelsFilterParam"
variant="sidebar" variant="sidebar"
class="block labels js-labels-block" class="block labels js-labels-block"
@toggleCollapse="expandSidebarAndOpenDropdown" @toggleCollapse="expandSidebar"
> >
{{ __('None') }} {{ __('None') }}
</labels-select> </labels-select>
......
...@@ -13,9 +13,6 @@ module Projects ...@@ -13,9 +13,6 @@ module Projects
name: 'i_ecosystem_jira_service_list_issues' name: 'i_ecosystem_jira_service_list_issues'
before_action :check_feature_enabled! before_action :check_feature_enabled!
before_action only: :show do
push_frontend_feature_flag(:jira_issue_details_edit_status, project, default_enabled: :yaml)
end
rescue_from ::Projects::Integrations::Jira::IssuesFinder::Error, with: :render_error rescue_from ::Projects::Integrations::Jira::IssuesFinder::Error, with: :render_error
......
...@@ -2,7 +2,6 @@ import { GlAlert, GlLoadingIcon } from '@gitlab/ui'; ...@@ -2,7 +2,6 @@ import { GlAlert, GlLoadingIcon } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import MockAdapter from 'axios-mock-adapter'; import MockAdapter from 'axios-mock-adapter';
import * as JiraIssuesShowApi from 'ee/integrations/jira/issues_show/api';
import JiraIssuesShow from 'ee/integrations/jira/issues_show/components/jira_issues_show_root.vue'; import JiraIssuesShow from 'ee/integrations/jira/issues_show/components/jira_issues_show_root.vue';
import JiraIssueSidebar from 'ee/integrations/jira/issues_show/components/sidebar/jira_issues_sidebar_root.vue'; import JiraIssueSidebar from 'ee/integrations/jira/issues_show/components/sidebar/jira_issues_sidebar_root.vue';
import { IssuableStatus } from '~/issue_show/constants'; import { IssuableStatus } from '~/issue_show/constants';
...@@ -120,38 +119,6 @@ describe('JiraIssuesShow', () => { ...@@ -120,38 +119,6 @@ describe('JiraIssuesShow', () => {
await waitForPromises(); await waitForPromises();
}); });
it('fetches issue statuses on issue-status-fetch', async () => {
const fetchIssueStatusesSpy = jest
.spyOn(JiraIssuesShowApi, 'fetchIssueStatuses')
.mockResolvedValue();
findJiraIssueSidebar().vm.$emit('issue-status-fetch');
await wrapper.vm.$nextTick();
expect(fetchIssueStatusesSpy).toHaveBeenCalled();
expect(findJiraIssueSidebar().props('isLoadingStatus')).toBe(true);
await waitForPromises();
expect(findJiraIssueSidebar().props('isLoadingStatus')).toBe(false);
});
it('updates issue status on issue-status-updated', async () => {
const updateIssueSpy = jest.spyOn(JiraIssuesShowApi, 'updateIssue').mockResolvedValue();
const status = 'In Review';
findJiraIssueSidebar().vm.$emit('issue-status-updated', status);
await wrapper.vm.$nextTick();
expect(updateIssueSpy).toHaveBeenCalledWith(expect.any(Object), { status });
expect(findJiraIssueSidebar().props('isUpdatingStatus')).toBe(true);
await waitForPromises();
expect(findJiraIssueSidebar().props('isUpdatingStatus')).toBe(false);
});
it('updates `sidebarExpanded` prop on `sidebar-toggle` event', async () => { it('updates `sidebarExpanded` prop on `sidebar-toggle` event', async () => {
const jiraIssueSidebar = findJiraIssueSidebar(); const jiraIssueSidebar = findJiraIssueSidebar();
expect(jiraIssueSidebar.props('sidebarExpanded')).toBe(true); expect(jiraIssueSidebar.props('sidebarExpanded')).toBe(true);
......
...@@ -41,5 +41,3 @@ export const mockJiraIssueComment = { ...@@ -41,5 +41,3 @@ export const mockJiraIssueComment = {
}, },
id: 10000, id: 10000,
}; };
export const mockJiraIssueStatuses = [{ title: 'In Progress' }, { title: 'Done' }];
...@@ -19616,15 +19616,9 @@ msgstr "" ...@@ -19616,15 +19616,9 @@ msgstr ""
msgid "JiraService|Events for %{noteable_model_name} are disabled." msgid "JiraService|Events for %{noteable_model_name} are disabled."
msgstr "" msgstr ""
msgid "JiraService|Failed to load Jira issue statuses. View the issue in Jira, or reload the page."
msgstr ""
msgid "JiraService|Failed to load Jira issue. View the issue in Jira, or reload the page." msgid "JiraService|Failed to load Jira issue. View the issue in Jira, or reload the page."
msgstr "" msgstr ""
msgid "JiraService|Failed to update Jira issue status. View the issue in Jira, or reload the page."
msgstr ""
msgid "JiraService|Fetch issue types for this Jira project" msgid "JiraService|Fetch issue types for this Jira project"
msgstr "" msgstr ""
...@@ -19673,9 +19667,6 @@ msgstr "" ...@@ -19673,9 +19667,6 @@ msgstr ""
msgid "JiraService|Move to Done" msgid "JiraService|Move to Done"
msgstr "" msgstr ""
msgid "JiraService|No available statuses"
msgstr ""
msgid "JiraService|Open Jira" msgid "JiraService|Open Jira"
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