Commit 27d7f3d8 authored by Olena Horal-Koretska's avatar Olena Horal-Koretska

Merge branch...

Merge branch '233439-vsa-requests-fail-without-value_stream_analytics_create_multiple_value_streams-feature-flag' into 'master'

VSA requests fail without multiple value streams feature flag

Closes #233439

See merge request gitlab-org/gitlab!38542
parents ecb23143 93888b0a
...@@ -311,12 +311,15 @@ export const createValueStream = ({ commit, dispatch, getters }, data) => { ...@@ -311,12 +311,15 @@ export const createValueStream = ({ commit, dispatch, getters }, data) => {
}); });
}; };
export const setSelectedValueStream = ({ commit, dispatch }, streamId) => { export const fetchValueStreamData = ({ dispatch }) =>
commit(types.SET_SELECTED_VALUE_STREAM, streamId); Promise.resolve()
return Promise.resolve()
.then(() => dispatch('fetchGroupStagesAndEvents')) .then(() => dispatch('fetchGroupStagesAndEvents'))
.then(() => dispatch('fetchStageMedianValues')) .then(() => dispatch('fetchStageMedianValues'))
.then(() => dispatch('durationChart/fetchDurationData')); .then(() => dispatch('durationChart/fetchDurationData'));
export const setSelectedValueStream = ({ commit, dispatch }, streamId) => {
commit(types.SET_SELECTED_VALUE_STREAM, streamId);
return dispatch('fetchValueStreamData');
}; };
export const receiveValueStreamsSuccess = ({ commit, dispatch }, data = []) => { export const receiveValueStreamsSuccess = ({ commit, dispatch }, data = []) => {
...@@ -344,5 +347,5 @@ export const fetchValueStreams = ({ commit, dispatch, getters, state }) => { ...@@ -344,5 +347,5 @@ export const fetchValueStreams = ({ commit, dispatch, getters, state }) => {
commit(types.RECEIVE_VALUE_STREAMS_ERROR, data); commit(types.RECEIVE_VALUE_STREAMS_ERROR, data);
}); });
} }
return dispatch('fetchGroupStagesAndEvents'); return dispatch('fetchValueStreamData');
}; };
...@@ -3,10 +3,12 @@ import { isNumber } from 'lodash'; ...@@ -3,10 +3,12 @@ import { isNumber } from 'lodash';
import httpStatus from '~/lib/utils/http_status'; import httpStatus from '~/lib/utils/http_status';
import { dateFormats } from '../../shared/constants'; import { dateFormats } from '../../shared/constants';
import { transformStagesForPathNavigation } from '../utils'; import { transformStagesForPathNavigation } from '../utils';
import { DEFAULT_VALUE_STREAM_ID } from '../constants';
export const hasNoAccessError = state => state.errorCode === httpStatus.FORBIDDEN; export const hasNoAccessError = state => state.errorCode === httpStatus.FORBIDDEN;
export const currentValueStreamId = ({ selectedValueStream }) => selectedValueStream?.id || null; export const currentValueStreamId = ({ selectedValueStream }) =>
selectedValueStream?.id || DEFAULT_VALUE_STREAM_ID;
export const currentGroupPath = ({ selectedGroup }) => export const currentGroupPath = ({ selectedGroup }) =>
selectedGroup && selectedGroup.fullPath ? selectedGroup.fullPath : null; selectedGroup && selectedGroup.fullPath ? selectedGroup.fullPath : null;
......
---
title: VSA requests fail without multiple value streams feature flag
merge_request: 38542
author:
type: fixed
...@@ -22,6 +22,7 @@ RSpec.describe 'Group Value Stream Analytics', :js do ...@@ -22,6 +22,7 @@ RSpec.describe 'Group Value Stream Analytics', :js do
stage_nav_selector = '.stage-nav' stage_nav_selector = '.stage-nav'
path_nav_selector = '.js-path-navigation' path_nav_selector = '.js-path-navigation'
filter_bar_selector = '.js-filter-bar' filter_bar_selector = '.js-filter-bar'
duration_stage_selector = '.js-dropdown-stages'
3.times do |i| 3.times do |i|
let_it_be("issue_#{i}".to_sym) { create(:issue, title: "New Issue #{i}", project: project, created_at: 2.days.ago) } let_it_be("issue_#{i}".to_sym) { create(:issue, title: "New Issue #{i}", project: project, created_at: 2.days.ago) }
...@@ -189,6 +190,25 @@ RSpec.describe 'Group Value Stream Analytics', :js do ...@@ -189,6 +190,25 @@ RSpec.describe 'Group Value Stream Analytics', :js do
end end
end end
# Adding this context as part of a fix for https://gitlab.com/gitlab-org/gitlab/-/issues/233439
# This can be removed when the feature flag is removed
context 'create multiple value streams disabled' do
before do
stub_feature_flags(value_stream_analytics_create_multiple_value_streams: false)
visit analytics_cycle_analytics_path
select_group
end
it 'displays the list of stages' do
expect(page).to have_selector(stage_nav_selector, visible: true)
end
it 'displays the duration chart' do
expect(page).to have_selector(duration_stage_selector, visible: true)
end
end
def wait_for_stages_to_load def wait_for_stages_to_load
expect(page).to have_selector '.js-stage-table' expect(page).to have_selector '.js-stage-table'
end end
...@@ -962,7 +982,7 @@ RSpec.describe 'Group Value Stream Analytics', :js do ...@@ -962,7 +982,7 @@ RSpec.describe 'Group Value Stream Analytics', :js do
end end
context 'Duration chart' do context 'Duration chart' do
let(:duration_chart_dropdown) { page.find('.js-dropdown-stages') } let(:duration_chart_dropdown) { page.find(duration_stage_selector) }
let_it_be(:translated_default_stage_names) do let_it_be(:translated_default_stage_names) do
Gitlab::Analytics::CycleAnalytics::DefaultStages.names.map do |name| Gitlab::Analytics::CycleAnalytics::DefaultStages.names.map do |name|
......
...@@ -97,11 +97,7 @@ describe('Cycle analytics actions', () => { ...@@ -97,11 +97,7 @@ describe('Cycle analytics actions', () => {
vs, vs,
{ ...state, selectedValueStream: {} }, { ...state, selectedValueStream: {} },
[{ type: types.SET_SELECTED_VALUE_STREAM, payload: vs }], [{ type: types.SET_SELECTED_VALUE_STREAM, payload: vs }],
[ [{ type: 'fetchValueStreamData' }],
{ type: 'fetchGroupStagesAndEvents' },
{ type: 'fetchStageMedianValues' },
{ type: 'durationChart/fetchDurationData' },
],
); );
}); });
}); });
...@@ -1035,13 +1031,37 @@ describe('Cycle analytics actions', () => { ...@@ -1035,13 +1031,37 @@ describe('Cycle analytics actions', () => {
}); });
it(`will dispatch the 'fetchGroupStagesAndEvents' request`, () => it(`will dispatch the 'fetchGroupStagesAndEvents' request`, () =>
testAction( testAction(actions.fetchValueStreams, null, state, [], [{ type: 'fetchValueStreamData' }]));
actions.fetchValueStreams, });
null, });
state,
[], describe('fetchValueStreamData', () => {
[{ type: 'fetchGroupStagesAndEvents' }], beforeEach(() => {
)); state = {
...state,
stages: [{ slug: selectedStageSlug }],
selectedGroup,
featureFlags: {
...state.featureFlags,
hasCreateMultipleValueStreams: true,
},
};
mock = new MockAdapter(axios);
mock.onGet(endpoints.valueStreamData).reply(httpStatusCodes.OK, { stages: [], events: [] });
});
it('dispatches fetchGroupStagesAndEvents, fetchStageMedianValues and durationChart/fetchDurationData', () => {
return testAction(
actions.fetchValueStreamData,
null,
state,
[],
[
{ type: 'fetchGroupStagesAndEvents' },
{ type: 'fetchStageMedianValues' },
{ type: 'durationChart/fetchDurationData' },
],
);
}); });
}); });
}); });
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment