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
b960a114
Commit
b960a114
authored
May 07, 2020
by
Ezekiel Kigbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor review comments
Moved some the isStageNameExistsError function to a utils file
parent
4d69c73d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
22 deletions
+12
-22
ee/app/assets/javascripts/analytics/cycle_analytics/components/base.vue
...javascripts/analytics/cycle_analytics/components/base.vue
+4
-1
ee/app/assets/javascripts/analytics/cycle_analytics/store/actions.js
...ts/javascripts/analytics/cycle_analytics/store/actions.js
+2
-10
ee/app/assets/javascripts/analytics/cycle_analytics/store/modules/custom_stages/actions.js
...cs/cycle_analytics/store/modules/custom_stages/actions.js
+1
-10
ee/app/assets/javascripts/analytics/cycle_analytics/utils.js
ee/app/assets/javascripts/analytics/cycle_analytics/utils.js
+4
-0
ee/spec/frontend/analytics/cycle_analytics/store/actions_spec.js
.../frontend/analytics/cycle_analytics/store/actions_spec.js
+1
-1
No files found.
ee/app/assets/javascripts/analytics/cycle_analytics/components/base.vue
View file @
b960a114
...
...
@@ -103,6 +103,9 @@ export default {
isLoadingTypeOfWork
()
{
return
this
.
isLoadingTasksByTypeChartTopLabels
||
this
.
isLoadingTasksByTypeChart
;
},
isUpdatingCustomStage
()
{
return
this
.
isEditingCustomStage
&&
this
.
isSavingCustomStage
;
},
hasDateRangeSet
()
{
return
this
.
startDate
&&
this
.
endDate
;
},
...
...
@@ -296,7 +299,7 @@ export default {
/>
</
template
>
<
template
v-if=
"customStageFormActive"
#content
>
<div
v-if=
"is
EditingCustomStage && isSav
ingCustomStage"
>
<div
v-if=
"is
Updat
ingCustomStage"
>
<gl-loading-icon
class=
"mt-4"
size=
"md"
/>
</div>
<custom-stage-form
...
...
ee/app/assets/javascripts/analytics/cycle_analytics/store/actions.js
View file @
b960a114
...
...
@@ -3,15 +3,7 @@ import createFlash from '~/flash';
import
{
__
,
sprintf
}
from
'
~/locale
'
;
import
httpStatus
from
'
~/lib/utils/http_status
'
;
import
*
as
types
from
'
./mutation_types
'
;
import
{
removeFlash
,
handleErrorOrRethrow
}
from
'
../utils
'
;
const
isStageNameExistsError
=
({
status
,
errors
})
=>
{
const
ERROR_NAME_RESERVED
=
'
is reserved
'
;
if
(
status
===
httpStatus
.
UNPROCESSABLE_ENTITY
)
{
if
(
errors
?.
name
?.
includes
(
ERROR_NAME_RESERVED
))
return
true
;
}
return
false
;
};
import
{
removeFlash
,
handleErrorOrRethrow
,
isStageNameExistsError
}
from
'
../utils
'
;
export
const
setFeatureFlags
=
({
commit
},
featureFlags
)
=>
commit
(
types
.
SET_FEATURE_FLAGS
,
featureFlags
);
...
...
@@ -104,7 +96,7 @@ export const receiveCycleAnalyticsDataSuccess = ({ commit, dispatch }) => {
};
export
const
receiveCycleAnalyticsDataError
=
({
commit
},
{
response
})
=>
{
const
{
status
=
null
}
=
response
;
// non api errors thrown wont have a status field
const
{
status
=
null
}
=
response
;
// non api errors thrown won
'
t have a status field
commit
(
types
.
RECEIVE_CYCLE_ANALYTICS_DATA_ERROR
,
status
);
if
(
!
status
||
status
!==
httpStatus
.
FORBIDDEN
)
...
...
ee/app/assets/javascripts/analytics/cycle_analytics/store/modules/custom_stages/actions.js
View file @
b960a114
import
Api
from
'
ee/api
'
;
import
createFlash
from
'
~/flash
'
;
import
{
__
,
sprintf
}
from
'
~/locale
'
;
import
httpStatus
from
'
~/lib/utils/http_status
'
;
import
*
as
types
from
'
./mutation_types
'
;
import
{
removeFlash
}
from
'
../../../utils
'
;
const
isStageNameExistsError
=
({
status
,
errors
})
=>
{
const
ERROR_NAME_RESERVED
=
'
is reserved
'
;
if
(
status
===
httpStatus
.
UNPROCESSABLE_ENTITY
)
{
if
(
errors
?.
name
?.
includes
(
ERROR_NAME_RESERVED
))
return
true
;
}
return
false
;
};
import
{
removeFlash
,
isStageNameExistsError
}
from
'
../../../utils
'
;
export
const
setStageEvents
=
({
commit
},
data
)
=>
commit
(
types
.
SET_STAGE_EVENTS
,
data
);
export
const
setStageFormErrors
=
({
commit
},
errors
)
=>
...
...
ee/app/assets/javascripts/analytics/cycle_analytics/utils.js
View file @
b960a114
...
...
@@ -18,6 +18,7 @@ import { STAGE_NAME } from './constants';
import
{
toYmd
}
from
'
../shared/utils
'
;
const
EVENT_TYPE_LABEL
=
'
label
'
;
const
ERROR_NAME_RESERVED
=
'
is reserved
'
;
export
const
removeFlash
=
(
type
=
'
alert
'
)
=>
{
const
flashEl
=
document
.
querySelector
(
`.flash-
${
type
}
`
);
...
...
@@ -337,3 +338,6 @@ export const handleErrorOrRethrow = ({ action, error }) => {
}
action
();
};
export
const
isStageNameExistsError
=
({
status
,
errors
})
=>
status
===
httpStatus
.
UNPROCESSABLE_ENTITY
&&
errors
?.
name
?.
includes
(
ERROR_NAME_RESERVED
);
ee/spec/frontend/analytics/cycle_analytics/store/actions_spec.js
View file @
b960a114
...
...
@@ -28,7 +28,7 @@ const stageEndpoint = ({ stageId }) =>
jest
.
mock
(
'
~/flash
'
);
describe
.
only
(
'
Cycle analytics actions
'
,
()
=>
{
describe
(
'
Cycle analytics actions
'
,
()
=>
{
let
state
;
let
mock
;
...
...
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