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
ff3d588d
Commit
ff3d588d
authored
May 11, 2020
by
Jason Goodman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Save feature flag toggle switch state on edit page
Pass state of switch to backend
parent
ec59bf70
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
2 deletions
+37
-2
ee/app/assets/javascripts/feature_flags/components/edit_feature_flag.vue
...avascripts/feature_flags/components/edit_feature_flag.vue
+1
-1
ee/app/assets/javascripts/feature_flags/store/modules/helpers.js
...assets/javascripts/feature_flags/store/modules/helpers.js
+1
-0
ee/spec/features/projects/feature_flags/user_updates_feature_flag_spec.rb
.../projects/feature_flags/user_updates_feature_flag_spec.rb
+11
-1
ee/spec/frontend/feature_flags/store/helpers_spec.js
ee/spec/frontend/feature_flags/store/helpers_spec.js
+16
-0
ee/spec/support/helpers/feature_flag_helpers.rb
ee/spec/support/helpers/feature_flag_helpers.rb
+8
-0
No files found.
ee/app/assets/javascripts/feature_flags/components/edit_feature_flag.vue
View file @
ff3d588d
...
@@ -83,7 +83,7 @@ export default {
...
@@ -83,7 +83,7 @@ export default {
{{
$options
.
translations
.
legacyFlagAlert
}}
{{
$options
.
translations
.
legacyFlagAlert
}}
</gl-alert>
</gl-alert>
<div
class=
"d-flex align-items-center mb-3 mt-3"
>
<div
class=
"d-flex align-items-center mb-3 mt-3"
>
<gl-toggle
:value=
"active"
class=
"m-0 mr-3"
@
change=
"toggleActive"
/>
<gl-toggle
:value=
"active"
class=
"m-0 mr-3
js-feature-flag-status
"
@
change=
"toggleActive"
/>
<h3
class=
"page-title m-0"
>
{{
title
}}
</h3>
<h3
class=
"page-title m-0"
>
{{
title
}}
</h3>
</div>
</div>
...
...
ee/app/assets/javascripts/feature_flags/store/modules/helpers.js
View file @
ff3d588d
...
@@ -190,6 +190,7 @@ export const mapStrategiesToRails = params => ({
...
@@ -190,6 +190,7 @@ export const mapStrategiesToRails = params => ({
name
:
params
.
name
,
name
:
params
.
name
,
description
:
params
.
description
,
description
:
params
.
description
,
version
:
params
.
version
,
version
:
params
.
version
,
active
:
params
.
active
,
strategies_attributes
:
(
params
.
strategies
||
[]).
map
(
s
=>
({
strategies_attributes
:
(
params
.
strategies
||
[]).
map
(
s
=>
({
id
:
s
.
id
,
id
:
s
.
id
,
name
:
s
.
name
,
name
:
s
.
name
,
...
...
ee/spec/features/projects/feature_flags/user_updates_feature_flag_spec.rb
View file @
ff3d588d
...
@@ -17,7 +17,7 @@ describe 'User updates feature flag', :js do
...
@@ -17,7 +17,7 @@ describe 'User updates feature flag', :js do
context
'with a new version feature flag'
do
context
'with a new version feature flag'
do
let!
(
:feature_flag
)
do
let!
(
:feature_flag
)
do
create_flag
(
project
,
'test_flag'
,
tru
e
,
version:
Operations
::
FeatureFlag
.
versions
[
'new_version_flag'
],
create_flag
(
project
,
'test_flag'
,
fals
e
,
version:
Operations
::
FeatureFlag
.
versions
[
'new_version_flag'
],
description:
'For testing'
)
description:
'For testing'
)
end
end
...
@@ -51,6 +51,16 @@ describe 'User updates feature flag', :js do
...
@@ -51,6 +51,16 @@ describe 'User updates feature flag', :js do
expect
(
page
).
to
have_text
'All environments'
expect
(
page
).
to
have_text
'All environments'
end
end
end
end
it
'user toggles the flag on'
do
visit
(
edit_project_feature_flag_path
(
project
,
feature_flag
))
status_toggle_button
.
click
click_button
'Save changes'
within_feature_flag_row
(
1
)
do
expect_status_toggle_button_to_be_checked
end
end
end
end
context
'with a legacy feature flag'
do
context
'with a legacy feature flag'
do
...
...
ee/spec/frontend/feature_flags/store/helpers_spec.js
View file @
ff3d588d
...
@@ -400,6 +400,7 @@ describe('feature flags helpers spec', () => {
...
@@ -400,6 +400,7 @@ describe('feature flags helpers spec', () => {
name
:
'
test
'
,
name
:
'
test
'
,
description
:
'
test description
'
,
description
:
'
test description
'
,
version
:
NEW_VERSION_FLAG
,
version
:
NEW_VERSION_FLAG
,
active
:
true
,
strategies
:
[
strategies
:
[
{
{
id
:
'
1
'
,
id
:
'
1
'
,
...
@@ -421,6 +422,7 @@ describe('feature flags helpers spec', () => {
...
@@ -421,6 +422,7 @@ describe('feature flags helpers spec', () => {
name
:
'
test
'
,
name
:
'
test
'
,
description
:
'
test description
'
,
description
:
'
test description
'
,
version
:
NEW_VERSION_FLAG
,
version
:
NEW_VERSION_FLAG
,
active
:
true
,
strategies_attributes
:
[
strategies_attributes
:
[
{
{
id
:
'
1
'
,
id
:
'
1
'
,
...
@@ -446,6 +448,7 @@ describe('feature flags helpers spec', () => {
...
@@ -446,6 +448,7 @@ describe('feature flags helpers spec', () => {
name
:
'
test
'
,
name
:
'
test
'
,
description
:
'
test description
'
,
description
:
'
test description
'
,
version
:
NEW_VERSION_FLAG
,
version
:
NEW_VERSION_FLAG
,
active
:
true
,
strategies
:
[
strategies
:
[
{
{
id
:
'
1
'
,
id
:
'
1
'
,
...
@@ -460,6 +463,7 @@ describe('feature flags helpers spec', () => {
...
@@ -460,6 +463,7 @@ describe('feature flags helpers spec', () => {
name
:
'
test
'
,
name
:
'
test
'
,
description
:
'
test description
'
,
description
:
'
test description
'
,
version
:
NEW_VERSION_FLAG
,
version
:
NEW_VERSION_FLAG
,
active
:
true
,
strategies_attributes
:
[
strategies_attributes
:
[
{
{
id
:
'
1
'
,
id
:
'
1
'
,
...
@@ -480,6 +484,7 @@ describe('feature flags helpers spec', () => {
...
@@ -480,6 +484,7 @@ describe('feature flags helpers spec', () => {
const
result
=
mapStrategiesToRails
({
const
result
=
mapStrategiesToRails
({
name
:
'
test
'
,
name
:
'
test
'
,
version
:
NEW_VERSION_FLAG
,
version
:
NEW_VERSION_FLAG
,
active
:
true
,
strategies
:
[
strategies
:
[
{
{
id
:
'
1
'
,
id
:
'
1
'
,
...
@@ -494,5 +499,16 @@ describe('feature flags helpers spec', () => {
...
@@ -494,5 +499,16 @@ describe('feature flags helpers spec', () => {
expect
(
strategyAttrs
.
parameters
).
toEqual
({
userIds
:
'
user1,user2,user3
'
});
expect
(
strategyAttrs
.
parameters
).
toEqual
({
userIds
:
'
user1,user2,user3
'
});
});
});
it
(
'
preserves the value of active
'
,
()
=>
{
const
result
=
mapStrategiesToRails
({
name
:
'
test
'
,
version
:
NEW_VERSION_FLAG
,
active
:
false
,
strategies
:
[],
});
expect
(
result
.
operations_feature_flag
.
active
).
toBe
(
false
);
});
});
});
});
});
ee/spec/support/helpers/feature_flag_helpers.rb
View file @
ff3d588d
...
@@ -60,6 +60,14 @@ module FeatureFlagHelpers
...
@@ -60,6 +60,14 @@ module FeatureFlagHelpers
find
(
'.js-feature-flag-edit-button'
)
find
(
'.js-feature-flag-edit-button'
)
end
end
def
status_toggle_button
find
(
'.js-feature-flag-status button'
)
end
def
expect_status_toggle_button_to_be_checked
expect
(
page
).
to
have_css
(
'.js-feature-flag-status button.is-checked'
)
end
def
expect_user_to_see_feature_flags_index_page
def
expect_user_to_see_feature_flags_index_page
expect
(
page
).
to
have_css
(
'h3.page-title'
,
text:
'Feature Flags'
)
expect
(
page
).
to
have_css
(
'h3.page-title'
,
text:
'Feature Flags'
)
expect
(
page
).
to
have_text
(
'All'
)
expect
(
page
).
to
have_text
(
'All'
)
...
...
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