Commit 5e779ebc authored by Mike Greiling's avatar Mike Greiling

Merge branch 'ci-variables-ui-ff' into 'master'

Refactor project/group variables UI into Vue - 1 / 4

See merge request gitlab-org/gitlab!25260
parents 070abaca 5a49d3f2
...@@ -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,27 +5,34 @@ ...@@ -5,27 +5,34 @@
- 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)
.col-lg-12.js-ci-variable-list-section{ data: { save_endpoint: save_endpoint, maskable_regex: ci_variable_maskable_regex } } - is_group = !@group.nil?
.hide.alert.alert-danger.js-ci-variable-error-box
%ul.ci-variable-list #js-ci-project-variables{ data: { endpoint: save_endpoint, project_id: @project&.id || '', group: is_group.to_s, maskable_regex: ci_variable_maskable_regex} }
= render 'ci/variables/variable_header'
- @variables.each.each do |variable| - else
= render 'ci/variables/variable_row', form_field: 'variables', variable: variable .row
= render 'ci/variables/variable_row', form_field: 'variables' .col-lg-12.js-ci-variable-list-section{ data: { save_endpoint: save_endpoint, maskable_regex: ci_variable_maskable_regex } }
.prepend-top-20 .hide.alert.alert-danger.js-ci-variable-error-box
%button.btn.btn-success.js-ci-variables-save-button{ type: 'button' }
%span.hide.js-ci-variables-save-loading-icon %ul.ci-variable-list
= icon('spinner spin') = render 'ci/variables/variable_header'
= _('Save variables') - @variables.each.each do |variable|
%button.btn.btn-info.btn-inverted.prepend-left-10.js-secret-value-reveal-button{ type: 'button', data: { secret_reveal_status: "#{@variables.size == 0}" } } = render 'ci/variables/variable_row', form_field: 'variables', variable: variable
- if @variables.size == 0 = render 'ci/variables/variable_row', form_field: 'variables'
= n_('Hide value', 'Hide values', @variables.size) .prepend-top-20
- else %button.btn.btn-success.js-ci-variables-save-button{ type: 'button' }
= n_('Reveal value', 'Reveal values', @variables.size) %span.hide.js-ci-variables-save-loading-icon
- if !@group && @project.group = icon('spinner spin')
.settings-header.border-top.prepend-top-20 = _('Save variables')
= render 'ci/group_variables/header' %button.btn.btn-info.btn-inverted.prepend-left-10.js-secret-value-reveal-button{ type: 'button', data: { secret_reveal_status: "#{@variables.size == 0}" } }
.settings-content.pr-0 - if @variables.size == 0
= render 'ci/group_variables/index' = n_('Hide value', 'Hide values', @variables.size)
- else
= n_('Reveal value', 'Reveal values', @variables.size)
- if !@group && @project.group
.settings-header.border-top.prepend-top-20
= render 'ci/group_variables/header'
.settings-content.pr-0
= render 'ci/group_variables/index'
...@@ -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