2021-11-25 01:12:46 -05:00
|
|
|
import { s__, sprintf } from '~/locale';
|
2021-10-21 05:09:48 -04:00
|
|
|
import updateIssueLabelsMutation from '~/boards/graphql/issue_set_labels.mutation.graphql';
|
2021-12-06 19:14:07 -05:00
|
|
|
import { IssuableType, WorkspaceType } from '~/issues/show/constants';
|
2021-07-01 08:08:37 -04:00
|
|
|
import { DEFAULT_DEBOUNCE_AND_THROTTLE_MS } from '~/lib/utils/constants';
|
2021-03-04 07:11:11 -05:00
|
|
|
import epicConfidentialQuery from '~/sidebar/queries/epic_confidential.query.graphql';
|
2021-04-28 05:10:13 -04:00
|
|
|
import epicDueDateQuery from '~/sidebar/queries/epic_due_date.query.graphql';
|
2021-05-06 05:18:56 -04:00
|
|
|
import epicParticipantsQuery from '~/sidebar/queries/epic_participants.query.graphql';
|
2021-07-12 05:09:40 -04:00
|
|
|
import epicReferenceQuery from '~/sidebar/queries/epic_reference.query.graphql';
|
2021-04-28 05:10:13 -04:00
|
|
|
import epicStartDateQuery from '~/sidebar/queries/epic_start_date.query.graphql';
|
2021-05-04 08:10:04 -04:00
|
|
|
import epicSubscribedQuery from '~/sidebar/queries/epic_subscribed.query.graphql';
|
2021-06-30 05:08:07 -04:00
|
|
|
import epicTodoQuery from '~/sidebar/queries/epic_todo.query.graphql';
|
2021-04-26 05:09:53 -04:00
|
|
|
import issuableAssigneesSubscription from '~/sidebar/queries/issuable_assignees.subscription.graphql';
|
2021-02-25 07:11:01 -05:00
|
|
|
import issueConfidentialQuery from '~/sidebar/queries/issue_confidential.query.graphql';
|
2021-04-13 05:11:10 -04:00
|
|
|
import issueDueDateQuery from '~/sidebar/queries/issue_due_date.query.graphql';
|
2021-03-15 11:09:07 -04:00
|
|
|
import issueReferenceQuery from '~/sidebar/queries/issue_reference.query.graphql';
|
2021-05-04 08:10:04 -04:00
|
|
|
import issueSubscribedQuery from '~/sidebar/queries/issue_subscribed.query.graphql';
|
2021-06-15 17:10:04 -04:00
|
|
|
import issueTimeTrackingQuery from '~/sidebar/queries/issue_time_tracking.query.graphql';
|
2021-07-15 02:09:39 -04:00
|
|
|
import issueTodoQuery from '~/sidebar/queries/issue_todo.query.graphql';
|
2021-07-07 14:08:30 -04:00
|
|
|
import mergeRequestMilestone from '~/sidebar/queries/merge_request_milestone.query.graphql';
|
2021-03-15 11:09:07 -04:00
|
|
|
import mergeRequestReferenceQuery from '~/sidebar/queries/merge_request_reference.query.graphql';
|
2021-05-04 08:10:04 -04:00
|
|
|
import mergeRequestSubscribed from '~/sidebar/queries/merge_request_subscribed.query.graphql';
|
2021-06-15 17:10:04 -04:00
|
|
|
import mergeRequestTimeTrackingQuery from '~/sidebar/queries/merge_request_time_tracking.query.graphql';
|
2021-07-15 02:09:39 -04:00
|
|
|
import mergeRequestTodoQuery from '~/sidebar/queries/merge_request_todo.query.graphql';
|
2021-06-30 05:08:07 -04:00
|
|
|
import todoCreateMutation from '~/sidebar/queries/todo_create.mutation.graphql';
|
|
|
|
import todoMarkDoneMutation from '~/sidebar/queries/todo_mark_done.mutation.graphql';
|
2021-04-28 05:10:13 -04:00
|
|
|
import updateEpicConfidentialMutation from '~/sidebar/queries/update_epic_confidential.mutation.graphql';
|
|
|
|
import updateEpicDueDateMutation from '~/sidebar/queries/update_epic_due_date.mutation.graphql';
|
|
|
|
import updateEpicStartDateMutation from '~/sidebar/queries/update_epic_start_date.mutation.graphql';
|
2021-05-04 08:10:04 -04:00
|
|
|
import updateEpicSubscriptionMutation from '~/sidebar/queries/update_epic_subscription.mutation.graphql';
|
2021-02-25 07:11:01 -05:00
|
|
|
import updateIssueConfidentialMutation from '~/sidebar/queries/update_issue_confidential.mutation.graphql';
|
2021-04-13 05:11:10 -04:00
|
|
|
import updateIssueDueDateMutation from '~/sidebar/queries/update_issue_due_date.mutation.graphql';
|
2021-05-04 08:10:04 -04:00
|
|
|
import updateIssueSubscriptionMutation from '~/sidebar/queries/update_issue_subscription.mutation.graphql';
|
2021-07-07 14:08:30 -04:00
|
|
|
import mergeRequestMilestoneMutation from '~/sidebar/queries/update_merge_request_milestone.mutation.graphql';
|
2021-10-21 05:09:48 -04:00
|
|
|
import updateMergeRequestLabelsMutation from '~/sidebar/queries/update_merge_request_labels.mutation.graphql';
|
2021-05-04 08:10:04 -04:00
|
|
|
import updateMergeRequestSubscriptionMutation from '~/sidebar/queries/update_merge_request_subscription.mutation.graphql';
|
2021-05-25 17:10:26 -04:00
|
|
|
import updateAlertAssigneesMutation from '~/vue_shared/alert_details/graphql/mutations/alert_set_assignees.mutation.graphql';
|
2021-09-28 23:12:00 -04:00
|
|
|
import epicLabelsQuery from '~/vue_shared/components/sidebar/labels_select_widget/graphql/epic_labels.query.graphql';
|
2021-10-26 05:09:57 -04:00
|
|
|
import updateEpicLabelsMutation from '~/vue_shared/components/sidebar/labels_select_widget/graphql/epic_update_labels.mutation.graphql';
|
2021-09-28 23:12:00 -04:00
|
|
|
import groupLabelsQuery from '~/vue_shared/components/sidebar/labels_select_widget/graphql/group_labels.query.graphql';
|
|
|
|
import issueLabelsQuery from '~/vue_shared/components/sidebar/labels_select_widget/graphql/issue_labels.query.graphql';
|
2021-11-02 05:09:49 -04:00
|
|
|
import mergeRequestLabelsQuery from '~/vue_shared/components/sidebar/labels_select_widget/graphql/merge_request_labels.query.graphql';
|
2021-09-28 23:12:00 -04:00
|
|
|
import projectLabelsQuery from '~/vue_shared/components/sidebar/labels_select_widget/graphql/project_labels.query.graphql';
|
2021-05-25 17:10:26 -04:00
|
|
|
import getAlertAssignees from '~/vue_shared/components/sidebar/queries/get_alert_assignees.query.graphql';
|
2021-04-30 08:12:30 -04:00
|
|
|
import getIssueAssignees from '~/vue_shared/components/sidebar/queries/get_issue_assignees.query.graphql';
|
|
|
|
import issueParticipantsQuery from '~/vue_shared/components/sidebar/queries/get_issue_participants.query.graphql';
|
2021-05-14 05:10:24 -04:00
|
|
|
import getIssueTimelogsQuery from '~/vue_shared/components/sidebar/queries/get_issue_timelogs.query.graphql';
|
2021-04-30 08:12:30 -04:00
|
|
|
import getMergeRequestAssignees from '~/vue_shared/components/sidebar/queries/get_mr_assignees.query.graphql';
|
2021-02-17 04:09:36 -05:00
|
|
|
import getMergeRequestParticipants from '~/vue_shared/components/sidebar/queries/get_mr_participants.query.graphql';
|
2021-05-14 05:10:24 -04:00
|
|
|
import getMrTimelogsQuery from '~/vue_shared/components/sidebar/queries/get_mr_timelogs.query.graphql';
|
2021-04-30 08:12:30 -04:00
|
|
|
import updateIssueAssigneesMutation from '~/vue_shared/components/sidebar/queries/update_issue_assignees.mutation.graphql';
|
|
|
|
import updateMergeRequestAssigneesMutation from '~/vue_shared/components/sidebar/queries/update_mr_assignees.mutation.graphql';
|
2021-06-08 05:09:56 -04:00
|
|
|
import projectIssueMilestoneMutation from './queries/project_issue_milestone.mutation.graphql';
|
|
|
|
import projectIssueMilestoneQuery from './queries/project_issue_milestone.query.graphql';
|
|
|
|
import projectMilestonesQuery from './queries/project_milestones.query.graphql';
|
2021-02-17 04:09:36 -05:00
|
|
|
|
2021-07-01 08:08:37 -04:00
|
|
|
export const ASSIGNEES_DEBOUNCE_DELAY = DEFAULT_DEBOUNCE_AND_THROTTLE_MS;
|
2021-03-04 07:11:11 -05:00
|
|
|
|
2021-06-21 17:08:33 -04:00
|
|
|
export const defaultEpicSort = 'TITLE_ASC';
|
|
|
|
|
2021-07-27 11:09:49 -04:00
|
|
|
export const epicIidPattern = /^&(?<iid>\d+)$/;
|
|
|
|
|
2021-02-17 04:09:36 -05:00
|
|
|
export const assigneesQueries = {
|
|
|
|
[IssuableType.Issue]: {
|
2021-04-30 08:12:30 -04:00
|
|
|
query: getIssueAssignees,
|
2021-04-26 05:09:53 -04:00
|
|
|
subscription: issuableAssigneesSubscription,
|
2021-04-30 08:12:30 -04:00
|
|
|
mutation: updateIssueAssigneesMutation,
|
|
|
|
},
|
|
|
|
[IssuableType.MergeRequest]: {
|
|
|
|
query: getMergeRequestAssignees,
|
|
|
|
mutation: updateMergeRequestAssigneesMutation,
|
|
|
|
},
|
2021-05-25 17:10:26 -04:00
|
|
|
[IssuableType.Alert]: {
|
|
|
|
query: getAlertAssignees,
|
|
|
|
mutation: updateAlertAssigneesMutation,
|
|
|
|
},
|
2021-04-30 08:12:30 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
export const participantsQueries = {
|
|
|
|
[IssuableType.Issue]: {
|
|
|
|
query: issueParticipantsQuery,
|
2021-02-17 04:09:36 -05:00
|
|
|
},
|
|
|
|
[IssuableType.MergeRequest]: {
|
|
|
|
query: getMergeRequestParticipants,
|
|
|
|
},
|
2021-05-06 05:18:56 -04:00
|
|
|
[IssuableType.Epic]: {
|
|
|
|
query: epicParticipantsQuery,
|
|
|
|
},
|
2021-05-25 17:10:26 -04:00
|
|
|
[IssuableType.Alert]: {
|
|
|
|
query: '',
|
|
|
|
skipQuery: true,
|
|
|
|
},
|
2021-02-17 04:09:36 -05:00
|
|
|
};
|
2021-02-25 07:11:01 -05:00
|
|
|
|
|
|
|
export const confidentialityQueries = {
|
|
|
|
[IssuableType.Issue]: {
|
|
|
|
query: issueConfidentialQuery,
|
|
|
|
mutation: updateIssueConfidentialMutation,
|
|
|
|
},
|
2021-03-04 07:11:11 -05:00
|
|
|
[IssuableType.Epic]: {
|
|
|
|
query: epicConfidentialQuery,
|
2021-04-28 05:10:13 -04:00
|
|
|
mutation: updateEpicConfidentialMutation,
|
2021-03-04 07:11:11 -05:00
|
|
|
},
|
2021-02-25 07:11:01 -05:00
|
|
|
};
|
2021-03-15 11:09:07 -04:00
|
|
|
|
|
|
|
export const referenceQueries = {
|
|
|
|
[IssuableType.Issue]: {
|
|
|
|
query: issueReferenceQuery,
|
|
|
|
},
|
|
|
|
[IssuableType.MergeRequest]: {
|
|
|
|
query: mergeRequestReferenceQuery,
|
|
|
|
},
|
2021-07-12 05:09:40 -04:00
|
|
|
[IssuableType.Epic]: {
|
|
|
|
query: epicReferenceQuery,
|
|
|
|
},
|
2021-03-15 11:09:07 -04:00
|
|
|
};
|
2021-04-13 05:11:10 -04:00
|
|
|
|
2021-10-26 05:09:57 -04:00
|
|
|
export const workspaceLabelsQueries = {
|
|
|
|
[WorkspaceType.project]: {
|
|
|
|
query: projectLabelsQuery,
|
2021-09-28 23:12:00 -04:00
|
|
|
},
|
2021-10-26 05:09:57 -04:00
|
|
|
[WorkspaceType.group]: {
|
|
|
|
query: groupLabelsQuery,
|
2021-09-28 23:12:00 -04:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2021-10-26 05:09:57 -04:00
|
|
|
export const issuableLabelsQueries = {
|
2021-10-21 05:09:48 -04:00
|
|
|
[IssuableType.Issue]: {
|
2021-10-26 05:09:57 -04:00
|
|
|
issuableQuery: issueLabelsQuery,
|
2021-10-21 05:09:48 -04:00
|
|
|
mutation: updateIssueLabelsMutation,
|
|
|
|
mutationName: 'updateIssue',
|
|
|
|
},
|
|
|
|
[IssuableType.MergeRequest]: {
|
2021-11-02 05:09:49 -04:00
|
|
|
issuableQuery: mergeRequestLabelsQuery,
|
2021-10-21 05:09:48 -04:00
|
|
|
mutation: updateMergeRequestLabelsMutation,
|
|
|
|
mutationName: 'mergeRequestSetLabels',
|
|
|
|
},
|
2021-10-26 05:09:57 -04:00
|
|
|
[IssuableType.Epic]: {
|
|
|
|
issuableQuery: epicLabelsQuery,
|
|
|
|
mutation: updateEpicLabelsMutation,
|
|
|
|
mutationName: 'updateEpic',
|
|
|
|
},
|
2021-10-21 05:09:48 -04:00
|
|
|
};
|
|
|
|
|
2021-04-28 05:10:13 -04:00
|
|
|
export const dateTypes = {
|
|
|
|
start: 'startDate',
|
|
|
|
due: 'dueDate',
|
|
|
|
};
|
|
|
|
|
|
|
|
export const dateFields = {
|
|
|
|
[dateTypes.start]: {
|
|
|
|
isDateFixed: 'startDateIsFixed',
|
|
|
|
dateFixed: 'startDateFixed',
|
|
|
|
dateFromMilestones: 'startDateFromMilestones',
|
|
|
|
},
|
|
|
|
[dateTypes.due]: {
|
|
|
|
isDateFixed: 'dueDateIsFixed',
|
|
|
|
dateFixed: 'dueDateFixed',
|
|
|
|
dateFromMilestones: 'dueDateFromMilestones',
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2021-05-04 08:10:04 -04:00
|
|
|
export const subscribedQueries = {
|
|
|
|
[IssuableType.Issue]: {
|
|
|
|
query: issueSubscribedQuery,
|
|
|
|
mutation: updateIssueSubscriptionMutation,
|
|
|
|
},
|
|
|
|
[IssuableType.Epic]: {
|
|
|
|
query: epicSubscribedQuery,
|
|
|
|
mutation: updateEpicSubscriptionMutation,
|
|
|
|
},
|
|
|
|
[IssuableType.MergeRequest]: {
|
|
|
|
query: mergeRequestSubscribed,
|
|
|
|
mutation: updateMergeRequestSubscriptionMutation,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2021-07-09 02:08:14 -04:00
|
|
|
export const Tracking = {
|
|
|
|
editEvent: 'click_edit_button',
|
|
|
|
rightSidebarLabel: 'right_sidebar',
|
|
|
|
};
|
|
|
|
|
2021-06-15 17:10:04 -04:00
|
|
|
export const timeTrackingQueries = {
|
|
|
|
[IssuableType.Issue]: {
|
|
|
|
query: issueTimeTrackingQuery,
|
|
|
|
},
|
|
|
|
[IssuableType.MergeRequest]: {
|
|
|
|
query: mergeRequestTimeTrackingQuery,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2021-04-13 05:11:10 -04:00
|
|
|
export const dueDateQueries = {
|
|
|
|
[IssuableType.Issue]: {
|
|
|
|
query: issueDueDateQuery,
|
|
|
|
mutation: updateIssueDueDateMutation,
|
|
|
|
},
|
2021-04-28 05:10:13 -04:00
|
|
|
[IssuableType.Epic]: {
|
|
|
|
query: epicDueDateQuery,
|
|
|
|
mutation: updateEpicDueDateMutation,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
export const startDateQueries = {
|
|
|
|
[IssuableType.Epic]: {
|
|
|
|
query: epicStartDateQuery,
|
|
|
|
mutation: updateEpicStartDateMutation,
|
|
|
|
},
|
2021-04-13 05:11:10 -04:00
|
|
|
};
|
2021-05-14 05:10:24 -04:00
|
|
|
|
|
|
|
export const timelogQueries = {
|
|
|
|
[IssuableType.Issue]: {
|
|
|
|
query: getIssueTimelogsQuery,
|
|
|
|
},
|
|
|
|
[IssuableType.MergeRequest]: {
|
|
|
|
query: getMrTimelogsQuery,
|
|
|
|
},
|
|
|
|
};
|
2021-06-08 05:09:56 -04:00
|
|
|
|
|
|
|
export const noAttributeId = null;
|
|
|
|
|
|
|
|
export const issuableMilestoneQueries = {
|
|
|
|
[IssuableType.Issue]: {
|
|
|
|
query: projectIssueMilestoneQuery,
|
|
|
|
mutation: projectIssueMilestoneMutation,
|
|
|
|
},
|
2021-07-07 14:08:30 -04:00
|
|
|
[IssuableType.MergeRequest]: {
|
|
|
|
query: mergeRequestMilestone,
|
|
|
|
mutation: mergeRequestMilestoneMutation,
|
|
|
|
},
|
2021-06-08 05:09:56 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
export const milestonesQueries = {
|
|
|
|
[IssuableType.Issue]: {
|
|
|
|
query: projectMilestonesQuery,
|
|
|
|
},
|
2021-07-07 14:08:30 -04:00
|
|
|
[IssuableType.MergeRequest]: {
|
|
|
|
query: projectMilestonesQuery,
|
|
|
|
},
|
2021-06-08 05:09:56 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
export const IssuableAttributeType = {
|
|
|
|
Milestone: 'milestone',
|
|
|
|
};
|
|
|
|
|
|
|
|
export const IssuableAttributeState = {
|
|
|
|
[IssuableAttributeType.Milestone]: 'active',
|
|
|
|
};
|
|
|
|
|
|
|
|
export const issuableAttributesQueries = {
|
|
|
|
[IssuableAttributeType.Milestone]: {
|
|
|
|
current: issuableMilestoneQueries,
|
|
|
|
list: milestonesQueries,
|
|
|
|
},
|
|
|
|
};
|
2021-06-30 05:08:07 -04:00
|
|
|
|
|
|
|
export const todoQueries = {
|
|
|
|
[IssuableType.Epic]: {
|
|
|
|
query: epicTodoQuery,
|
|
|
|
},
|
2021-07-15 02:09:39 -04:00
|
|
|
[IssuableType.Issue]: {
|
|
|
|
query: issueTodoQuery,
|
|
|
|
},
|
|
|
|
[IssuableType.MergeRequest]: {
|
|
|
|
query: mergeRequestTodoQuery,
|
|
|
|
},
|
2021-06-30 05:08:07 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
export const TodoMutationTypes = {
|
|
|
|
Create: 'create',
|
|
|
|
MarkDone: 'mark-done',
|
|
|
|
};
|
|
|
|
|
|
|
|
export const todoMutations = {
|
|
|
|
[TodoMutationTypes.Create]: todoCreateMutation,
|
|
|
|
[TodoMutationTypes.MarkDone]: todoMarkDoneMutation,
|
|
|
|
};
|
2021-11-25 01:12:46 -05:00
|
|
|
|
|
|
|
export function dropdowni18nText(issuableAttribute, issuableType) {
|
|
|
|
return {
|
|
|
|
noAttribute: sprintf(s__('DropdownWidget|No %{issuableAttribute}'), {
|
|
|
|
issuableAttribute,
|
|
|
|
}),
|
|
|
|
assignAttribute: sprintf(s__('DropdownWidget|Assign %{issuableAttribute}'), {
|
|
|
|
issuableAttribute,
|
|
|
|
}),
|
|
|
|
noAttributesFound: sprintf(s__('DropdownWidget|No %{issuableAttribute} found'), {
|
|
|
|
issuableAttribute,
|
|
|
|
}),
|
|
|
|
updateError: sprintf(
|
|
|
|
s__(
|
|
|
|
'DropdownWidget|Failed to set %{issuableAttribute} on this %{issuableType}. Please try again.',
|
|
|
|
),
|
|
|
|
{ issuableAttribute, issuableType },
|
|
|
|
),
|
|
|
|
listFetchError: sprintf(
|
|
|
|
s__(
|
|
|
|
'DropdownWidget|Failed to fetch the %{issuableAttribute} for this %{issuableType}. Please try again.',
|
|
|
|
),
|
|
|
|
{ issuableAttribute, issuableType },
|
|
|
|
),
|
|
|
|
currentFetchError: sprintf(
|
|
|
|
s__(
|
|
|
|
'DropdownWidget|An error occurred while fetching the assigned %{issuableAttribute} of the selected %{issuableType}.',
|
|
|
|
),
|
|
|
|
{ issuableAttribute, issuableType },
|
|
|
|
),
|
|
|
|
};
|
|
|
|
}
|