From 8aea75ef522fcef265b45e7f204192a6fb55a247 Mon Sep 17 00:00:00 2001
From: Roger Meier <r.meier@siemens.com>
Date: Mon, 8 Jun 2020 21:15:03 +0000
Subject: [PATCH] Show custom attributes within Admin Pages

Closes #23652
---
 app/views/admin/groups/show.html.haml                |  2 ++
 app/views/admin/projects/show.html.haml              |  2 ++
 app/views/admin/users/show.html.haml                 |  2 ++
 app/views/shared/_custom_attributes.html.haml        | 12 ++++++++++++
 .../feat-admin-pages-show-custom-attributes.yml      |  5 +++++
 locale/gitlab.pot                                    |  3 +++
 6 files changed, 26 insertions(+)
 create mode 100644 app/views/shared/_custom_attributes.html.haml
 create mode 100644 changelogs/unreleased/feat-admin-pages-show-custom-attributes.yml

diff --git a/app/views/admin/groups/show.html.haml b/app/views/admin/groups/show.html.haml
index ebed558f11b29..e105091e77303 100644
--- a/app/views/admin/groups/show.html.haml
+++ b/app/views/admin/groups/show.html.haml
@@ -59,6 +59,8 @@
 
         = render_if_exists 'namespaces/shared_runner_status', namespace: @group
 
+    = render 'shared/custom_attributes', custom_attributes: @group.custom_attributes
+
     = render_if_exists 'ldap_group_links/ldap_group_links_show', group: @group
 
     .card
diff --git a/app/views/admin/projects/show.html.haml b/app/views/admin/projects/show.html.haml
index 8abc4c37e706a..f9d42d3f53b91 100644
--- a/app/views/admin/projects/show.html.haml
+++ b/app/views/admin/projects/show.html.haml
@@ -108,6 +108,8 @@
               = visibility_level_icon(@project.visibility_level)
               = visibility_level_label(@project.visibility_level)
 
+    = render 'shared/custom_attributes', custom_attributes: @project.custom_attributes
+
     = render_if_exists 'admin/projects/geo_status_widget', locals: { project: @project }
 
     .card
diff --git a/app/views/admin/users/show.html.haml b/app/views/admin/users/show.html.haml
index 54cbed87bd542..e76f1f6444c3b 100644
--- a/app/views/admin/users/show.html.haml
+++ b/app/views/admin/users/show.html.haml
@@ -141,6 +141,8 @@
 
         = render_if_exists 'namespaces/shared_runner_status', namespace: @user.namespace
 
+    = render 'shared/custom_attributes', custom_attributes: @user.custom_attributes
+
   .col-md-6
     - unless @user == current_user
       - unless @user.confirmed?
diff --git a/app/views/shared/_custom_attributes.html.haml b/app/views/shared/_custom_attributes.html.haml
new file mode 100644
index 0000000000000..966ab8e3cb1fa
--- /dev/null
+++ b/app/views/shared/_custom_attributes.html.haml
@@ -0,0 +1,12 @@
+- return unless custom_attributes.present?
+
+.card
+  .card-header
+    = link_to(_('Custom Attributes'), help_page_path('api/custom_attributes.md'))
+  %ul.content-list
+    - custom_attributes.each do |custom_attribute|
+      %li
+        %span.light
+          = custom_attribute.key
+        %strong
+          = custom_attribute.value
diff --git a/changelogs/unreleased/feat-admin-pages-show-custom-attributes.yml b/changelogs/unreleased/feat-admin-pages-show-custom-attributes.yml
new file mode 100644
index 0000000000000..6a9efcff17235
--- /dev/null
+++ b/changelogs/unreleased/feat-admin-pages-show-custom-attributes.yml
@@ -0,0 +1,5 @@
+---
+title: Show custom attributes within Admin Pages
+merge_request: 34017
+author: Roger Meier
+type: added
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index a7d1408869292..36b854f73dbdb 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -6675,6 +6675,9 @@ msgstr ""
 msgid "CurrentUser|Upgrade"
 msgstr ""
 
+msgid "Custom Attributes"
+msgstr ""
+
 msgid "Custom CI configuration path"
 msgstr ""
 
-- 
GitLab