Commit e8ffe5f0 authored by Miguel Rincon's avatar Miguel Rincon

Merge branch '344855-feature-flag-rollout-of-admin_deploy_keys_vue' into 'master'

Remove `admin_deploy_keys_vue` feature flag

See merge request gitlab-org/gitlab!78144
parents fe881e80 18f44e6f
- page_title _('Deploy Keys')
- if Feature.enabled?(:admin_deploy_keys_vue, default_enabled: :yaml)
#js-admin-deploy-keys-table{ data: admin_deploy_keys_data }
- else
- if @deploy_keys.any?
%h3.page-title.deploy-keys-title
= _('Public deploy keys (%{deploy_keys_count})') % { deploy_keys_count: @deploy_keys.load.size }
= link_to _('New deploy key'), new_admin_deploy_key_path, class: 'float-right btn gl-button btn-confirm btn-md gl-button'
%table.table.b-table.gl-table.b-table-stacked-lg{ data: { testid: 'deploy-keys-list' } }
%thead
%tr
%th= _('Title')
%th= _('Fingerprint')
%th= _('Projects with write access')
%th= _('Created')
%th.gl-lg-w-1px.gl-white-space-nowrap
%span.gl-sr-only
= _('Actions')
%tbody
- @deploy_keys.each do |deploy_key|
%tr
%td{ data: { label: _('Title') } }
%div
= deploy_key.title
%td{ data: { label: _('Fingerprint') } }
%div
%code= deploy_key.fingerprint
%td{ data: { label: _('Projects with write access') } }
%div
- deploy_key.projects_with_write_access.each do |project|
= link_to project.full_name, admin_project_path(project), class: 'gl-display-block'
%td{ data: { label: _('Created') } }
%div
= time_ago_with_tooltip(deploy_key.created_at)
%td.gl-lg-w-1px.gl-white-space-nowrap{ data: { label: _('Actions') } }
%div
= link_to edit_admin_deploy_key_path(deploy_key), class: 'btn btn-default btn-md gl-button btn-icon gl-mr-3', aria: { label: _('Edit deploy key') } do
= sprite_icon('pencil', css_class: 'gl-button-icon')
= link_to admin_deploy_key_path(deploy_key), data: { confirm: _('Are you sure?') }, method: :delete, class: 'btn btn-danger btn-md gl-button btn-icon', aria: { label: _('Remove deploy key') } do
= sprite_icon('remove', css_class: 'gl-button-icon')
- else
= render 'shared/empty_states/deploy_keys'
#js-admin-deploy-keys-table{ data: admin_deploy_keys_data }
.empty-state.gl-display-flex.gl-flex-direction-column.gl-flex-wrap.gl-text-center
.gl-flex-grow-0.gl-flex-shrink-0
.svg-250.svg-content
= image_tag 'illustrations/empty-state/empty-deploy-keys-lg.svg'
.gl-flex-grow-0.gl-flex-shrink-0
.text-content.gl-mx-auto.gl-my-0.gl-p-5
%h4.h4= _('Deploy Keys')
%p= _('Deploy keys grant read/write access to all repositories in your instance')
= link_to _('New deploy key'), new_admin_deploy_key_path, class: 'gl-button btn btn-confirm btn-md'
---
name: admin_deploy_keys_vue
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/73580
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/344855
milestone: '14.5'
type: development
group: group::access
default_enabled: true
......@@ -28948,9 +28948,6 @@ msgstr ""
msgid "Public deploy keys"
msgstr ""
msgid "Public deploy keys (%{deploy_keys_count})"
msgstr ""
msgid "Public pipelines"
msgstr ""
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe 'admin deploy keys' do
RSpec.describe 'admin deploy keys', :js do
include Spec::Support::Helpers::ModalHelpers
let_it_be(:admin) { create(:admin) }
......@@ -15,112 +15,81 @@ RSpec.describe 'admin deploy keys' do
gitlab_enable_admin_mode_sign_in(admin)
end
shared_examples 'renders deploy keys correctly' do
it 'show all public deploy keys' do
visit admin_deploy_keys_path
it 'show all public deploy keys' do
visit admin_deploy_keys_path
page.within(find('[data-testid="deploy-keys-list"]', match: :first)) do
expect(page).to have_content(deploy_key.title)
expect(page).to have_content(another_deploy_key.title)
end
page.within(find('[data-testid="deploy-keys-list"]', match: :first)) do
expect(page).to have_content(deploy_key.title)
expect(page).to have_content(another_deploy_key.title)
end
end
it 'shows all the projects the deploy key has write access' do
write_key = create(:deploy_keys_project, :write_access, deploy_key: deploy_key)
it 'shows all the projects the deploy key has write access' do
write_key = create(:deploy_keys_project, :write_access, deploy_key: deploy_key)
visit admin_deploy_keys_path
visit admin_deploy_keys_path
page.within(find('[data-testid="deploy-keys-list"]', match: :first)) do
expect(page).to have_content(write_key.project.full_name)
end
page.within(find('[data-testid="deploy-keys-list"]', match: :first)) do
expect(page).to have_content(write_key.project.full_name)
end
end
describe 'create a new deploy key' do
let(:new_ssh_key) { attributes_for(:key)[:key] }
before do
visit admin_deploy_keys_path
click_link 'New deploy key'
end
it 'creates a new deploy key' do
fill_in 'deploy_key_title', with: 'laptop'
fill_in 'deploy_key_key', with: new_ssh_key
click_button 'Create'
expect(current_path).to eq admin_deploy_keys_path
describe 'create a new deploy key' do
let(:new_ssh_key) { attributes_for(:key)[:key] }
page.within(find('[data-testid="deploy-keys-list"]', match: :first)) do
expect(page).to have_content('laptop')
end
end
before do
visit admin_deploy_keys_path
click_link 'New deploy key'
end
describe 'update an existing deploy key' do
before do
visit admin_deploy_keys_path
page.within('tr', text: deploy_key.title) do
click_link(_('Edit deploy key'))
end
end
it 'creates a new deploy key' do
fill_in 'deploy_key_title', with: 'laptop'
fill_in 'deploy_key_key', with: new_ssh_key
click_button 'Create'
it 'updates an existing deploy key' do
fill_in 'deploy_key_title', with: 'new-title'
click_button 'Save changes'
expect(current_path).to eq admin_deploy_keys_path
expect(current_path).to eq admin_deploy_keys_path
page.within(find('[data-testid="deploy-keys-list"]', match: :first)) do
expect(page).to have_content('new-title')
end
page.within(find('[data-testid="deploy-keys-list"]', match: :first)) do
expect(page).to have_content('laptop')
end
end
end
context 'when `admin_deploy_keys_vue` feature flag is enabled', :js do
it_behaves_like 'renders deploy keys correctly'
describe 'remove an existing deploy key' do
before do
visit admin_deploy_keys_path
describe 'update an existing deploy key' do
before do
visit admin_deploy_keys_path
page.within('tr', text: deploy_key.title) do
click_link(_('Edit deploy key'))
end
end
it 'removes an existing deploy key' do
accept_gl_confirm('Are you sure you want to delete this deploy key?', button_text: 'Delete') do
page.within('tr', text: deploy_key.title) do
click_button _('Delete deploy key')
end
end
it 'updates an existing deploy key' do
fill_in 'deploy_key_title', with: 'new-title'
click_button 'Save changes'
expect(current_path).to eq admin_deploy_keys_path
page.within(find('[data-testid="deploy-keys-list"]', match: :first)) do
expect(page).not_to have_content(deploy_key.title)
end
expect(current_path).to eq admin_deploy_keys_path
page.within(find('[data-testid="deploy-keys-list"]', match: :first)) do
expect(page).to have_content('new-title')
end
end
end
context 'when `admin_deploy_keys_vue` feature flag is disabled' do
describe 'remove an existing deploy key' do
before do
stub_feature_flags(admin_deploy_keys_vue: false)
visit admin_deploy_keys_path
end
it_behaves_like 'renders deploy keys correctly'
describe 'remove an existing deploy key' do
before do
visit admin_deploy_keys_path
end
it 'removes an existing deploy key' do
it 'removes an existing deploy key' do
accept_gl_confirm('Are you sure you want to delete this deploy key?', button_text: 'Delete') do
page.within('tr', text: deploy_key.title) do
click_link _('Remove deploy key')
click_button _('Delete deploy key')
end
end
expect(current_path).to eq admin_deploy_keys_path
page.within(find('[data-testid="deploy-keys-list"]', match: :first)) do
expect(page).not_to have_content(deploy_key.title)
end
expect(current_path).to eq admin_deploy_keys_path
page.within(find('[data-testid="deploy-keys-list"]', match: :first)) do
expect(page).not_to have_content(deploy_key.title)
end
end
end
......
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