From eed30afa93c48c37ba236453a522e3dc3fd2ad09 Mon Sep 17 00:00:00 2001 From: "yan.bai" Date: Fri, 14 Jun 2024 15:42:48 +0900 Subject: [PATCH] organize service detail page view --- promgen/locale/ja/LC_MESSAGES/django.po | 4 ++ promgen/static/css/promgen.css | 23 +++++++ .../promgen/service_action_button_group.html | 44 +++++++++++++ promgen/templates/promgen/service_block.html | 66 +++---------------- .../service_block_panel_notifiers.inc.html | 7 ++ .../service_block_panel_rules.inc.html | 17 +++++ .../promgen/service_block_projects.html | 24 +------ promgen/templates/promgen/service_detail.html | 50 ++++++++++++-- .../promgen/service_detail_projects.html | 20 ++++++ .../service_detail_projects_table.html | 27 ++++++++ 10 files changed, 196 insertions(+), 86 deletions(-) create mode 100644 promgen/templates/promgen/service_action_button_group.html create mode 100644 promgen/templates/promgen/service_block_panel_notifiers.inc.html create mode 100644 promgen/templates/promgen/service_block_panel_rules.inc.html create mode 100644 promgen/templates/promgen/service_detail_projects.html create mode 100644 promgen/templates/promgen/service_detail_projects_table.html diff --git a/promgen/locale/ja/LC_MESSAGES/django.po b/promgen/locale/ja/LC_MESSAGES/django.po index a13701c8f..c06544ec7 100644 --- a/promgen/locale/ja/LC_MESSAGES/django.po +++ b/promgen/locale/ja/LC_MESSAGES/django.po @@ -172,3 +172,7 @@ msgstr "Serviceを登録" #: templates/promgen/project_detail_hosts.html:49 msgid "Silence selected hosts" msgstr "選択したHostをSilence" + +#: templates/promgen/service_detail.html:23 +msgid "Actions" +msgstr "Actions" diff --git a/promgen/static/css/promgen.css b/promgen/static/css/promgen.css index d106ccbc3..f01ae226c 100644 --- a/promgen/static/css/promgen.css +++ b/promgen/static/css/promgen.css @@ -81,6 +81,29 @@ a[rel]:after { cursor: pointer; } + +/* service-detail */ +.promgen-flex-space-between-center { + display: flex; + align-items: center; + justify-content: space-between; +} + + +/* service-action-button-group */ +.service-action-button-group { + hr { + margin-top: 5px !important; + margin-bottom: 5px !important; + } + .dropdown-menu > li > form > button { + padding: 3px 20px; + white-space: nowrap; + background: none; + border: none; + } +} + /* Margin Top */ .mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: 0.25rem !important; } diff --git a/promgen/templates/promgen/service_action_button_group.html b/promgen/templates/promgen/service_action_button_group.html new file mode 100644 index 000000000..1b478d3f1 --- /dev/null +++ b/promgen/templates/promgen/service_action_button_group.html @@ -0,0 +1,44 @@ +{% load i18n %} +{% load promgen %} + +
+
+ + +
+ {% translate "Silence" %} + + {% translate "Edit Service" %} + +
diff --git a/promgen/templates/promgen/service_block.html b/promgen/templates/promgen/service_block.html index 441752edd..5e99b51b7 100644 --- a/promgen/templates/promgen/service_block.html +++ b/promgen/templates/promgen/service_block.html @@ -35,73 +35,25 @@
-
+ -
{% csrf_token %} - - - -
+ {% include "promgen/service_action_button_group.html" %} -
- - -
- - {% trans "Edit Service" %} - {% trans "Silence" %} - - - -
- {% csrf_token %} - -
-
-
- - {% if service.rule_set.count or request.site.rule_set.count %} -
- - {% include "promgen/rule_header.html" %} - {% include "promgen/rule_block.html" with rule_list=service.rule_set.all toggle=1 delete=1 %} - {% include "promgen/rule_block.html" with rule_list=request.site.rule_set.all collapse="service-site-rules-" overwrite_type='service' overwrite_id=service.id %} -
-
- {% endif %} + + {% include "promgen/service_block_panel_rules.inc.html" %} - {% if service.notifiers.count %} -
- {% include "promgen/notifier_block.html" with object=service show_edit=1 %} -
- {% endif %} + {% include "promgen/service_block_panel_notifiers.inc.html" %} {% include "promgen/service_block_projects.html" with project_list=project_list|default:service.project_set.all service=service only %} diff --git a/promgen/templates/promgen/service_block_panel_notifiers.inc.html b/promgen/templates/promgen/service_block_panel_notifiers.inc.html new file mode 100644 index 000000000..608beb4e5 --- /dev/null +++ b/promgen/templates/promgen/service_block_panel_notifiers.inc.html @@ -0,0 +1,7 @@ +{% load promgen %} + +{% if service.notifiers.count %} +
+ {% include "promgen/notifier_block.html" with object=service show_edit=1 %} +
+{% endif %} diff --git a/promgen/templates/promgen/service_block_panel_rules.inc.html b/promgen/templates/promgen/service_block_panel_rules.inc.html new file mode 100644 index 000000000..5b3c6095b --- /dev/null +++ b/promgen/templates/promgen/service_block_panel_rules.inc.html @@ -0,0 +1,17 @@ +{% load i18n %} +{% load promgen %} + +{% if service.rule_set.count or request.site.rule_set.count %} +
+ + {% include "promgen/rule_header.html" %} + {% include "promgen/rule_block.html" with rule_list=service.rule_set.all toggle=1 delete=1 %} + {% include "promgen/rule_block.html" with rule_list=request.site.rule_set.all collapse="service-site-rules-" overwrite_type='service' overwrite_id=service.id %} +
+ +
+{% endif %} diff --git a/promgen/templates/promgen/service_block_projects.html b/promgen/templates/promgen/service_block_projects.html index fd4540a03..bde08579b 100644 --- a/promgen/templates/promgen/service_block_projects.html +++ b/promgen/templates/promgen/service_block_projects.html @@ -10,30 +10,8 @@ ( {{shard.url}} ) {% trans "Register Project" %}
- - - - - - - - {% for project in shard_projects %} - {% if service.notifiers.count == 0 and project.notifiers.count == 0 %} - - - - {% endif %} + {% include 'promgen/service_detail_projects_table.html' with shard_projects=shard_projects service=service %} - {% include 'promgen/project_row.html' %} - {% empty %} - - - - {% endfor %} -
ProjectExportersNotifiersActions
- - {% trans "No notifications configured for this project. Please configure some" %} -
No Projects?
{% endfor %} diff --git a/promgen/templates/promgen/service_detail.html b/promgen/templates/promgen/service_detail.html index 556b8e1b6..75b137804 100644 --- a/promgen/templates/promgen/service_detail.html +++ b/promgen/templates/promgen/service_detail.html @@ -8,15 +8,53 @@ {% block content %} -