Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
98fb79db
Commit
98fb79db
authored
Feb 01, 2021
by
Ezekiel Kigbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use separate arrays for hidden stages
Cleans up the hidden and active stages in the form
parent
8219c379
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
36 deletions
+22
-36
ee/app/assets/javascripts/analytics/cycle_analytics/components/create_value_stream_form/constants.js
...nalytics/components/create_value_stream_form/constants.js
+2
-8
ee/app/assets/javascripts/analytics/cycle_analytics/components/value_stream_form.vue
...nalytics/cycle_analytics/components/value_stream_form.vue
+19
-25
ee/app/assets/javascripts/analytics/cycle_analytics/store/modules/custom_stages/mutations.js
.../cycle_analytics/store/modules/custom_stages/mutations.js
+0
-1
ee/app/assets/javascripts/analytics/cycle_analytics/store/mutations.js
.../javascripts/analytics/cycle_analytics/store/mutations.js
+1
-2
No files found.
ee/app/assets/javascripts/analytics/cycle_analytics/components/create_value_stream_form/constants.js
View file @
98fb79db
...
@@ -71,13 +71,7 @@ export const defaultFields = {
...
@@ -71,13 +71,7 @@ export const defaultFields = {
endEventLabelId
:
null
,
endEventLabelId
:
null
,
};
};
const
defaultStageCommonFields
=
{
custom
:
false
,
hidden
:
false
};
export
const
defaultCustomStageFields
=
{
...
defaultFields
,
custom
:
true
};
export
const
defaultCustomStageFields
=
{
...
defaultFields
,
...
defaultStageCommonFields
,
custom
:
true
,
};
/**
/**
* These stage configs are copied from the https://gitlab.com/gitlab-org/gitlab/-/tree/master/lib/gitlab/cycle_analytics
* These stage configs are copied from the https://gitlab.com/gitlab-org/gitlab/-/tree/master/lib/gitlab/cycle_analytics
...
@@ -120,7 +114,7 @@ const BASE_DEFAULT_STAGE_CONFIG = [
...
@@ -120,7 +114,7 @@ const BASE_DEFAULT_STAGE_CONFIG = [
export
const
DEFAULT_STAGE_CONFIG
=
BASE_DEFAULT_STAGE_CONFIG
.
map
(({
id
,
...
rest
})
=>
({
export
const
DEFAULT_STAGE_CONFIG
=
BASE_DEFAULT_STAGE_CONFIG
.
map
(({
id
,
...
rest
})
=>
({
...
rest
,
...
rest
,
...
defaultStageCommonFields
,
custom
:
false
,
name
:
capitalizeFirstCharacter
(
id
),
name
:
capitalizeFirstCharacter
(
id
),
}));
}));
...
...
ee/app/assets/javascripts/analytics/cycle_analytics/components/value_stream_form.vue
View file @
98fb79db
...
@@ -17,9 +17,6 @@ import { validateValueStreamName, validateStage } from './create_value_stream_fo
...
@@ -17,9 +17,6 @@ import { validateValueStreamName, validateStage } from './create_value_stream_fo
import
DefaultStageFields
from
'
./create_value_stream_form/default_stage_fields.vue
'
;
import
DefaultStageFields
from
'
./create_value_stream_form/default_stage_fields.vue
'
;
import
CustomStageFields
from
'
./create_value_stream_form/custom_stage_fields.vue
'
;
import
CustomStageFields
from
'
./create_value_stream_form/custom_stage_fields.vue
'
;
const
findStageIndexByName
=
(
stages
,
target
=
''
)
=>
stages
.
findIndex
(({
name
})
=>
name
===
target
);
const
initializeStageErrors
=
(
selectedPreset
=
PRESET_OPTIONS_DEFAULT
)
=>
const
initializeStageErrors
=
(
selectedPreset
=
PRESET_OPTIONS_DEFAULT
)
=>
selectedPreset
===
PRESET_OPTIONS_DEFAULT
?
DEFAULT_STAGE_CONFIG
.
map
(()
=>
({}))
:
[{}];
selectedPreset
===
PRESET_OPTIONS_DEFAULT
?
DEFAULT_STAGE_CONFIG
.
map
(()
=>
({}))
:
[{}];
...
@@ -30,10 +27,9 @@ const initializeStages = (selectedPreset = PRESET_OPTIONS_DEFAULT) =>
...
@@ -30,10 +27,9 @@ const initializeStages = (selectedPreset = PRESET_OPTIONS_DEFAULT) =>
const
formatStageDataForSubmission
=
(
stages
)
=>
{
const
formatStageDataForSubmission
=
(
stages
)
=>
{
return
stages
.
map
(({
custom
=
false
,
name
,
...
rest
})
=>
{
return
stages
.
map
(({
custom
=
false
,
name
,
...
rest
})
=>
{
const
additionalProps
=
custom
?
convertObjectPropsToSnakeCase
({
...
rest
})
:
{};
return
custom
return
{
?
convertObjectPropsToSnakeCase
({
...
rest
,
custom
,
name
})
...
additionalProps
,
:
{
custom
,
name
,
name
,
};
};
});
});
...
@@ -85,6 +81,7 @@ export default {
...
@@ -85,6 +81,7 @@ export default {
:
{
stages
:
[],
nameError
};
:
{
stages
:
[],
nameError
};
return
{
return
{
hiddenStages
:
[],
selectedPreset
:
initialPreset
,
selectedPreset
:
initialPreset
,
presetOptions
:
PRESET_OPTIONS
,
presetOptions
:
PRESET_OPTIONS
,
name
:
''
,
name
:
''
,
...
@@ -127,12 +124,6 @@ export default {
...
@@ -127,12 +124,6 @@ export default {
],
],
};
};
},
},
hiddenStages
()
{
return
this
.
stages
.
filter
((
stage
)
=>
stage
.
hidden
);
},
activeStages
()
{
return
this
.
stages
.
filter
((
stage
)
=>
!
stage
.
hidden
);
},
hasFormErrors
()
{
hasFormErrors
()
{
return
Boolean
(
return
Boolean
(
this
.
nameError
.
length
||
this
.
stageErrors
.
some
((
obj
)
=>
Object
.
keys
(
obj
).
length
),
this
.
nameError
.
length
||
this
.
stageErrors
.
some
((
obj
)
=>
Object
.
keys
(
obj
).
length
),
...
@@ -177,7 +168,7 @@ export default {
...
@@ -177,7 +168,7 @@ export default {
return
sprintf
(
this
.
$options
.
I18N
.
HIDDEN_DEFAULT_STAGE
,
{
name
});
return
sprintf
(
this
.
$options
.
I18N
.
HIDDEN_DEFAULT_STAGE
,
{
name
});
},
},
validateStages
()
{
validateStages
()
{
return
this
.
activeS
tages
.
map
(
validateStage
);
return
this
.
s
tages
.
map
(
validateStage
);
},
},
validate
()
{
validate
()
{
const
{
name
}
=
this
;
const
{
name
}
=
this
;
...
@@ -196,14 +187,15 @@ export default {
...
@@ -196,14 +187,15 @@ export default {
Vue
.
set
(
this
,
'
stages
'
,
newStages
);
Vue
.
set
(
this
,
'
stages
'
,
newStages
);
},
},
validateStageFields
(
index
)
{
validateStageFields
(
index
)
{
Vue
.
set
(
this
.
stageErrors
,
index
,
validateStage
(
this
.
activeS
tages
[
index
]));
Vue
.
set
(
this
.
stageErrors
,
index
,
validateStage
(
this
.
s
tages
[
index
]));
},
},
fieldErrors
(
index
)
{
fieldErrors
(
index
)
{
return
this
.
stageErrors
&&
this
.
stageErrors
[
index
]
?
this
.
stageErrors
[
index
]
:
{};
return
this
.
stageErrors
&&
this
.
stageErrors
[
index
]
?
this
.
stageErrors
[
index
]
:
{};
},
},
onHide
(
index
)
{
onHide
(
index
)
{
const
stage
=
this
.
stages
[
index
];
const
target
=
this
.
stages
[
index
];
Vue
.
set
(
this
.
stages
,
index
,
{
...
stage
,
hidden
:
true
});
Vue
.
set
(
this
,
'
stages
'
,
[...
this
.
stages
.
filter
((
_
,
i
)
=>
i
!==
index
)]);
Vue
.
set
(
this
,
'
hiddenStages
'
,
[...
this
.
hiddenStages
,
target
]);
},
},
onRemove
(
index
)
{
onRemove
(
index
)
{
const
newErrors
=
this
.
stageErrors
.
filter
((
_
,
idx
)
=>
idx
!==
index
);
const
newErrors
=
this
.
stageErrors
.
filter
((
_
,
idx
)
=>
idx
!==
index
);
...
@@ -212,9 +204,11 @@ export default {
...
@@ -212,9 +204,11 @@ export default {
Vue
.
set
(
this
,
'
stageErrors
'
,
[...
newErrors
]);
Vue
.
set
(
this
,
'
stageErrors
'
,
[...
newErrors
]);
},
},
onRestore
(
hiddenStageIndex
)
{
onRestore
(
hiddenStageIndex
)
{
const
stage
=
this
.
hiddenStages
[
hiddenStageIndex
];
const
target
=
this
.
hiddenStages
[
hiddenStageIndex
];
const
stageIndex
=
findStageIndexByName
(
this
.
stages
,
stage
.
name
);
Vue
.
set
(
this
,
'
hiddenStages
'
,
[
Vue
.
set
(
this
.
stages
,
stageIndex
,
{
...
stage
,
hidden
:
false
});
...
this
.
hiddenStages
.
filter
((
_
,
i
)
=>
i
!==
hiddenStageIndex
),
]);
Vue
.
set
(
this
,
'
stages
'
,
[...
this
.
stages
,
target
]);
},
},
onAddStage
()
{
onAddStage
()
{
// validate previous stages only and add a new stage
// validate previous stages only and add a new stage
...
@@ -297,7 +291,7 @@ export default {
...
@@ -297,7 +291,7 @@ export default {
@
input=
"onSelectPreset"
@
input=
"onSelectPreset"
/>
/>
<div
v-if=
"hasExtendedFormFields"
data-testid=
"extended-form-fields"
>
<div
v-if=
"hasExtendedFormFields"
data-testid=
"extended-form-fields"
>
<div
v-for=
"(stage, activeStageIndex) in
activeS
tages"
:key=
"stageKey(activeStageIndex)"
>
<div
v-for=
"(stage, activeStageIndex) in
s
tages"
:key=
"stageKey(activeStageIndex)"
>
<hr
class=
"gl-my-3"
/>
<hr
class=
"gl-my-3"
/>
<span
<span
class=
"gl-display-flex gl-m-0 gl-vertical-align-middle gl-mr-2 gl-font-weight-bold gl-display-flex gl-pb-3"
class=
"gl-display-flex gl-m-0 gl-vertical-align-middle gl-mr-2 gl-font-weight-bold gl-display-flex gl-pb-3"
...
@@ -308,7 +302,7 @@ export default {
...
@@ -308,7 +302,7 @@ export default {
:stage=
"stage"
:stage=
"stage"
:stage-events=
"formEvents"
:stage-events=
"formEvents"
:index=
"activeStageIndex"
:index=
"activeStageIndex"
:total-stages=
"
activeS
tages.length"
:total-stages=
"
s
tages.length"
:errors=
"fieldErrors(activeStageIndex)"
:errors=
"fieldErrors(activeStageIndex)"
@
move=
"handleMove"
@
move=
"handleMove"
@
remove=
"onRemove"
@
remove=
"onRemove"
...
@@ -319,7 +313,7 @@ export default {
...
@@ -319,7 +313,7 @@ export default {
:stage=
"stage"
:stage=
"stage"
:stage-events=
"formEvents"
:stage-events=
"formEvents"
:index=
"activeStageIndex"
:index=
"activeStageIndex"
:total-stages=
"
activeS
tages.length"
:total-stages=
"
s
tages.length"
:errors=
"fieldErrors(activeStageIndex)"
:errors=
"fieldErrors(activeStageIndex)"
@
move=
"handleMove"
@
move=
"handleMove"
@
hide=
"onHide"
@
hide=
"onHide"
...
...
ee/app/assets/javascripts/analytics/cycle_analytics/store/modules/custom_stages/mutations.js
View file @
98fb79db
...
@@ -66,7 +66,6 @@ export default {
...
@@ -66,7 +66,6 @@ export default {
},
},
[
types
.
RECEIVE_CREATE_STAGE_ERROR
](
state
)
{
[
types
.
RECEIVE_CREATE_STAGE_ERROR
](
state
)
{
state
.
isSavingCustomStage
=
false
;
state
.
isSavingCustomStage
=
false
;
// ??
state
.
isCreatingCustomStage
=
false
;
state
.
isCreatingCustomStage
=
false
;
state
.
isEditingCustomStage
=
false
;
state
.
isEditingCustomStage
=
false
;
},
},
...
...
ee/app/assets/javascripts/analytics/cycle_analytics/store/mutations.js
View file @
98fb79db
...
@@ -122,10 +122,9 @@ export default {
...
@@ -122,10 +122,9 @@ export default {
state
.
createValueStreamErrors
=
{};
state
.
createValueStreamErrors
=
{};
},
},
[
types
.
RECEIVE_CREATE_VALUE_STREAM_ERROR
](
state
,
{
data
:
{
stages
=
[]
},
errors
=
{}
})
{
[
types
.
RECEIVE_CREATE_VALUE_STREAM_ERROR
](
state
,
{
data
:
{
stages
=
[]
},
errors
=
{}
})
{
state
.
isCreatingValueStream
=
false
;
const
{
stages
:
stageErrors
=
{},
...
rest
}
=
errors
;
const
{
stages
:
stageErrors
=
{},
...
rest
}
=
errors
;
state
.
createValueStreamErrors
=
{
...
rest
,
stages
:
prepareStageErrors
(
stages
,
stageErrors
)
};
state
.
createValueStreamErrors
=
{
...
rest
,
stages
:
prepareStageErrors
(
stages
,
stageErrors
)
};
state
.
isCreatingValueStream
=
false
;
},
},
[
types
.
RECEIVE_CREATE_VALUE_STREAM_SUCCESS
](
state
,
valueStream
)
{
[
types
.
RECEIVE_CREATE_VALUE_STREAM_SUCCESS
](
state
,
valueStream
)
{
state
.
isCreatingValueStream
=
false
;
state
.
isCreatingValueStream
=
false
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment