All files / app/assets/javascripts/related_issues constants.js

100% Statements 14/14
100% Branches 0/0
100% Functions 0/0
100% Lines 14/14

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107    31x           31x           31x           31x                                                 31x           31x           31x         31x         31x         31x         31x                     31x                   31x       31x        
import { __, sprintf } from '~/locale';
 
export const issuableTypesMap = {
  ISSUE: 'issue',
  EPIC: 'epic',
  MERGE_REQUEST: 'merge_request',
};
 
export const linkedIssueTypesMap = {
  BLOCKS: 'blocks',
  IS_BLOCKED_BY: 'is_blocked_by',
  RELATES_TO: 'relates_to',
};
 
export const linkedIssueTypesTextMap = {
  [linkedIssueTypesMap.RELATES_TO]: __('Relates to'),
  [linkedIssueTypesMap.BLOCKS]: __('Blocks'),
  [linkedIssueTypesMap.IS_BLOCKED_BY]: __('Is blocked by'),
};
 
export const autoCompleteTextMap = {
  true: {
    [issuableTypesMap.ISSUE]: sprintf(
      __(' or %{emphasisStart}#issue id%{emphasisEnd}'),
      { emphasisStart: '<', emphasisEnd: '>' },
      false,
    ),
    [issuableTypesMap.EPIC]: sprintf(
      __(' or %{emphasisStart}&epic id%{emphasisEnd}'),
      { emphasisStart: '<', emphasisEnd: '>' },
      false,
    ),
    [issuableTypesMap.MERGE_REQUEST]: sprintf(
      __(' or %{emphasisStart}!merge request id%{emphasisEnd}'),
      { emphasisStart: '<', emphasisEnd: '>' },
      false,
    ),
  },
  false: {
    [issuableTypesMap.ISSUE]: '',
    [issuableTypesMap.EPIC]: '',
    [issuableTypesMap.MERGE_REQUEST]: __(' or references (e.g. path/to/project!merge_request_id)'),
  },
};
 
export const inputPlaceholderTextMap = {
  [issuableTypesMap.ISSUE]: __('Paste issue link'),
  [issuableTypesMap.EPIC]: __('Paste epic link'),
  [issuableTypesMap.MERGE_REQUEST]: __('Enter merge request URLs'),
};
 
export const inputPlaceholderConfidentialTextMap = {
  [issuableTypesMap.ISSUE]: __('Paste confidential issue link'),
  [issuableTypesMap.EPIC]: __('Paste confidential epic link'),
  [issuableTypesMap.MERGE_REQUEST]: __('Enter merge request URLs'),
};
 
export const relatedIssuesRemoveErrorMap = {
  [issuableTypesMap.ISSUE]: __('An error occurred while removing issues.'),
  [issuableTypesMap.EPIC]: __('An error occurred while removing epics.'),
};
 
export const pathIndeterminateErrorMap = {
  [issuableTypesMap.ISSUE]: __('We could not determine the path to remove the issue'),
  [issuableTypesMap.EPIC]: __('We could not determine the path to remove the epic'),
};
 
export const itemAddFailureTypesMap = {
  NOT_FOUND: 'not_found',
  MAX_NUMBER_OF_CHILD_EPICS: 'conflict',
};
 
export const addRelatedIssueErrorMap = {
  [issuableTypesMap.ISSUE]: __('Issue cannot be found.'),
  [issuableTypesMap.EPIC]: __('Epic cannot be found.'),
};
 
export const addRelatedItemErrorMap = {
  [itemAddFailureTypesMap.MAX_NUMBER_OF_CHILD_EPICS]: __(
    'This epic already has the maximum number of child epics.',
  ),
};
 
/**
 * These are used to map issuableType to the correct icon.
 * Since these are never used for any display purposes, don't wrap
 * them inside i18n functions.
 */
export const issuableIconMap = {
  [issuableTypesMap.ISSUE]: 'issues',
  [issuableTypesMap.EPIC]: 'epic',
};
 
/**
 * These are used to map issuableType to the correct QA class.
 * Since these are never used for any display purposes, don't wrap
 * them inside i18n functions.
 */
export const issuableQaClassMap = {
  [issuableTypesMap.EPIC]: 'qa-add-epics-button',
};
 
export const PathIdSeparator = {
  Epic: '&',
  Issue: '#',
};