diff --git a/app/assets/javascripts/issues/show/components/description.vue b/app/assets/javascripts/issues/show/components/description.vue index 369aa69473937b43f2a21f4d6b4ad1f633a2a13b..a0bc76537faabf433eea518eeb02ad4821115968 100644 --- a/app/assets/javascripts/issues/show/components/description.vue +++ b/app/assets/javascripts/issues/show/components/description.vue @@ -20,7 +20,7 @@ import { sprintfWorkItem, I18N_WORK_ITEM_ERROR_CREATING, I18N_WORK_ITEM_ERROR_DELETING, - TASK_TYPE_NAME, + WORK_ITEM_TYPE_VALUE_TASK, } from '~/work_items/constants'; import { renderGFM } from '~/behaviors/markdown/render_gfm'; import eventHub from '../event_hub'; @@ -129,7 +129,7 @@ export default { }, computed: { taskWorkItemTypeId() { - return this.workItemTypes.find((type) => type.name === TASK_TYPE_NAME)?.id; + return this.workItemTypes.find((type) => type.name === WORK_ITEM_TYPE_VALUE_TASK)?.id; }, issueGid() { return this.issueId ? convertToGraphQLId(TYPENAME_WORK_ITEM, this.issueId) : null; diff --git a/app/assets/javascripts/work_items/components/notes/work_item_comment_form.vue b/app/assets/javascripts/work_items/components/notes/work_item_comment_form.vue index 9ede327b2f13b5713df15cd41ce46f7c34b957b3..480549452ad77861602558c15ca24952c8fd5fcb 100644 --- a/app/assets/javascripts/work_items/components/notes/work_item_comment_form.vue +++ b/app/assets/javascripts/work_items/components/notes/work_item_comment_form.vue @@ -4,7 +4,11 @@ import { helpPagePath } from '~/helpers/help_page_helper'; import { s__, __ } from '~/locale'; import Tracking from '~/tracking'; import { capitalizeFirstCharacter } from '~/lib/utils/text_utility'; -import { STATE_OPEN, TRACKING_CATEGORY_SHOW, TASK_TYPE_NAME } from '~/work_items/constants'; +import { + STATE_OPEN, + TRACKING_CATEGORY_SHOW, + WORK_ITEM_TYPE_VALUE_TASK, +} from '~/work_items/constants'; import { getDraft, clearDraft, updateDraft } from '~/lib/utils/autosave'; import { confirmAction } from '~/lib/utils/confirm_via_gl_modal/confirm_via_gl_modal'; import MarkdownEditor from '~/vue_shared/components/markdown/markdown_editor.vue'; @@ -127,10 +131,12 @@ export default { return this.isNoteInternal ? this.$options.i18n.addInternalNote : this.commentButtonText; }, workItemDocPath() { - return this.workItemType === TASK_TYPE_NAME ? 'user/tasks.html' : 'user/okrs.html'; + return this.workItemType === WORK_ITEM_TYPE_VALUE_TASK ? 'user/tasks.html' : 'user/okrs.html'; }, workItemDocAnchor() { - return this.workItemType === TASK_TYPE_NAME ? 'confidential-tasks' : 'confidential-okrs'; + return this.workItemType === WORK_ITEM_TYPE_VALUE_TASK + ? 'confidential-tasks' + : 'confidential-okrs'; }, getWorkItemData() { return { diff --git a/app/assets/javascripts/work_items/components/notes/work_item_comment_locked.vue b/app/assets/javascripts/work_items/components/notes/work_item_comment_locked.vue index c1b6903cf17f0ea7004f3bda399bfb601fd784ae..31330204b7e503f27d66b477341ed27159a3513e 100644 --- a/app/assets/javascripts/work_items/components/notes/work_item_comment_locked.vue +++ b/app/assets/javascripts/work_items/components/notes/work_item_comment_locked.vue @@ -2,7 +2,7 @@ import { GlLink, GlIcon } from '@gitlab/ui'; import { __, sprintf } from '~/locale'; import { helpPagePath } from '~/helpers/help_page_helper'; -import { TASK_TYPE_NAME } from '~/work_items/constants'; +import { WORK_ITEM_TYPE_VALUE_TASK } from '~/work_items/constants'; export default { components: { @@ -13,7 +13,7 @@ export default { workItemType: { required: false, type: String, - default: TASK_TYPE_NAME, + default: WORK_ITEM_TYPE_VALUE_TASK, }, isProjectArchived: { required: false, diff --git a/app/assets/javascripts/work_items/components/shared/work_item_link_child_contents.vue b/app/assets/javascripts/work_items/components/shared/work_item_link_child_contents.vue index 78afb9a04efd6104d4d041fe2e68bc143c2beae2..7ea2b7ff86ad5b40e62cd93f6a0777b05b7eb142 100644 --- a/app/assets/javascripts/work_items/components/shared/work_item_link_child_contents.vue +++ b/app/assets/javascripts/work_items/components/shared/work_item_link_child_contents.vue @@ -6,7 +6,6 @@ import RichTimestampTooltip from '~/vue_shared/components/rich_timestamp_tooltip import WorkItemLinkChildMetadata from 'ee_else_ce/work_items/components/shared/work_item_link_child_metadata.vue'; import { STATE_OPEN, - TASK_TYPE_NAME, WIDGET_TYPE_PROGRESS, WIDGET_TYPE_HIERARCHY, WIDGET_TYPE_HEALTH_STATUS, @@ -14,6 +13,7 @@ import { WIDGET_TYPE_ASSIGNEES, WIDGET_TYPE_LABELS, WORK_ITEM_NAME_TO_ICON_MAP, + WORK_ITEM_TYPE_VALUE_TASK, } from '../../constants'; export default { @@ -79,7 +79,7 @@ export default { return this.childItem.state === STATE_OPEN; }, iconName() { - if (this.childItemType === TASK_TYPE_NAME && !this.showTaskIcon) { + if (this.childItemType === WORK_ITEM_TYPE_VALUE_TASK && !this.showTaskIcon) { return this.isChildItemOpen ? 'issue-open-m' : 'issue-close'; } return WORK_ITEM_NAME_TO_ICON_MAP[this.childItemType]; @@ -88,7 +88,7 @@ export default { return this.childItem.workItemType.name; }, iconClass() { - if (this.childItemType === TASK_TYPE_NAME && !this.showTaskIcon) { + if (this.childItemType === WORK_ITEM_TYPE_VALUE_TASK && !this.showTaskIcon) { return this.isChildItemOpen ? 'gl-text-green-500' : 'gl-text-blue-500'; } return ''; diff --git a/app/assets/javascripts/work_items/components/work_item_links/work_item_link_child.vue b/app/assets/javascripts/work_items/components/work_item_links/work_item_link_child.vue index f43718c4cb85f02775f89a6fe4923add3b23ee12..1de737765e24dfc8a68ae9fe081768089b3ee1e1 100644 --- a/app/assets/javascripts/work_items/components/work_item_links/work_item_link_child.vue +++ b/app/assets/javascripts/work_items/components/work_item_links/work_item_link_child.vue @@ -8,10 +8,10 @@ import { createAlert } from '~/alert'; import updateWorkItemMutation from '../../graphql/update_work_item.mutation.graphql'; import { STATE_OPEN, - TASK_TYPE_NAME, - WORK_ITEM_TYPE_VALUE_OBJECTIVE, WIDGET_TYPE_HIERARCHY, WORK_ITEM_NAME_TO_ICON_MAP, + WORK_ITEM_TYPE_VALUE_OBJECTIVE, + WORK_ITEM_TYPE_VALUE_TASK, } from '../../constants'; import getWorkItemTreeQuery from '../../graphql/work_item_tree.query.graphql'; import WorkItemLinkChildContents from '../shared/work_item_link_child_contents.vue'; @@ -76,13 +76,13 @@ export default { return this.childItem.workItemType.name; }, iconName() { - if (this.childItemType === TASK_TYPE_NAME) { + if (this.childItemType === WORK_ITEM_TYPE_VALUE_TASK) { return this.isItemOpen ? 'issue-open-m' : 'issue-close'; } return WORK_ITEM_NAME_TO_ICON_MAP[this.childItemType]; }, iconClass() { - if (this.childItemType === TASK_TYPE_NAME) { + if (this.childItemType === WORK_ITEM_TYPE_VALUE_TASK) { return this.isItemOpen ? 'gl-text-green-500' : 'gl-text-blue-500'; } return ''; diff --git a/app/assets/javascripts/work_items/constants.js b/app/assets/javascripts/work_items/constants.js index 62fdc8a21c29dc042525bab95326988c8c1f5bed..fcf73e5f822738372213e85e2d4472b0ecaa8d7c 100644 --- a/app/assets/javascripts/work_items/constants.js +++ b/app/assets/javascripts/work_items/constants.js @@ -10,8 +10,6 @@ export const STATE_EVENT_CLOSE = 'CLOSE'; export const TRACKING_CATEGORY_SHOW = 'workItems:show'; -export const TASK_TYPE_NAME = 'Task'; - export const WIDGET_TYPE_ASSIGNEES = 'ASSIGNEES'; export const WIDGET_TYPE_DESCRIPTION = 'DESCRIPTION'; export const WIDGET_TYPE_AWARD_EMOJI = 'AWARD_EMOJI'; @@ -46,9 +44,6 @@ export const WORK_ITEM_TYPE_VALUE_REQUIREMENTS = 'Requirements'; export const WORK_ITEM_TYPE_VALUE_KEY_RESULT = 'Key Result'; export const WORK_ITEM_TYPE_VALUE_OBJECTIVE = 'Objective'; -export const NAMESPACE_GROUP = 'group'; -export const NAMESPACE_PROJECT = 'project'; - export const WORK_ITEM_TITLE_MAX_LENGTH = 255; export const i18n = { diff --git a/app/helpers/work_items_helper.rb b/app/helpers/work_items_helper.rb index d2e3d41377a04dd2ff09a4358395f78c8b51534c..b7e9699dc1212396899941bdbce3a1c9d5d52110 100644 --- a/app/helpers/work_items_helper.rb +++ b/app/helpers/work_items_helper.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module WorkItemsHelper - def work_items_index_data(resource_parent) + def work_items_show_data(resource_parent) { full_path: resource_parent.full_path, issues_list_path: diff --git a/app/views/groups/work_items/show.html.haml b/app/views/groups/work_items/show.html.haml index 7def8b0d6e681316ef844a3bea9e61fd43c814ff..7363d8f977a9b4ab3c98bd81fb10ba07b3c7deb7 100644 --- a/app/views/groups/work_items/show.html.haml +++ b/app/views/groups/work_items/show.html.haml @@ -4,4 +4,4 @@ - @gfm_form = true - @noteable_type = 'WorkItem' -#js-work-items{ data: work_items_index_data(@group).merge(iid: request.params['iid']) } +#js-work-items{ data: work_items_show_data(@group).merge(iid: request.params['iid']) } diff --git a/app/views/projects/issues/_work_item_links.html.haml b/app/views/projects/issues/_work_item_links.html.haml index bf23fdc761b006bea66bc0a2f37507fc611801c7..7a8f2163bf6e621062c95aa4e9dd32b4ff035043 100644 --- a/app/views/projects/issues/_work_item_links.html.haml +++ b/app/views/projects/issues/_work_item_links.html.haml @@ -1,6 +1,6 @@ .js-work-item-links-root{ data: { issuable_id: @issue.id, issuable_iid: @issue.iid, full_path: @project.full_path, - wi: work_items_index_data(@project), + wi: work_items_show_data(@project), register_path: new_user_registration_path(redirect_to_referer: 'yes'), sign_in_path: new_session_path(:user, redirect_to_referer: 'yes') } } diff --git a/app/views/projects/work_items/show.html.haml b/app/views/projects/work_items/show.html.haml index 7e0bddf1b5de35935dfa757e5bd28e17e0b8cdf0..c69e42917f19ce7b348eecb0f94aee3233e036e4 100644 --- a/app/views/projects/work_items/show.html.haml +++ b/app/views/projects/work_items/show.html.haml @@ -4,4 +4,4 @@ - @gfm_form = true - @noteable_type = 'WorkItem' -#js-work-items{ data: work_items_index_data(@project) } +#js-work-items{ data: work_items_show_data(@project) } diff --git a/ee/app/helpers/ee/work_items_helper.rb b/ee/app/helpers/ee/work_items_helper.rb index 71e7697201512ceca66e0d83102ec93c5a3d4e93..88c92ce2c26e5785d561a1e0f315fdba6114021f 100644 --- a/ee/app/helpers/ee/work_items_helper.rb +++ b/ee/app/helpers/ee/work_items_helper.rb @@ -4,8 +4,8 @@ module EE module WorkItemsHelper extend ::Gitlab::Utils::Override - override :work_items_index_data - def work_items_index_data(resource_parent) + override :work_items_show_data + def work_items_show_data(resource_parent) super.merge( has_issue_weights_feature: resource_parent.licensed_feature_available?(:issue_weights).to_s, has_okrs_feature: resource_parent.licensed_feature_available?(:okrs).to_s, diff --git a/ee/spec/helpers/ee/work_items_helper_spec.rb b/ee/spec/helpers/ee/work_items_helper_spec.rb index e52ffc1010cf979b1b058526d13c3dded27e0967..4c757441b5a85598f779c688e0a249e7e9b55b36 100644 --- a/ee/spec/helpers/ee/work_items_helper_spec.rb +++ b/ee/spec/helpers/ee/work_items_helper_spec.rb @@ -3,8 +3,8 @@ require "spec_helper" RSpec.describe EE::WorkItemsHelper, feature_category: :team_planning do - describe '#work_items_index_data' do - subject(:work_items_index_data) { helper.work_items_index_data(project) } + describe '#work_items_show_data' do + subject(:work_items_show_data) { helper.work_items_show_data(project) } before do stub_licensed_features( @@ -21,7 +21,7 @@ let(:feature_available) { true } it 'returns true for the features' do - expect(work_items_index_data).to include( + expect(work_items_show_data).to include( { has_issuable_health_status_feature: "true", has_issue_weights_feature: "true", @@ -36,7 +36,7 @@ let(:feature_available) { false } it 'returns false for the features' do - expect(work_items_index_data).to include( + expect(work_items_show_data).to include( { has_issuable_health_status_feature: "false", has_issue_weights_feature: "false", diff --git a/spec/frontend/work_items/components/work_item_assignees_spec.js b/spec/frontend/work_items/components/work_item_assignees_spec.js index 6c0042bdad78939afc23bdf6a2d1f4762cf0eb60..b34eed21c60272ba018c667be72ce38935cdf438 100644 --- a/spec/frontend/work_items/components/work_item_assignees_spec.js +++ b/spec/frontend/work_items/components/work_item_assignees_spec.js @@ -14,9 +14,9 @@ import updateWorkItemMutation from '~/work_items/graphql/update_work_item.mutati import WorkItemAssignees from '~/work_items/components/work_item_assignees.vue'; import { i18n, - TASK_TYPE_NAME, - TRACKING_CATEGORY_SHOW, DEFAULT_PAGE_SIZE_ASSIGNEES, + TRACKING_CATEGORY_SHOW, + WORK_ITEM_TYPE_VALUE_TASK, } from '~/work_items/constants'; import { projectMembersResponseWithCurrentUser, @@ -97,7 +97,7 @@ describe('WorkItemAssignees component', () => { fullPath: 'test-project-path', workItemId, allowsMultipleAssignees, - workItemType: TASK_TYPE_NAME, + workItemType: WORK_ITEM_TYPE_VALUE_TASK, canUpdate, canInviteMembers, }, diff --git a/spec/frontend/work_items/components/work_item_links/work_item_link_child_spec.js b/spec/frontend/work_items/components/work_item_links/work_item_link_child_spec.js index 36af0c5b3c83db4fa3772db100dd0469b0fb3b7a..3c65a29e4389a2799c49f75d5505901776ea63d2 100644 --- a/spec/frontend/work_items/components/work_item_links/work_item_link_child_spec.js +++ b/spec/frontend/work_items/components/work_item_links/work_item_link_child_spec.js @@ -13,8 +13,8 @@ import WorkItemTreeChildren from '~/work_items/components/work_item_links/work_i import WorkItemLinkChildContents from '~/work_items/components/shared/work_item_link_child_contents.vue'; import { WIDGET_TYPE_HIERARCHY, - TASK_TYPE_NAME, WORK_ITEM_TYPE_VALUE_OBJECTIVE, + WORK_ITEM_TYPE_VALUE_TASK, } from '~/work_items/constants'; import { @@ -47,7 +47,7 @@ describe('WorkItemLinkChild', () => { canUpdate = true, issuableGid = WORK_ITEM_ID, childItem = workItemTask, - workItemType = TASK_TYPE_NAME, + workItemType = WORK_ITEM_TYPE_VALUE_TASK, apolloProvider = null, } = {}) => { getWorkItemTreeQueryHandler = jest.fn().mockResolvedValue(workItemHierarchyTreeResponse); diff --git a/spec/helpers/work_items_helper_spec.rb b/spec/helpers/work_items_helper_spec.rb index b790f21d4127cda2111f422281320cb914f80ca1..59b8b13aea284a6f1317b67f51ef3aa02ae5fb31 100644 --- a/spec/helpers/work_items_helper_spec.rb +++ b/spec/helpers/work_items_helper_spec.rb @@ -3,13 +3,13 @@ require "spec_helper" RSpec.describe WorkItemsHelper, feature_category: :team_planning do - describe '#work_items_index_data' do - subject(:work_items_index_data) { helper.work_items_index_data(project) } + describe '#work_items_show_data' do + subject(:work_items_show_data) { helper.work_items_show_data(project) } let_it_be(:project) { build(:project) } it 'returns the expected data properties' do - expect(work_items_index_data).to include( + expect(work_items_show_data).to include( { full_path: project.full_path, issues_list_path: project_issues_path(project),