Commit 987ce34c authored by Albert Salim's avatar Albert Salim

Merge branch '290737-remove-vue-admin-users-feature-flag' into 'master'

Remove vue_admin_users feature flag [RUN ALL RSPEC] [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!61129
parents 3621b7dc 12e3dfbe
...@@ -107,6 +107,7 @@ export default { ...@@ -107,6 +107,7 @@ export default {
:items="users" :items="users"
:fields="$options.fields" :fields="$options.fields"
:empty-text="s__('AdminUsers|No users found')" :empty-text="s__('AdminUsers|No users found')"
data-qa-selector="user_row_content"
show-empty show-empty
stacked="md" stacked="md"
:tbody-tr-attr="{ 'data-qa-selector': 'user_row_content' }" :tbody-tr-attr="{ 'data-qa-selector': 'user_row_content' }"
......
.gl-responsive-table-row{ role: 'row', data: { qa_selector: 'user_row_content' } }
.table-section.section-40
.table-mobile-header{ role: 'rowheader' }
= _('Name')
.table-mobile-content
= render 'user_detail', user: user
.table-section.section-10
.table-mobile-header{ role: 'rowheader' }
= _('Projects')
.table-mobile-content.gl-str-truncated{ data: { testid: "user-project-count-#{user.id}" } }
= user.authorized_projects.length
.table-section.section-15
.table-mobile-header{ role: 'rowheader' }
= _('Created on')
.table-mobile-content
= l(user.created_at.to_date, format: :admin)
.table-section.section-15
.table-mobile-header{ role: 'rowheader' }
= _('Last activity')
.table-mobile-content
= user.last_activity_on.nil? ? _('Never') : l(user.last_activity_on, format: :admin)
- unless user.internal?
.table-section.section-20.table-button-footer
.table-action-buttons{ data: { testid: "user-actions-#{user.id}" } }
= link_to _('Edit'), edit_admin_user_path(user), class: 'btn gl-button btn-default'
- unless user == current_user
%button.dropdown-new.btn.gl-button.btn-default{ type: 'button', data: { testid: "dropdown-toggle", toggle: 'dropdown' } }
= sprite_icon('settings')
= sprite_icon('chevron-down')
%ul.dropdown-menu.dropdown-menu-right
%li.dropdown-header
= _('Settings')
%li
- if user.ldap_blocked?
%span.small
= s_('AdminUsers|Cannot unblock LDAP blocked users')
- elsif user.blocked?
- if user.blocked_pending_approval?
= link_to s_('AdminUsers|Approve'), approve_admin_user_path(user), method: :put
= link_to s_('AdminUsers|Reject'), reject_admin_user_path(user), method: :delete
- else
%button.gl-button.btn.btn-default-tertiary.js-confirm-modal-button{ data: user_unblock_data(user) }
= s_('AdminUsers|Unblock')
- else
%button.gl-button.btn.btn-default-tertiary.js-confirm-modal-button{ data: user_block_data(user, user_block_effects) }
= s_('AdminUsers|Block')
- if user.can_be_deactivated?
%li
%button.gl-button.btn.btn-default-tertiary.js-confirm-modal-button{ data: user_deactivation_data(user, user_deactivation_effects) }
= s_('AdminUsers|Deactivate')
- elsif user.deactivated?
%li
%button.gl-button.btn.btn-default-tertiary.js-confirm-modal-button{ data: user_activation_data(user) }
= s_('AdminUsers|Activate')
- if user.access_locked?
%li
= link_to _('Unlock'), unlock_admin_user_path(user), method: :put, data: { confirm: _('Are you sure?') }
- if can?(current_user, :destroy_user, user) && !user.blocked_pending_approval?
%li.divider
- if user.can_be_removed?
%li
%button.js-delete-user-modal-button.gl-button.btn.btn-danger-tertiary{ data: { 'gl-modal-action': 'delete',
delete_user_url: admin_user_path(user),
block_user_url: block_admin_user_path(user),
username: sanitize_name(user.name) } }
= s_('AdminUsers|Delete user')
%li
%button.js-delete-user-modal-button.gl-button.btn.btn-danger-tertiary{ data: { 'gl-modal-action': 'delete-with-contributions',
delete_user_url: admin_user_path(user, hard_delete: true),
block_user_url: block_admin_user_path(user),
username: sanitize_name(user.name) } }
= s_('AdminUsers|Delete user and contributions')
...@@ -73,20 +73,9 @@ ...@@ -73,20 +73,9 @@
= link_to admin_users_path(sort: value, filter: params[:filter], search_query: params[:search_query]) do = link_to admin_users_path(sort: value, filter: params[:filter], search_query: params[:search_query]) do
= title = title
- if Feature.enabled?(:vue_admin_users, default_enabled: :yaml) #js-admin-users-app{ data: admin_users_data_attributes(@users) }
#js-admin-users-app{ data: admin_users_data_attributes(@users) } .gl-spinner-container.gl-my-7
.gl-spinner-container.gl-my-7 %span.gl-vertical-align-bottom.gl-spinner.gl-spinner-dark.gl-spinner-lg{ aria: { label: _('Loading') } }
%span.gl-vertical-align-bottom.gl-spinner.gl-spinner-dark.gl-spinner-lg{ aria: { label: _('Loading') } }
- elsif @users.empty?
.nothing-here-block.border-top-0
= s_('AdminUsers|No users found')
- else
.table-holder
.thead-white.text-nowrap.gl-responsive-table-row.table-row-header{ role: 'row' }
- user_table_headers.each do |header|
.table-section{ class: header[:section_class_name], role: 'rowheader' }= header[:header_text]
= render partial: 'admin/users/user', collection: @users
= paginate_collection @users = paginate_collection @users
......
---
name: vue_admin_users
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/48922
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/290737
milestone: '13.7'
type: development
group: group::compliance
default_enabled: true
This diff is collapsed.
...@@ -84,8 +84,8 @@ tests = [ ...@@ -84,8 +84,8 @@ tests = [
{ {
explanation: 'FOSS views should map to respective spec', explanation: 'FOSS views should map to respective spec',
source: 'app/views/admin/users/_user.html.haml', source: 'app/views/admin/dashboard/index.html.haml',
expected: ['spec/views/admin/users/_user.html.haml_spec.rb'] expected: ['spec/views/admin/dashboard/index.html.haml_spec.rb']
}, },
{ {
......
...@@ -356,27 +356,19 @@ RSpec.describe 'Admin::Users::User' do ...@@ -356,27 +356,19 @@ RSpec.describe 'Admin::Users::User' do
end end
end end
[true, false].each do |vue_admin_users| describe 'GET /admin/users', :js do
context "with vue_admin_users feature flag set to #{vue_admin_users}", js: vue_admin_users do context 'user pending approval' do
before do it 'shows user info', :aggregate_failures do
stub_feature_flags(vue_admin_users: vue_admin_users) user = create(:user, :blocked_pending_approval)
end
describe 'GET /admin/users' do
context 'user pending approval' do
it 'shows user info', :aggregate_failures do
user = create(:user, :blocked_pending_approval)
visit admin_users_path visit admin_users_path
click_link 'Pending approval' click_link 'Pending approval'
click_link user.name click_link user.name
expect(page).to have_content(user.name) expect(page).to have_content(user.name)
expect(page).to have_content('Pending approval') expect(page).to have_content('Pending approval')
expect(page).to have_link('Approve user') expect(page).to have_link('Approve user')
expect(page).to have_link('Reject request') expect(page).to have_link('Reject request')
end
end
end end
end end
end end
......
This diff is collapsed.
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'admin/users/_user.html.haml' do
before do
allow(view).to receive(:user).and_return(user)
end
context 'internal users' do
context 'when showing a `Ghost User`' do
let(:user) { create(:user, :ghost) }
it 'does not render action buttons' do
render
expect(rendered).not_to have_selector('.table-action-buttons')
end
end
context 'when showing a `Bot User`' do
let(:user) { create(:user, user_type: :alert_bot) }
it 'does not render action buttons' do
render
expect(rendered).not_to have_selector('.table-action-buttons')
end
end
context 'when showing a `Migration User`' do
let(:user) { create(:user, user_type: :migration_bot) }
it 'does not render action buttons' do
render
expect(rendered).not_to have_selector('.table-action-buttons')
end
end
end
context 'when showing an external user' do
let(:user) { create(:user) }
it 'renders action buttons' do
render
expect(rendered).to have_selector('.table-action-buttons')
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