Commit 2524cb10 authored by Ash McKenzie's avatar Ash McKenzie

Merge branch 'ce-xanf-add-admin-area-links' into 'master'

Resolve "Add interactive links in the Admin Area overview"

See merge request gitlab-org/gitlab-ce!29306
parents bc537606 a6ac0a27
# frozen_string_literal: true # frozen_string_literal: true
module DashboardHelper module DashboardHelper
include IconsHelper
def assigned_issues_dashboard_path def assigned_issues_dashboard_path
issues_dashboard_path(assignee_username: current_user.username) issues_dashboard_path(assignee_username: current_user.username)
end end
...@@ -25,6 +27,19 @@ module DashboardHelper ...@@ -25,6 +27,19 @@ module DashboardHelper
false false
end end
def feature_entry(title, href: nil, enabled: true)
enabled_text = enabled ? 'on' : 'off'
label = "#{title}: status #{enabled_text}"
link_or_title = href && enabled ? tag.a(title, href: href) : title
tag.p(aria: { label: label }) do
concat(link_or_title)
concat(tag.span(class: ['light', 'float-right']) do
concat(boolean_to_icon(enabled))
end)
end
end
private private
def get_dashboard_nav_links def get_dashboard_nav_links
......
...@@ -76,51 +76,17 @@ ...@@ -76,51 +76,17 @@
.info-well .info-well
.well-segment.admin-well.admin-well-features .well-segment.admin-well.admin-well-features
%h4 Features %h4 Features
- sign_up = "Sign up" = feature_entry(_('Sign up'), href: admin_application_settings_path(anchor: 'js-signup-settings'))
%p{ "aria-label" => "#{sign_up}: status " + (allow_signup? ? "on" : "off") } = feature_entry(_('LDAP'), enabled: Gitlab.config.ldap.enabled)
= sign_up = feature_entry(_('Gravatar'), href: admin_application_settings_path(anchor: 'js-account-settings'), enabled: gravatar_enabled?)
%span.light.float-right = feature_entry(_('OmniAuth'), href: admin_application_settings_path(anchor: 'js-signin-settings'), enabled: Gitlab::Auth.omniauth_enabled?)
= boolean_to_icon allow_signup? = feature_entry(_('Reply by email'), enabled: Gitlab::IncomingEmail.enabled?)
- 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::Auth.omniauth_enabled? ? "on" : "off") }
= omniauth
%span.light.float-right
= boolean_to_icon Gitlab::Auth.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 'admin/dashboard/elastic_and_geo' = render_if_exists 'admin/dashboard/elastic_and_geo'
- container_reg = "Container Registry" = feature_entry(_('Container Registry'), href: ci_cd_admin_application_settings_path(anchor: 'js-registry-settings'), enabled: Gitlab.config.registry.enabled)
%p{ "aria-label" => "#{container_reg}: status " + (Gitlab.config.registry.enabled ? "on" : "off") } = feature_entry(_('Gitlab Pages'), href: help_instance_configuration_url, enabled: Gitlab.config.pages.enabled)
= container_reg = feature_entry(_('Shared Runners'), href: admin_runners_path, enabled: Gitlab.config.gitlab_ci.shared_runners_enabled)
%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 .col-md-4
.info-well .info-well
.well-segment.admin-well .well-segment.admin-well
...@@ -130,6 +96,7 @@ ...@@ -130,6 +96,7 @@
.float-right .float-right
= version_status_badge = version_status_badge
%p %p
%a{ href: admin_application_settings_path }
GitLab GitLab
%span.float-right %span.float-right
= Gitlab::VERSION = Gitlab::VERSION
......
---
title: Add links to relevant configuration areas in admin area overview
merge_request: 29306
author:
type: added
...@@ -4971,6 +4971,9 @@ msgstr "" ...@@ -4971,6 +4971,9 @@ msgstr ""
msgid "Gitea Import" msgid "Gitea Import"
msgstr "" msgstr ""
msgid "Gitlab Pages"
msgstr ""
msgid "Given access %{time_ago}" msgid "Given access %{time_ago}"
msgstr "" msgstr ""
...@@ -5031,6 +5034,9 @@ msgstr "" ...@@ -5031,6 +5034,9 @@ msgstr ""
msgid "Graph" msgid "Graph"
msgstr "" msgstr ""
msgid "Gravatar"
msgstr ""
msgid "Gravatar enabled" msgid "Gravatar enabled"
msgstr "" msgstr ""
...@@ -5963,6 +5969,9 @@ msgstr "" ...@@ -5963,6 +5969,9 @@ msgstr ""
msgid "Kubernetes service integration has been disabled. Fields on this page are not used by GitLab, you can configure your Kubernetes clusters using the new <a href=\"%{url}\"/>Kubernetes Clusters</a> page" msgid "Kubernetes service integration has been disabled. Fields on this page are not used by GitLab, you can configure your Kubernetes clusters using the new <a href=\"%{url}\"/>Kubernetes Clusters</a> page"
msgstr "" msgstr ""
msgid "LDAP"
msgstr ""
msgid "LFS" msgid "LFS"
msgstr "" msgstr ""
...@@ -7154,6 +7163,9 @@ msgstr "" ...@@ -7154,6 +7163,9 @@ msgstr ""
msgid "OfSearchInADropdown|Filter" msgid "OfSearchInADropdown|Filter"
msgstr "" msgstr ""
msgid "OmniAuth"
msgstr ""
msgid "Once removed, the fork relationship cannot be restored and you will no longer be able to send merge requests to the source." msgid "Once removed, the fork relationship cannot be restored and you will no longer be able to send merge requests to the source."
msgstr "" msgstr ""
...@@ -8898,6 +8910,9 @@ msgstr "" ...@@ -8898,6 +8910,9 @@ msgstr ""
msgid "Replace all label(s)" msgid "Replace all label(s)"
msgstr "" msgstr ""
msgid "Reply by email"
msgstr ""
msgid "Reply to comment" msgid "Reply to comment"
msgstr "" msgstr ""
...@@ -9706,6 +9721,9 @@ msgstr "" ...@@ -9706,6 +9721,9 @@ msgstr ""
msgid "Sign out" msgid "Sign out"
msgstr "" msgstr ""
msgid "Sign up"
msgstr ""
msgid "Sign-in restrictions" msgid "Sign-in restrictions"
msgstr "" msgstr ""
......
...@@ -22,6 +22,43 @@ describe DashboardHelper do ...@@ -22,6 +22,43 @@ describe DashboardHelper do
end end
end end
describe '#feature_entry' do
context 'when implicitly enabled' do
it 'considers feature enabled by default' do
entry = feature_entry('Demo', href: 'demo.link')
expect(entry).to include('<p aria-label="Demo: status on">')
expect(entry).to include('<a href="demo.link">Demo</a>')
end
end
context 'when explicitly enabled' do
it 'returns a link' do
entry = feature_entry('Demo', href: 'demo.link', enabled: true)
expect(entry).to include('<p aria-label="Demo: status on">')
expect(entry).to include('<a href="demo.link">Demo</a>')
end
it 'returns text if href is not provided' do
entry = feature_entry('Demo', enabled: true)
expect(entry).to include('<p aria-label="Demo: status on">')
expect(entry).not_to match(/<a[^>]+>/)
end
end
context 'when disabled' do
it 'returns text without link' do
entry = feature_entry('Demo', href: 'demo.link', enabled: false)
expect(entry).to include('<p aria-label="Demo: status off">')
expect(entry).not_to match(/<a[^>]+>/)
expect(entry).to include('Demo')
end
end
end
describe '.has_start_trial?' do describe '.has_start_trial?' do
subject { helper.has_start_trial? } subject { helper.has_start_trial? }
......
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