gitlab-org--gitlab-foss/app/views/admin/dashboard/index.html.haml
Stan Hu b6125f7045 Fix fast admin counters not working when PostgreSQL has secondaries
This commit does a number of things:

1. Reduces the number of queries needed by perform a single query to get all
the tuples for the relevant rows.

2. Uses a transaction to query the tuple counts to ensure that the data
is retrieved from the primary.

Closes #46742
2018-05-25 22:58:43 -07:00

199 lines
7.4 KiB
Text

- @no_container = true
- breadcrumb_title "Dashboard"
%div{ class: container_class }
= render_if_exists "admin/licenses/breakdown", license: @license
.admin-dashboard.prepend-top-default
.row
.col-sm-4
.info-well.dark-well
.well-segment.well-centered
= link_to admin_projects_path do
%h3.text-center
Projects:
= approximate_count_with_delimiters(@counts, Project)
%hr
= link_to('New project', new_project_path, class: "btn btn-new")
.col-sm-4
.info-well.dark-well
.well-segment.well-centered
= link_to admin_users_path do
%h3.text-center
Users:
= approximate_count_with_delimiters(@counts, User)
= render_if_exists 'users_statistics'
%hr
= link_to 'New user', new_admin_user_path, class: "btn btn-new"
.col-sm-4
.info-well.dark-well
.well-segment.well-centered
= link_to admin_groups_path do
%h3.text-center
Groups:
= approximate_count_with_delimiters(@counts, Group)
%hr
= link_to 'New group', new_admin_group_path, class: "btn btn-new"
.row
.col-md-4
.info-well
.well-segment.admin-well.admin-well-statistics
%h4 Statistics
%p
Forks
%span.light.float-right
= approximate_count_with_delimiters(@counts, ForkedProjectLink)
%p
Issues
%span.light.float-right
= approximate_count_with_delimiters(@counts, Issue)
%p
Merge Requests
%span.light.float-right
= approximate_count_with_delimiters(@counts, MergeRequest)
%p
Notes
%span.light.float-right
= approximate_count_with_delimiters(@counts, Note)
%p
Snippets
%span.light.float-right
= approximate_count_with_delimiters(@counts, Snippet)
%p
SSH Keys
%span.light.float-right
= approximate_count_with_delimiters(@counts, Key)
%p
Milestones
%span.light.float-right
= approximate_count_with_delimiters(@counts, Milestone)
%p
Active Users
%span.light.float-right
= number_with_delimiter(User.active.count)
.col-md-4
.info-well
.well-segment.admin-well.admin-well-features
%h4 Features
- sign_up = "Sign up"
%p{ "aria-label" => "#{sign_up}: status " + (allow_signup? ? "on" : "off") }
= sign_up
%span.light.float-right
= boolean_to_icon allow_signup?
- ldap = "LDAP"
%p{ "aria-label" => "#{ldap}: status " + (Gitlab.config.ldap.enabled ? "on" : "off") }
= ldap
%span.light.float-right
= boolean_to_icon Gitlab.config.ldap.enabled
- gravatar = "Gravatar"
%p{ "aria-label" => "#{gravatar}: status " + (gravatar_enabled? ? "on" : "off") }
= gravatar
%span.light.float-right
= boolean_to_icon gravatar_enabled?
- omniauth = "OmniAuth"
%p{ "aria-label" => "#{omniauth}: status " + (Gitlab.config.omniauth.enabled ? "on" : "off") }
= omniauth
%span.light.float-right
= boolean_to_icon Gitlab.config.omniauth.enabled
- reply_email = "Reply by email"
%p{ "aria-label" => "#{reply_email}: status " + (Gitlab::IncomingEmail.enabled? ? "on" : "off") }
= reply_email
%span.light.float-right
= boolean_to_icon Gitlab::IncomingEmail.enabled?
= render_if_exists 'elastic_and_geo'
- container_reg = "Container Registry"
%p{ "aria-label" => "#{container_reg}: status " + (Gitlab.config.registry.enabled ? "on" : "off") }
= container_reg
%span.light.float-right
= boolean_to_icon Gitlab.config.registry.enabled
- gitlab_pages = 'GitLab Pages'
- gitlab_pages_enabled = Gitlab.config.pages.enabled
%p{ "aria-label" => "#{gitlab_pages}: status " + (gitlab_pages_enabled ? "on" : "off") }
= gitlab_pages
%span.light.float-right
= boolean_to_icon gitlab_pages_enabled
- gitlab_shared_runners = 'Shared Runners'
- gitlab_shared_runners_enabled = Gitlab.config.gitlab_ci.shared_runners_enabled
%p{ "aria-label" => "#{gitlab_shared_runners}: status " + (gitlab_shared_runners_enabled ? "on" : "off") }
= gitlab_shared_runners
%span.light.float-right
= boolean_to_icon gitlab_shared_runners_enabled
.col-md-4
.info-well
.well-segment.admin-well
%h4
Components
- if Gitlab::CurrentSettings.version_check_enabled
.float-right
= version_status_badge
%p
GitLab
%span.float-right
= Gitlab::VERSION
= "(#{Gitlab.revision})"
%p
GitLab Shell
%span.float-right
= Gitlab::Shell.new.version
%p
GitLab Workhorse
%span.float-right
= gitlab_workhorse_version
%p
GitLab API
%span.float-right
= API::API::version
- if Gitlab.config.pages.enabled
%p
GitLab Pages
%span.float-right
= Gitlab::Pages::VERSION
= render_if_exists 'geo'
%p
Ruby
%span.float-right
#{RUBY_VERSION}p#{RUBY_PATCHLEVEL}
%p
Rails
%span.float-right
#{Rails::VERSION::STRING}
%p
= Gitlab::Database.adapter_name
%span.float-right
= Gitlab::Database.version
%p
= link_to "Gitaly Servers", admin_gitaly_servers_path
.row
.col-md-4
.info-well
.well-segment.admin-well
%h4 Latest projects
- @projects.each do |project|
%p
= link_to project.full_name, [:admin, project.namespace.becomes(Namespace), project], class: 'str-truncated-60'
%span.light.float-right
#{time_ago_with_tooltip(project.created_at)}
.col-md-4
.info-well
.well-segment.admin-well
%h4 Latest users
- @users.each do |user|
%p
= link_to [:admin, user], class: 'str-truncated-60' do
= user.name
%span.light.float-right
#{time_ago_with_tooltip(user.created_at)}
.col-md-4
.info-well
.well-segment.admin-well
%h4 Latest groups
- @groups.each do |group|
%p
= link_to [:admin, group], class: 'str-truncated-60' do
= group.full_name
%span.light.float-right
#{time_ago_with_tooltip(group.created_at)}