Skip to content
Snippets Groups Projects
Commit f38dfab5 authored by Martin Wortschack's avatar Martin Wortschack
Browse files

Update Vuex store with stageId

parent a7583096
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -151,14 +151,18 @@ export const receiveGroupStagesError = ({ commit }, error) => {
createFlash(__('There was an error fetching value stream analytics stages.'));
};
 
export const setDefaultSelectedStage = ({ dispatch, getters }) => {
export const setDefaultSelectedStage = ({ state, dispatch, getters }) => {
const { stageId = null } = state;
const { activeStages = [] } = getters;
 
if (activeStages?.length) {
const [firstActiveStage] = activeStages;
const activeStage = stageId
? activeStages.find((stage) => stage.id === stageId) || activeStages[0]
: activeStages[0];
return Promise.all([
dispatch('setSelectedStage', firstActiveStage),
dispatch('fetchStageData', firstActiveStage.slug),
dispatch('setSelectedStage', activeStage),
dispatch('fetchStageData', activeStage.slug),
]);
}
 
Loading
Loading
@@ -286,11 +290,12 @@ export const initializeCycleAnalytics = ({ dispatch, commit }, initialData = {})
selectedAssigneeList,
selectedLabelList,
group,
stageId,
} = initialData;
commit(types.SET_FEATURE_FLAGS, featureFlags);
 
if (group?.fullPath) {
return Promise.all([
const promises = [
dispatch('setPaths', { groupPath: group.fullPath, milestonesPath, labelsPath }),
dispatch('filters/initialize', {
selectedAuthor,
Loading
Loading
@@ -300,14 +305,22 @@ export const initializeCycleAnalytics = ({ dispatch, commit }, initialData = {})
}),
dispatch('durationChart/setLoading', true),
dispatch('typeOfWork/setLoading', true),
])
.then(() => dispatch('fetchCycleAnalyticsData'))
];
if (stageId) {
dispatch('setStageId', stageId);
}
return Promise.all(promises)
.then(() => dispatch('fetchCycleAnalyticsData', stageId))
.then(() => dispatch('initializeCycleAnalyticsSuccess'));
}
 
return dispatch('initializeCycleAnalyticsSuccess');
};
 
export const setStageId = ({ commit }, stageId) => commit(types.SET_STAGE_ID, stageId);
export const requestReorderStage = ({ commit }) => commit(types.REQUEST_REORDER_STAGE);
 
export const receiveReorderStageSuccess = ({ commit }) =>
Loading
Loading
Loading
Loading
@@ -2,6 +2,7 @@ export const SET_FEATURE_FLAGS = 'SET_FEATURE_FLAGS';
 
export const SET_SELECTED_PROJECTS = 'SET_SELECTED_PROJECTS';
export const SET_SELECTED_STAGE = 'SET_SELECTED_STAGE';
export const SET_STAGE_ID = 'SET_STAGE_ID';
export const SET_DATE_RANGE = 'SET_DATE_RANGE';
export const SET_SELECTED_VALUE_STREAM = 'SET_SELECTED_VALUE_STREAM';
 
Loading
Loading
Loading
Loading
@@ -12,6 +12,9 @@ export default {
[types.SET_SELECTED_STAGE](state, rawData) {
state.selectedStage = convertObjectPropsToCamelCase(rawData);
},
[types.SET_STAGE_ID](state, stageId) {
state.stageId = stageId;
},
[types.SET_DATE_RANGE](state, { startDate, endDate }) {
state.startDate = startDate;
state.endDate = endDate;
Loading
Loading
Loading
Loading
@@ -5,6 +5,8 @@ export default () => ({
startDate: null,
endDate: null,
 
stageId: null,
isLoading: false,
isLoadingStage: false,
 
Loading
Loading
Loading
Loading
@@ -105,6 +105,7 @@ export const buildCycleAnalyticsInitialData = ({
labelsPath = '',
milestonesPath = '',
defaultStages = null,
stageId = null,
} = {}) => ({
selectedValueStream: buildValueStreamFromJson(valueStream),
group: groupId
Loading
Loading
@@ -128,6 +129,7 @@ export const buildCycleAnalyticsInitialData = ({
defaultStageConfig: defaultStages
? buildDefaultStagesFromJSON(defaultStages).map(convertObjectPropsToCamelCase)
: [],
stageId,
});
 
export const filterBySearchTerm = (data = [], searchTerm = '', filterByKey = 'name') => {
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment