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
cbc6f400
Commit
cbc6f400
authored
Jul 09, 2020
by
Jason Goodman
Committed by
Andrew Fontaine
Jul 09, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Default feature flag strategy dropdown to all users
Default to all users for new flags and existing flags
parent
6566448f
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
36 additions
and
6 deletions
+36
-6
ee/app/assets/javascripts/feature_flags/components/form.vue
ee/app/assets/javascripts/feature_flags/components/form.vue
+1
-1
ee/app/assets/javascripts/feature_flags/components/new_feature_flag.vue
...javascripts/feature_flags/components/new_feature_flag.vue
+7
-2
ee/changelogs/unreleased/default-dropdown-to-all-users.yml
ee/changelogs/unreleased/default-dropdown-to-all-users.yml
+5
-0
ee/spec/frontend/feature_flags/components/form_spec.js
ee/spec/frontend/feature_flags/components/form_spec.js
+9
-3
ee/spec/frontend/feature_flags/components/new_feature_flag_spec.js
...rontend/feature_flags/components/new_feature_flag_spec.js
+8
-0
ee/spec/frontend/feature_flags/mock_data.js
ee/spec/frontend/feature_flags/mock_data.js
+6
-0
No files found.
ee/app/assets/javascripts/feature_flags/components/form.vue
View file @
cbc6f400
...
...
@@ -175,7 +175,7 @@ export default {
},
addStrategy
()
{
this
.
formStrategies
.
push
({
name
:
''
,
parameters
:
{},
scopes
:
[]
});
this
.
formStrategies
.
push
({
name
:
ROLLOUT_STRATEGY_ALL_USERS
,
parameters
:
{},
scopes
:
[]
});
},
deleteStrategy
(
s
)
{
...
...
ee/app/assets/javascripts/feature_flags/components/new_feature_flag.vue
View file @
cbc6f400
...
...
@@ -3,7 +3,12 @@ import { createNamespacedHelpers } from 'vuex';
import
{
GlAlert
}
from
'
@gitlab/ui
'
;
import
store
from
'
../store/index
'
;
import
FeatureFlagForm
from
'
./form.vue
'
;
import
{
LEGACY_FLAG
,
NEW_VERSION_FLAG
,
NEW_FLAG_ALERT
}
from
'
../constants
'
;
import
{
LEGACY_FLAG
,
NEW_VERSION_FLAG
,
NEW_FLAG_ALERT
,
ROLLOUT_STRATEGY_ALL_USERS
,
}
from
'
../constants
'
;
import
{
createNewEnvironmentScope
}
from
'
../store/modules/helpers
'
;
import
featureFlagsMixin
from
'
~/vue_shared/mixins/gl_feature_flags_mixin
'
;
...
...
@@ -58,7 +63,7 @@ export default {
return
this
.
glFeatures
.
featureFlagsNewVersion
;
},
strategies
()
{
return
[{
name
:
''
,
parameters
:
{},
scopes
:
[]
}];
return
[{
name
:
ROLLOUT_STRATEGY_ALL_USERS
,
parameters
:
{},
scopes
:
[]
}];
},
},
created
()
{
...
...
ee/changelogs/unreleased/default-dropdown-to-all-users.yml
0 → 100644
View file @
cbc6f400
---
title
:
Default new feature flag strategies to all users
merge_request
:
35883
author
:
type
:
changed
ee/spec/frontend/feature_flags/components/form_spec.js
View file @
cbc6f400
...
...
@@ -14,7 +14,7 @@ import {
NEW_VERSION_FLAG
,
}
from
'
ee/feature_flags/constants
'
;
import
ToggleButton
from
'
~/vue_shared/components/toggle_button.vue
'
;
import
{
featureFlag
,
userList
}
from
'
../mock_data
'
;
import
{
featureFlag
,
userList
,
allUsersStrategy
}
from
'
../mock_data
'
;
import
RelatedIssuesRoot
from
'
ee/related_issues/components/related_issues_root.vue
'
;
jest
.
mock
(
'
ee/api.js
'
);
...
...
@@ -454,9 +454,15 @@ describe('feature flag form', () => {
expect
(
wrapper
.
findAll
(
Strategy
)).
toHaveLength
(
2
);
});
it
(
'
should add a
strategy when clicking the Add button
'
,
()
=>
{
it
(
'
adds an all users
strategy when clicking the Add button
'
,
()
=>
{
wrapper
.
find
(
GlDeprecatedButton
).
vm
.
$emit
(
'
click
'
);
return
wrapper
.
vm
.
$nextTick
().
then
(()
=>
expect
(
wrapper
.
findAll
(
Strategy
)).
toHaveLength
(
3
));
return
wrapper
.
vm
.
$nextTick
().
then
(()
=>
{
const
strategies
=
wrapper
.
findAll
(
Strategy
);
expect
(
strategies
).
toHaveLength
(
3
);
expect
(
strategies
.
at
(
2
).
props
(
'
strategy
'
)).
toEqual
(
allUsersStrategy
);
});
});
it
(
'
should remove a strategy on delete
'
,
()
=>
{
...
...
ee/spec/frontend/feature_flags/components/new_feature_flag_spec.js
View file @
cbc6f400
...
...
@@ -9,6 +9,7 @@ import {
DEFAULT_PERCENT_ROLLOUT
,
NEW_FLAG_ALERT
,
}
from
'
ee/feature_flags/constants
'
;
import
{
allUsersStrategy
}
from
'
../mock_data
'
;
describe
(
'
New feature flag form
'
,
()
=>
{
let
wrapper
;
...
...
@@ -74,6 +75,7 @@ describe('New feature flag form', () => {
expect
(
wrapper
.
find
(
Form
).
props
(
'
scopes
'
)).
toContainEqual
(
defaultScope
);
});
it
(
'
should alert users that feature flags are changing soon
'
,
()
=>
{
expect
(
wrapper
.
find
(
GlAlert
).
text
()).
toBe
(
NEW_FLAG_ALERT
);
});
...
...
@@ -81,4 +83,10 @@ describe('New feature flag form', () => {
it
(
'
should pass in the project ID
'
,
()
=>
{
expect
(
wrapper
.
find
(
Form
).
props
(
'
projectId
'
)).
toBe
(
'
8
'
);
});
it
(
'
has an all users strategy by default
'
,
()
=>
{
const
strategies
=
wrapper
.
find
(
Form
).
props
(
'
strategies
'
);
expect
(
strategies
).
toEqual
([
allUsersStrategy
]);
});
});
ee/spec/frontend/feature_flags/mock_data.js
View file @
cbc6f400
...
...
@@ -100,3 +100,9 @@ export const userList = {
updated_at
:
'
2020-02-04T08:13:10.507Z
'
,
path
:
'
/path/to/user/list
'
,
};
export
const
allUsersStrategy
=
{
name
:
ROLLOUT_STRATEGY_ALL_USERS
,
parameters
:
{},
scopes
:
[],
};
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