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

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

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 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207          68x   68x 68x   68x 68x 68x   68x 68x 68x 68x   68x   68x               68x 68x 68x 68x     68x 68x   68x                                                                             68x                             68x   68x                                                 68x         68x           68x                             68x                               68x                               68x 68x 68x       68x             68x                           68x 68x  
import { s__ } from '~/locale';
import { helpPagePath } from '~/helpers/help_page_helper';
import { DOCS_URL_IN_EE_DIR } from 'jh_else_ce/lib/utils/url_utility';
import { stateToComponentMap as classStateMap, stateKey } from './stores/state_maps';
 
export const FOUR_MINUTES_IN_MS = 1000 * 60 * 4;
 
export const STATE_QUERY_POLLING_INTERVAL_DEFAULT = 5000;
export const STATE_QUERY_POLLING_INTERVAL_BACKOFF = 1.2;
 
export const SUCCESS = 'success';
export const WARNING = 'warning';
export const INFO = 'info';
 
export const MWPS_MERGE_STRATEGY = 'merge_when_pipeline_succeeds';
export const MWCP_MERGE_STRATEGY = 'merge_when_checks_pass';
export const MTWPS_MERGE_STRATEGY = 'add_to_merge_train_when_pipeline_succeeds';
export const MT_MERGE_STRATEGY = 'merge_train';
 
export const PIPELINE_FAILED_STATE = 'failed';
 
export const AUTO_MERGE_STRATEGIES = [
  MWPS_MERGE_STRATEGY,
  MTWPS_MERGE_STRATEGY,
  MT_MERGE_STRATEGY,
  MWCP_MERGE_STRATEGY,
];
 
// SP - "Suggest Pipelines"
export const SP_TRACK_LABEL = 'no_pipeline_noticed';
export const SP_SHOW_TRACK_EVENT = 'click_button';
export const SP_SHOW_TRACK_VALUE = 10;
export const SP_HELP_CONTENT = s__(
  `mrWidget|GitLab %{linkStart}CI/CD can automatically build, test, and deploy your application.%{linkEnd} It only takes a few minutes to get started, and we can help you create a pipeline configuration file.`,
);
export const SP_HELP_URL = `${DOCS_URL_IN_EE_DIR}/ci/quick_start/`;
export const SP_ICON_NAME = 'status_notfound';
 
export const MERGE_ACTIVE_STATUS_PHRASES = [
  {
    message: s__('mrWidget|%{boldStart}Merging!%{boldEnd} Drum roll, please…'),
    emoji: 'drum',
  },
  {
    message: s__("mrWidget|%{boldStart}Merging!%{boldEnd} We're almost there…"),
    emoji: 'sparkles',
  },
  {
    message: s__('mrWidget|%{boldStart}Merging!%{boldEnd} Changes will land soon…'),
    emoji: 'airplane_arriving',
  },
  {
    message: s__('mrWidget|%{boldStart}Merging!%{boldEnd} Changes are being shipped…'),
    emoji: 'ship',
  },
  {
    message: s__("mrWidget|%{boldStart}Merging!%{boldEnd} Everything's good…"),
    emoji: 'relieved',
  },
  {
    message: s__('mrWidget|%{boldStart}Merging!%{boldEnd} This is going to be great…'),
    emoji: 'heart_eyes',
  },
  {
    message: s__('mrWidget|%{boldStart}Merging!%{boldEnd} Lift-off in 5… 4… 3…'),
    emoji: 'rocket',
  },
  {
    message: s__('mrWidget|%{boldStart}Merging!%{boldEnd} The changes are leaving the station…'),
    emoji: 'bullettrain_front',
  },
  {
    message: s__('mrWidget|%{boldStart}Merging!%{boldEnd} Take a deep breath and relax…'),
    emoji: 'sunglasses',
  },
];
 
const STATE_MACHINE = {
  states: {
    IDLE: 'IDLE',
    MERGING: 'MERGING',
    MERGED: 'MERGED',
    AUTO_MERGE: 'AUTO_MERGE',
  },
  transitions: {
    MERGE: 'start-merge',
    AUTO_MERGE: 'start-auto-merge',
    MERGE_FAILURE: 'merge-failed',
    MERGED: 'merge-done',
    MERGING: 'merging',
  },
};
const { states, transitions } = STATE_MACHINE;
 
STATE_MACHINE.definition = {
  initial: states.IDLE,
  states: {
    [states.IDLE]: {
      on: {
        [transitions.MERGE]: states.MERGING,
        [transitions.AUTO_MERGE]: states.AUTO_MERGE,
        [transitions.MERGING]: states.MERGING,
      },
    },
    [states.MERGING]: {
      on: {
        [transitions.MERGED]: states.MERGED,
        [transitions.MERGE_FAILURE]: states.IDLE,
      },
    },
    [states.AUTO_MERGE]: {
      on: {
        [transitions.MERGED]: states.IDLE,
        [transitions.MERGE_FAILURE]: states.IDLE,
      },
    },
  },
};
 
export const stateToTransitionMap = {
  [stateKey.merging]: transitions.MERGE,
  [stateKey.merged]: transitions.MERGED,
  [stateKey.autoMergeEnabled]: transitions.AUTO_MERGE,
};
export const stateToComponentMap = {
  [states.MERGING]: classStateMap[stateKey.merging],
  [states.MERGED]: classStateMap[stateKey.merged],
  [states.AUTO_MERGE]: classStateMap[stateKey.autoMergeEnabled],
};
 
export const EXTENSION_ICONS = {
  failed: 'failed',
  warning: 'warning',
  success: 'success',
  neutral: 'neutral',
  error: 'error',
  notice: 'notice',
  severityCritical: 'severityCritical',
  severityHigh: 'severityHigh',
  severityMedium: 'severityMedium',
  severityLow: 'severityLow',
  severityInfo: 'severityInfo',
  severityUnknown: 'severityUnknown',
};
 
export const EXTENSION_ICON_NAMES = {
  failed: 'status-failed',
  warning: 'status-alert',
  success: 'status-success',
  neutral: 'status-neutral',
  error: 'status-alert',
  notice: 'status-alert',
  scheduled: 'status-scheduled',
  severityCritical: 'severity-critical',
  severityHigh: 'severity-high',
  severityMedium: 'severity-medium',
  severityLow: 'severity-low',
  severityInfo: 'severity-info',
  severityUnknown: 'severity-unknown',
};
 
export const EXTENSION_ICON_CLASS = {
  failed: 'gl-text-red-500',
  warning: 'gl-text-orange-500',
  success: 'gl-text-green-500',
  neutral: 'gl-text-gray-400',
  error: 'gl-text-red-500',
  notice: 'gl-text-gray-500',
  scheduled: 'gl-text-blue-500',
  severityCritical: 'gl-text-red-800',
  severityHigh: 'gl-text-red-600',
  severityMedium: 'gl-text-orange-400',
  severityLow: 'gl-text-orange-300',
  severityInfo: 'gl-text-blue-400',
  severityUnknown: 'gl-text-gray-400',
};
 
export const TELEMETRY_WIDGET_VIEWED = 'WIDGET_VIEWED';
export const TELEMETRY_WIDGET_EXPANDED = 'WIDGET_EXPANDED';
export const TELEMETRY_WIDGET_FULL_REPORT_CLICKED = 'WIDGET_FULL_REPORT_CLICKED';
 
export { STATE_MACHINE };
 
export const INVALID_RULES_DOCS_PATH = helpPagePath(
  'user/project/merge_requests/approvals/index.md',
  {
    anchor: 'invalid-rules',
  },
);
 
export const DETAILED_MERGE_STATUS = {
  PREPARING: 'PREPARING',
  MERGEABLE: 'MERGEABLE',
  CHECKING: 'CHECKING',
  NOT_OPEN: 'NOT_OPEN',
  DISCUSSIONS_NOT_RESOLVED: 'DISCUSSIONS_NOT_RESOLVED',
  NOT_APPROVED: 'NOT_APPROVED',
  DRAFT_STATUS: 'DRAFT_STATUS',
  BLOCKED_STATUS: 'BLOCKED_STATUS',
  CI_MUST_PASS: 'CI_MUST_PASS',
  CI_STILL_RUNNING: 'CI_STILL_RUNNING',
  EXTERNAL_STATUS_CHECKS: 'EXTERNAL_STATUS_CHECKS',
};
 
export const MT_SKIP_TRAIN = 'skip';
export const MT_RESTART_TRAIN = 'restart';