2022-11-25 23:54:43 +05:30
import { invert } from 'lodash' ;
2022-10-11 01:57:18 +05:30
import { s _ _ , _ _ , sprintf } from '~/locale' ;
2021-12-11 22:18:48 +05:30
import updateIssueLabelsMutation from '~/boards/graphql/issue_set_labels.mutation.graphql' ;
2022-05-07 20:08:51 +05:30
import userSearchQuery from '~/graphql_shared/queries/users_search.query.graphql' ;
import userSearchWithMRPermissionsQuery from '~/graphql_shared/queries/users_search_with_mr_permissions.graphql' ;
2023-05-27 22:25:52 +05:30
import {
TYPE _ALERT ,
TYPE _EPIC ,
TYPE _ISSUE ,
TYPE _MERGE _REQUEST ,
TYPE _TEST _CASE ,
WORKSPACE _GROUP ,
WORKSPACE _PROJECT ,
} from '~/issues/constants' ;
2021-09-04 01:27:46 +05:30
import updateAlertAssigneesMutation from '~/vue_shared/alert_details/graphql/mutations/alert_set_assignees.mutation.graphql' ;
2023-06-20 00:43:36 +05:30
import issuableDatesUpdatedSubscription from '../graphql_shared/subscriptions/work_item_dates.subscription.graphql' ;
2023-04-23 21:23:45 +05:30
import updateTestCaseLabelsMutation from './components/labels/labels_select_widget/graphql/update_test_case_labels.mutation.graphql' ;
2023-03-04 22:38:38 +05:30
import epicLabelsQuery from './components/labels/labels_select_widget/graphql/epic_labels.query.graphql' ;
import updateEpicLabelsMutation from './components/labels/labels_select_widget/graphql/epic_update_labels.mutation.graphql' ;
import groupLabelsQuery from './components/labels/labels_select_widget/graphql/group_labels.query.graphql' ;
import issueLabelsQuery from './components/labels/labels_select_widget/graphql/issue_labels.query.graphql' ;
import mergeRequestLabelsQuery from './components/labels/labels_select_widget/graphql/merge_request_labels.query.graphql' ;
import projectLabelsQuery from './components/labels/labels_select_widget/graphql/project_labels.query.graphql' ;
import epicConfidentialQuery from './queries/epic_confidential.query.graphql' ;
import epicDueDateQuery from './queries/epic_due_date.query.graphql' ;
import epicParticipantsQuery from './queries/epic_participants.query.graphql' ;
import epicReferenceQuery from './queries/epic_reference.query.graphql' ;
import epicStartDateQuery from './queries/epic_start_date.query.graphql' ;
import epicSubscribedQuery from './queries/epic_subscribed.query.graphql' ;
import epicTodoQuery from './queries/epic_todo.query.graphql' ;
import issuableAssigneesSubscription from './queries/issuable_assignees.subscription.graphql' ;
import issueConfidentialQuery from './queries/issue_confidential.query.graphql' ;
import issueDueDateQuery from './queries/issue_due_date.query.graphql' ;
import issueReferenceQuery from './queries/issue_reference.query.graphql' ;
import issueSubscribedQuery from './queries/issue_subscribed.query.graphql' ;
import issueTimeTrackingQuery from './queries/issue_time_tracking.query.graphql' ;
import issueTodoQuery from './queries/issue_todo.query.graphql' ;
import mergeRequestMilestone from './queries/merge_request_milestone.query.graphql' ;
import mergeRequestReferenceQuery from './queries/merge_request_reference.query.graphql' ;
import mergeRequestSubscribed from './queries/merge_request_subscribed.query.graphql' ;
import mergeRequestTimeTrackingQuery from './queries/merge_request_time_tracking.query.graphql' ;
import mergeRequestTodoQuery from './queries/merge_request_todo.query.graphql' ;
import todoCreateMutation from './queries/todo_create.mutation.graphql' ;
import todoMarkDoneMutation from './queries/todo_mark_done.mutation.graphql' ;
import updateEpicConfidentialMutation from './queries/update_epic_confidential.mutation.graphql' ;
import updateEpicDueDateMutation from './queries/update_epic_due_date.mutation.graphql' ;
import updateEpicStartDateMutation from './queries/update_epic_start_date.mutation.graphql' ;
import updateEpicSubscriptionMutation from './queries/update_epic_subscription.mutation.graphql' ;
import updateIssueConfidentialMutation from './queries/update_issue_confidential.mutation.graphql' ;
import updateIssueDueDateMutation from './queries/update_issue_due_date.mutation.graphql' ;
import updateIssueSubscriptionMutation from './queries/update_issue_subscription.mutation.graphql' ;
import mergeRequestMilestoneMutation from './queries/update_merge_request_milestone.mutation.graphql' ;
import updateMergeRequestLabelsMutation from './queries/update_merge_request_labels.mutation.graphql' ;
import updateMergeRequestSubscriptionMutation from './queries/update_merge_request_subscription.mutation.graphql' ;
import getAlertAssignees from './queries/get_alert_assignees.query.graphql' ;
import getIssueAssignees from './queries/get_issue_assignees.query.graphql' ;
import issueParticipantsQuery from './queries/get_issue_participants.query.graphql' ;
import getIssueTimelogsQuery from './queries/get_issue_timelogs.query.graphql' ;
import getMergeRequestAssignees from './queries/get_mr_assignees.query.graphql' ;
import getMergeRequestParticipants from './queries/get_mr_participants.query.graphql' ;
import getMrTimelogsQuery from './queries/get_mr_timelogs.query.graphql' ;
import updateIssueAssigneesMutation from './queries/update_issue_assignees.mutation.graphql' ;
import updateMergeRequestAssigneesMutation from './queries/update_mr_assignees.mutation.graphql' ;
import getEscalationStatusQuery from './queries/escalation_status.query.graphql' ;
import updateEscalationStatusMutation from './queries/update_escalation_status.mutation.graphql' ;
2023-01-13 00:05:48 +05:30
import groupMilestonesQuery from './queries/group_milestones.query.graphql' ;
2021-09-04 01:27:46 +05:30
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-03-11 19:13:27 +05:30
2021-09-30 23:02:18 +05:30
export const defaultEpicSort = 'TITLE_ASC' ;
2021-04-17 20:07:23 +05:30
2021-10-27 15:23:28 +05:30
export const epicIidPattern = /^&(?<iid>\d+)$/ ;
2021-03-11 19:13:27 +05:30
export const assigneesQueries = {
2023-04-23 21:23:45 +05:30
[ TYPE _ISSUE ] : {
2021-06-08 01:23:25 +05:30
query : getIssueAssignees ,
subscription : issuableAssigneesSubscription ,
mutation : updateIssueAssigneesMutation ,
} ,
2023-05-27 22:25:52 +05:30
[ TYPE _MERGE _REQUEST ] : {
2021-06-08 01:23:25 +05:30
query : getMergeRequestAssignees ,
mutation : updateMergeRequestAssigneesMutation ,
} ,
2023-05-27 22:25:52 +05:30
[ TYPE _ALERT ] : {
2021-09-04 01:27:46 +05:30
query : getAlertAssignees ,
mutation : updateAlertAssigneesMutation ,
} ,
2021-06-08 01:23:25 +05:30
} ;
export const participantsQueries = {
2023-04-23 21:23:45 +05:30
[ TYPE _ISSUE ] : {
2021-06-08 01:23:25 +05:30
query : issueParticipantsQuery ,
2021-03-11 19:13:27 +05:30
} ,
2023-05-27 22:25:52 +05:30
[ TYPE _MERGE _REQUEST ] : {
2021-03-11 19:13:27 +05:30
query : getMergeRequestParticipants ,
2021-06-08 01:23:25 +05:30
} ,
2023-04-23 21:23:45 +05:30
[ TYPE _EPIC ] : {
2021-06-08 01:23:25 +05:30
query : epicParticipantsQuery ,
2021-03-11 19:13:27 +05:30
} ,
2023-05-27 22:25:52 +05:30
[ TYPE _ALERT ] : {
2021-09-04 01:27:46 +05:30
query : '' ,
skipQuery : true ,
} ,
2021-03-11 19:13:27 +05:30
} ;
2021-04-17 20:07:23 +05:30
2022-05-07 20:08:51 +05:30
export const userSearchQueries = {
2023-04-23 21:23:45 +05:30
[ TYPE _ISSUE ] : {
2022-05-07 20:08:51 +05:30
query : userSearchQuery ,
} ,
2023-05-27 22:25:52 +05:30
[ TYPE _MERGE _REQUEST ] : {
2022-05-07 20:08:51 +05:30
query : userSearchWithMRPermissionsQuery ,
} ,
} ;
2021-04-17 20:07:23 +05:30
export const confidentialityQueries = {
2023-04-23 21:23:45 +05:30
[ TYPE _ISSUE ] : {
2021-04-17 20:07:23 +05:30
query : issueConfidentialQuery ,
mutation : updateIssueConfidentialMutation ,
} ,
2023-04-23 21:23:45 +05:30
[ TYPE _EPIC ] : {
2021-04-17 20:07:23 +05:30
query : epicConfidentialQuery ,
2021-06-08 01:23:25 +05:30
mutation : updateEpicConfidentialMutation ,
2021-04-17 20:07:23 +05:30
} ,
} ;
export const referenceQueries = {
2023-04-23 21:23:45 +05:30
[ TYPE _ISSUE ] : {
2021-04-17 20:07:23 +05:30
query : issueReferenceQuery ,
} ,
2023-05-27 22:25:52 +05:30
[ TYPE _MERGE _REQUEST ] : {
2021-04-17 20:07:23 +05:30
query : mergeRequestReferenceQuery ,
} ,
2023-04-23 21:23:45 +05:30
[ TYPE _EPIC ] : {
2021-09-30 23:02:18 +05:30
query : epicReferenceQuery ,
} ,
2021-04-17 20:07:23 +05:30
} ;
2021-04-29 21:17:54 +05:30
2021-12-11 22:18:48 +05:30
export const workspaceLabelsQueries = {
2023-05-27 22:25:52 +05:30
[ WORKSPACE _PROJECT ] : {
2021-12-11 22:18:48 +05:30
query : projectLabelsQuery ,
} ,
2023-05-27 22:25:52 +05:30
[ WORKSPACE _GROUP ] : {
2021-12-11 22:18:48 +05:30
query : groupLabelsQuery ,
} ,
} ;
export const issuableLabelsQueries = {
2023-04-23 21:23:45 +05:30
[ TYPE _ISSUE ] : {
2021-11-18 22:05:49 +05:30
issuableQuery : issueLabelsQuery ,
2021-12-11 22:18:48 +05:30
mutation : updateIssueLabelsMutation ,
mutationName : 'updateIssue' ,
} ,
2023-05-27 22:25:52 +05:30
[ TYPE _MERGE _REQUEST ] : {
2021-12-11 22:18:48 +05:30
issuableQuery : mergeRequestLabelsQuery ,
mutation : updateMergeRequestLabelsMutation ,
mutationName : 'mergeRequestSetLabels' ,
2021-11-18 22:05:49 +05:30
} ,
2023-04-23 21:23:45 +05:30
[ TYPE _EPIC ] : {
2021-11-18 22:05:49 +05:30
issuableQuery : epicLabelsQuery ,
2021-12-11 22:18:48 +05:30
mutation : updateEpicLabelsMutation ,
mutationName : 'updateEpic' ,
2021-11-18 22:05:49 +05:30
} ,
2023-05-27 22:25:52 +05:30
[ TYPE _TEST _CASE ] : {
2023-04-23 21:23:45 +05:30
issuableQuery : issueLabelsQuery ,
mutation : updateTestCaseLabelsMutation ,
mutationName : 'updateTestCaseLabels' ,
} ,
2021-11-18 22:05:49 +05:30
} ;
2021-06-08 01:23:25 +05:30
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' ,
} ,
} ;
export const subscribedQueries = {
2023-04-23 21:23:45 +05:30
[ TYPE _ISSUE ] : {
2021-06-08 01:23:25 +05:30
query : issueSubscribedQuery ,
mutation : updateIssueSubscriptionMutation ,
} ,
2023-04-23 21:23:45 +05:30
[ TYPE _EPIC ] : {
2021-06-08 01:23:25 +05:30
query : epicSubscribedQuery ,
mutation : updateEpicSubscriptionMutation ,
} ,
2023-05-27 22:25:52 +05:30
[ TYPE _MERGE _REQUEST ] : {
2021-06-08 01:23:25 +05:30
query : mergeRequestSubscribed ,
mutation : updateMergeRequestSubscriptionMutation ,
} ,
} ;
2021-09-30 23:02:18 +05:30
export const Tracking = {
editEvent : 'click_edit_button' ,
rightSidebarLabel : 'right_sidebar' ,
} ;
2021-09-04 01:27:46 +05:30
export const timeTrackingQueries = {
2023-04-23 21:23:45 +05:30
[ TYPE _ISSUE ] : {
2021-09-04 01:27:46 +05:30
query : issueTimeTrackingQuery ,
} ,
2023-05-27 22:25:52 +05:30
[ TYPE _MERGE _REQUEST ] : {
2021-09-04 01:27:46 +05:30
query : mergeRequestTimeTrackingQuery ,
} ,
} ;
2021-04-29 21:17:54 +05:30
export const dueDateQueries = {
2023-04-23 21:23:45 +05:30
[ TYPE _ISSUE ] : {
2021-04-29 21:17:54 +05:30
query : issueDueDateQuery ,
mutation : updateIssueDueDateMutation ,
2023-06-20 00:43:36 +05:30
subscription : issuableDatesUpdatedSubscription ,
2021-04-29 21:17:54 +05:30
} ,
2023-04-23 21:23:45 +05:30
[ TYPE _EPIC ] : {
2021-06-08 01:23:25 +05:30
query : epicDueDateQuery ,
mutation : updateEpicDueDateMutation ,
} ,
} ;
export const startDateQueries = {
2023-04-23 21:23:45 +05:30
[ TYPE _EPIC ] : {
2021-06-08 01:23:25 +05:30
query : epicStartDateQuery ,
mutation : updateEpicStartDateMutation ,
} ,
} ;
export const timelogQueries = {
2023-04-23 21:23:45 +05:30
[ TYPE _ISSUE ] : {
2021-06-08 01:23:25 +05:30
query : getIssueTimelogsQuery ,
} ,
2023-05-27 22:25:52 +05:30
[ TYPE _MERGE _REQUEST ] : {
2021-06-08 01:23:25 +05:30
query : getMrTimelogsQuery ,
} ,
2021-04-29 21:17:54 +05:30
} ;
2021-09-04 01:27:46 +05:30
export const noAttributeId = null ;
export const issuableMilestoneQueries = {
2023-04-23 21:23:45 +05:30
[ TYPE _ISSUE ] : {
2021-09-04 01:27:46 +05:30
query : projectIssueMilestoneQuery ,
mutation : projectIssueMilestoneMutation ,
} ,
2023-05-27 22:25:52 +05:30
[ TYPE _MERGE _REQUEST ] : {
2021-09-30 23:02:18 +05:30
query : mergeRequestMilestone ,
mutation : mergeRequestMilestoneMutation ,
} ,
2021-09-04 01:27:46 +05:30
} ;
export const milestonesQueries = {
2023-04-23 21:23:45 +05:30
[ TYPE _ISSUE ] : {
2023-01-13 00:05:48 +05:30
query : {
2023-05-27 22:25:52 +05:30
[ WORKSPACE _GROUP ] : groupMilestonesQuery ,
[ WORKSPACE _PROJECT ] : projectMilestonesQuery ,
2023-01-13 00:05:48 +05:30
} ,
2021-09-04 01:27:46 +05:30
} ,
2023-05-27 22:25:52 +05:30
[ TYPE _MERGE _REQUEST ] : {
2023-01-13 00:05:48 +05:30
query : {
2023-05-27 22:25:52 +05:30
[ WORKSPACE _GROUP ] : groupMilestonesQuery ,
[ WORKSPACE _PROJECT ] : projectMilestonesQuery ,
2023-01-13 00:05:48 +05:30
} ,
2021-09-30 23:02:18 +05:30
} ,
2021-09-04 01:27:46 +05:30
} ;
export const IssuableAttributeType = {
Milestone : 'milestone' ,
} ;
2022-11-25 23:54:43 +05:30
export const LocalizedIssuableAttributeType = {
Milestone : s _ _ ( 'Issuable|milestone' ) ,
} ;
export const IssuableAttributeTypeKeyMap = invert ( IssuableAttributeType ) ;
2021-09-04 01:27:46 +05:30
export const IssuableAttributeState = {
[ IssuableAttributeType . Milestone ] : 'active' ,
} ;
export const issuableAttributesQueries = {
[ IssuableAttributeType . Milestone ] : {
current : issuableMilestoneQueries ,
list : milestonesQueries ,
} ,
} ;
2021-09-30 23:02:18 +05:30
export const todoQueries = {
2023-04-23 21:23:45 +05:30
[ TYPE _EPIC ] : {
2021-09-30 23:02:18 +05:30
query : epicTodoQuery ,
} ,
2023-04-23 21:23:45 +05:30
[ TYPE _ISSUE ] : {
2021-09-30 23:02:18 +05:30
query : issueTodoQuery ,
} ,
2023-05-27 22:25:52 +05:30
[ TYPE _MERGE _REQUEST ] : {
2021-09-30 23:02:18 +05:30
query : mergeRequestTodoQuery ,
} ,
} ;
export const TodoMutationTypes = {
Create : 'create' ,
MarkDone : 'mark-done' ,
} ;
export const todoMutations = {
[ TodoMutationTypes . Create ] : todoCreateMutation ,
[ TodoMutationTypes . MarkDone ] : todoMarkDoneMutation ,
} ;
2022-01-26 12:08:38 +05:30
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 } ,
) ,
2022-10-11 01:57:18 +05:30
noPermissionToView : sprintf (
s _ _ ( "DropdownWidget|You don't have permission to view this %{issuableAttribute}." ) ,
{ issuableAttribute } ,
) ,
editConfirmation : sprintf (
s _ _ (
'DropdownWidget|You do not have permission to view the currently assigned %{issuableAttribute} and will not be able to choose it again if you reassign it.' ,
) ,
{
issuableAttribute ,
} ,
) ,
editConfirmationCta : sprintf ( s _ _ ( 'DropdownWidget|Edit %{issuableAttribute}' ) , {
issuableAttribute ,
} ) ,
editConfirmationCancel : s _ _ ( 'DropdownWidget|Cancel' ) ,
2022-01-26 12:08:38 +05:30
} ;
}
2022-05-07 20:08:51 +05:30
export const escalationStatusQuery = getEscalationStatusQuery ;
export const escalationStatusMutation = updateEscalationStatusMutation ;
2022-10-11 01:57:18 +05:30
export const HOW _TO _TRACK _TIME = _ _ ( 'How to track time' ) ;
2023-03-04 22:38:38 +05:30
export const statusDropdownOptions = [
{
text : _ _ ( 'Open' ) ,
value : 'reopen' ,
} ,
{
text : _ _ ( 'Closed' ) ,
value : 'close' ,
} ,
] ;
export const subscriptionsDropdownOptions = [
{
text : _ _ ( 'Subscribe' ) ,
value : 'subscribe' ,
} ,
{
text : _ _ ( 'Unsubscribe' ) ,
value : 'unsubscribe' ,
} ,
] ;
export const INCIDENT _SEVERITY = {
CRITICAL : {
value : 'CRITICAL' ,
icon : 'critical' ,
label : s _ _ ( 'IncidentManagement|Critical - S1' ) ,
} ,
HIGH : {
value : 'HIGH' ,
icon : 'high' ,
label : s _ _ ( 'IncidentManagement|High - S2' ) ,
} ,
MEDIUM : {
value : 'MEDIUM' ,
icon : 'medium' ,
label : s _ _ ( 'IncidentManagement|Medium - S3' ) ,
} ,
LOW : {
value : 'LOW' ,
icon : 'low' ,
label : s _ _ ( 'IncidentManagement|Low - S4' ) ,
} ,
UNKNOWN : {
value : 'UNKNOWN' ,
icon : 'unknown' ,
label : s _ _ ( 'IncidentManagement|Unknown' ) ,
} ,
} ;
export const MILESTONE _STATE = {
ACTIVE : 'active' ,
CLOSED : 'closed' ,
} ;
export const SEVERITY _I18N = {
UPDATE _SEVERITY _ERROR : s _ _ ( 'SeverityWidget|There was an error while updating severity.' ) ,
TRY _AGAIN : _ _ ( 'Please try again' ) ,
EDIT : _ _ ( 'Edit' ) ,
SEVERITY : s _ _ ( 'SeverityWidget|Severity' ) ,
SEVERITY _VALUE : s _ _ ( 'SeverityWidget|Severity: %{severity}' ) ,
} ;
export const STATUS _TRIGGERED = 'TRIGGERED' ;
export const STATUS _ACKNOWLEDGED = 'ACKNOWLEDGED' ;
export const STATUS _RESOLVED = 'RESOLVED' ;
export const STATUS _TRIGGERED _LABEL = s _ _ ( 'IncidentManagement|Triggered' ) ;
export const STATUS _ACKNOWLEDGED _LABEL = s _ _ ( 'IncidentManagement|Acknowledged' ) ;
export const STATUS _RESOLVED _LABEL = s _ _ ( 'IncidentManagement|Resolved' ) ;
export const STATUS _LABELS = {
[ STATUS _TRIGGERED ] : STATUS _TRIGGERED _LABEL ,
[ STATUS _ACKNOWLEDGED ] : STATUS _ACKNOWLEDGED _LABEL ,
[ STATUS _RESOLVED ] : STATUS _RESOLVED _LABEL ,
} ;
export const INCIDENTS _I18N = {
fetchError : s _ _ (
'IncidentManagement|An error occurred while fetching the incident status. Please reload the page.' ,
) ,
title : s _ _ ( 'IncidentManagement|Status' ) ,
updateError : s _ _ (
'IncidentManagement|An error occurred while updating the incident status. Please reload the page and try again.' ,
) ,
} ;