2018-05-09 12:01:36 +05:30
|
|
|
import $ from 'jquery';
|
2018-03-17 18:26:18 +05:30
|
|
|
import Vue from 'vue';
|
2020-05-24 23:13:21 +05:30
|
|
|
import VueApollo from 'vue-apollo';
|
2021-09-30 23:02:18 +05:30
|
|
|
import { TYPE_ISSUE, TYPE_MERGE_REQUEST } from '~/graphql_shared/constants';
|
|
|
|
import { convertToGraphQLId } from '~/graphql_shared/utils';
|
2021-09-04 01:27:46 +05:30
|
|
|
import initInviteMembersModal from '~/invite_members/init_invite_members_modal';
|
|
|
|
import initInviteMembersTrigger from '~/invite_members/init_invite_members_trigger';
|
2022-01-26 12:08:38 +05:30
|
|
|
import { IssuableType } from '~/issues/constants';
|
2021-03-11 19:13:27 +05:30
|
|
|
import {
|
|
|
|
isInIssuePage,
|
|
|
|
isInDesignPage,
|
|
|
|
isInIncidentPage,
|
2022-05-07 20:08:51 +05:30
|
|
|
isInMRPage,
|
2021-03-11 19:13:27 +05:30
|
|
|
parseBoolean,
|
|
|
|
} from '~/lib/utils/common_utils';
|
2022-01-26 12:08:38 +05:30
|
|
|
import { __ } from '~/locale';
|
2021-04-29 21:17:54 +05:30
|
|
|
import CollapsedAssigneeList from '~/sidebar/components/assignees/collapsed_assignee_list.vue';
|
|
|
|
import SidebarAssigneesWidget from '~/sidebar/components/assignees/sidebar_assignees_widget.vue';
|
2021-04-17 20:07:23 +05:30
|
|
|
import SidebarConfidentialityWidget from '~/sidebar/components/confidential/sidebar_confidentiality_widget.vue';
|
2021-06-08 01:23:25 +05:30
|
|
|
import SidebarDueDateWidget from '~/sidebar/components/date/sidebar_date_widget.vue';
|
2021-09-04 01:27:46 +05:30
|
|
|
import SidebarParticipantsWidget from '~/sidebar/components/participants/sidebar_participants_widget.vue';
|
2021-04-17 20:07:23 +05:30
|
|
|
import SidebarReferenceWidget from '~/sidebar/components/reference/sidebar_reference_widget.vue';
|
2021-09-30 23:02:18 +05:30
|
|
|
import SidebarDropdownWidget from '~/sidebar/components/sidebar_dropdown_widget.vue';
|
|
|
|
import SidebarTodoWidget from '~/sidebar/components/todo_toggle/sidebar_todo_widget.vue';
|
2021-04-17 20:07:23 +05:30
|
|
|
import { apolloProvider } from '~/sidebar/graphql';
|
2021-09-04 01:27:46 +05:30
|
|
|
import trackShowInviteMemberLink from '~/sidebar/track_invite_members';
|
2021-10-27 15:23:28 +05:30
|
|
|
import { DropdownVariant } from '~/vue_shared/components/sidebar/labels_select_vue/constants';
|
2022-01-26 12:08:38 +05:30
|
|
|
import LabelsSelectWidget from '~/vue_shared/components/sidebar/labels_select_widget/labels_select_root.vue';
|
|
|
|
import { LabelType } from '~/vue_shared/components/sidebar/labels_select_widget/constants';
|
2022-03-02 08:16:31 +05:30
|
|
|
import eventHub from '~/sidebar/event_hub';
|
2022-05-07 20:08:51 +05:30
|
|
|
import { refreshUserMergeRequestCounts } from '~/commons/nav/user_merge_requests';
|
2021-03-11 19:13:27 +05:30
|
|
|
import Translate from '../vue_shared/translate';
|
2018-03-27 19:54:05 +05:30
|
|
|
import SidebarAssignees from './components/assignees/sidebar_assignees.vue';
|
2021-03-11 19:13:27 +05:30
|
|
|
import CopyEmailToClipboard from './components/copy_email_to_clipboard.vue';
|
2022-05-07 20:08:51 +05:30
|
|
|
import SidebarEscalationStatus from './components/incidents/sidebar_escalation_status.vue';
|
2020-10-24 23:57:45 +05:30
|
|
|
import IssuableLockForm from './components/lock/issuable_lock_form.vue';
|
2021-03-11 19:13:27 +05:30
|
|
|
import SidebarReviewers from './components/reviewers/sidebar_reviewers.vue';
|
2020-11-24 15:15:51 +05:30
|
|
|
import SidebarSeverity from './components/severity/sidebar_severity.vue';
|
2021-06-08 01:23:25 +05:30
|
|
|
import SidebarSubscriptionsWidget from './components/subscriptions/sidebar_subscriptions_widget.vue';
|
2021-03-11 19:13:27 +05:30
|
|
|
import SidebarTimeTracking from './components/time_tracking/sidebar_time_tracking.vue';
|
2021-09-30 23:02:18 +05:30
|
|
|
import { IssuableAttributeType } from './constants';
|
2021-03-11 19:13:27 +05:30
|
|
|
import SidebarMoveIssue from './lib/sidebar_move_issue';
|
2022-01-26 12:08:38 +05:30
|
|
|
import CrmContacts from './components/crm_contacts/crm_contacts.vue';
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
Vue.use(Translate);
|
2020-05-24 23:13:21 +05:30
|
|
|
Vue.use(VueApollo);
|
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
function getSidebarOptions(sidebarOptEl = document.querySelector('.js-sidebar-options')) {
|
|
|
|
return JSON.parse(sidebarOptEl.innerHTML);
|
2020-05-24 23:13:21 +05:30
|
|
|
}
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2021-09-30 23:02:18 +05:30
|
|
|
function mountSidebarToDoWidget() {
|
|
|
|
const el = document.querySelector('.js-issuable-todo');
|
|
|
|
|
|
|
|
if (!el) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
const { projectPath, iid, id } = el.dataset;
|
|
|
|
|
|
|
|
return new Vue({
|
|
|
|
el,
|
2022-04-04 11:22:00 +05:30
|
|
|
name: 'SidebarTodoRoot',
|
2021-09-30 23:02:18 +05:30
|
|
|
apolloProvider,
|
|
|
|
components: {
|
|
|
|
SidebarTodoWidget,
|
|
|
|
},
|
|
|
|
provide: {
|
|
|
|
isClassicSidebar: true,
|
|
|
|
},
|
|
|
|
render: (createElement) =>
|
|
|
|
createElement('sidebar-todo-widget', {
|
|
|
|
props: {
|
|
|
|
fullPath: projectPath,
|
|
|
|
issuableId:
|
2022-08-13 15:12:31 +05:30
|
|
|
isInIssuePage() || isInIncidentPage() || isInDesignPage()
|
2021-09-30 23:02:18 +05:30
|
|
|
? convertToGraphQLId(TYPE_ISSUE, id)
|
|
|
|
: convertToGraphQLId(TYPE_MERGE_REQUEST, id),
|
|
|
|
issuableIid: iid,
|
|
|
|
issuableType:
|
2022-08-13 15:12:31 +05:30
|
|
|
isInIssuePage() || isInIncidentPage() || isInDesignPage()
|
|
|
|
? IssuableType.Issue
|
|
|
|
: IssuableType.MergeRequest,
|
2021-09-30 23:02:18 +05:30
|
|
|
},
|
|
|
|
}),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-03-11 19:13:27 +05:30
|
|
|
function getSidebarAssigneeAvailabilityData() {
|
|
|
|
const sidebarAssigneeEl = document.querySelectorAll('.js-sidebar-assignee-data input');
|
|
|
|
return Array.from(sidebarAssigneeEl)
|
|
|
|
.map((el) => el.dataset)
|
|
|
|
.reduce(
|
|
|
|
(acc, { username, availability = '' }) => ({
|
|
|
|
...acc,
|
|
|
|
[username]: availability,
|
|
|
|
}),
|
|
|
|
{},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2021-04-29 21:17:54 +05:30
|
|
|
function mountAssigneesComponentDeprecated(mediator) {
|
2018-03-17 18:26:18 +05:30
|
|
|
const el = document.getElementById('js-vue-sidebar-assignees');
|
|
|
|
|
|
|
|
if (!el) return;
|
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
const { id, iid, fullPath } = getSidebarOptions();
|
2021-03-11 19:13:27 +05:30
|
|
|
const assigneeAvailabilityStatus = getSidebarAssigneeAvailabilityData();
|
2018-03-17 18:26:18 +05:30
|
|
|
// eslint-disable-next-line no-new
|
|
|
|
new Vue({
|
|
|
|
el,
|
2022-04-04 11:22:00 +05:30
|
|
|
name: 'SidebarAssigneesRoot',
|
2020-05-24 23:13:21 +05:30
|
|
|
apolloProvider,
|
2018-03-17 18:26:18 +05:30
|
|
|
components: {
|
|
|
|
SidebarAssignees,
|
|
|
|
},
|
2021-03-08 18:12:59 +05:30
|
|
|
render: (createElement) =>
|
2018-12-13 13:39:08 +05:30
|
|
|
createElement('sidebar-assignees', {
|
2021-01-03 14:25:43 +05:30
|
|
|
props: {
|
|
|
|
mediator,
|
|
|
|
issuableIid: String(iid),
|
|
|
|
projectPath: fullPath,
|
|
|
|
field: el.dataset.field,
|
2022-07-23 23:45:48 +05:30
|
|
|
signedIn: Object.prototype.hasOwnProperty.call(el.dataset, 'signedIn'),
|
2021-03-11 19:13:27 +05:30
|
|
|
issuableType:
|
2021-04-17 20:07:23 +05:30
|
|
|
isInIssuePage() || isInIncidentPage() || isInDesignPage()
|
|
|
|
? IssuableType.Issue
|
|
|
|
: IssuableType.MergeRequest,
|
2021-06-08 01:23:25 +05:30
|
|
|
issuableId: id,
|
2021-03-11 19:13:27 +05:30
|
|
|
assigneeAvailabilityStatus,
|
2021-01-03 14:25:43 +05:30
|
|
|
},
|
|
|
|
}),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-04-29 21:17:54 +05:30
|
|
|
function mountAssigneesComponent() {
|
|
|
|
const el = document.getElementById('js-vue-sidebar-assignees');
|
|
|
|
|
|
|
|
if (!el) return;
|
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
const { id, iid, fullPath, editable } = getSidebarOptions();
|
2022-05-07 20:08:51 +05:30
|
|
|
const isIssuablePage = isInIssuePage() || isInIncidentPage() || isInDesignPage();
|
|
|
|
const issuableType = isIssuablePage ? IssuableType.Issue : IssuableType.MergeRequest;
|
2021-04-29 21:17:54 +05:30
|
|
|
// eslint-disable-next-line no-new
|
|
|
|
new Vue({
|
|
|
|
el,
|
2022-04-04 11:22:00 +05:30
|
|
|
name: 'SidebarAssigneesRoot',
|
2021-04-29 21:17:54 +05:30
|
|
|
apolloProvider,
|
|
|
|
components: {
|
|
|
|
SidebarAssigneesWidget,
|
|
|
|
},
|
|
|
|
provide: {
|
|
|
|
canUpdate: editable,
|
2022-07-23 23:45:48 +05:30
|
|
|
directlyInviteMembers: Object.prototype.hasOwnProperty.call(
|
|
|
|
el.dataset,
|
|
|
|
'directlyInviteMembers',
|
|
|
|
),
|
2021-04-29 21:17:54 +05:30
|
|
|
},
|
|
|
|
render: (createElement) =>
|
|
|
|
createElement('sidebar-assignees-widget', {
|
|
|
|
props: {
|
|
|
|
iid: String(iid),
|
|
|
|
fullPath,
|
2022-05-07 20:08:51 +05:30
|
|
|
issuableType,
|
2021-06-08 01:23:25 +05:30
|
|
|
issuableId: id,
|
|
|
|
allowMultipleAssignees: !el.dataset.maxAssignees,
|
2021-04-29 21:17:54 +05:30
|
|
|
},
|
|
|
|
scopedSlots: {
|
2022-05-07 20:08:51 +05:30
|
|
|
collapsed: ({ users }) =>
|
2021-04-29 21:17:54 +05:30
|
|
|
createElement(CollapsedAssigneeList, {
|
|
|
|
props: {
|
|
|
|
users,
|
2022-05-07 20:08:51 +05:30
|
|
|
issuableType,
|
2021-04-29 21:17:54 +05:30
|
|
|
},
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
});
|
2021-09-04 01:27:46 +05:30
|
|
|
|
|
|
|
const assigneeDropdown = document.querySelector('.js-sidebar-assignee-dropdown');
|
|
|
|
|
|
|
|
if (assigneeDropdown) {
|
|
|
|
trackShowInviteMemberLink(assigneeDropdown);
|
|
|
|
}
|
2021-04-29 21:17:54 +05:30
|
|
|
}
|
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
function mountReviewersComponent(mediator) {
|
|
|
|
const el = document.getElementById('js-vue-sidebar-reviewers');
|
|
|
|
|
|
|
|
if (!el) return;
|
|
|
|
|
|
|
|
const { iid, fullPath } = getSidebarOptions();
|
|
|
|
// eslint-disable-next-line no-new
|
|
|
|
new Vue({
|
|
|
|
el,
|
2022-04-04 11:22:00 +05:30
|
|
|
name: 'SidebarReviewersRoot',
|
2021-01-03 14:25:43 +05:30
|
|
|
apolloProvider,
|
|
|
|
components: {
|
|
|
|
SidebarReviewers,
|
|
|
|
},
|
2021-03-08 18:12:59 +05:30
|
|
|
render: (createElement) =>
|
2021-01-03 14:25:43 +05:30
|
|
|
createElement('sidebar-reviewers', {
|
2018-12-13 13:39:08 +05:30
|
|
|
props: {
|
|
|
|
mediator,
|
2020-05-24 23:13:21 +05:30
|
|
|
issuableIid: String(iid),
|
|
|
|
projectPath: fullPath,
|
2018-12-13 13:39:08 +05:30
|
|
|
field: el.dataset.field,
|
2021-09-30 23:02:18 +05:30
|
|
|
issuableType:
|
|
|
|
isInIssuePage() || isInDesignPage() ? IssuableType.Issue : IssuableType.MergeRequest,
|
2018-12-13 13:39:08 +05:30
|
|
|
},
|
|
|
|
}),
|
2018-03-17 18:26:18 +05:30
|
|
|
});
|
2021-09-04 01:27:46 +05:30
|
|
|
|
|
|
|
const reviewerDropdown = document.querySelector('.js-sidebar-reviewer-dropdown');
|
|
|
|
|
|
|
|
if (reviewerDropdown) {
|
|
|
|
trackShowInviteMemberLink(reviewerDropdown);
|
|
|
|
}
|
2018-03-17 18:26:18 +05:30
|
|
|
}
|
|
|
|
|
2022-01-26 12:08:38 +05:30
|
|
|
function mountCrmContactsComponent() {
|
|
|
|
const el = document.getElementById('js-issue-crm-contacts');
|
|
|
|
|
|
|
|
if (!el) return;
|
|
|
|
|
2022-07-16 23:28:13 +05:30
|
|
|
const { issueId, groupIssuesPath } = el.dataset;
|
2022-01-26 12:08:38 +05:30
|
|
|
// eslint-disable-next-line no-new
|
|
|
|
new Vue({
|
|
|
|
el,
|
2022-04-04 11:22:00 +05:30
|
|
|
name: 'SidebarCrmContactsRoot',
|
2022-01-26 12:08:38 +05:30
|
|
|
apolloProvider,
|
|
|
|
components: {
|
|
|
|
CrmContacts,
|
|
|
|
},
|
|
|
|
render: (createElement) =>
|
|
|
|
createElement('crm-contacts', {
|
|
|
|
props: {
|
|
|
|
issueId,
|
2022-07-16 23:28:13 +05:30
|
|
|
groupIssuesPath,
|
2022-01-26 12:08:38 +05:30
|
|
|
},
|
|
|
|
}),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-09-30 23:02:18 +05:30
|
|
|
function mountMilestoneSelect() {
|
|
|
|
const el = document.querySelector('.js-milestone-select');
|
|
|
|
|
|
|
|
if (!el) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
const { canEdit, projectPath, issueIid } = el.dataset;
|
|
|
|
|
|
|
|
return new Vue({
|
|
|
|
el,
|
2022-04-04 11:22:00 +05:30
|
|
|
name: 'SidebarMilestoneRoot',
|
2021-09-30 23:02:18 +05:30
|
|
|
apolloProvider,
|
|
|
|
components: {
|
|
|
|
SidebarDropdownWidget,
|
|
|
|
},
|
|
|
|
provide: {
|
|
|
|
canUpdate: parseBoolean(canEdit),
|
|
|
|
isClassicSidebar: true,
|
|
|
|
},
|
|
|
|
render: (createElement) =>
|
|
|
|
createElement('sidebar-dropdown-widget', {
|
|
|
|
props: {
|
|
|
|
attrWorkspacePath: projectPath,
|
|
|
|
workspacePath: projectPath,
|
|
|
|
iid: issueIid,
|
|
|
|
issuableType:
|
|
|
|
isInIssuePage() || isInDesignPage() ? IssuableType.Issue : IssuableType.MergeRequest,
|
|
|
|
issuableAttribute: IssuableAttributeType.Milestone,
|
|
|
|
icon: 'clock',
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-11-24 15:15:51 +05:30
|
|
|
export function mountSidebarLabels() {
|
|
|
|
const el = document.querySelector('.js-sidebar-labels');
|
|
|
|
|
|
|
|
if (!el) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return new Vue({
|
|
|
|
el,
|
2022-04-04 11:22:00 +05:30
|
|
|
name: 'SidebarLabelsRoot',
|
2021-01-29 00:20:46 +05:30
|
|
|
apolloProvider,
|
2022-01-26 12:08:38 +05:30
|
|
|
|
|
|
|
components: {
|
|
|
|
LabelsSelectWidget,
|
|
|
|
},
|
2020-11-24 15:15:51 +05:30
|
|
|
provide: {
|
|
|
|
...el.dataset,
|
2022-01-26 12:08:38 +05:30
|
|
|
canUpdate: parseBoolean(el.dataset.canEdit),
|
2020-11-24 15:15:51 +05:30
|
|
|
allowLabelCreate: parseBoolean(el.dataset.allowLabelCreate),
|
|
|
|
allowLabelEdit: parseBoolean(el.dataset.canEdit),
|
|
|
|
allowScopedLabels: parseBoolean(el.dataset.allowScopedLabels),
|
2021-11-11 11:23:49 +05:30
|
|
|
isClassicSidebar: true,
|
2020-11-24 15:15:51 +05:30
|
|
|
},
|
2022-01-26 12:08:38 +05:30
|
|
|
render: (createElement) =>
|
|
|
|
createElement('labels-select-widget', {
|
|
|
|
props: {
|
|
|
|
iid: String(el.dataset.iid),
|
|
|
|
fullPath: el.dataset.projectPath,
|
|
|
|
allowLabelRemove: parseBoolean(el.dataset.canEdit),
|
|
|
|
allowMultiselect: true,
|
|
|
|
footerCreateLabelTitle: __('Create project label'),
|
|
|
|
footerManageLabelTitle: __('Manage project labels'),
|
|
|
|
labelsCreateTitle: __('Create project label'),
|
|
|
|
labelsFilterBasePath: el.dataset.projectIssuesPath,
|
|
|
|
variant: DropdownVariant.Sidebar,
|
|
|
|
issuableType:
|
|
|
|
isInIssuePage() || isInIncidentPage() || isInDesignPage()
|
|
|
|
? IssuableType.Issue
|
|
|
|
: IssuableType.MergeRequest,
|
|
|
|
workspaceType: 'project',
|
|
|
|
attrWorkspacePath: el.dataset.projectPath,
|
|
|
|
labelCreateType: LabelType.project,
|
|
|
|
},
|
|
|
|
class: ['block labels js-labels-block'],
|
|
|
|
scopedSlots: {
|
|
|
|
default: () => __('None'),
|
|
|
|
},
|
|
|
|
}),
|
2020-11-24 15:15:51 +05:30
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-04-17 20:07:23 +05:30
|
|
|
function mountConfidentialComponent() {
|
2018-03-17 18:26:18 +05:30
|
|
|
const el = document.getElementById('js-confidential-entry-point');
|
2021-04-17 20:07:23 +05:30
|
|
|
if (!el) {
|
|
|
|
return;
|
|
|
|
}
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2020-07-28 23:09:34 +05:30
|
|
|
const { fullPath, iid } = getSidebarOptions();
|
2018-03-17 18:26:18 +05:30
|
|
|
const dataNode = document.getElementById('js-confidential-issue-data');
|
|
|
|
const initialData = JSON.parse(dataNode.innerHTML);
|
|
|
|
|
2021-04-17 20:07:23 +05:30
|
|
|
// eslint-disable-next-line no-new
|
|
|
|
new Vue({
|
|
|
|
el,
|
2022-04-04 11:22:00 +05:30
|
|
|
name: 'SidebarConfidentialRoot',
|
2021-04-17 20:07:23 +05:30
|
|
|
apolloProvider,
|
|
|
|
components: {
|
|
|
|
SidebarConfidentialityWidget,
|
|
|
|
},
|
|
|
|
provide: {
|
|
|
|
canUpdate: initialData.is_editable,
|
2021-09-04 01:27:46 +05:30
|
|
|
isClassicSidebar: true,
|
2021-04-17 20:07:23 +05:30
|
|
|
},
|
|
|
|
|
|
|
|
render: (createElement) =>
|
|
|
|
createElement('sidebar-confidentiality-widget', {
|
|
|
|
props: {
|
2021-04-29 21:17:54 +05:30
|
|
|
iid: String(iid),
|
|
|
|
fullPath,
|
2021-04-17 20:07:23 +05:30
|
|
|
issuableType:
|
|
|
|
isInIssuePage() || isInIncidentPage() || isInDesignPage()
|
|
|
|
? IssuableType.Issue
|
|
|
|
: IssuableType.MergeRequest,
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-04-29 21:17:54 +05:30
|
|
|
function mountDueDateComponent() {
|
|
|
|
const el = document.getElementById('js-due-date-entry-point');
|
|
|
|
if (!el) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const { fullPath, iid, editable } = getSidebarOptions();
|
|
|
|
|
|
|
|
// eslint-disable-next-line no-new
|
|
|
|
new Vue({
|
|
|
|
el,
|
2022-04-04 11:22:00 +05:30
|
|
|
name: 'SidebarDueDateRoot',
|
2021-04-29 21:17:54 +05:30
|
|
|
apolloProvider,
|
|
|
|
components: {
|
|
|
|
SidebarDueDateWidget,
|
|
|
|
},
|
|
|
|
provide: {
|
|
|
|
canUpdate: editable,
|
|
|
|
},
|
|
|
|
|
|
|
|
render: (createElement) =>
|
|
|
|
createElement('sidebar-due-date-widget', {
|
|
|
|
props: {
|
2021-06-08 01:23:25 +05:30
|
|
|
iid: String(iid),
|
|
|
|
fullPath,
|
2021-04-29 21:17:54 +05:30
|
|
|
issuableType: IssuableType.Issue,
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-04-17 20:07:23 +05:30
|
|
|
function mountReferenceComponent() {
|
|
|
|
const el = document.getElementById('js-reference-entry-point');
|
|
|
|
if (!el) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const { fullPath, iid } = getSidebarOptions();
|
|
|
|
|
|
|
|
// eslint-disable-next-line no-new
|
|
|
|
new Vue({
|
|
|
|
el,
|
2022-04-04 11:22:00 +05:30
|
|
|
name: 'SidebarReferenceRoot',
|
2021-04-17 20:07:23 +05:30
|
|
|
apolloProvider,
|
|
|
|
components: {
|
|
|
|
SidebarReferenceWidget,
|
|
|
|
},
|
|
|
|
provide: {
|
|
|
|
iid: String(iid),
|
|
|
|
fullPath,
|
|
|
|
},
|
|
|
|
|
|
|
|
render: (createElement) =>
|
|
|
|
createElement('sidebar-reference-widget', {
|
|
|
|
props: {
|
|
|
|
issuableType:
|
|
|
|
isInIssuePage() || isInIncidentPage() || isInDesignPage()
|
|
|
|
? IssuableType.Issue
|
|
|
|
: IssuableType.MergeRequest,
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
});
|
2018-03-17 18:26:18 +05:30
|
|
|
}
|
|
|
|
|
2021-11-11 11:23:49 +05:30
|
|
|
function mountLockComponent(store) {
|
2018-03-17 18:26:18 +05:30
|
|
|
const el = document.getElementById('js-lock-entry-point');
|
2021-01-03 14:25:43 +05:30
|
|
|
|
2021-11-11 11:23:49 +05:30
|
|
|
if (!el || !store) {
|
2021-01-03 14:25:43 +05:30
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-07-16 23:28:13 +05:30
|
|
|
const { fullPath, editable } = getSidebarOptions();
|
2018-03-17 18:26:18 +05:30
|
|
|
|
2021-11-11 11:23:49 +05:30
|
|
|
// eslint-disable-next-line no-new
|
|
|
|
new Vue({
|
|
|
|
el,
|
2022-04-04 11:22:00 +05:30
|
|
|
name: 'SidebarLockRoot',
|
2021-11-11 11:23:49 +05:30
|
|
|
store,
|
|
|
|
provide: {
|
|
|
|
fullPath,
|
|
|
|
},
|
|
|
|
render: (createElement) =>
|
|
|
|
createElement(IssuableLockForm, {
|
|
|
|
props: {
|
2022-07-16 23:28:13 +05:30
|
|
|
isEditable: editable,
|
2021-11-11 11:23:49 +05:30
|
|
|
},
|
|
|
|
}),
|
|
|
|
});
|
2018-03-17 18:26:18 +05:30
|
|
|
}
|
|
|
|
|
2021-09-04 01:27:46 +05:30
|
|
|
function mountParticipantsComponent() {
|
2018-03-17 18:26:18 +05:30
|
|
|
const el = document.querySelector('.js-sidebar-participants-entry-point');
|
|
|
|
|
|
|
|
if (!el) return;
|
|
|
|
|
2021-09-04 01:27:46 +05:30
|
|
|
const { fullPath, iid } = getSidebarOptions();
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
// eslint-disable-next-line no-new
|
|
|
|
new Vue({
|
|
|
|
el,
|
2022-04-04 11:22:00 +05:30
|
|
|
name: 'SidebarParticipantsRoot',
|
2021-09-04 01:27:46 +05:30
|
|
|
apolloProvider,
|
2018-03-17 18:26:18 +05:30
|
|
|
components: {
|
2021-09-04 01:27:46 +05:30
|
|
|
SidebarParticipantsWidget,
|
2018-03-17 18:26:18 +05:30
|
|
|
},
|
2021-03-08 18:12:59 +05:30
|
|
|
render: (createElement) =>
|
2021-09-04 01:27:46 +05:30
|
|
|
createElement('sidebar-participants-widget', {
|
2018-12-13 13:39:08 +05:30
|
|
|
props: {
|
2021-09-04 01:27:46 +05:30
|
|
|
iid: String(iid),
|
|
|
|
fullPath,
|
|
|
|
issuableType:
|
|
|
|
isInIssuePage() || isInIncidentPage() || isInDesignPage()
|
|
|
|
? IssuableType.Issue
|
|
|
|
: IssuableType.MergeRequest,
|
2018-12-13 13:39:08 +05:30
|
|
|
},
|
|
|
|
}),
|
2018-03-17 18:26:18 +05:30
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
function mountSubscriptionsComponent() {
|
2018-03-17 18:26:18 +05:30
|
|
|
const el = document.querySelector('.js-sidebar-subscriptions-entry-point');
|
|
|
|
|
|
|
|
if (!el) return;
|
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
const { fullPath, iid, editable } = getSidebarOptions();
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
// eslint-disable-next-line no-new
|
|
|
|
new Vue({
|
|
|
|
el,
|
2022-04-04 11:22:00 +05:30
|
|
|
name: 'SidebarSubscriptionsRoot',
|
2021-06-08 01:23:25 +05:30
|
|
|
apolloProvider,
|
2018-03-17 18:26:18 +05:30
|
|
|
components: {
|
2021-06-08 01:23:25 +05:30
|
|
|
SidebarSubscriptionsWidget,
|
|
|
|
},
|
|
|
|
provide: {
|
|
|
|
canUpdate: editable,
|
2018-03-17 18:26:18 +05:30
|
|
|
},
|
2021-03-08 18:12:59 +05:30
|
|
|
render: (createElement) =>
|
2021-06-08 01:23:25 +05:30
|
|
|
createElement('sidebar-subscriptions-widget', {
|
2018-12-13 13:39:08 +05:30
|
|
|
props: {
|
2021-06-08 01:23:25 +05:30
|
|
|
iid: String(iid),
|
|
|
|
fullPath,
|
|
|
|
issuableType:
|
|
|
|
isInIssuePage() || isInIncidentPage() || isInDesignPage()
|
|
|
|
? IssuableType.Issue
|
|
|
|
: IssuableType.MergeRequest,
|
2018-12-13 13:39:08 +05:30
|
|
|
},
|
|
|
|
}),
|
2018-03-17 18:26:18 +05:30
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
function mountTimeTrackingComponent() {
|
|
|
|
const el = document.getElementById('issuable-time-tracker');
|
2021-09-04 01:27:46 +05:30
|
|
|
const { id, iid, fullPath, issuableType, timeTrackingLimitToHours } = getSidebarOptions();
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
if (!el) return;
|
|
|
|
|
|
|
|
// eslint-disable-next-line no-new
|
|
|
|
new Vue({
|
|
|
|
el,
|
2022-04-04 11:22:00 +05:30
|
|
|
name: 'SidebarTimeTrackingRoot',
|
2021-06-08 01:23:25 +05:30
|
|
|
apolloProvider,
|
2021-09-04 01:27:46 +05:30
|
|
|
provide: { issuableType },
|
|
|
|
render: (createElement) =>
|
|
|
|
createElement(SidebarTimeTracking, {
|
|
|
|
props: {
|
|
|
|
fullPath,
|
|
|
|
issuableId: id.toString(),
|
|
|
|
issuableIid: iid.toString(),
|
|
|
|
limitToHours: timeTrackingLimitToHours,
|
|
|
|
},
|
|
|
|
}),
|
2018-03-17 18:26:18 +05:30
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-11-24 15:15:51 +05:30
|
|
|
function mountSeverityComponent() {
|
|
|
|
const severityContainerEl = document.querySelector('#js-severity');
|
|
|
|
|
|
|
|
if (!severityContainerEl) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2021-10-27 15:23:28 +05:30
|
|
|
const { fullPath, iid, severity, editable } = getSidebarOptions();
|
2020-11-24 15:15:51 +05:30
|
|
|
|
|
|
|
return new Vue({
|
|
|
|
el: severityContainerEl,
|
2022-04-04 11:22:00 +05:30
|
|
|
name: 'SidebarSeverityRoot',
|
2020-11-24 15:15:51 +05:30
|
|
|
apolloProvider,
|
|
|
|
components: {
|
|
|
|
SidebarSeverity,
|
|
|
|
},
|
2021-10-27 15:23:28 +05:30
|
|
|
provide: {
|
|
|
|
canUpdate: editable,
|
|
|
|
},
|
2021-03-08 18:12:59 +05:30
|
|
|
render: (createElement) =>
|
2020-11-24 15:15:51 +05:30
|
|
|
createElement('sidebar-severity', {
|
|
|
|
props: {
|
|
|
|
projectPath: fullPath,
|
|
|
|
iid: String(iid),
|
|
|
|
initialSeverity: severity.toUpperCase(),
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2022-05-07 20:08:51 +05:30
|
|
|
function mountEscalationStatusComponent() {
|
|
|
|
const statusContainerEl = document.querySelector('#js-escalation-status');
|
|
|
|
|
|
|
|
if (!statusContainerEl) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
const { issuableType } = getSidebarOptions();
|
|
|
|
const { canUpdate, issueIid, projectPath } = statusContainerEl.dataset;
|
|
|
|
|
|
|
|
return new Vue({
|
|
|
|
el: statusContainerEl,
|
|
|
|
apolloProvider,
|
|
|
|
components: {
|
|
|
|
SidebarEscalationStatus,
|
|
|
|
},
|
|
|
|
provide: {
|
|
|
|
canUpdate: parseBoolean(canUpdate),
|
|
|
|
},
|
|
|
|
render: (createElement) =>
|
|
|
|
createElement('sidebar-escalation-status', {
|
|
|
|
props: {
|
|
|
|
iid: issueIid,
|
|
|
|
issuableType,
|
|
|
|
projectPath,
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-03-08 18:12:59 +05:30
|
|
|
function mountCopyEmailComponent() {
|
|
|
|
const el = document.getElementById('issuable-copy-email');
|
|
|
|
|
|
|
|
if (!el) return;
|
|
|
|
|
|
|
|
const { createNoteEmail } = getSidebarOptions();
|
|
|
|
|
|
|
|
// eslint-disable-next-line no-new
|
|
|
|
new Vue({
|
|
|
|
el,
|
2022-04-04 11:22:00 +05:30
|
|
|
name: 'SidebarCopyEmailRoot',
|
2021-03-08 18:12:59 +05:30
|
|
|
render: (createElement) =>
|
2021-04-29 21:17:54 +05:30
|
|
|
createElement(CopyEmailToClipboard, { props: { issueEmailAddress: createNoteEmail } }),
|
2021-03-08 18:12:59 +05:30
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-04-29 21:17:54 +05:30
|
|
|
const isAssigneesWidgetShown =
|
2022-05-07 20:08:51 +05:30
|
|
|
(isInIssuePage() || isInDesignPage() || isInMRPage()) && gon.features.issueAssigneesWidget;
|
2021-04-29 21:17:54 +05:30
|
|
|
|
2021-11-11 11:23:49 +05:30
|
|
|
export function mountSidebar(mediator, store) {
|
2021-09-04 01:27:46 +05:30
|
|
|
initInviteMembersModal();
|
|
|
|
initInviteMembersTrigger();
|
|
|
|
|
2021-09-30 23:02:18 +05:30
|
|
|
mountSidebarToDoWidget();
|
2021-04-29 21:17:54 +05:30
|
|
|
if (isAssigneesWidgetShown) {
|
|
|
|
mountAssigneesComponent();
|
|
|
|
} else {
|
|
|
|
mountAssigneesComponentDeprecated(mediator);
|
|
|
|
}
|
2021-01-03 14:25:43 +05:30
|
|
|
mountReviewersComponent(mediator);
|
2022-01-26 12:08:38 +05:30
|
|
|
mountCrmContactsComponent();
|
2021-11-11 11:23:49 +05:30
|
|
|
mountSidebarLabels();
|
2021-09-30 23:02:18 +05:30
|
|
|
mountMilestoneSelect();
|
2018-03-17 18:26:18 +05:30
|
|
|
mountConfidentialComponent(mediator);
|
2021-04-29 21:17:54 +05:30
|
|
|
mountDueDateComponent(mediator);
|
2021-04-17 20:07:23 +05:30
|
|
|
mountReferenceComponent(mediator);
|
2021-11-11 11:23:49 +05:30
|
|
|
mountLockComponent(store);
|
2021-09-04 01:27:46 +05:30
|
|
|
mountParticipantsComponent();
|
2021-06-08 01:23:25 +05:30
|
|
|
mountSubscriptionsComponent();
|
2021-03-08 18:12:59 +05:30
|
|
|
mountCopyEmailComponent();
|
2018-03-17 18:26:18 +05:30
|
|
|
|
|
|
|
new SidebarMoveIssue(
|
|
|
|
mediator,
|
|
|
|
$('.js-move-issue'),
|
|
|
|
$('.js-move-issue-confirmation-button'),
|
|
|
|
).init();
|
|
|
|
|
|
|
|
mountTimeTrackingComponent();
|
2020-11-24 15:15:51 +05:30
|
|
|
|
|
|
|
mountSeverityComponent();
|
2022-03-02 08:16:31 +05:30
|
|
|
|
2022-05-07 20:08:51 +05:30
|
|
|
mountEscalationStatusComponent();
|
|
|
|
|
2022-03-02 08:16:31 +05:30
|
|
|
if (window.gon?.features?.mrAttentionRequests) {
|
2022-05-07 20:08:51 +05:30
|
|
|
eventHub.$on('removeCurrentUserAttentionRequested', () => {
|
|
|
|
mediator.removeCurrentUserAttentionRequested();
|
|
|
|
refreshUserMergeRequestCounts();
|
|
|
|
});
|
2022-03-02 08:16:31 +05:30
|
|
|
}
|
2018-03-17 18:26:18 +05:30
|
|
|
}
|
|
|
|
|
2020-05-24 23:13:21 +05:30
|
|
|
export { getSidebarOptions };
|