Commit cc2be1ac authored by Ezekiel Kigbo's avatar Ezekiel Kigbo Committed by Martin Wortschack

Adds value_stream_analytics_extended_form feature flag

Adds the feature flag for extended value stream
create form
parent afb907e4
---
name: value_stream_analytics_extended_form
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/50229
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/294190
milestone: '13.7'
type: development
group: group::optimize
default_enabled: false
...@@ -179,6 +179,7 @@ export default { ...@@ -179,6 +179,7 @@ export default {
<value-stream-select <value-stream-select
v-if="shouldDisplayCreateMultipleValueStreams" v-if="shouldDisplayCreateMultipleValueStreams"
class="gl-align-self-start gl-sm-align-self-start gl-mt-0 gl-sm-mt-5" class="gl-align-self-start gl-sm-align-self-start gl-mt-0 gl-sm-mt-5"
:has-extended-form-fields="featureFlags.hasExtendedFormFields"
/> />
</div> </div>
<gl-empty-state <gl-empty-state
......
...@@ -46,6 +46,11 @@ export default { ...@@ -46,6 +46,11 @@ export default {
required: false, required: false,
default: () => ({}), default: () => ({}),
}, },
hasExtendedFormFields: {
type: Boolean,
required: false,
default: false,
},
}, },
data() { data() {
return { return {
...@@ -143,6 +148,7 @@ export default { ...@@ -143,6 +148,7 @@ export default {
@input="onHandleInput" @input="onHandleInput"
/> />
</gl-form-group> </gl-form-group>
<div v-if="hasExtendedFormFields" data-testid="extended-form-fields"></div>
</gl-form> </gl-form>
</gl-modal> </gl-modal>
</template> </template>
...@@ -23,6 +23,7 @@ export default () => { ...@@ -23,6 +23,7 @@ export default () => {
cycleAnalyticsScatterplotEnabled: hasDurationChart = false, cycleAnalyticsScatterplotEnabled: hasDurationChart = false,
valueStreamAnalyticsPathNavigation: hasPathNavigation = false, valueStreamAnalyticsPathNavigation: hasPathNavigation = false,
valueStreamAnalyticsCreateMultipleValueStreams: hasCreateMultipleValueStreams = false, valueStreamAnalyticsCreateMultipleValueStreams: hasCreateMultipleValueStreams = false,
valueStreamAnalyticsExtendedForm: hasExtendedFormFields = false,
} = gon?.features; } = gon?.features;
const { const {
...@@ -42,6 +43,7 @@ export default () => { ...@@ -42,6 +43,7 @@ export default () => {
hasDurationChart, hasDurationChart,
hasPathNavigation, hasPathNavigation,
hasCreateMultipleValueStreams, hasCreateMultipleValueStreams,
hasExtendedFormFields,
}, },
}); });
......
...@@ -16,6 +16,7 @@ class Groups::Analytics::CycleAnalyticsController < Groups::Analytics::Applicati ...@@ -16,6 +16,7 @@ class Groups::Analytics::CycleAnalyticsController < Groups::Analytics::Applicati
push_frontend_feature_flag(:cycle_analytics_scatterplot_enabled, default_enabled: true) push_frontend_feature_flag(:cycle_analytics_scatterplot_enabled, default_enabled: true)
push_frontend_feature_flag(:value_stream_analytics_path_navigation, @group) push_frontend_feature_flag(:value_stream_analytics_path_navigation, @group)
push_frontend_feature_flag(:value_stream_analytics_create_multiple_value_streams, default_enabled: true) push_frontend_feature_flag(:value_stream_analytics_create_multiple_value_streams, default_enabled: true)
push_frontend_feature_flag(:value_stream_analytics_extended_form, @group)
render_403 unless can?(current_user, :read_group_cycle_analytics, @group) render_403 unless can?(current_user, :read_group_cycle_analytics, @group)
end end
......
...@@ -19,7 +19,8 @@ RSpec.describe 'Group value stream analytics' do ...@@ -19,7 +19,8 @@ RSpec.describe 'Group value stream analytics' do
expect(page).to have_pushed_frontend_feature_flags( expect(page).to have_pushed_frontend_feature_flags(
cycleAnalyticsScatterplotEnabled: true, cycleAnalyticsScatterplotEnabled: true,
valueStreamAnalyticsPathNavigation: true valueStreamAnalyticsPathNavigation: true,
valueStreamAnalyticsExtendedForm: true
) )
end end
...@@ -35,6 +36,18 @@ RSpec.describe 'Group value stream analytics' do ...@@ -35,6 +36,18 @@ RSpec.describe 'Group value stream analytics' do
end end
end end
context 'when `value_stream_analytics_extended_form` is disabled for a group' do
before do
stub_feature_flags(value_stream_analytics_extended_form: false, thing: group)
end
it 'pushes disabled feature flag to the frontend' do
visit group_analytics_cycle_analytics_path(group)
expect(page).to have_pushed_frontend_feature_flags(valueStreamAnalyticsExtendedForm: false)
end
end
context 'when `value_stream_analytics_create_multiple_value_streams` is disabled for a group' do context 'when `value_stream_analytics_create_multiple_value_streams` is disabled for a group' do
before do before do
stub_feature_flags(value_stream_analytics_create_multiple_value_streams: false, thing: group) stub_feature_flags(value_stream_analytics_create_multiple_value_streams: false, thing: group)
......
...@@ -27,7 +27,7 @@ describe('ValueStreamForm', () => { ...@@ -27,7 +27,7 @@ describe('ValueStreamForm', () => {
}, },
}); });
const createComponent = ({ data = {}, initialState = {} } = {}) => const createComponent = ({ props = {}, data = {}, initialState = {} } = {}) =>
shallowMount(ValueStreamForm, { shallowMount(ValueStreamForm, {
localVue, localVue,
store: fakeStore({ initialState }), store: fakeStore({ initialState }),
...@@ -36,6 +36,9 @@ describe('ValueStreamForm', () => { ...@@ -36,6 +36,9 @@ describe('ValueStreamForm', () => {
...data, ...data,
}; };
}, },
propsData: {
...props,
},
mocks: { mocks: {
$toast: { $toast: {
show: mockToastShow, show: mockToastShow,
...@@ -48,6 +51,7 @@ describe('ValueStreamForm', () => { ...@@ -48,6 +51,7 @@ describe('ValueStreamForm', () => {
findModal().props('actionPrimary').attributes[1].disabled; findModal().props('actionPrimary').attributes[1].disabled;
const submitModal = () => findModal().vm.$emit('primary', mockEvent); const submitModal = () => findModal().vm.$emit('primary', mockEvent);
const findFormGroup = () => wrapper.find(GlFormGroup); const findFormGroup = () => wrapper.find(GlFormGroup);
const findExtendedFormFields = () => wrapper.find('[data-testid="extended-form-fields"]');
afterEach(() => { afterEach(() => {
wrapper.destroy(); wrapper.destroy();
...@@ -56,12 +60,26 @@ describe('ValueStreamForm', () => { ...@@ -56,12 +60,26 @@ describe('ValueStreamForm', () => {
describe('default state', () => { describe('default state', () => {
beforeEach(() => { beforeEach(() => {
wrapper = createComponent({ initialState: {} }); wrapper = createComponent();
}); });
it('submit button is disabled', () => { it('submit button is disabled', () => {
expect(createSubmitButtonDisabledState()).toBe(true); expect(createSubmitButtonDisabledState()).toBe(true);
}); });
it('does not include extended fields', () => {
expect(findExtendedFormFields().exists()).toBe(false);
});
});
describe('with hasExtendedFormFields=true', () => {
beforeEach(() => {
wrapper = createComponent({ props: { hasExtendedFormFields: true } });
});
it('has the extended fields', () => {
expect(findExtendedFormFields().exists()).toBe(true);
});
}); });
describe('form errors', () => { describe('form errors', () => {
......
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