Commit 68155ee7 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'issue_3946' into 'master'

Improve UI consistency for admin area

Closes #3946

See merge request !4424
parents 7ebd011e 140b0952
...@@ -21,6 +21,7 @@ v 8.10.0 (unreleased) ...@@ -21,6 +21,7 @@ v 8.10.0 (unreleased)
- Fix pagination when sorting by columns with lots of ties (like priority) - Fix pagination when sorting by columns with lots of ties (like priority)
- Updated project header design - Updated project header design
- Exclude email check from the standard health check - Exclude email check from the standard health check
- Updated layout for Projects, Groups, Users on Admin area !4424
- Fix changing issue state columns in milestone view - Fix changing issue state columns in milestone view
- Add notification settings dropdown for groups - Add notification settings dropdown for groups
- Allow importing from Github using Personal Access Tokens. (Eric K Idema) - Allow importing from Github using Personal Access Tokens. (Eric K Idema)
......
...@@ -127,7 +127,7 @@ class Dispatcher ...@@ -127,7 +127,7 @@ class Dispatcher
when 'groups' when 'groups'
new UsersSelect() new UsersSelect()
when 'projects' when 'projects'
new NamespaceSelect() new NamespaceSelects()
when 'dashboard', 'root' when 'dashboard', 'root'
shortcut_handler = new ShortcutsDashboardNavigation() shortcut_handler = new ShortcutsDashboardNavigation()
when 'profiles' when 'profiles'
......
class @NamespaceSelect class @NamespaceSelect
constructor: -> constructor: (opts) ->
namespaceFormatResult = (namespace) -> {
markup = "<div class='namespace-result'>" @dropdown
markup += "<span class='namespace-kind'>" + namespace.kind + "</span>" } = opts
markup += "<span class='namespace-path'>" + namespace.path + "</span>"
markup += "</div>" showAny = true
markup fieldName = 'namespace_id'
formatSelection = (namespace) -> if @dropdown.attr 'data-field-name'
namespace.kind + ": " + namespace.path fieldName = @dropdown.data 'fieldName'
$('.ajax-namespace-select').each (i, select) -> if @dropdown.attr 'data-show-any'
$(select).select2 showAny = @dropdown.data 'showAny'
placeholder: "Search for namespace"
multiple: $(select).hasClass('multiselect') @dropdown.glDropdown(
minimumInputLength: 0 filterable: true
query: (query) -> selectable: true
Api.namespaces query.term, (namespaces) -> filterRemote: true
data = { results: namespaces } search:
query.callback(data) fields: ['path']
fieldName: fieldName
dropdownCssClass: "ajax-namespace-dropdown" toggleLabel: (selected) ->
formatResult: namespaceFormatResult return if not selected.id? then selected.text else "#{selected.kind}: #{selected.path}"
formatSelection: formatSelection data: (term, dataCallback) ->
Api.namespaces term, (namespaces) ->
if showAny
anyNamespace =
text: 'Any namespace'
id: null
namespaces.unshift(anyNamespace)
namespaces.splice 1, 0, 'divider'
dataCallback(namespaces)
text: (namespace) ->
return if not namespace.id? then namespace.text else "#{namespace.kind}: #{namespace.path}"
renderRow: @renderRow
clicked: @onSelectItem
)
onSelectItem: (item, el, e) =>
e.preventDefault()
class @NamespaceSelects
constructor: (opts = {}) ->
{
@$dropdowns = $('.js-namespace-select')
} = opts
@$dropdowns.each (i, dropdown) ->
$dropdown = $(dropdown)
new NamespaceSelect(
dropdown: $dropdown
)
...@@ -68,6 +68,10 @@ ...@@ -68,6 +68,10 @@
color: $dropdown-toggle-hover-icon-color; color: $dropdown-toggle-hover-icon-color;
} }
} }
&.large {
width: 200px;
}
} }
.dropdown-menu, .dropdown-menu,
......
...@@ -134,6 +134,11 @@ ...@@ -134,6 +134,11 @@
margin-bottom: 0; margin-bottom: 0;
border-bottom: none; border-bottom: none;
&.wide {
width: 100%;
display: block;
}
li a { li a {
padding: 16px 10px 11px; padding: 16px 10px 11px;
} }
...@@ -164,6 +169,7 @@ ...@@ -164,6 +169,7 @@
> .btn { > .btn {
margin-right: $gl-padding-top; margin-right: $gl-padding-top;
display: inline-block; display: inline-block;
vertical-align: top;
&:last-child { &:last-child {
margin-right: 0; margin-right: 0;
......
...@@ -71,3 +71,36 @@ ...@@ -71,3 +71,36 @@
@extend .broadcast-message; @extend .broadcast-message;
margin-bottom: 20px; margin-bottom: 20px;
} }
// Users List
.users-list {
.user-row {
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
.user-details {
flex: 1 1 auto;
}
.user-name {
display: inline-block;
font-weight: bold;
}
.controls {
> .btn, > .dropdown {
margin-left: 5px;
}
}
.dropdown {
.btn-block {
margin-bottom: 0;
line-height: inherit;
}
}
}
...@@ -38,6 +38,39 @@ ...@@ -38,6 +38,39 @@
margin-right: 15px; margin-right: 15px;
} }
} }
&.group-admin {
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
.group-avatar, .group-details, .group-controls {
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
}
.group-details {
flex: 1 1 auto;
flex-direction: column;
min-width: 0;
}
.group-controls {
align-items: center;
a {
margin-left: 5px;
}
}
}
}
.ldap-group-links {
.form-actions {
margin-bottom: $gl-padding;
}
} }
.groups-cover-block { .groups-cover-block {
......
...@@ -475,10 +475,6 @@ pre.light-well { ...@@ -475,10 +475,6 @@ pre.light-well {
a:hover { a:hover {
text-decoration: none; text-decoration: none;
} }
> span {
margin-left: 10px;
}
} }
} }
......
...@@ -208,7 +208,7 @@ ...@@ -208,7 +208,7 @@
margin-top: 5px; margin-top: 5px;
@media (min-width: $screen-sm-min) { @media (min-width: $screen-sm-min) {
width: 160px; width: 180px;
margin-top: 0; margin-top: 0;
} }
} }
......
...@@ -5,11 +5,12 @@ class Admin::ProjectsController < Admin::ApplicationController ...@@ -5,11 +5,12 @@ class Admin::ProjectsController < Admin::ApplicationController
def index def index
@projects = Project.all @projects = Project.all
@projects = @projects.in_namespace(params[:namespace_id]) if params[:namespace_id].present? @projects = @projects.in_namespace(params[:namespace_id]) if params[:namespace_id].present?
@projects = @projects.where("projects.visibility_level IN (?)", params[:visibility_levels]) if params[:visibility_levels].present? @projects = @projects.where(visibility_level: params[:visibility_level]) if params[:visibility_level].present?
@projects = @projects.with_push if params[:with_push].present? @projects = @projects.with_push if params[:with_push].present?
@projects = @projects.abandoned if params[:abandoned].present? @projects = @projects.abandoned if params[:abandoned].present?
@projects = @projects.where(last_repository_check_failed: true) if params[:last_repository_check_failed].present? @projects = @projects.where(last_repository_check_failed: true) if params[:last_repository_check_failed].present?
@projects = @projects.non_archived unless params[:with_archived].present? @projects = @projects.non_archived unless params[:archived].present?
@projects = @projects.personal(current_user) if params[:personal].present?
@projects = @projects.search(params[:name]) if params[:name].present? @projects = @projects.search(params[:name]) if params[:name].present?
@projects = @projects.sort(@sort = params[:sort]) @projects = @projects.sort(@sort = params[:sort])
@projects = @projects.includes(:namespace).order("namespaces.path, projects.name ASC").page(params[:page]) @projects = @projects.includes(:namespace).order("namespaces.path, projects.name ASC").page(params[:page])
......
...@@ -39,7 +39,7 @@ module DropdownsHelper ...@@ -39,7 +39,7 @@ module DropdownsHelper
end end
end end
def dropdown_toggle(toggle_text, data_attr, options) def dropdown_toggle(toggle_text, data_attr, options = {})
content_tag(:button, class: "dropdown-menu-toggle #{options[:toggle_class] if options.has_key?(:toggle_class)}", id: (options[:id] if options.has_key?(:id)), type: "button", data: data_attr) do content_tag(:button, class: "dropdown-menu-toggle #{options[:toggle_class] if options.has_key?(:toggle_class)}", id: (options[:id] if options.has_key?(:id)), type: "button", data: data_attr) do
output = content_tag(:span, toggle_text, class: "dropdown-toggle-text") output = content_tag(:span, toggle_text, class: "dropdown-toggle-text")
output << icon('chevron-down') output << icon('chevron-down')
......
- css_class = '' unless local_assigns[:css_class] - css_class = '' unless local_assigns[:css_class]
- css_class += ' no-description' if group.description.blank?
%li.group-row{ class: css_class } %li.group-row.group-admin{ class: css_class }
.controls.hidden-xs .group-avatar
= link_to 'Edit', edit_admin_group_path(group), id: "edit_#{dom_id(group)}", class: 'btn btn-grouped btn-sm' = image_tag group_icon(group), class: 'avatar hidden-xs'
= link_to 'Destroy', [:admin, group], data: {confirm: "REMOVE #{group.name}? Are you sure?"}, method: :delete, class: 'btn btn-grouped btn-sm btn-remove' .group-details
.title
= link_to [:admin, group], class: 'group-name' do
= group.name
.group-stats
%span>= pluralize(number_with_delimiter(group.projects.count), 'project')
,
%span= pluralize(number_with_delimiter(group.users.count), 'member')
.stats - if group.description.present?
%span .description
= icon('bookmark') = markdown(group.description, pipeline: :description)
= number_with_delimiter(group.projects.count) .group-controls.hidden-xs
= link_to 'Edit', edit_admin_group_path(group), id: "edit_#{dom_id(group)}", class: 'btn'
%span = link_to 'Delete', [:admin, group], data: { confirm: "Are you sure you want to remove #{group.name}?" }, method: :delete, class: 'btn btn-remove'
= icon('users')
= number_with_delimiter(group.users.count)
%span.visibility-icon.has-tooltip{data: { container: 'body', placement: 'left' }, title: visibility_icon_description(group)}
= visibility_level_icon(group.visibility_level, fw: false)
= image_tag group_icon(group), class: 'avatar s40 hidden-xs'
.title
= link_to [:admin, group], class: 'group-name' do
= group.name
- if group.description.present?
.description
= markdown(group.description, pipeline: :description)
...@@ -3,41 +3,32 @@ ...@@ -3,41 +3,32 @@
= render "admin/dashboard/head" = render "admin/dashboard/head"
%div{ class: container_class } %div{ class: container_class }
%h3.page-title
Groups (#{number_with_delimiter(@groups.total_count)})
%p.light
Group allows you to keep projects organized.
Use groups for uniting related projects.
.top-area .top-area
.nav-search .prepend-top-default.append-bottom-default
= form_tag admin_groups_path, method: :get, class: 'form-inline' do = form_tag admin_groups_path, method: :get, class: 'js-search-form' do |f|
= hidden_field_tag :sort, @sort = hidden_field_tag :sort, @sort
= text_field_tag :name, params[:name], class: "form-control" .search-holder
= button_tag "Search", class: "btn submit btn-primary" - project_name = params[:name].present? ? params[:name] : nil
.search-field-holder
.nav-controls = search_field_tag :name, project_name, class: "form-control search-text-input js-search-input", autofocus: true, spellcheck: false, placeholder: 'Search by name'
.dropdown.inline = icon("search", class: "search-icon")
%a.dropdown-toggle.btn{href: '#', "data-toggle" => "dropdown"} .dropdown
%span.light - toggle_text = @sort.present? ? sort_options_hash[@sort] : sort_title_recently_created
- if @sort.present? = dropdown_toggle(toggle_text, { toggle: 'dropdown' })
= sort_options_hash[@sort] %ul.dropdown-menu.dropdown-menu-align-right
- else %li.dropdown-header
= sort_title_recently_created Sort by
%b.caret %li
%ul.dropdown-menu = link_to admin_groups_path(sort: sort_value_recently_created, name: project_name) do
%li = sort_title_recently_created
= link_to admin_groups_path(sort: sort_value_recently_created) do = link_to admin_groups_path(sort: sort_value_oldest_created, name: project_name) do
= sort_title_recently_created = sort_title_oldest_created
= link_to admin_groups_path(sort: sort_value_oldest_created) do = link_to admin_groups_path(sort: sort_value_recently_updated, name: project_name) do
= sort_title_oldest_created = sort_title_recently_updated
= link_to admin_groups_path(sort: sort_value_recently_updated) do = link_to admin_groups_path(sort: sort_value_oldest_updated, name: project_name) do
= sort_title_recently_updated = sort_title_oldest_updated
= link_to admin_groups_path(sort: sort_value_oldest_updated) do = link_to new_admin_group_path, class: "btn btn-new" do
= sort_title_oldest_updated New Group
= link_to 'New Group', new_admin_group_path, class: "btn btn-new"
%ul.content-list %ul.content-list
= render @groups = render @groups
......
- @no_container = true - @no_container = true
- page_title "Projects" - page_title "Projects"
= render 'shared/show_aside' - params[:visibility_level] ||= []
= render "admin/dashboard/head" = render "admin/dashboard/head"
%div{ class: container_class } %div{ class: container_class }
.row.prepend-top-default .top-area
%aside.col-md-3 .prepend-top-default
.panel.admin-filter = form_tag admin_namespaces_projects_path, method: :get do |f|
= form_tag admin_namespaces_projects_path, method: :get, class: '' do .search-holder
.form-group .search-field-holder
= label_tag :name, 'Name:' = search_field_tag :name, params[:name], class: "form-control search-text-input js-search-input", id: "dashboard_search", autofocus: true, spellcheck: false, placeholder: 'Search by name'
= text_field_tag :name, params[:name], class: "form-control"
- if params[:visibility_level].present?
= hidden_field_tag 'visibility_level', params[:visibility_level]
- if params[:sort].present?
= hidden_field_tag 'sort', params[:sort]
- if params[:personal].present?
= hidden_field_tag 'visibility_level', 'true'
- if params[:archived].present?
= hidden_field_tag 'archived', 'true'
= icon("search", class: "search-icon")
.dropdown
- toggle_text = 'Search for Namespace'
- if params[:namespace_id].present?
- namespace = Namespace.find(params[:namespace_id])
- toggle_text = "#{namespace.kind}: #{namespace.path}"
= dropdown_toggle(toggle_text, { toggle: 'dropdown' }, { toggle_class: 'js-namespace-select large' })
.dropdown-menu.dropdown-select.dropdown-menu-align-right
= dropdown_title('Namespaces')
= dropdown_filter("Search for Namespace")
= dropdown_content
= dropdown_loading
= button_tag "Search", class: "btn btn-primary btn-search"
%ul.nav-links
- opts = params[:visibility_level].present? ? {} : { page: admin_namespaces_projects_path }
= nav_link(opts) do
= link_to admin_namespaces_projects_path do
All
.form-group = nav_link(html_options: { class: params[:visibility_level] == Gitlab::VisibilityLevel::PRIVATE.to_s ? 'active' : '' }) do
= label_tag :namespace_id, "Namespace" = link_to admin_namespaces_projects_path(visibility_level: Gitlab::VisibilityLevel::PRIVATE) do
= namespace_select_tag :namespace_id, selected: params[:namespace_id], class: 'input-large' Private
= nav_link(html_options: { class: params[:visibility_level] == Gitlab::VisibilityLevel::INTERNAL.to_s ? 'active' : '' }) do
= link_to admin_namespaces_projects_path(visibility_level: Gitlab::VisibilityLevel::INTERNAL) do
Internal
= nav_link(html_options: { class: params[:visibility_level] == Gitlab::VisibilityLevel::PUBLIC.to_s ? 'active' : '' }) do
= link_to admin_namespaces_projects_path(visibility_level: Gitlab::VisibilityLevel::PUBLIC) do
Public
.form-group .nav-controls
%strong Activity = render 'shared/projects/dropdown'
.checkbox = link_to new_project_path, class: 'btn btn-new' do
= label_tag :with_push do New Project
= check_box_tag :with_push, 1, params[:with_push]
%span Projects with push events
.checkbox
= label_tag :abandoned do
= check_box_tag :abandoned, 1, params[:abandoned]
%span No activity over 6 month
.checkbox
= label_tag :with_archived do
= check_box_tag :with_archived, 1, params[:with_archived]
%span Show archived projects
%fieldset .projects-list-holder
%strong Visibility level: - if @projects.any?
.visibility-levels %ul.projects-list.content-list
- Project.visibility_levels.each do |label, level| - @projects.each_with_index do |project|
.checkbox %li.project-row
%label .controls.pull-right
= check_box_tag 'visibility_levels[]', level, params[:visibility_levels].present? && params[:visibility_levels].include?(level.to_s) - if project.archived
%span.descr %span.label.label-warning archived
= visibility_level_icon(level) %span.label.label-gray
= label = repository_size(project)
%fieldset = link_to 'Edit', edit_namespace_project_path(project.namespace, project), id: "edit_#{dom_id(project)}", class: "btn"
%strong Problems = link_to 'Delete', [project.namespace.becomes(Namespace), project], data: { confirm: remove_project_message(project) }, method: :delete, class: "btn btn-remove"
.checkbox .title
= label_tag :last_repository_check_failed do = link_to [:admin, project.namespace.becomes(Namespace), project] do
= check_box_tag :last_repository_check_failed, 1, params[:last_repository_check_failed] .dash-project-avatar
%span Last repository check failed = project_icon(project, alt: '', class: 'avatar project-avatar s40')
%span.project-full-name
%span.namespace-name
- if project.namespace
= project.namespace.human_name
\/
%span.project-name.filter-title
= project.name
= hidden_field_tag :sort, params[:sort] - if project.description.present?
= button_tag "Search", class: "btn submit btn-primary" .description
= link_to "Reset", admin_namespaces_projects_path, class: "btn btn-cancel" = markdown(project.description, pipeline: :description)
%section.col-md-9 = paginate @projects, theme: 'gitlab'
.panel.panel-default - else
.panel-heading .nothing-here-block No projects found
Projects (#{@projects.total_count})
.controls
.dropdown.inline
%button.dropdown-toggle.btn.btn-sm{type: 'button', 'data-toggle' => 'dropdown'}
%span.light
- if @sort.present?
= sort_options_hash[@sort]
- else
= sort_title_recently_created
%b.caret
%ul.dropdown-menu
%li
= link_to admin_namespaces_projects_path(sort: sort_value_recently_created) do
= sort_title_recently_created
= link_to admin_namespaces_projects_path(sort: sort_value_oldest_created) do
= sort_title_oldest_created
= link_to admin_namespaces_projects_path(sort: sort_value_recently_updated) do
= sort_title_recently_updated
= link_to admin_namespaces_projects_path(sort: sort_value_oldest_updated) do
= sort_title_oldest_updated
= link_to admin_namespaces_projects_path(sort: sort_value_largest_repo) do
= sort_title_largest_repo
= link_to 'New Project', new_project_path, class: "btn btn-sm btn-success"
%ul.well-list
- @projects.each do |project|
%li
.list-item-name
%span{ class: visibility_level_color(project.visibility_level) }
= visibility_level_icon(project.visibility_level)
= link_to project.name_with_namespace, [:admin, project.namespace.becomes(Namespace), project]
.pull-right
- if project.archived
%span.label.label-warning archived
%span.label.label-gray
= repository_size(project)
= link_to 'Edit', edit_namespace_project_path(project.namespace, project), id: "edit_#{dom_id(project)}", class: "btn btn-sm"
= link_to 'Destroy', [project.namespace.becomes(Namespace), project], data: { confirm: remove_project_message(project) }, method: :delete, class: "btn btn-sm btn-remove"
- if @projects.blank?
.nothing-here-block 0 projects matches
= paginate @projects, theme: "gitlab"
...@@ -99,7 +99,13 @@ ...@@ -99,7 +99,13 @@
.form-group .form-group
= f.label :new_namespace_id, "Namespace", class: 'control-label' = f.label :new_namespace_id, "Namespace", class: 'control-label'
.col-sm-10 .col-sm-10
= namespace_select_tag :new_namespace_id, selected: params[:namespace_id], class: 'input-large' .dropdown
= dropdown_toggle('Search for Namespace', { toggle: 'dropdown', field_name: 'new_namespace_id', show_any: 'false' }, { toggle_class: 'js-namespace-select large' })
.dropdown-menu.dropdown-select
= dropdown_title('Namespaces')
= dropdown_filter("Search for Namespace")
= dropdown_content
= dropdown_loading
.form-group .form-group
.col-sm-offset-2.col-sm-10 .col-sm-offset-2.col-sm-10
......
%li.user-row
.user-avatar
= image_tag avatar_icon(user), class: "avatar", alt: ''
.user-details
.user-name
= link_to user.name, [:admin, user]
- if user.blocked?
%span.label.label-danger blocked
- if user.admin?
%span.label.label-success Admin
- if user.external?
%span.label.label-default External
- if user == current_user
%span It's you!
.user-email
= mail_to user.email, user.email
.controls.pull-right
= link_to 'Edit', edit_admin_user_path(user), id: "edit_#{dom_id(user)}", class: 'btn'
- unless user == current_user
.dropdown.inline
%a.dropdown-new.btn.btn-default#project-settings-button{href: '#', data: { toggle: 'dropdown' } }
= icon('cog')
= icon('caret-down')
%ul.dropdown-menu.dropdown-menu-align-right
%li.dropdown-header
Settings
%li
- if user.ldap_blocked?
%span.small Cannot unblock LDAP blocked users
- elsif user.blocked?
= link_to 'Unblock', unblock_admin_user_path(user), method: :put
- else
= link_to 'Block', block_admin_user_path(user), data: { confirm: 'USER WILL BE BLOCKED! Are you sure?' }, method: :put
- if user.access_locked?
%li
= link_to 'Unlock', unlock_admin_user_path(user), method: :put, class: 'btn-grouped btn btn-xs btn-success', data: { confirm: 'Are you sure?' }
- if user.can_be_removed?
%li.divider
%li
= link_to 'Delete User', [:admin, user], data: { confirm: "USER #{user.name} WILL BE REMOVED! All issues, merge requests and groups linked to this user will also be removed! Consider cancelling this deletion and blocking the user instead. Are you sure?" },
class: 'btn btn-remove btn-block',
method: :delete
- @no_container = true - @no_container = true
- page_title "Users" - page_title "Users"
= render 'shared/show_aside'
= render "admin/dashboard/head" = render "admin/dashboard/head"
%div{ class: container_class } %div{ class: container_class }
.admin-filter .top-area
%ul.nav-links .prepend-top-default
%li{class: "#{'active' unless params[:filter]}"} = form_tag admin_users_path, method: :get do
= link_to admin_users_path do - if params[:filter].present?
Active = hidden_field_tag "filter", h(params[:filter])
%small.badge= number_with_delimiter(User.active.count) .search-holder
%li{class: "#{'active' if params[:filter] == "admins"}"} .search-field-holder
= link_to admin_users_path(filter: "admins") do = search_field_tag :name, params[:name], placeholder: 'Search by name, email or username', class: 'form-control search-text-input js-search-input', spellcheck: false
Admins = icon("search", class: "search-icon")
%small.badge= number_with_delimiter(User.admins.count) .dropdown
%li.filter-two-factor-enabled{class: "#{'active' if params[:filter] == 'two_factor_enabled'}"} - toggle_text = if @sort.present? then sort_options_hash[@sort] else sort_title_name end
= link_to admin_users_path(filter: 'two_factor_enabled') do = dropdown_toggle(toggle_text, { toggle: 'dropdown' })
2FA Enabled %ul.dropdown-menu.dropdown-menu-align-right
%small.badge= number_with_delimiter(User.with_two_factor.count) %li.dropdown-header
%li.filter-two-factor-disabled{class: "#{'active' if params[:filter] == 'two_factor_disabled'}"} Sort by
= link_to admin_users_path(filter: 'two_factor_disabled') do %li
2FA Disabled = link_to admin_users_path(sort: sort_value_name, filter: params[:filter]) do
%small.badge= number_with_delimiter(User.without_two_factor.count) = sort_title_name
%li.filter-external{class: "#{'active' if params[:filter] == 'external'}"} = link_to admin_users_path(sort: sort_value_recently_signin, filter: params[:filter]) do
= link_to admin_users_path(filter: 'external') do = sort_title_recently_signin
External = link_to admin_users_path(sort: sort_value_oldest_signin, filter: params[:filter]) do
%small.badge= number_with_delimiter(User.external.count) = sort_title_oldest_signin
%li{class: "#{'active' if params[:filter] == "blocked"}"} = link_to admin_users_path(sort: sort_value_recently_created, filter: params[:filter]) do
= link_to admin_users_path(filter: "blocked") do = sort_title_recently_created
Blocked = link_to admin_users_path(sort: sort_value_oldest_created, filter: params[:filter]) do
%small.badge= number_with_delimiter(User.blocked.count) = sort_title_oldest_created
%li{class: "#{'active' if params[:filter] == "wop"}"} = link_to admin_users_path(sort: sort_value_recently_updated, filter: params[:filter]) do
= link_to admin_users_path(filter: "wop") do = sort_title_recently_updated
Without projects = link_to admin_users_path(sort: sort_value_oldest_updated, filter: params[:filter]) do
%small.badge= number_with_delimiter(User.without_projects.count) = sort_title_oldest_updated
= link_to 'New User', new_admin_user_path, class: 'btn btn-new btn-search'
.row-content-block.second-block .nav-block
.pull-right %ul.nav-links.wide.scrolling-tabs.white.scrolling-tabs
.dropdown.inline .fade-left
%a.dropdown-toggle.btn{href: '#', "data-toggle" => "dropdown"} = nav_link(html_options: { class: ('active' unless params[:filter]) }) do
%span.light = link_to admin_users_path do
- if @sort.present? Active
= sort_options_hash[@sort] %small.badge= number_with_delimiter(User.active.count)
- else = nav_link(html_options: { class: ('active' if params[:filter] == 'admins') }) do
= sort_title_name = link_to admin_users_path(filter: "admins") do
%b.caret Admins
%ul.dropdown-menu %small.badge= number_with_delimiter(User.admins.count)
%li = nav_link(html_options: { class: "#{'active' if params[:filter] == 'two_factor_enabled'} filter-two-factor-enabled" }) do
= link_to admin_users_path(sort: sort_value_name, filter: params[:filter]) do = link_to admin_users_path(filter: 'two_factor_enabled') do
= sort_title_name 2FA Enabled
= link_to admin_users_path(sort: sort_value_recently_signin, filter: params[:filter]) do %small.badge= number_with_delimiter(User.with_two_factor.count)
= sort_title_recently_signin = nav_link(html_options: { class: "#{'active' if params[:filter] == 'two_factor_disabled'} filter-two-factor-disabled" }) do
= link_to admin_users_path(sort: sort_value_oldest_signin, filter: params[:filter]) do = link_to admin_users_path(filter: 'two_factor_disabled') do
= sort_title_oldest_signin 2FA Disabled
= link_to admin_users_path(sort: sort_value_recently_created, filter: params[:filter]) do %small.badge= number_with_delimiter(User.without_two_factor.count)
= sort_title_recently_created = nav_link(html_options: { class: ('active' if params[:filter] == 'external') }) do
= link_to admin_users_path(sort: sort_value_oldest_created, filter: params[:filter]) do = link_to admin_users_path(filter: 'external') do
= sort_title_oldest_created External
= link_to admin_users_path(sort: sort_value_recently_updated, filter: params[:filter]) do %small.badge= number_with_delimiter(User.external.count)
= sort_title_recently_updated = nav_link(html_options: { class: ('active' if params[:filter] == 'blocked') }) do
= link_to admin_users_path(sort: sort_value_oldest_updated, filter: params[:filter]) do = link_to admin_users_path(filter: "blocked") do
= sort_title_oldest_updated Blocked
%small.badge= number_with_delimiter(User.blocked.count)
= nav_link(html_options: { class: ('active' if params[:filter] == 'wop') }) do
= link_to admin_users_path(filter: "wop") do
Without projects
%small.badge= number_with_delimiter(User.without_projects.count)
.fade-right
= link_to 'New User', new_admin_user_path, class: "btn btn-new" %ul.users-list.content-list
= form_tag admin_users_path, method: :get, class: 'form-inline' do - if @users.empty?
.form-group %li
= search_field_tag :name, params[:name], placeholder: 'Name, email or username', class: 'form-control', spellcheck: false .nothing-here-block No users found.
= hidden_field_tag "filter", params[:filter] - else
= button_tag class: 'btn btn-primary' do = render partial: 'admin/users/user', collection: @users
%i.fa.fa-search
.panel.panel-default
%ul.well-list
- @users.each do |user|
%li
.list-item-name
- if user.blocked?
= icon("lock", class: "cred")
- else
= icon("user", class: "cgreen")
= link_to user.name, [:admin, user]
- if user.admin?
%strong.cred (Admin)
- if user.external?
%strong.cred (External)
- if user == current_user
%span.cred It's you!
.pull-right
%span.light
%i.fa.fa-envelope
= mail_to user.email, user.email, class: 'light'
&nbsp;
.pull-right
= link_to 'Edit', edit_admin_user_path(user), id: "edit_#{dom_id(user)}", class: 'btn-grouped btn btn-xs'
- unless user == current_user
- if user.ldap_blocked?
= link_to '#', title: 'Cannot unblock LDAP blocked users', data: {toggle: 'tooltip'}, class: 'btn-grouped btn btn-xs btn-success disabled' do
%i.fa.fa-lock
Unblock
- elsif user.blocked?
= link_to 'Unblock', unblock_admin_user_path(user), method: :put, class: 'btn-grouped btn btn-xs btn-success'
- else
= link_to 'Block', block_admin_user_path(user), data: {confirm: 'USER WILL BE BLOCKED! Are you sure?'}, method: :put, class: 'btn-grouped btn btn-xs btn-warning'
- if user.access_locked?
= link_to 'Unlock', unlock_admin_user_path(user), method: :put, class: 'btn-grouped btn btn-xs btn-success', data: { confirm: 'Are you sure?' }
- if user.can_be_removed?
= link_to 'Destroy', [:admin, user], data: { confirm: "USER #{user.name} WILL BE REMOVED! All issues, merge requests and groups linked to this user will also be removed! Maybe block the user instead? Are you sure?" }, method: :delete, class: 'btn-grouped btn btn-xs btn-remove'
= paginate @users, theme: "gitlab" = paginate @users, theme: "gitlab"
- @sort ||= sort_value_recently_updated - @sort ||= sort_value_recently_updated
- personal = params[:personal] - personal = params[:personal]
- archived = params[:archived] - archived = params[:archived]
- namespace_id = params[:namespace_id]
.dropdown.inline .dropdown.inline
%button.dropdown-toggle.btn{type: 'button', 'data-toggle' => 'dropdown'} - toggle_text = projects_sort_options_hash[@sort]
%span.light = dropdown_toggle(toggle_text, { toggle: 'dropdown' }, { id: 'sort-projects-dropdown' })
= projects_sort_options_hash[@sort]
%b.caret
%ul.dropdown-menu.dropdown-menu-align-right.dropdown-menu-selectable %ul.dropdown-menu.dropdown-menu-align-right.dropdown-menu-selectable
%li.dropdown-header %li.dropdown-header
Sort by Sort by
- projects_sort_options_hash.each do |value, title| - projects_sort_options_hash.each do |value, title|
%li %li
= link_to filter_projects_path(sort: value, archived: archived, personal: personal), class: ("is-active" if @sort == value) do = link_to filter_projects_path(namespace_id: namespace_id, sort: value, archived: archived, personal: personal), class: ("is-active" if @sort == value) do
= title = title
%li.divider %li.divider
%li %li
= link_to filter_projects_path(sort: @sort, archived: nil), class: ("is-active" unless params[:archived].present?) do = link_to filter_projects_path(namespace_id: namespace_id, sort: @sort, archived: nil), class: ("is-active" unless params[:archived].present?) do
Hide archived projects Hide archived projects
%li %li
= link_to filter_projects_path(sort: @sort, archived: true), class: ("is-active" if params[:archived].present?) do = link_to filter_projects_path(namespace_id: namespace_id, sort: @sort, archived: true), class: ("is-active" if params[:archived].present?) do
Show archived projects Show archived projects
- if current_user - if current_user
%li.divider %li.divider
%li %li
= link_to filter_projects_path(sort: @sort, personal: nil), class: ("is-active" unless personal) do = link_to filter_projects_path(namespace_id: namespace_id, sort: @sort, personal: nil), class: ("is-active" unless personal.present?) do
Owned by anyone Owned by anyone
%li %li
= link_to filter_projects_path(sort: @sort, personal: true), class: ("is-active" if personal) do = link_to filter_projects_path(namespace_id: namespace_id, sort: @sort, personal: true), class: ("is-active" if personal.present?) do
Owned by me Owned by me
...@@ -10,10 +10,11 @@ Feature: Admin Projects ...@@ -10,10 +10,11 @@ Feature: Admin Projects
Then I should see all non-archived projects Then I should see all non-archived projects
And I should not see project "Archive" And I should not see project "Archive"
@javascript
Scenario: I should see all projects in the list Scenario: I should see all projects in the list
Given archived project "Archive" Given archived project "Archive"
When I visit admin projects page When I visit admin projects page
And I check "Show archived projects" And I select "Show archived projects"
Then I should see all projects Then I should see all projects
And I should see "archived" label And I should see "archived" label
...@@ -22,6 +23,7 @@ Feature: Admin Projects ...@@ -22,6 +23,7 @@ Feature: Admin Projects
And I click on first project And I click on first project
Then I should see project details Then I should see project details
@javascript
Scenario: Transfer project Scenario: Transfer project
Given group 'Web' Given group 'Web'
And I visit admin project page And I visit admin project page
......
...@@ -18,9 +18,9 @@ class Spinach::Features::AdminProjects < Spinach::FeatureSteps ...@@ -18,9 +18,9 @@ class Spinach::Features::AdminProjects < Spinach::FeatureSteps
end end
end end
step 'I check "Show archived projects"' do step 'I select "Show archived projects"' do
page.check 'Show archived projects' find(:css, '#sort-projects-dropdown').click
click_button "Search" click_link 'Show archived projects'
end end
step 'I should see "archived" label' do step 'I should see "archived" label' do
...@@ -45,7 +45,8 @@ class Spinach::Features::AdminProjects < Spinach::FeatureSteps ...@@ -45,7 +45,8 @@ class Spinach::Features::AdminProjects < Spinach::FeatureSteps
step 'I transfer project to group \'Web\'' do step 'I transfer project to group \'Web\'' do
allow_any_instance_of(Projects::TransferService). allow_any_instance_of(Projects::TransferService).
to receive(:move_uploads_to_new_namespace).and_return(true) to receive(:move_uploads_to_new_namespace).and_return(true)
find(:xpath, "//input[@id='new_namespace_id']").set group.id click_button 'Search for Namespace'
click_link 'group: web'
click_button 'Transfer' click_button 'Transfer'
end end
......
...@@ -11,12 +11,12 @@ describe Admin::ProjectsController do ...@@ -11,12 +11,12 @@ describe Admin::ProjectsController do
render_views render_views
it 'retrieves the project for the given visibility level' do it 'retrieves the project for the given visibility level' do
get :index, visibility_levels: [Gitlab::VisibilityLevel::PUBLIC] get :index, visibility_level: [Gitlab::VisibilityLevel::PUBLIC]
expect(response.body).to match(project.name) expect(response.body).to match(project.name)
end end
it 'does not retrieve the project' do it 'does not retrieve the project' do
get :index, visibility_levels: [Gitlab::VisibilityLevel::INTERNAL] get :index, visibility_level: [Gitlab::VisibilityLevel::INTERNAL]
expect(response.body).not_to match(project.name) expect(response.body).not_to match(project.name)
end 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