diff options
Diffstat (limited to 'app/assets/javascripts/sidebar/mount_sidebar.js')
-rw-r--r-- | app/assets/javascripts/sidebar/mount_sidebar.js | 66 |
1 files changed, 39 insertions, 27 deletions
diff --git a/app/assets/javascripts/sidebar/mount_sidebar.js b/app/assets/javascripts/sidebar/mount_sidebar.js index fb024d818da..74843bcc006 100644 --- a/app/assets/javascripts/sidebar/mount_sidebar.js +++ b/app/assets/javascripts/sidebar/mount_sidebar.js @@ -4,7 +4,7 @@ import { TYPENAME_ISSUE, TYPENAME_MERGE_REQUEST } from '~/graphql_shared/constan import { convertToGraphQLId, getIdFromGraphQLId } from '~/graphql_shared/utils'; import initInviteMembersModal from '~/invite_members/init_invite_members_modal'; import initInviteMembersTrigger from '~/invite_members/init_invite_members_trigger'; -import { IssuableType, TYPE_ISSUE } from '~/issues/constants'; +import { TYPE_ISSUE, TYPE_MERGE_REQUEST, WORKSPACE_PROJECT } from '~/issues/constants'; import { gqlClient } from '~/issues/list/graphql'; import { isInDesignPage, @@ -17,6 +17,7 @@ import { __ } from '~/locale'; import { apolloProvider } from '~/graphql_shared/issuable_client'; import Translate from '~/vue_shared/translate'; import UserSelect from '~/vue_shared/components/user_select/user_select.vue'; +import NewHeaderActionsPopover from '~/issues/show/components/new_header_actions_popover.vue'; import CollapsedAssigneeList from './components/assignees/collapsed_assignee_list.vue'; import SidebarAssignees from './components/assignees/sidebar_assignees.vue'; import SidebarAssigneesWidget from './components/assignees/sidebar_assignees_widget.vue'; @@ -24,8 +25,6 @@ import SidebarConfidentialityWidget from './components/confidential/sidebar_conf import CopyEmailToClipboard from './components/copy/copy_email_to_clipboard.vue'; import SidebarDueDateWidget from './components/date/sidebar_date_widget.vue'; import SidebarEscalationStatus from './components/incidents/sidebar_escalation_status.vue'; -import { DropdownVariant } from './components/labels/labels_select_vue/constants'; -import { LabelType } from './components/labels/labels_select_widget/constants'; import LabelsSelectWidget from './components/labels/labels_select_widget/labels_select_root.vue'; import IssuableLockForm from './components/lock/issuable_lock_form.vue'; import MilestoneDropdown from './components/milestone/milestone_dropdown.vue'; @@ -81,7 +80,7 @@ function mountSidebarTodoWidget() { issuableType: isInIssuePage() || isInIncidentPage() || isInDesignPage() ? TYPE_ISSUE - : IssuableType.MergeRequest, + : TYPE_MERGE_REQUEST, }, }), }); @@ -125,7 +124,7 @@ function mountSidebarAssigneesDeprecated(mediator) { issuableType: isInIssuePage() || isInIncidentPage() || isInDesignPage() ? TYPE_ISSUE - : IssuableType.MergeRequest, + : TYPE_MERGE_REQUEST, issuableId: id, assigneeAvailabilityStatus, }, @@ -142,14 +141,14 @@ function mountSidebarAssigneesWidget() { const { id, iid, fullPath, editable } = getSidebarOptions(); const isIssuablePage = isInIssuePage() || isInIncidentPage() || isInDesignPage(); - const issuableType = isIssuablePage ? TYPE_ISSUE : IssuableType.MergeRequest; + const issuableType = isIssuablePage ? TYPE_ISSUE : TYPE_MERGE_REQUEST; // eslint-disable-next-line no-new new Vue({ el, name: 'SidebarAssigneesRoot', apolloProvider, provide: { - canUpdate: editable, + canUpdate: parseBoolean(editable), directlyInviteMembers: Object.prototype.hasOwnProperty.call( el.dataset, 'directlyInviteMembers', @@ -163,7 +162,7 @@ function mountSidebarAssigneesWidget() { issuableType, issuableId: id, allowMultipleAssignees: !el.dataset.maxAssignees || el.dataset.maxAssignees > 1, - editable, + editable: parseBoolean(editable), }, scopedSlots: { collapsed: ({ users }) => @@ -204,8 +203,7 @@ function mountSidebarReviewers(mediator) { issuableIid: String(iid), projectPath: fullPath, field: el.dataset.field, - issuableType: - isInIssuePage() || isInDesignPage() ? TYPE_ISSUE : IssuableType.MergeRequest, + issuableType: isInIssuePage() || isInDesignPage() ? TYPE_ISSUE : TYPE_MERGE_REQUEST, }, }), }); @@ -275,8 +273,7 @@ function mountSidebarMilestoneWidget() { attrWorkspacePath: projectPath, workspacePath: projectPath, iid: issueIid, - issuableType: - isInIssuePage() || isInDesignPage() ? TYPE_ISSUE : IssuableType.MergeRequest, + issuableType: isInIssuePage() || isInDesignPage() ? TYPE_ISSUE : TYPE_MERGE_REQUEST, issuableAttribute: IssuableAttributeType.Milestone, icon: 'clock', }, @@ -313,7 +310,7 @@ export function mountMilestoneDropdown() { attrWorkspacePath: fullPath, canAdminMilestone, inputName, - issuableType: isInIssuePage() ? TYPE_ISSUE : IssuableType.MergeRequest, + issuableType: isInIssuePage() ? TYPE_ISSUE : TYPE_MERGE_REQUEST, milestoneId, milestoneTitle, projectMilestonesPath, @@ -354,14 +351,13 @@ export function mountSidebarLabelsWidget() { footerManageLabelTitle: __('Manage project labels'), labelsCreateTitle: __('Create project label'), labelsFilterBasePath: el.dataset.projectIssuesPath, - variant: DropdownVariant.Sidebar, issuableType: isInIssuePage() || isInIncidentPage() || isInDesignPage() ? TYPE_ISSUE - : IssuableType.MergeRequest, - workspaceType: 'project', + : TYPE_MERGE_REQUEST, + workspaceType: WORKSPACE_PROJECT, attrWorkspacePath: el.dataset.projectPath, - labelCreateType: LabelType.project, + labelCreateType: WORKSPACE_PROJECT, }, class: ['block labels js-labels-block'], scopedSlots: { @@ -398,7 +394,7 @@ function mountSidebarConfidentialityWidget() { issuableType: isInIssuePage() || isInIncidentPage() || isInDesignPage() ? TYPE_ISSUE - : IssuableType.MergeRequest, + : TYPE_MERGE_REQUEST, }, }), }); @@ -418,7 +414,7 @@ function mountSidebarDueDateWidget() { name: 'SidebarDueDateWidgetRoot', apolloProvider, provide: { - canUpdate: editable, + canUpdate: parseBoolean(editable), }, render: (createElement) => createElement(SidebarDueDateWidget, { @@ -454,7 +450,7 @@ function mountSidebarReferenceWidget() { issuableType: isInIssuePage() || isInIncidentPage() || isInDesignPage() ? TYPE_ISSUE - : IssuableType.MergeRequest, + : TYPE_MERGE_REQUEST, }, }), }); @@ -479,7 +475,7 @@ function mountIssuableLockForm(store) { render: (createElement) => createElement(IssuableLockForm, { props: { - isEditable: editable, + isEditable: parseBoolean(editable), }, }), }); @@ -506,7 +502,7 @@ function mountSidebarParticipantsWidget() { issuableType: isInIssuePage() || isInIncidentPage() || isInDesignPage() ? TYPE_ISSUE - : IssuableType.MergeRequest, + : TYPE_MERGE_REQUEST, }, }), }); @@ -526,7 +522,7 @@ function mountSidebarSubscriptionsWidget() { name: 'SidebarSubscriptionsWidgetRoot', apolloProvider, provide: { - canUpdate: editable, + canUpdate: parseBoolean(editable), }, render: (createElement) => createElement(SidebarSubscriptionsWidget, { @@ -536,7 +532,7 @@ function mountSidebarSubscriptionsWidget() { issuableType: isInIssuePage() || isInIncidentPage() || isInDesignPage() ? TYPE_ISSUE - : IssuableType.MergeRequest, + : TYPE_MERGE_REQUEST, }, }), }); @@ -590,7 +586,7 @@ function mountSidebarSeverityWidget() { name: 'SidebarSeverityWidgetRoot', apolloProvider, provide: { - canUpdate: editable, + canUpdate: parseBoolean(editable), }, render: (createElement) => createElement(SidebarSeverityWidget, { @@ -648,7 +644,7 @@ function mountCopyEmailToClipboard() { }); } -export function mountMoveIssuesButton() { +export async function mountMoveIssuesButton() { const el = document.querySelector('.js-move-issues'); if (!el) { @@ -661,7 +657,7 @@ export function mountMoveIssuesButton() { el, name: 'MoveIssuesRoot', apolloProvider: new VueApollo({ - defaultClient: gqlClient, + defaultClient: await gqlClient(), }), render: (createElement) => createElement(MoveIssuesButton, { @@ -790,6 +786,21 @@ export function mountAssigneesDropdown() { }); } +function mountNewIssuePopover() { + const el = document.querySelector('.js-sidebar-header-popover'); + + if (!el) { + return null; + } + + return new Vue({ + el, + name: 'NewHeaderActionsPopover', + render: (createElement) => + createElement(NewHeaderActionsPopover, { props: { issueType: TYPE_MERGE_REQUEST } }), + }); +} + const isAssigneesWidgetShown = (isInIssuePage() || isInDesignPage() || isInMRPage()) && gon.features.issueAssigneesWidget; @@ -817,6 +828,7 @@ export function mountSidebar(mediator, store) { mountSidebarSeverityWidget(); mountSidebarEscalationStatus(); mountMoveIssueButton(); + mountNewIssuePopover(); } export { getSidebarOptions }; |