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