Commit b6623731 authored by Coung Ngo's avatar Coung Ngo

Move and rename IssuableType constant

- Move constant from `~/vue_shared/issuable/show/constants`
  as it's not used in `~/vue_shared/issuable/show`
- Move constant to `~/issues/constants` as it's related
  to issues
- Rename to `IssueType` as incidents and test cases are
  issue types
parent 82253cc6
......@@ -19,6 +19,12 @@ export const IssuableType = {
Alert: 'alert',
};
export const IssueType = {
Issue: 'issue',
Incident: 'incident',
TestCase: 'test_case',
};
export const WorkspaceType = {
project: 'project',
group: 'group',
......
......@@ -6,6 +6,7 @@ import ShortcutsNavigation from '~/behaviors/shortcuts/shortcuts_navigation';
import GLForm from '~/gl_form';
import { initIssuableHeaderWarnings, initIssuableSidebar } from '~/issuable';
import IssuableTemplateSelectors from '~/issuable/issuable_template_selectors';
import { IssueType } from '~/issues/constants';
import Issue from '~/issues/issue';
import { initTitleSuggestions, initTypePopover } from '~/issues/new';
import { initRelatedMergeRequests } from '~/issues/related_merge_requests';
......@@ -20,7 +21,6 @@ import LabelsSelect from '~/labels/labels_select';
import MilestoneSelect from '~/milestones/milestone_select';
import initNotesApp from '~/notes';
import { store } from '~/notes/stores';
import { IssuableType } from '~/vue_shared/issuable/show/constants';
import ZenMode from '~/zen_mode';
import FilteredSearchServiceDesk from './filtered_search_service_desk';
......@@ -55,9 +55,9 @@ export function initShow() {
const { issueType, ...issuableData } = parseIssuableData(el);
if (issueType === IssuableType.Incident) {
if (issueType === IssueType.Incident) {
initIncidentApp(issuableData);
initHeaderActions(store, IssuableType.Incident);
initHeaderActions(store, IssueType.Incident);
} else {
initIssueApp(issuableData, store);
initHeaderActions(store);
......
......@@ -11,8 +11,7 @@ import {
import { mapActions, mapGetters, mapState } from 'vuex';
import createFlash, { FLASH_TYPES } from '~/flash';
import { EVENT_ISSUABLE_VUE_APP_CHANGE } from '~/issuable/constants';
import { IssuableType } from '~/vue_shared/issuable/show/constants';
import { IssuableStatus } from '~/issues/constants';
import { IssuableStatus, IssueType } from '~/issues/constants';
import { ISSUE_STATE_EVENT_CLOSE, ISSUE_STATE_EVENT_REOPEN } from '~/issues/show/constants';
import { capitalizeFirstCharacter } from '~/lib/utils/text_utility';
import { visitUrl } from '~/lib/utils/url_utility';
......@@ -83,7 +82,7 @@ export default {
default: '',
},
issueType: {
default: IssuableType.Issue,
default: IssueType.Issue,
},
newIssuePath: {
default: '',
......@@ -106,8 +105,8 @@ export default {
},
issueTypeText() {
const issueTypeTexts = {
[IssuableType.Issue]: s__('HeaderAction|issue'),
[IssuableType.Incident]: s__('HeaderAction|incident'),
[IssueType.Issue]: s__('HeaderAction|issue'),
[IssueType.Incident]: s__('HeaderAction|incident'),
};
return issueTypeTexts[this.issueType] ?? this.issueType;
......
export const IssuableType = {
Issue: 'issue',
Incident: 'incident',
TestCase: 'test_case',
};
......@@ -4,10 +4,9 @@ import { shallowMount } from '@vue/test-utils';
import Vuex from 'vuex';
import { mockTracking } from 'helpers/tracking_helper';
import createFlash, { FLASH_TYPES } from '~/flash';
import { IssuableType } from '~/vue_shared/issuable/show/constants';
import { IssuableStatus, IssueType } from '~/issues/constants';
import DeleteIssueModal from '~/issues/show/components/delete_issue_modal.vue';
import HeaderActions from '~/issues/show/components/header_actions.vue';
import { IssuableStatus } from '~/issues/constants';
import { ISSUE_STATE_EVENT_CLOSE, ISSUE_STATE_EVENT_REOPEN } from '~/issues/show/constants';
import promoteToEpicMutation from '~/issues/show/queries/promote_to_epic.mutation.graphql';
import * as urlUtility from '~/lib/utils/url_utility';
......@@ -36,7 +35,7 @@ describe('HeaderActions component', () => {
iid: '32',
isIssueAuthor: true,
issuePath: 'gitlab-org/gitlab-test/-/issues/1',
issueType: IssuableType.Issue,
issueType: IssueType.Issue,
newIssuePath: 'gitlab-org/gitlab-test/-/issues/new',
projectPath: 'gitlab-org/gitlab-test',
reportAbusePath:
......@@ -112,8 +111,8 @@ describe('HeaderActions component', () => {
describe.each`
issueType
${IssuableType.Issue}
${IssuableType.Incident}
${IssueType.Issue}
${IssueType.Incident}
`('when issue type is $issueType', ({ issueType }) => {
describe('close/reopen button', () => {
describe.each`
......
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