2020-08-07 03:10:05 +00:00
import { s _ _ } from '~/locale' ;
2021-09-27 15:10:13 +00:00
import { stateToComponentMap as classStateMap , stateKey } from './stores/state_maps' ;
2020-08-07 03:10:05 +00:00
2020-07-13 15:09:08 +00:00
export const SUCCESS = 'success' ;
2019-04-15 13:25:48 +00:00
export const WARNING = 'warning' ;
export const DANGER = 'danger' ;
2020-08-13 12:09:50 +00:00
export const INFO = 'info' ;
2021-05-31 18:09:56 +00:00
export const CONFIRM = 'confirm' ;
2019-04-15 13:25:48 +00:00
2019-06-11 14:19:22 +00:00
export const MWPS _MERGE _STRATEGY = 'merge_when_pipeline_succeeds' ;
2019-08-22 17:53:14 +00:00
export const MTWPS _MERGE _STRATEGY = 'add_to_merge_train_when_pipeline_succeeds' ;
2019-06-11 14:19:22 +00:00
export const MT _MERGE _STRATEGY = 'merge_train' ;
2021-08-25 09:10:52 +00:00
export const PIPELINE _FAILED _STATE = 'failed' ;
2019-08-22 17:53:14 +00:00
export const AUTO _MERGE _STRATEGIES = [ MWPS _MERGE _STRATEGY , MTWPS _MERGE _STRATEGY , MT _MERGE _STRATEGY ] ;
2020-08-07 03:10:05 +00:00
// 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 _ _ (
2021-11-10 15:13:21 +00:00
` 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. ` ,
2020-08-07 03:10:05 +00:00
) ;
2021-11-10 15:13:21 +00:00
export const SP _HELP _URL = 'https://docs.gitlab.com/ee/ci/quick_start/' ;
2020-08-07 03:10:05 +00:00
export const SP _ICON _NAME = 'status_notfound' ;
2021-04-30 12:12:30 +00:00
export const MERGE _ACTIVE _STATUS _PHRASES = [
{
message : s _ _ ( 'mrWidget|Merging! Drum roll, please…' ) ,
emoji : 'drum' ,
} ,
{
message : s _ _ ( "mrWidget|Merging! We're almost there…" ) ,
emoji : 'sparkles' ,
} ,
{
message : s _ _ ( 'mrWidget|Merging! Changes will land soon…' ) ,
emoji : 'airplane_arriving' ,
} ,
{
message : s _ _ ( 'mrWidget|Merging! Changes are being shipped…' ) ,
emoji : 'ship' ,
} ,
{
message : s _ _ ( "mrWidget|Merging! Everything's good…" ) ,
emoji : 'relieved' ,
} ,
{
message : s _ _ ( 'mrWidget|Merging! This is going to be great…' ) ,
emoji : 'heart_eyes' ,
} ,
2021-11-23 15:11:19 +00:00
{
message : s _ _ ( 'mrWidget|Merging! Lift-off in 5… 4… 3…' ) ,
emoji : 'rocket' ,
} ,
{
message : s _ _ ( 'mrWidget|Merging! The changes are leaving the station…' ) ,
emoji : 'bullettrain_front' ,
} ,
{
message : s _ _ ( 'mrWidget|Merging! Take a deep breath and relax…' ) ,
emoji : 'sunglasses' ,
} ,
2021-04-30 12:12:30 +00:00
] ;
2021-09-27 15:10:13 +00:00
const STATE _MACHINE = {
states : {
IDLE : 'IDLE' ,
MERGING : 'MERGING' ,
2021-10-08 21:09:48 +00:00
AUTO _MERGE : 'AUTO_MERGE' ,
2021-09-27 15:10:13 +00:00
} ,
transitions : {
MERGE : 'start-merge' ,
2021-10-08 21:09:48 +00:00
AUTO _MERGE : 'start-auto-merge' ,
2021-09-27 15:10:13 +00:00
MERGE _FAILURE : 'merge-failed' ,
MERGED : 'merge-done' ,
} ,
} ;
const { states , transitions } = STATE _MACHINE ;
STATE _MACHINE . definition = {
initial : states . IDLE ,
states : {
[ states . IDLE ] : {
on : {
[ transitions . MERGE ] : states . MERGING ,
2021-10-08 21:09:48 +00:00
[ transitions . AUTO _MERGE ] : states . AUTO _MERGE ,
2021-09-27 15:10:13 +00:00
} ,
} ,
[ states . MERGING ] : {
on : {
[ transitions . MERGED ] : states . IDLE ,
[ transitions . MERGE _FAILURE ] : states . IDLE ,
} ,
} ,
2021-10-08 21:09:48 +00:00
[ states . AUTO _MERGE ] : {
on : {
[ transitions . MERGED ] : states . IDLE ,
[ transitions . MERGE _FAILURE ] : states . IDLE ,
} ,
} ,
2021-09-27 15:10:13 +00:00
} ,
} ;
export const stateToTransitionMap = {
[ stateKey . merging ] : transitions . MERGE ,
[ stateKey . merged ] : transitions . MERGED ,
2021-10-08 21:09:48 +00:00
[ stateKey . autoMergeEnabled ] : transitions . AUTO _MERGE ,
2021-09-27 15:10:13 +00:00
} ;
export const stateToComponentMap = {
[ states . MERGING ] : classStateMap [ stateKey . merging ] ,
2021-10-08 21:09:48 +00:00
[ states . AUTO _MERGE ] : classStateMap [ stateKey . autoMergeEnabled ] ,
2021-09-27 15:10:13 +00:00
} ;
2021-09-29 12:11:22 +00:00
export const EXTENSION _ICONS = {
2021-09-30 12:12:36 +00:00
failed : 'failed' ,
warning : 'warning' ,
success : 'success' ,
neutral : 'neutral' ,
error : 'error' ,
notice : 'notice' ,
2021-10-01 18:09:44 +00:00
severityCritical : 'severityCritical' ,
severityHigh : 'severityHigh' ,
severityMedium : 'severityMedium' ,
severityLow : 'severityLow' ,
severityInfo : 'severityInfo' ,
severityUnknown : 'severityUnknown' ,
2021-09-30 12:12:36 +00:00
} ;
export const EXTENSION _ICON _NAMES = {
2021-09-29 12:11:22 +00:00
failed : 'status-failed' ,
warning : 'status-alert' ,
success : 'status-success' ,
neutral : 'status-neutral' ,
2021-09-30 12:12:36 +00:00
error : 'status-alert' ,
notice : 'status-alert' ,
2021-10-01 18:09:44 +00:00
severityCritical : 'severity-critical' ,
severityHigh : 'severity-high' ,
severityMedium : 'severity-medium' ,
severityLow : 'severity-low' ,
severityInfo : 'severity-info' ,
severityUnknown : 'severity-unknown' ,
2021-09-29 12:11:22 +00:00
} ;
export const EXTENSION _ICON _CLASS = {
2021-09-30 12:12:36 +00:00
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' ,
2021-10-01 18:09:44 +00:00
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' ,
2021-09-29 12:11:22 +00:00
} ;
2021-12-06 15:14:39 +00:00
export const EXTENSION _SUMMARY _FAILED _CLASS = 'gl-text-red-500' ;
export const EXTENSION _SUMMARY _NEUTRAL _CLASS = 'gl-text-gray-700' ;
2021-09-27 15:10:13 +00:00
export { STATE _MACHINE } ;
2022-01-13 00:16:12 +00:00
export const REBASE _BUTTON _KEY = 'rebase' ;
export const REBASE _WITHOUT _CI _BUTTON _KEY = 'rebaseWithoutCi' ;