Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
372b13e4
Commit
372b13e4
authored
Sep 14, 2020
by
Amy Troschinetz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reset scope to all-environments when last scope removed
parent
4f028edc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
4 deletions
+42
-4
ee/app/assets/javascripts/feature_flags/components/strategy.vue
.../assets/javascripts/feature_flags/components/strategy.vue
+5
-3
ee/changelogs/unreleased/reset-to-all-when-last-scope-removed.yml
...elogs/unreleased/reset-to-all-when-last-scope-removed.yml
+5
-0
ee/spec/frontend/feature_flags/components/strategy_spec.js
ee/spec/frontend/feature_flags/components/strategy_spec.js
+32
-1
No files found.
ee/app/assets/javascripts/feature_flags/components/strategy.vue
View file @
372b13e4
...
...
@@ -148,9 +148,8 @@ export default {
},
appliesToAllEnvironments
()
{
return
(
this
.
filteredEnvironments
.
length
===
0
||
(
this
.
filteredEnvironments
.
length
===
1
&&
this
.
filteredEnvironments
[
0
].
environmentScope
===
'
*
'
)
this
.
filteredEnvironments
.
length
===
1
&&
this
.
filteredEnvironments
[
0
].
environmentScope
===
'
*
'
);
},
filteredEnvironments
()
{
...
...
@@ -203,6 +202,9 @@ export default {
}
else
{
this
.
environments
=
this
.
environments
.
filter
(
e
=>
e
!==
environment
);
}
if
(
this
.
filteredEnvironments
.
length
===
0
)
{
this
.
environments
.
push
({
environmentScope
:
'
*
'
});
}
this
.
onStrategyChange
();
},
isStrategyType
(
type
)
{
...
...
ee/changelogs/unreleased/reset-to-all-when-last-scope-removed.yml
0 → 100644
View file @
372b13e4
---
title
:
Reset scope to all-environments when last scope removed
merge_request
:
42287
author
:
type
:
fixed
ee/spec/frontend/feature_flags/components/strategy_spec.js
View file @
372b13e4
...
...
@@ -160,7 +160,38 @@ describe('Feature flags strategy', () => {
});
describe
(
'
with a strategy
'
,
()
=>
{
describe
(
'
with scopes defined
'
,
()
=>
{
describe
(
'
with a single environment scope defined
'
,
()
=>
{
let
strategy
;
beforeEach
(()
=>
{
strategy
=
{
name
:
ROLLOUT_STRATEGY_PERCENT_ROLLOUT
,
parameters
:
{
percentage
:
'
50
'
},
scopes
:
[{
environmentScope
:
'
production
'
}],
};
const
propsData
=
{
strategy
,
index
:
0
,
endpoint
:
''
};
factory
({
propsData
,
provide
});
});
it
(
'
should revert to all-environments scope when last scope is removed
'
,
()
=>
{
const
token
=
wrapper
.
find
(
GlToken
);
token
.
vm
.
$emit
(
'
close
'
);
return
wrapper
.
vm
.
$nextTick
().
then
(()
=>
{
expect
(
wrapper
.
findAll
(
GlToken
)).
toHaveLength
(
0
);
expect
(
wrapper
.
emitted
(
'
change
'
)).
toEqual
([
[
{
name
:
ROLLOUT_STRATEGY_PERCENT_ROLLOUT
,
parameters
:
{
percentage
:
'
50
'
,
groupId
:
PERCENT_ROLLOUT_GROUP_ID
},
scopes
:
[{
environmentScope
:
'
*
'
}],
},
],
]);
});
});
});
describe
(
'
with an all-environments scope defined
'
,
()
=>
{
let
strategy
;
beforeEach
(()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment