Commit 1e0f1e65 authored by Andrew Fontaine's avatar Andrew Fontaine

Merge branch 'allow-no-strategies-in-ui' into 'master'

Always Show Delete Button on Feature Flag Strategies

See merge request gitlab-org/gitlab!35786
parents ec1b3c44 0102e02a
...@@ -150,9 +150,6 @@ export default { ...@@ -150,9 +150,6 @@ export default {
supportsStrategies() { supportsStrategies() {
return this.glFeatures.featureFlagsNewVersion && this.version === NEW_VERSION_FLAG; return this.glFeatures.featureFlagsNewVersion && this.version === NEW_VERSION_FLAG;
}, },
canDeleteStrategy() {
return this.formStrategies.length > 1;
},
showRelatedIssues() { showRelatedIssues() {
return this.featureFlagIssuesEndpoint.length > 0; return this.featureFlagIssuesEndpoint.length > 0;
}, },
...@@ -349,7 +346,6 @@ export default { ...@@ -349,7 +346,6 @@ export default {
:strategy="strategy" :strategy="strategy"
:index="index" :index="index"
:endpoint="environmentsEndpoint" :endpoint="environmentsEndpoint"
:can-delete="canDeleteStrategy"
:user-lists="userLists" :user-lists="userLists"
@change="onFormStrategyChange($event, index)" @change="onFormStrategyChange($event, index)"
@delete="deleteStrategy(strategy)" @delete="deleteStrategy(strategy)"
......
...@@ -50,10 +50,6 @@ export default { ...@@ -50,10 +50,6 @@ export default {
required: false, required: false,
default: '', default: '',
}, },
canDelete: {
type: Boolean,
required: true,
},
userLists: { userLists: {
type: Array, type: Array,
required: false, required: false,
...@@ -274,7 +270,6 @@ export default { ...@@ -274,7 +270,6 @@ export default {
<div class="align-self-end align-self-md-stretch order-first offset-md-0 order-md-0 ml-auto"> <div class="align-self-end align-self-md-stretch order-first offset-md-0 order-md-0 ml-auto">
<gl-deprecated-button <gl-deprecated-button
v-if="canDelete"
data-testid="delete-strategy-button" data-testid="delete-strategy-button"
variant="danger" variant="danger"
@click="$emit('delete')" @click="$emit('delete')"
......
---
title: Always show delete button on feature flag strategies
merge_request: 35786
author:
type: fixed
...@@ -23,7 +23,6 @@ describe('Feature flags strategy', () => { ...@@ -23,7 +23,6 @@ describe('Feature flags strategy', () => {
strategy: {}, strategy: {},
index: 0, index: 0,
endpoint: '', endpoint: '',
canDelete: true,
userLists: [userList], userLists: [userList],
}, },
}, },
...@@ -56,7 +55,7 @@ describe('Feature flags strategy', () => { ...@@ -56,7 +55,7 @@ describe('Feature flags strategy', () => {
parameters[parameter] = value; parameters[parameter] = value;
} }
strategy = { name, parameters }; strategy = { name, parameters };
propsData = { strategy, index: 0, endpoint: '', canDelete: true }; propsData = { strategy, index: 0, endpoint: '' };
factory({ propsData }); factory({ propsData });
}); });
...@@ -92,7 +91,7 @@ describe('Feature flags strategy', () => { ...@@ -92,7 +91,7 @@ describe('Feature flags strategy', () => {
let strategy; let strategy;
beforeEach(() => { beforeEach(() => {
strategy = { name: ROLLOUT_STRATEGY_GITLAB_USER_LIST, userListId: '2', parameters: {} }; strategy = { name: ROLLOUT_STRATEGY_GITLAB_USER_LIST, userListId: '2', parameters: {} };
propsData = { strategy, index: 0, endpoint: '', canDelete: true, userLists: [userList] }; propsData = { strategy, index: 0, endpoint: '', userLists: [userList] };
factory({ propsData }); factory({ propsData });
}); });
...@@ -142,7 +141,7 @@ describe('Feature flags strategy', () => { ...@@ -142,7 +141,7 @@ describe('Feature flags strategy', () => {
parameters: { percentage: '50' }, parameters: { percentage: '50' },
scopes: [{ environmentScope: '*' }], scopes: [{ environmentScope: '*' }],
}; };
const propsData = { strategy, index: 0, endpoint: '', canDelete: true }; const propsData = { strategy, index: 0, endpoint: '' };
factory({ propsData }); factory({ propsData });
}); });
...@@ -208,23 +207,16 @@ describe('Feature flags strategy', () => { ...@@ -208,23 +207,16 @@ describe('Feature flags strategy', () => {
wrapper.find(GlDeprecatedButton).vm.$emit('click'); wrapper.find(GlDeprecatedButton).vm.$emit('click');
expect(wrapper.emitted('delete')).toEqual([[]]); expect(wrapper.emitted('delete')).toEqual([[]]);
}); });
it('should not display the delete button if can delete is false', () => {
const propsData = { strategy, index: 0, endpoint: '', canDelete: false };
factory({ propsData });
expect(wrapper.find(GlDeprecatedButton).exists()).toBe(false);
});
}); });
describe('wihtout scopes defined', () => { describe('without scopes defined', () => {
beforeEach(() => { beforeEach(() => {
const strategy = { const strategy = {
name: ROLLOUT_STRATEGY_PERCENT_ROLLOUT, name: ROLLOUT_STRATEGY_PERCENT_ROLLOUT,
parameters: { percentage: '50' }, parameters: { percentage: '50' },
scopes: [], scopes: [],
}; };
const propsData = { strategy, index: 0, endpoint: '', canDelete: true }; const propsData = { strategy, index: 0, endpoint: '' };
factory({ propsData }); factory({ propsData });
}); });
......
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