2020-10-24 23:57:45 +05:30
import { s _ _ } from '~/locale' ;
2022-07-23 23:45:48 +05:30
import { helpPagePath } from '~/helpers/help_page_helper' ;
2021-11-18 22:05:49 +05:30
import { stateToComponentMap as classStateMap , stateKey } from './stores/state_maps' ;
2020-10-24 23:57:45 +05:30
2023-05-27 22:25:52 +05:30
export const FOUR _MINUTES _IN _MS = 1000 * 60 * 4 ;
export const STATE _QUERY _POLLING _INTERVAL _DEFAULT = 5000 ;
export const STATE _QUERY _POLLING _INTERVAL _BACKOFF = 2 ;
2020-07-28 23:09:34 +05:30
export const SUCCESS = 'success' ;
2019-07-07 11:18:12 +05:30
export const WARNING = 'warning' ;
2020-10-24 23:57:45 +05:30
export const INFO = 'info' ;
2019-09-04 21:01:54 +05:30
export const MWPS _MERGE _STRATEGY = 'merge_when_pipeline_succeeds' ;
2019-12-04 20:38:33 +05:30
export const MTWPS _MERGE _STRATEGY = 'add_to_merge_train_when_pipeline_succeeds' ;
2019-09-04 21:01:54 +05:30
export const MT _MERGE _STRATEGY = 'merge_train' ;
2021-11-11 11:23:49 +05:30
export const PIPELINE _FAILED _STATE = 'failed' ;
2019-12-04 20:38:33 +05:30
export const AUTO _MERGE _STRATEGIES = [ MWPS _MERGE _STRATEGY , MTWPS _MERGE _STRATEGY , MT _MERGE _STRATEGY ] ;
2020-10-24 23:57:45 +05:30
// 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-12-11 22:18:48 +05:30
` 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-10-24 23:57:45 +05:30
) ;
2021-12-11 22:18:48 +05:30
export const SP _HELP _URL = 'https://docs.gitlab.com/ee/ci/quick_start/' ;
2020-10-24 23:57:45 +05:30
export const SP _ICON _NAME = 'status_notfound' ;
2021-06-08 01:23:25 +05:30
export const MERGE _ACTIVE _STATUS _PHRASES = [
{
2023-04-23 21:23:45 +05:30
message : s _ _ ( 'mrWidget|%{boldStart}Merging!%{boldEnd} Drum roll, please…' ) ,
2021-06-08 01:23:25 +05:30
emoji : 'drum' ,
} ,
{
2023-04-23 21:23:45 +05:30
message : s _ _ ( "mrWidget|%{boldStart}Merging!%{boldEnd} We're almost there…" ) ,
2021-06-08 01:23:25 +05:30
emoji : 'sparkles' ,
} ,
{
2023-04-23 21:23:45 +05:30
message : s _ _ ( 'mrWidget|%{boldStart}Merging!%{boldEnd} Changes will land soon…' ) ,
2021-06-08 01:23:25 +05:30
emoji : 'airplane_arriving' ,
} ,
{
2023-04-23 21:23:45 +05:30
message : s _ _ ( 'mrWidget|%{boldStart}Merging!%{boldEnd} Changes are being shipped…' ) ,
2021-06-08 01:23:25 +05:30
emoji : 'ship' ,
} ,
{
2023-04-23 21:23:45 +05:30
message : s _ _ ( "mrWidget|%{boldStart}Merging!%{boldEnd} Everything's good…" ) ,
2021-06-08 01:23:25 +05:30
emoji : 'relieved' ,
} ,
{
2023-04-23 21:23:45 +05:30
message : s _ _ ( 'mrWidget|%{boldStart}Merging!%{boldEnd} This is going to be great…' ) ,
2021-06-08 01:23:25 +05:30
emoji : 'heart_eyes' ,
} ,
2022-01-26 12:08:38 +05:30
{
2023-04-23 21:23:45 +05:30
message : s _ _ ( 'mrWidget|%{boldStart}Merging!%{boldEnd} Lift-off in 5… 4… 3…' ) ,
2022-01-26 12:08:38 +05:30
emoji : 'rocket' ,
} ,
{
2023-04-23 21:23:45 +05:30
message : s _ _ ( 'mrWidget|%{boldStart}Merging!%{boldEnd} The changes are leaving the station…' ) ,
2022-01-26 12:08:38 +05:30
emoji : 'bullettrain_front' ,
} ,
{
2023-04-23 21:23:45 +05:30
message : s _ _ ( 'mrWidget|%{boldStart}Merging!%{boldEnd} Take a deep breath and relax…' ) ,
2022-01-26 12:08:38 +05:30
emoji : 'sunglasses' ,
} ,
2021-06-08 01:23:25 +05:30
] ;
2021-11-18 22:05:49 +05:30
const STATE _MACHINE = {
states : {
IDLE : 'IDLE' ,
MERGING : 'MERGING' ,
2022-04-04 11:22:00 +05:30
MERGED : 'MERGED' ,
2021-11-18 22:05:49 +05:30
AUTO _MERGE : 'AUTO_MERGE' ,
} ,
transitions : {
MERGE : 'start-merge' ,
AUTO _MERGE : 'start-auto-merge' ,
MERGE _FAILURE : 'merge-failed' ,
MERGED : 'merge-done' ,
2022-04-04 11:22:00 +05:30
MERGING : 'merging' ,
2021-11-18 22:05:49 +05:30
} ,
} ;
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 ,
2022-04-04 11:22:00 +05:30
[ transitions . MERGING ] : states . MERGING ,
2021-11-18 22:05:49 +05:30
} ,
} ,
[ states . MERGING ] : {
on : {
2022-04-04 11:22:00 +05:30
[ transitions . MERGED ] : states . MERGED ,
2021-11-18 22:05:49 +05:30
[ 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 ] ,
2022-04-04 11:22:00 +05:30
[ states . MERGED ] : classStateMap [ stateKey . merged ] ,
2021-11-18 22:05:49 +05:30
[ 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' ,
2022-10-11 01:57:18 +05:30
scheduled : 'status-scheduled' ,
2021-11-18 22:05:49 +05:30
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' ,
2022-10-11 01:57:18 +05:30
scheduled : 'gl-text-blue-500' ,
2021-11-18 22:05:49 +05:30
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' ,
} ;
2022-07-23 23:45:48 +05:30
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' ;
2021-11-18 22:05:49 +05:30
export { STATE _MACHINE } ;
2022-07-23 23:45:48 +05:30
export const INVALID _RULES _DOCS _PATH = helpPagePath (
'user/project/merge_requests/approvals/index.md' ,
{
anchor : 'invalid-rules' ,
} ,
) ;
2022-11-25 23:54:43 +05:30
export const DETAILED _MERGE _STATUS = {
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' ,
POLICIES _DENIED : 'POLICIES_DENIED' ,
CI _MUST _PASS : 'CI_MUST_PASS' ,
CI _STILL _RUNNING : 'CI_STILL_RUNNING' ,
2023-01-13 00:05:48 +05:30
EXTERNAL _STATUS _CHECKS : 'EXTERNAL_STATUS_CHECKS' ,
2022-11-25 23:54:43 +05:30
} ;