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) => {
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
import Note from 'ee/external_issues_show/components/note.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 { IssuableStatus, IssuableStatusText } from '~/issue_show/constants';
import createFlash from '~/flash';
import IssuableShow from '~/issuable_show/components/issuable_show_root.vue';
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
import { s__ } from '~/locale';
......@@ -34,11 +33,8 @@ export default {
data() {
return {
isLoading: true,
isLoadingStatus: false,
isUpdatingStatus: false,
errorMessage: null,
issue: {},
statuses: [],
};
},
computed: {
......@@ -77,41 +73,6 @@ export default {
jiraIssueCommentId(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>
......@@ -137,11 +98,6 @@ export default {
<jira-issue-sidebar
:sidebar-expanded="sidebarExpanded"
:issue="issue"
:is-loading-status="isLoadingStatus"
:is-updating-status="isUpdatingStatus"
:statuses="statuses"
@issue-status-fetch="onIssueStatusFetch"
@issue-status-updated="onIssueStatusUpdated"
@sidebar-toggle="toggleSidebar"
/>
</template>
......
......@@ -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 { 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 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 {
name: 'JiraIssuesSidebar',
......@@ -18,7 +17,6 @@ export default {
CopyableField,
LabelsSelect,
},
mixins: [glFeatureFlagsMixin()],
inject: {
issuesListPath: {
default: null,
......@@ -33,21 +31,6 @@ export default {
type: Object,
required: true,
},
isLoadingStatus: {
type: Boolean,
required: false,
default: false,
},
isUpdatingStatus: {
type: Boolean,
required: false,
default: false,
},
statuses: {
type: Array,
required: false,
default: () => [],
},
},
computed: {
assignee() {
......@@ -57,47 +40,20 @@ export default {
reference() {
return this.issue.references?.relative;
},
canUpdateStatus() {
return this.glFeatures.jiraIssueDetailsEditStatus;
},
},
labelsFilterParam,
i18n: {
statusTitle: __('Status'),
statusDropdownEmpty: s__('JiraService|No available statuses'),
statusDropdownTitle: __('Change status'),
referenceName: __('Reference'),
avatarSubLabel: __('Jira user'),
},
mounted() {
this.sidebarEl = document.querySelector('aside.right-sidebar');
},
methods: {
toggleSidebar() {
this.$emit('sidebar-toggle');
},
afterSidebarTransitioned(callback) {
// Wait for sidebar expand animation to complete
this.sidebarEl.addEventListener('transitionend', callback, { once: true });
},
expandSidebarAndOpenDropdown(dropdownRef = null) {
expandSidebar() {
// Expand the sidebar if not already expanded.
if (!this.sidebarExpanded) {
this.toggleSidebar();
}
if (dropdownRef) {
this.afterSidebarTransitioned(() => {
dropdownRef.expand();
});
this.$emit('sidebar-toggle');
}
},
onIssueStatusFetch() {
this.$emit('issue-status-fetch');
},
onIssueStatusUpdated(status) {
this.$emit('issue-status-updated', status);
},
},
};
</script>
......@@ -108,17 +64,9 @@ export default {
<issue-due-date :due-date="issue.dueDate" />
<issue-field
icon="progress"
:can-edit-field="canUpdateStatus"
:dropdown-title="$options.i18n.statusDropdownTitle"
:dropdown-empty="$options.i18n.statusDropdownEmpty"
:items="statuses"
:loading="isLoadingStatus"
:title="$options.i18n.statusTitle"
:updating="isUpdatingStatus"
:value="issue.status"
@expand-sidebar="expandSidebarAndOpenDropdown"
@issue-field-fetch="onIssueStatusFetch"
@issue-field-updated="onIssueStatusUpdated"
@expand-sidebar="expandSidebar"
/>
<labels-select
:allow-scoped-labels="true"
......@@ -127,7 +75,7 @@ export default {
:labels-filter-param="$options.labelsFilterParam"
variant="sidebar"
class="block labels js-labels-block"
@toggleCollapse="expandSidebarAndOpenDropdown"
@toggleCollapse="expandSidebar"
>
{{ __('None') }}
</labels-select>
......
......@@ -13,9 +13,6 @@ module Projects
name: 'i_ecosystem_jira_service_list_issues'
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
......
......@@ -2,7 +2,6 @@ import { GlAlert, GlLoadingIcon } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
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 JiraIssueSidebar from 'ee/integrations/jira/issues_show/components/sidebar/jira_issues_sidebar_root.vue';
import { IssuableStatus } from '~/issue_show/constants';
......@@ -120,38 +119,6 @@ describe('JiraIssuesShow', () => {
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 () => {
const jiraIssueSidebar = findJiraIssueSidebar();
expect(jiraIssueSidebar.props('sidebarExpanded')).toBe(true);
......
......@@ -41,5 +41,3 @@ export const mockJiraIssueComment = {
},
id: 10000,
};
export const mockJiraIssueStatuses = [{ title: 'In Progress' }, { title: 'Done' }];
......@@ -19616,15 +19616,9 @@ msgstr ""
msgid "JiraService|Events for %{noteable_model_name} are disabled."
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."
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"
msgstr ""
......@@ -19673,9 +19667,6 @@ msgstr ""
msgid "JiraService|Move to Done"
msgstr ""
msgid "JiraService|No available statuses"
msgstr ""
msgid "JiraService|Open Jira"
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