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
b06e1d67
Commit
b06e1d67
authored
Feb 13, 2020
by
Andrew Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure User IDs are Removed When Moving to Default
If All Users is selected, the user IDs should not be saved.
parent
bc9dd91f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
18 deletions
+31
-18
ee/app/assets/javascripts/feature_flags/components/form.vue
ee/app/assets/javascripts/feature_flags/components/form.vue
+14
-6
ee/app/assets/javascripts/feature_flags/store/modules/helpers.js
...assets/javascripts/feature_flags/store/modules/helpers.js
+1
-1
ee/changelogs/unreleased/clear-users-on-strategy-change.yml
ee/changelogs/unreleased/clear-users-on-strategy-change.yml
+5
-0
ee/spec/frontend/feature_flags/components/form_spec.js
ee/spec/frontend/feature_flags/components/form_spec.js
+11
-11
No files found.
ee/app/assets/javascripts/feature_flags/components/form.vue
View file @
b06e1d67
...
@@ -202,6 +202,12 @@ export default {
...
@@ -202,6 +202,12 @@ export default {
shouldDisplayUserIds
(
scope
)
{
shouldDisplayUserIds
(
scope
)
{
return
scope
.
rolloutStrategy
===
ROLLOUT_STRATEGY_USER_ID
||
scope
.
shouldIncludeUserIds
;
return
scope
.
rolloutStrategy
===
ROLLOUT_STRATEGY_USER_ID
||
scope
.
shouldIncludeUserIds
;
},
},
onStrategyChange
(
index
)
{
const
scope
=
this
.
filteredScopes
[
index
];
scope
.
shouldIncludeUserIds
=
scope
.
rolloutUserIds
.
length
>
0
&&
scope
.
rolloutStrategy
===
ROLLOUT_STRATEGY_PERCENT_ROLLOUT
;
},
},
},
};
};
</
script
>
</
script
>
...
@@ -256,6 +262,7 @@ export default {
...
@@ -256,6 +262,7 @@ export default {
<div
<div
v-for=
"(scope, index) in filteredScopes"
v-for=
"(scope, index) in filteredScopes"
:key=
"scope.id"
:key=
"scope.id"
ref=
"scopeRow"
class=
"gl-responsive-table-row"
class=
"gl-responsive-table-row"
role=
"row"
role=
"row"
>
>
...
@@ -281,9 +288,9 @@ export default {
...
@@ -281,9 +288,9 @@ export default {
@
clearInput=
"env => (scope.environmentScope = '')"
@
clearInput=
"env => (scope.environmentScope = '')"
/>
/>
<gl-badge
v-if=
"permissionsFlag && scope.protected"
variant=
"success"
>
{{
<gl-badge
v-if=
"permissionsFlag && scope.protected"
variant=
"success"
>
s__
(
'
FeatureFlags|Protected
'
)
{{
s__
(
'
FeatureFlags|Protected
'
)
}}
}}
</gl-badge>
</gl-badge>
</div>
</div>
</div>
</div>
...
@@ -314,6 +321,7 @@ export default {
...
@@ -314,6 +321,7 @@ export default {
v-model=
"scope.rolloutStrategy"
v-model=
"scope.rolloutStrategy"
:disabled=
"!scope.active"
:disabled=
"!scope.active"
class=
"form-control select-control w-100 js-rollout-strategy"
class=
"form-control select-control w-100 js-rollout-strategy"
@
change=
"onStrategyChange(index)"
>
>
<option
:value=
"$options.ROLLOUT_STRATEGY_ALL_USERS"
>
<option
:value=
"$options.ROLLOUT_STRATEGY_ALL_USERS"
>
{{
s__
(
'
FeatureFlags|All users
'
)
}}
{{
s__
(
'
FeatureFlags|All users
'
)
}}
...
@@ -433,9 +441,9 @@ export default {
...
@@ -433,9 +441,9 @@ export default {
{{ s__('FeatureFlags|Rollout Strategy') }}
{{ s__('FeatureFlags|Rollout Strategy') }}
</div>
</div>
<div
class=
"table-mobile-content js-rollout-strategy form-inline"
>
<div
class=
"table-mobile-content js-rollout-strategy form-inline"
>
<label
class=
"sr-only"
for=
"new-rollout-strategy-placeholder"
>
<label
class=
"sr-only"
for=
"new-rollout-strategy-placeholder"
>
{{
{{ s__('FeatureFlags|Rollout Strategy') }}
s__('FeatureFlags|Rollout Strategy')
</label>
}}
</label>
<div
class=
"select-wrapper col-12 col-md-8 p-0"
>
<div
class=
"select-wrapper col-12 col-md-8 p-0"
>
<select
<select
id=
"new-rollout-strategy-placeholder"
id=
"new-rollout-strategy-placeholder"
...
...
ee/app/assets/javascripts/feature_flags/store/modules/helpers.js
View file @
b06e1d67
...
@@ -49,7 +49,7 @@ export const mapToScopesViewModel = scopesFromRails =>
...
@@ -49,7 +49,7 @@ export const mapToScopesViewModel = scopesFromRails =>
// eslint-disable-next-line no-underscore-dangle
// eslint-disable-next-line no-underscore-dangle
shouldBeDestroyed
:
Boolean
(
s
.
_destroy
),
shouldBeDestroyed
:
Boolean
(
s
.
_destroy
),
shouldIncludeUserIds
:
rolloutUserIds
.
length
>
0
,
shouldIncludeUserIds
:
rolloutUserIds
.
length
>
0
&&
percentStrategy
!==
null
,
};
};
});
});
/**
/**
...
...
ee/changelogs/unreleased/clear-users-on-strategy-change.yml
0 → 100644
View file @
b06e1d67
---
title
:
Ensure User IDs are Removed When Moving to All Users Strategy
merge_request
:
25190
author
:
type
:
fixed
ee/spec/frontend/feature_flags/components/form_spec.js
View file @
b06e1d67
...
@@ -14,29 +14,18 @@ import { featureFlag } from '../mock_data';
...
@@ -14,29 +14,18 @@ import { featureFlag } from '../mock_data';
describe
(
'
feature flag form
'
,
()
=>
{
describe
(
'
feature flag form
'
,
()
=>
{
let
wrapper
;
let
wrapper
;
let
oldGon
;
const
requiredProps
=
{
const
requiredProps
=
{
cancelPath
:
'
feature_flags
'
,
cancelPath
:
'
feature_flags
'
,
submitText
:
'
Create
'
,
submitText
:
'
Create
'
,
environmentsEndpoint
:
'
/environments.json
'
,
environmentsEndpoint
:
'
/environments.json
'
,
};
};
beforeEach
(()
=>
{
oldGon
=
window
.
gon
;
window
.
gon
=
{
features
:
{
featureFlagsUsersPerEnvironment
:
true
}
};
});
afterEach
(()
=>
{
window
.
gon
=
oldGon
;
});
const
factory
=
(
props
=
{})
=>
{
const
factory
=
(
props
=
{})
=>
{
wrapper
=
shallowMount
(
Form
,
{
wrapper
=
shallowMount
(
Form
,
{
propsData
:
props
,
propsData
:
props
,
provide
:
{
provide
:
{
glFeatures
:
{
glFeatures
:
{
featureFlagPermissions
:
true
,
featureFlagPermissions
:
true
,
featureFlagsUsersPerEnvironment
:
true
,
},
},
},
},
});
});
...
@@ -174,6 +163,15 @@ describe('feature flag form', () => {
...
@@ -174,6 +163,15 @@ describe('feature flag form', () => {
});
});
});
});
});
});
describe
(
'
on strategy change
'
,
()
=>
{
it
(
'
should not include user IDs if All Users is selected
'
,
()
=>
{
const
scope
=
wrapper
.
find
({
ref
:
'
scopeRow
'
});
scope
.
find
(
'
select
'
).
setValue
(
ROLLOUT_STRATEGY_ALL_USERS
);
return
wrapper
.
vm
.
$nextTick
().
then
(()
=>
{
expect
(
scope
.
find
(
'
#rollout-user-id-0
'
).
exists
()).
toBe
(
false
);
});
});
});
});
});
describe
(
'
deleting an existing scope
'
,
()
=>
{
describe
(
'
deleting an existing scope
'
,
()
=>
{
...
@@ -354,6 +352,7 @@ describe('feature flag form', () => {
...
@@ -354,6 +352,7 @@ describe('feature flag form', () => {
rolloutStrategy
:
ROLLOUT_STRATEGY_PERCENT_ROLLOUT
,
rolloutStrategy
:
ROLLOUT_STRATEGY_PERCENT_ROLLOUT
,
rolloutPercentage
:
'
55
'
,
rolloutPercentage
:
'
55
'
,
rolloutUserIds
:
''
,
rolloutUserIds
:
''
,
shouldIncludeUserIds
:
false
,
},
},
{
{
id
:
expect
.
any
(
String
),
id
:
expect
.
any
(
String
),
...
@@ -374,6 +373,7 @@ describe('feature flag form', () => {
...
@@ -374,6 +373,7 @@ describe('feature flag form', () => {
rolloutStrategy
:
ROLLOUT_STRATEGY_PERCENT_ROLLOUT
,
rolloutStrategy
:
ROLLOUT_STRATEGY_PERCENT_ROLLOUT
,
rolloutPercentage
:
DEFAULT_PERCENT_ROLLOUT
,
rolloutPercentage
:
DEFAULT_PERCENT_ROLLOUT
,
rolloutUserIds
:
''
,
rolloutUserIds
:
''
,
shouldIncludeUserIds
:
false
,
},
},
]);
]);
});
});
...
...
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