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 {
...
@@ -58,7 +58,6 @@ export default {
'
isAddingCustomStage
'
,
'
isAddingCustomStage
'
,
'
isSavingCustomStage
'
,
'
isSavingCustomStage
'
,
'
selectedGroup
'
,
'
selectedGroup
'
,
'
selectedProjectIds
'
,
'
selectedStageId
'
,
'
selectedStageId
'
,
'
stages
'
,
'
stages
'
,
'
summary
'
,
'
summary
'
,
...
@@ -74,7 +73,6 @@ export default {
...
@@ -74,7 +73,6 @@ export default {
'
currentStage
'
,
'
currentStage
'
,
'
defaultStage
'
,
'
defaultStage
'
,
'
hasNoAccessError
'
,
'
hasNoAccessError
'
,
'
currentGroupPath
'
,
'
durationChartPlottableData
'
,
'
durationChartPlottableData
'
,
]),
]),
shouldRenderEmptyState
()
{
shouldRenderEmptyState
()
{
...
@@ -110,13 +108,10 @@ export default {
...
@@ -110,13 +108,10 @@ export default {
},
},
methods
:
{
methods
:
{
...
mapActions
([
...
mapActions
([
'
fetchCustomStageFormData
'
,
'
fetchCycleAnalyticsData
'
,
'
fetchCycleAnalyticsData
'
,
'
fetchStageData
'
,
'
fetchStageData
'
,
'
fetchGroupStagesAndEvents
'
,
'
setSelectedGroup
'
,
'
setSelectedGroup
'
,
'
setSelectedProjects
'
,
'
setSelectedProjects
'
,
'
setSelectedTimeframe
'
,
'
setSelectedStageId
'
,
'
setSelectedStageId
'
,
'
hideCustomStageForm
'
,
'
hideCustomStageForm
'
,
'
showCustomStageForm
'
,
'
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
createFlash
,
{
hideFlash
}
from
'
~/flash
'
;
import
{
__
}
from
'
~/locale
'
;
import
{
__
}
from
'
~/locale
'
;
import
Api
from
'
ee/api
'
;
import
httpStatus
from
'
~/lib/utils/http_status
'
;
import
httpStatus
from
'
~/lib/utils/http_status
'
;
import
*
as
types
from
'
./mutation_types
'
;
import
*
as
types
from
'
./mutation_types
'
;
import
{
nestQueryStringKeys
}
from
'
../utils
'
;
import
{
nestQueryStringKeys
}
from
'
../utils
'
;
import
{
dateFormats
}
from
'
../../shared/constants
'
;
const
removeError
=
()
=>
{
const
removeError
=
()
=>
{
const
flashEl
=
document
.
querySelector
(
'
.flash-alert
'
);
const
flashEl
=
document
.
querySelector
(
'
.flash-alert
'
);
...
@@ -305,26 +303,27 @@ export const receiveDurationDataError = ({ commit }) => {
...
@@ -305,26 +303,27 @@ export const receiveDurationDataError = ({ commit }) => {
createFlash
(
__
(
'
There was an error while fetching cycle analytics duration data.
'
));
createFlash
(
__
(
'
There was an error while fetching cycle analytics duration data.
'
));
};
};
export
const
fetchDurationData
=
({
state
,
dispatch
})
=>
{
export
const
fetchDurationData
=
({
state
,
dispatch
,
getters
})
=>
{
dispatch
(
'
requestDurationData
'
);
dispatch
(
'
requestDurationData
'
);
const
{
const
{
stages
,
stages
,
startDate
,
endDate
,
selectedProjectIds
,
selectedGroup
:
{
fullPath
},
selectedGroup
:
{
fullPath
},
}
=
state
;
}
=
state
;
const
{
cycleAnalyticsRequestParams
:
{
created_after
,
created_before
,
project_ids
},
}
=
getters
;
return
Promise
.
all
(
return
Promise
.
all
(
stages
.
map
(
stage
=>
{
stages
.
map
(
stage
=>
{
const
{
slug
}
=
stage
;
const
{
slug
}
=
stage
;
return
Api
.
cycleAnalyticsDurationChart
(
slug
,
{
return
Api
.
cycleAnalyticsDurationChart
(
slug
,
{
group_id
:
fullPath
,
group_id
:
fullPath
,
created_after
:
dateFormat
(
startDate
,
dateFormats
.
isoDate
)
,
created_after
,
created_before
:
dateFormat
(
endDate
,
dateFormats
.
isoDate
)
,
created_before
,
project_ids
:
selectedProjectIds
,
project_ids
,
}).
then
(({
data
})
=>
({
}).
then
(({
data
})
=>
({
slug
,
slug
,
selected
:
true
,
selected
:
true
,
...
...
ee/spec/frontend/analytics/cycle_analytics/store/actions_spec.js
View file @
9e2240d2
...
@@ -352,7 +352,7 @@ describe('Cycle analytics actions', () => {
...
@@ -352,7 +352,7 @@ describe('Cycle analytics actions', () => {
{
{
dispatch
:
mockDispatchContext
,
dispatch
:
mockDispatchContext
,
state
:
{
...
state
,
endpoints
:
{
cycleAnalyticsStagesPath
:
'
/this/is/fake
'
}
},
state
:
{
...
state
,
endpoints
:
{
cycleAnalyticsStagesPath
:
'
/this/is/fake
'
}
},
commit
:
()
=>
{}
,
getters
,
},
},
{},
{},
);
);
...
@@ -710,32 +710,52 @@ describe('Cycle analytics actions', () => {
...
@@ -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
=
{
const
stateWithStages
=
{
...
state
,
...
state
,
stages
:
[
stages
[
0
],
stages
[
1
]],
stages
:
[
stages
[
0
],
stages
[
1
]],
selectedGroup
,
selectedGroup
,
startDate
,
endDate
,
};
};
const
dispatch
=
jest
.
fn
();
testAction
(
actions
actions
.
fetchDurationData
,
.
fetchDurationData
({
transformedDurationData
,
dispatch
,
stateWithStages
,
state
:
stateWithStages
,
[],
getters
,
[
})
{
type
:
'
requestDurationData
'
},
.
then
(()
=>
{
{
expect
(
dispatch
).
toHaveBeenCalledWith
(
type
:
'
receiveDurationDataSuccess
'
,
'
receiveDurationDataSuccess
'
,
payload
:
transformedDurationData
,
transformedDurationData
,
},
);
],
done
();
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
=
{
const
brokenState
=
{
...
state
,
...
state
,
stages
:
[
stages
:
[
...
@@ -744,18 +764,20 @@ describe('Cycle analytics actions', () => {
...
@@ -744,18 +764,20 @@ describe('Cycle analytics actions', () => {
},
},
],
],
selectedGroup
,
selectedGroup
,
startDate
,
endDate
,
};
};
const
dispatch
=
jest
.
fn
();
testAction
(
actions
actions
.
fetchDurationData
,
.
fetchDurationData
({
{},
dispatch
,
brokenState
,
state
:
brokenState
,
[],
getters
,
[{
type
:
'
requestDurationData
'
},
{
type
:
'
receiveDurationDataError
'
}],
})
done
,
.
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