From 8e0d5bce17495d9015c26e4e85f9094409b85b50 Mon Sep 17 00:00:00 2001 From: Marcin Piwowarczyk Date: Wed, 7 Nov 2018 11:22:26 +0100 Subject: [PATCH] Add Volume Size value in cluster instances details Volume Size parameter was not shown for cluster instances. This change makes Volue Size visible in instances table. Change-Id: Iee819189f7ca49aeec579aa06d88911b0ac37b19 Signed-off-by: Marcin Piwowarczyk --- trove_dashboard/content/database_clusters/tables.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/trove_dashboard/content/database_clusters/tables.py b/trove_dashboard/content/database_clusters/tables.py index 3cf8426..e80ec43 100644 --- a/trove_dashboard/content/database_clusters/tables.py +++ b/trove_dashboard/content/database_clusters/tables.py @@ -209,6 +209,12 @@ def get_host(instance): return _("Not Assigned") +def get_instance_volume_size(instance): + if hasattr(instance, "volume"): + return sizeformat.diskgbformat(instance.volume.get("size")) + return _("Not available") + + class InstancesTable(tables.DataTable): name = tables.Column("name", verbose_name=_("Name")) @@ -219,6 +225,9 @@ class InstancesTable(tables.DataTable): size = tables.Column(get_instance_size, verbose_name=_("Size"), attrs={'data-type': 'size'}) + volume_size = tables.Column(get_instance_volume_size, + verbose_name=_("Volume Size"), + attrs={'data-type': 'size'}) status = tables.Column("status", filters=(title, filters.replace_underscores), verbose_name=_("Status"))