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 {
supportsStrategies() {
return this.glFeatures.featureFlagsNewVersion && this.version === NEW_VERSION_FLAG;
},
canDeleteStrategy() {
return this.formStrategies.length > 1;
},
showRelatedIssues() {
return this.featureFlagIssuesEndpoint.length > 0;
},
......@@ -349,7 +346,6 @@ export default {
:strategy="strategy"
:index="index"
:endpoint="environmentsEndpoint"
:can-delete="canDeleteStrategy"
:user-lists="userLists"
@change="onFormStrategyChange($event, index)"
@delete="deleteStrategy(strategy)"
......
......@@ -50,10 +50,6 @@ export default {
required: false,
default: '',
},
canDelete: {
type: Boolean,
required: true,
},
userLists: {
type: Array,
required: false,
......@@ -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">
<gl-deprecated-button
v-if="canDelete"
data-testid="delete-strategy-button"
variant="danger"
@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', () => {
strategy: {},
index: 0,
endpoint: '',
canDelete: true,
userLists: [userList],
},
},
......@@ -56,7 +55,7 @@ describe('Feature flags strategy', () => {
parameters[parameter] = value;
}
strategy = { name, parameters };
propsData = { strategy, index: 0, endpoint: '', canDelete: true };
propsData = { strategy, index: 0, endpoint: '' };
factory({ propsData });
});
......@@ -92,7 +91,7 @@ describe('Feature flags strategy', () => {
let strategy;
beforeEach(() => {
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 });
});
......@@ -142,7 +141,7 @@ describe('Feature flags strategy', () => {
parameters: { percentage: '50' },
scopes: [{ environmentScope: '*' }],
};
const propsData = { strategy, index: 0, endpoint: '', canDelete: true };
const propsData = { strategy, index: 0, endpoint: '' };
factory({ propsData });
});
......@@ -208,23 +207,16 @@ describe('Feature flags strategy', () => {
wrapper.find(GlDeprecatedButton).vm.$emit('click');
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(() => {
const strategy = {
name: ROLLOUT_STRATEGY_PERCENT_ROLLOUT,
parameters: { percentage: '50' },
scopes: [],
};
const propsData = { strategy, index: 0, endpoint: '', canDelete: true };
const propsData = { strategy, index: 0, endpoint: '' };
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