Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
afcf11d2
Commit
afcf11d2
authored
Oct 16, 2019
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve admin features widget
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
c47991bc
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
90 additions
and
29 deletions
+90
-29
app/helpers/dashboard_helper.rb
app/helpers/dashboard_helper.rb
+11
-2
app/views/admin/dashboard/index.html.haml
app/views/admin/dashboard/index.html.haml
+29
-8
changelogs/unreleased/dz-improve-admin-features.yml
changelogs/unreleased/dz-improve-admin-features.yml
+5
-0
locale/gitlab.pot
locale/gitlab.pot
+3
-0
spec/helpers/dashboard_helper_spec.rb
spec/helpers/dashboard_helper_spec.rb
+42
-19
No files found.
app/helpers/dashboard_helper.rb
View file @
afcf11d2
...
...
@@ -27,16 +27,25 @@ module DashboardHelper
false
end
def
feature_entry
(
title
,
href:
nil
,
enabled:
true
)
def
feature_entry
(
title
,
href:
nil
,
enabled:
true
,
doc_href:
nil
)
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
)
)
boolean_to_icon
(
enabled
)
end
)
if
doc_href
.
present?
link_to_doc
=
link_to
(
sprite_icon
(
'question'
,
size:
16
),
doc_href
,
class:
'prepend-left-5'
,
title:
_
(
'Documentation'
),
target:
'_blank'
,
rel:
'noopener noreferrer'
)
concat
(
link_to_doc
)
end
end
end
...
...
app/views/admin/dashboard/index.html.haml
View file @
afcf11d2
...
...
@@ -41,17 +41,38 @@
.info-well
.well-segment.admin-well.admin-well-features
%h4
Features
=
feature_entry
(
_
(
'Sign up'
),
href:
admin_application_settings_path
(
anchor:
'js-signup-settings'
),
enabled:
allow_signup?
)
=
feature_entry
(
_
(
'LDAP'
),
enabled:
Gitlab
.
config
.
ldap
.
enabled
)
=
feature_entry
(
_
(
'Gravatar'
),
href:
admin_application_settings_path
(
anchor:
'js-account-settings'
),
enabled:
gravatar_enabled?
)
=
feature_entry
(
_
(
'OmniAuth'
),
href:
admin_application_settings_path
(
anchor:
'js-signin-settings'
),
enabled:
Gitlab
::
Auth
.
omniauth_enabled?
)
=
feature_entry
(
_
(
'Reply by email'
),
enabled:
Gitlab
::
IncomingEmail
.
enabled?
)
=
feature_entry
(
_
(
'Sign up'
),
href:
admin_application_settings_path
(
anchor:
'js-signup-settings'
),
enabled:
allow_signup?
)
=
feature_entry
(
_
(
'LDAP'
),
enabled:
Gitlab
.
config
.
ldap
.
enabled
)
=
feature_entry
(
_
(
'Gravatar'
),
href:
admin_application_settings_path
(
anchor:
'js-account-settings'
),
enabled:
gravatar_enabled?
)
=
feature_entry
(
_
(
'OmniAuth'
),
href:
admin_application_settings_path
(
anchor:
'js-signin-settings'
),
enabled:
Gitlab
::
Auth
.
omniauth_enabled?
)
=
feature_entry
(
_
(
'Reply by email'
),
enabled:
Gitlab
::
IncomingEmail
.
enabled?
)
=
render_if_exists
'admin/dashboard/elastic_and_geo'
=
feature_entry
(
_
(
'Container Registry'
),
href:
ci_cd_admin_application_settings_path
(
anchor:
'js-registry-settings'
),
enabled:
Gitlab
.
config
.
registry
.
enabled
)
=
feature_entry
(
_
(
'Gitlab Pages'
),
href:
help_instance_configuration_url
,
enabled:
Gitlab
.
config
.
pages
.
enabled
)
=
feature_entry
(
_
(
'Shared Runners'
),
href:
admin_runners_path
,
enabled:
Gitlab
.
config
.
gitlab_ci
.
shared_runners_enabled
)
=
feature_entry
(
_
(
'Container Registry'
),
href:
ci_cd_admin_application_settings_path
(
anchor:
'js-registry-settings'
),
enabled:
Gitlab
.
config
.
registry
.
enabled
,
doc_href:
help_page_path
(
'user/packages/container_registry/index'
))
=
feature_entry
(
_
(
'Gitlab Pages'
),
enabled:
Gitlab
.
config
.
pages
.
enabled
,
doc_href:
help_instance_configuration_url
)
=
feature_entry
(
_
(
'Shared Runners'
),
href:
admin_runners_path
,
enabled:
Gitlab
.
config
.
gitlab_ci
.
shared_runners_enabled
)
.col-md-4
.info-well
.well-segment.admin-well
...
...
changelogs/unreleased/dz-improve-admin-features.yml
0 → 100644
View file @
afcf11d2
---
title
:
Improve admin dashboard features
merge_request
:
18666
author
:
type
:
changed
locale/gitlab.pot
View file @
afcf11d2
...
...
@@ -5751,6 +5751,9 @@ msgstr ""
msgid "Dockerfile"
msgstr ""
msgid "Documentation"
msgstr ""
msgid "Documentation for popular identity providers"
msgstr ""
...
...
spec/helpers/dashboard_helper_spec.rb
View file @
afcf11d2
...
...
@@ -25,39 +25,62 @@ describe DashboardHelper do
end
describe
'#feature_entry'
do
context
'when implicitly enabled'
do
it
'considers feature enabled by default'
do
entry
=
feature_entry
(
'Demo'
,
href:
'demo.link'
)
shared_examples
"a feature is enabled"
do
it
{
is_expected
.
to
include
(
'<p aria-label="Demo: status on">'
)
}
end
shared_examples
"a feature is disabled"
do
it
{
is_expected
.
to
include
(
'<p aria-label="Demo: status off">'
)
}
end
expect
(
entry
).
to
include
(
'<p aria-label="Demo: status on">'
)
expect
(
entry
).
to
include
(
'<a href="demo.link">Demo</a>'
)
shared_examples
"a feature without link"
do
it
do
is_expected
.
not_to
have_link
(
'Demo'
)
is_expected
.
not_to
have_link
(
'Documentation'
)
end
end
shared_examples
"a feature with configuration"
do
it
{
is_expected
.
to
have_link
(
'Demo'
,
href:
'demo.link'
)
}
end
shared_examples
"a feature with documentation"
do
it
{
is_expected
.
to
have_link
(
'Documentation'
,
href:
'doc.link'
)
}
end
context
'when implicitly enabled'
do
subject
{
feature_entry
(
'Demo'
)
}
it_behaves_like
'a feature is enabled'
end
context
'when explicitly enabled'
do
it
'returns a link
'
do
entry
=
feature_entry
(
'Demo'
,
href:
'demo.link'
,
enabled:
true
)
context
'without links
'
do
subject
{
feature_entry
(
'Demo'
,
enabled:
true
)
}
expect
(
entry
).
to
include
(
'<p aria-label="Demo: status on">'
)
expect
(
entry
).
to
include
(
'<a href="demo.link">Demo</a>'
)
it_behaves_like
'a feature is enabled'
it_behaves_like
'a feature without link'
end
it
'returns text if href is not provided
'
do
entry
=
feature_entry
(
'Demo'
,
enabled:
true
)
context
'with configure link
'
do
subject
{
feature_entry
(
'Demo'
,
href:
'demo.link'
,
enabled:
true
)
}
expect
(
entry
).
to
include
(
'<p aria-label="Demo: status on">'
)
expect
(
entry
).
not_to
match
(
/<a[^>]+>/
)
it_behaves_like
'a feature with configuration'
end
context
'with configure and documentation links'
do
subject
{
feature_entry
(
'Demo'
,
href:
'demo.link'
,
doc_href:
'doc.link'
,
enabled:
true
)
}
it_behaves_like
'a feature with configuration'
it_behaves_like
'a feature with documentation'
end
end
context
'when disabled'
do
it
'returns text without link'
do
entry
=
feature_entry
(
'Demo'
,
href:
'demo.link'
,
enabled:
false
)
subject
{
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
it_behaves_like
'a feature is disabled'
it_behaves_like
'a feature without link'
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment