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
9e2240d2
Commit
9e2240d2
authored
Dec 11, 2019
by
Brandon Labuschagne
Committed by
Martin Wortschack
Dec 11, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve "Cleanup cycle analytics mapped imports"
parent
8a6ea16a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
44 deletions
+60
-44
ee/app/assets/javascripts/analytics/cycle_analytics/components/base.vue
...javascripts/analytics/cycle_analytics/components/base.vue
+0
-5
ee/app/assets/javascripts/analytics/cycle_analytics/store/actions.js
...ts/javascripts/analytics/cycle_analytics/store/actions.js
+9
-10
ee/spec/frontend/analytics/cycle_analytics/store/actions_spec.js
.../frontend/analytics/cycle_analytics/store/actions_spec.js
+51
-29
No files found.
ee/app/assets/javascripts/analytics/cycle_analytics/components/base.vue
View file @
9e2240d2
...
...
@@ -58,7 +58,6 @@ export default {
'
isAddingCustomStage
'
,
'
isSavingCustomStage
'
,
'
selectedGroup
'
,
'
selectedProjectIds
'
,
'
selectedStageId
'
,
'
stages
'
,
'
summary
'
,
...
...
@@ -74,7 +73,6 @@ export default {
'
currentStage
'
,
'
defaultStage
'
,
'
hasNoAccessError
'
,
'
currentGroupPath
'
,
'
durationChartPlottableData
'
,
]),
shouldRenderEmptyState
()
{
...
...
@@ -110,13 +108,10 @@ export default {
},
methods
:
{
...
mapActions
([
'
fetchCustomStageFormData
'
,
'
fetchCycleAnalyticsData
'
,
'
fetchStageData
'
,
'
fetchGroupStagesAndEvents
'
,
'
setSelectedGroup
'
,
'
setSelectedProjects
'
,
'
setSelectedTimeframe
'
,
'
setSelectedStageId
'
,
'
hideCustomStageForm
'
,
'
showCustomStageForm
'
,
...
...
ee/app/assets/javascripts/analytics/cycle_analytics/store/actions.js
View file @
9e2240d2
import
dateFormat
from
'
dateformat
'
;
import
Api
from
'
ee/api
'
;
import
createFlash
,
{
hideFlash
}
from
'
~/flash
'
;
import
{
__
}
from
'
~/locale
'
;
import
Api
from
'
ee/api
'
;
import
httpStatus
from
'
~/lib/utils/http_status
'
;
import
*
as
types
from
'
./mutation_types
'
;
import
{
nestQueryStringKeys
}
from
'
../utils
'
;
import
{
dateFormats
}
from
'
../../shared/constants
'
;
const
removeError
=
()
=>
{
const
flashEl
=
document
.
querySelector
(
'
.flash-alert
'
);
...
...
@@ -305,26 +303,27 @@ export const receiveDurationDataError = ({ commit }) => {
createFlash
(
__
(
'
There was an error while fetching cycle analytics duration data.
'
));
};
export
const
fetchDurationData
=
({
state
,
dispatch
})
=>
{
export
const
fetchDurationData
=
({
state
,
dispatch
,
getters
})
=>
{
dispatch
(
'
requestDurationData
'
);
const
{
stages
,
startDate
,
endDate
,
selectedProjectIds
,
selectedGroup
:
{
fullPath
},
}
=
state
;
const
{
cycleAnalyticsRequestParams
:
{
created_after
,
created_before
,
project_ids
},
}
=
getters
;
return
Promise
.
all
(
stages
.
map
(
stage
=>
{
const
{
slug
}
=
stage
;
return
Api
.
cycleAnalyticsDurationChart
(
slug
,
{
group_id
:
fullPath
,
created_after
:
dateFormat
(
startDate
,
dateFormats
.
isoDate
)
,
created_before
:
dateFormat
(
endDate
,
dateFormats
.
isoDate
)
,
project_ids
:
selectedProjectIds
,
created_after
,
created_before
,
project_ids
,
}).
then
(({
data
})
=>
({
slug
,
selected
:
true
,
...
...
ee/spec/frontend/analytics/cycle_analytics/store/actions_spec.js
View file @
9e2240d2
...
...
@@ -352,7 +352,7 @@ describe('Cycle analytics actions', () => {
{
dispatch
:
mockDispatchContext
,
state
:
{
...
state
,
endpoints
:
{
cycleAnalyticsStagesPath
:
'
/this/is/fake
'
}
},
commit
:
()
=>
{}
,
getters
,
},
{},
);
...
...
@@ -710,32 +710,52 @@ describe('Cycle analytics actions', () => {
});
});
it
(
"
dispatches the 're
questDurationData' and 'receiveDurationDataSuccess' action
s
"
,
done
=>
{
it
(
"
dispatches the 're
ceiveDurationDataSuccess' action on succes
s
"
,
done
=>
{
const
stateWithStages
=
{
...
state
,
stages
:
[
stages
[
0
],
stages
[
1
]],
selectedGroup
,
startDate
,
endDate
,
};
const
dispatch
=
jest
.
fn
();
testAction
(
actions
.
fetchDurationData
,
transformedDurationData
,
stateWithStages
,
[],
[
{
type
:
'
requestDurationData
'
},
{
type
:
'
receiveDurationDataSuccess
'
,
payload
:
transformedDurationData
,
},
],
done
,
);
actions
.
fetchDurationData
({
dispatch
,
state
:
stateWithStages
,
getters
,
})
.
then
(()
=>
{
expect
(
dispatch
).
toHaveBeenCalledWith
(
'
receiveDurationDataSuccess
'
,
transformedDurationData
,
);
done
();
})
.
catch
(
done
.
fail
);
});
it
(
"
dispatches the 'requestDurationData' action
"
,
done
=>
{
const
stateWithStages
=
{
...
state
,
stages
:
[
stages
[
0
],
stages
[
1
]],
selectedGroup
,
};
const
dispatch
=
jest
.
fn
();
actions
.
fetchDurationData
({
dispatch
,
state
:
stateWithStages
,
getters
,
})
.
then
(()
=>
{
expect
(
dispatch
).
toHaveBeenNthCalledWith
(
1
,
'
requestDurationData
'
);
done
();
})
.
catch
(
done
.
fail
);
});
it
(
"
dispatches the 're
questDurationData' and 'receiveDurationDataError' actions
when there is an error
"
,
done
=>
{
it
(
"
dispatches the 're
ceiveDurationDataError' action
when there is an error
"
,
done
=>
{
const
brokenState
=
{
...
state
,
stages
:
[
...
...
@@ -744,18 +764,20 @@ describe('Cycle analytics actions', () => {
},
],
selectedGroup
,
startDate
,
endDate
,
};
const
dispatch
=
jest
.
fn
();
testAction
(
actions
.
fetchDurationData
,
{},
brokenState
,
[],
[{
type
:
'
requestDurationData
'
},
{
type
:
'
receiveDurationDataError
'
}],
done
,
);
actions
.
fetchDurationData
({
dispatch
,
state
:
brokenState
,
getters
,
})
.
then
(()
=>
{
expect
(
dispatch
).
toHaveBeenCalledWith
(
'
receiveDurationDataError
'
);
done
();
})
.
catch
(
done
.
fail
);
});
});
...
...
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