From 131f1b1dcd8909d354f33fe07f2328428d657e19 Mon Sep 17 00:00:00 2001 From: Samuel Liu Date: Thu, 27 Jun 2024 16:33:38 -0400 Subject: [PATCH] add annotations on summary pages with labels and fix miq_custom_attributes --- app/controllers/container_group_controller.rb | 2 +- app/controllers/container_node_controller.rb | 2 +- app/controllers/container_replicator_controller.rb | 2 +- app/controllers/container_route_controller.rb | 2 +- app/controllers/container_service_controller.rb | 2 +- app/controllers/container_template_controller.rb | 2 +- app/helpers/container_summary_helper.rb | 6 +++++- 7 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app/controllers/container_group_controller.rb b/app/controllers/container_group_controller.rb index 7145ea96e68..c95f961f386 100644 --- a/app/controllers/container_group_controller.rb +++ b/app/controllers/container_group_controller.rb @@ -16,7 +16,7 @@ def show_list def textual_group_list [ %i[properties container_labels container_node_selectors volumes], - %i[relationships conditions smart_management] + %i[relationships conditions smart_management annotations] ] end helper_method :textual_group_list diff --git a/app/controllers/container_node_controller.rb b/app/controllers/container_node_controller.rb index 5bfb45a8abd..df33e63b76f 100644 --- a/app/controllers/container_node_controller.rb +++ b/app/controllers/container_node_controller.rb @@ -15,7 +15,7 @@ def show_list def textual_group_list [ %i[properties container_labels compliance miq_custom_attributes], - %i[relationships conditions smart_management] + %i[relationships conditions smart_management annotations] ] end helper_method :textual_group_list diff --git a/app/controllers/container_replicator_controller.rb b/app/controllers/container_replicator_controller.rb index 98be0f26e76..883a1457ee0 100644 --- a/app/controllers/container_replicator_controller.rb +++ b/app/controllers/container_replicator_controller.rb @@ -26,7 +26,7 @@ def download_summary_pdf private def textual_group_list - [%i[properties container_labels container_selectors compliance], %i[relationships smart_management]] + [%i[properties container_labels container_selectors compliance], %i[relationships smart_management annotations]] end helper_method :textual_group_list diff --git a/app/controllers/container_route_controller.rb b/app/controllers/container_route_controller.rb index c339d79db7f..3cf2a3acfc9 100644 --- a/app/controllers/container_route_controller.rb +++ b/app/controllers/container_route_controller.rb @@ -20,7 +20,7 @@ def download_summary_pdf private def textual_group_list - [%i[properties container_labels], %i[relationships smart_management]] + [%i[properties container_labels annotations], %i[relationships smart_management]] end helper_method :textual_group_list diff --git a/app/controllers/container_service_controller.rb b/app/controllers/container_service_controller.rb index c7997b2a4db..73837868f5b 100644 --- a/app/controllers/container_service_controller.rb +++ b/app/controllers/container_service_controller.rb @@ -25,7 +25,7 @@ def download_summary_pdf private def textual_group_list - [%i[properties port_configs container_labels container_selectors], %i[relationships smart_management]] + [%i[properties port_configs container_labels container_selectors], %i[relationships smart_management annotations]] end helper_method :textual_group_list diff --git a/app/controllers/container_template_controller.rb b/app/controllers/container_template_controller.rb index 3973ff3068c..2758089979e 100644 --- a/app/controllers/container_template_controller.rb +++ b/app/controllers/container_template_controller.rb @@ -20,7 +20,7 @@ def download_summary_pdf private def textual_group_list - [%i[properties parameters objects], %i[relationships container_labels smart_management]] + [%i[properties parameters objects], %i[relationships container_labels smart_management annotations]] end helper_method :textual_group_list diff --git a/app/helpers/container_summary_helper.rb b/app/helpers/container_summary_helper.rb index 770b4cc2d85..1c76c88f729 100644 --- a/app/helpers/container_summary_helper.rb +++ b/app/helpers/container_summary_helper.rb @@ -73,12 +73,16 @@ def textual_group_container_labels TextualGroup.new(_("Labels"), textual_key_value_group(@record.labels.to_a)) end + def textual_group_annotations + TextualGroup.new(_("Annotations"), textual_key_value_group(@record.annotations)) + end + def textual_group_miq_custom_attributes TextualGroup.new(_("Custom Attributes"), textual_miq_custom_attributes) end def textual_miq_custom_attributes - attrs = @record.custom_attributes + attrs = @record.miq_custom_attributes return nil if attrs.blank? attrs.sort_by(&:name).collect { |a| {:label => a.name.tr("_", " "), :value => a.value} } end