Commit 5a49d3f2 authored by Payton Burdette's avatar Payton Burdette Committed by Mike Greiling

Introduce feature flag for refactor

First MR of several for refactor of
ci variables from Haml to Vue. This MR
sets up a feature flag disabled by default
for the new Vue refactor.
parent fdab40dd
...@@ -6,6 +6,9 @@ module Groups ...@@ -6,6 +6,9 @@ module Groups
skip_cross_project_access_check :show skip_cross_project_access_check :show
before_action :authorize_admin_group! before_action :authorize_admin_group!
before_action :authorize_update_max_artifacts_size!, only: [:update] before_action :authorize_update_max_artifacts_size!, only: [:update]
before_action do
push_frontend_feature_flag(:new_variables_ui, @group)
end
def show def show
define_ci_variables define_ci_variables
......
...@@ -5,6 +5,9 @@ module Projects ...@@ -5,6 +5,9 @@ module Projects
class CiCdController < Projects::ApplicationController class CiCdController < Projects::ApplicationController
before_action :authorize_admin_pipeline! before_action :authorize_admin_pipeline!
before_action :define_variables before_action :define_variables
before_action do
push_frontend_feature_flag(:new_variables_ui, @project)
end
def show def show
end end
......
...@@ -5,7 +5,13 @@ ...@@ -5,7 +5,13 @@
- link_start = '<a href="%{url}">'.html_safe % { url: help_page_path('ci/variables/README', anchor: 'protected-variables') } - link_start = '<a href="%{url}">'.html_safe % { url: help_page_path('ci/variables/README', anchor: 'protected-variables') }
= s_('Environment variables are configured by your administrator to be %{link_start}protected%{link_end} by default').html_safe % { link_start: link_start, link_end: '</a>'.html_safe } = s_('Environment variables are configured by your administrator to be %{link_start}protected%{link_end} by default').html_safe % { link_start: link_start, link_end: '</a>'.html_safe }
.row - if Feature.enabled?(:new_variables_ui, @project || @group)
- is_group = !@group.nil?
#js-ci-project-variables{ data: { endpoint: save_endpoint, project_id: @project&.id || '', group: is_group.to_s, maskable_regex: ci_variable_maskable_regex} }
- else
.row
.col-lg-12.js-ci-variable-list-section{ data: { save_endpoint: save_endpoint, maskable_regex: ci_variable_maskable_regex } } .col-lg-12.js-ci-variable-list-section{ data: { save_endpoint: save_endpoint, maskable_regex: ci_variable_maskable_regex } }
.hide.alert.alert-danger.js-ci-variable-error-box .hide.alert.alert-danger.js-ci-variable-error-box
...@@ -24,7 +30,8 @@ ...@@ -24,7 +30,8 @@
= n_('Hide value', 'Hide values', @variables.size) = n_('Hide value', 'Hide values', @variables.size)
- else - else
= n_('Reveal value', 'Reveal values', @variables.size) = n_('Reveal value', 'Reveal values', @variables.size)
- if !@group && @project.group
- if !@group && @project.group
.settings-header.border-top.prepend-top-20 .settings-header.border-top.prepend-top-20
= render 'ci/group_variables/header' = render 'ci/group_variables/header'
.settings-content.pr-0 .settings-content.pr-0
......
...@@ -11,7 +11,7 @@ describe 'Group variables', :js do ...@@ -11,7 +11,7 @@ describe 'Group variables', :js do
before do before do
group.add_owner(user) group.add_owner(user)
gitlab_sign_in(user) gitlab_sign_in(user)
stub_feature_flags(new_variables_ui: false)
visit page_path visit page_path
end end
......
...@@ -24,6 +24,7 @@ describe 'Project group variables', :js do ...@@ -24,6 +24,7 @@ describe 'Project group variables', :js do
sign_in(user) sign_in(user)
project.add_maintainer(user) project.add_maintainer(user)
group.add_owner(user) group.add_owner(user)
stub_feature_flags(new_variables_ui: false)
end end
it 'project in group shows inherited vars from ancestor group' do it 'project in group shows inherited vars from ancestor group' do
......
...@@ -12,7 +12,7 @@ describe 'Project variables', :js do ...@@ -12,7 +12,7 @@ describe 'Project variables', :js do
sign_in(user) sign_in(user)
project.add_maintainer(user) project.add_maintainer(user)
project.variables << variable project.variables << variable
stub_feature_flags(new_variables_ui: false)
visit page_path visit page_path
end end
......
...@@ -10,6 +10,7 @@ describe 'Project > Settings > CI/CD > Container registry tag expiration policy' ...@@ -10,6 +10,7 @@ describe 'Project > Settings > CI/CD > Container registry tag expiration policy'
before do before do
sign_in(user) sign_in(user)
stub_container_registry_config(enabled: true) stub_container_registry_config(enabled: true)
stub_feature_flags(new_variables_ui: false)
end end
context 'as owner' do context 'as owner' do
......
...@@ -15,6 +15,7 @@ describe 'Groups (JavaScript fixtures)', type: :controller do ...@@ -15,6 +15,7 @@ describe 'Groups (JavaScript fixtures)', type: :controller do
end end
before do before do
stub_feature_flags(new_variables_ui: false)
group.add_maintainer(admin) group.add_maintainer(admin)
sign_in(admin) sign_in(admin)
end end
......
...@@ -20,6 +20,7 @@ describe 'Projects (JavaScript fixtures)', type: :controller do ...@@ -20,6 +20,7 @@ describe 'Projects (JavaScript fixtures)', type: :controller do
end end
before do before do
stub_feature_flags(new_variables_ui: false)
project.add_maintainer(admin) project.add_maintainer(admin)
sign_in(admin) sign_in(admin)
allow(SecureRandom).to receive(:hex).and_return('securerandomhex:thereisnospoon') allow(SecureRandom).to receive(:hex).and_return('securerandomhex:thereisnospoon')
......
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