From 804b4c3abe0372359e0f678e9b9c20dce652ac9b Mon Sep 17 00:00:00 2001 From: Shu Muto Date: Wed, 27 Dec 2017 10:59:12 +0900 Subject: [PATCH] Add noValue filter for cluster template parameters This patch shows '-' or 'None' for empty parameters on Cluster Template details view and in drawer on table view. Change-Id: I48f9051c0217560cbe4210370c5b3c0bebf5a2d1 --- .../details/drawer.controller.js | 10 ++++++ .../cluster-templates/details/drawer.html | 1 + .../details/overview.controller.js | 9 ++++++ .../cluster-templates/details/overview.html | 31 +++++++++---------- 4 files changed, 35 insertions(+), 16 deletions(-) diff --git a/magnum_ui/static/dashboard/container-infra/cluster-templates/details/drawer.controller.js b/magnum_ui/static/dashboard/container-infra/cluster-templates/details/drawer.controller.js index 970a11f2..a753557c 100644 --- a/magnum_ui/static/dashboard/container-infra/cluster-templates/details/drawer.controller.js +++ b/magnum_ui/static/dashboard/container-infra/cluster-templates/details/drawer.controller.js @@ -31,6 +31,16 @@ ]; function controller() { + var ctrl = this; + ctrl.objLen = objLen; + + function objLen(obj) { + var length = 0; + if (typeof obj === 'object') { + length = Object.keys(obj).length; + } + return length; + } } })(); diff --git a/magnum_ui/static/dashboard/container-infra/cluster-templates/details/drawer.html b/magnum_ui/static/dashboard/container-infra/cluster-templates/details/drawer.html index aa75ac28..f4846cc3 100644 --- a/magnum_ui/static/dashboard/container-infra/cluster-templates/details/drawer.html +++ b/magnum_ui/static/dashboard/container-infra/cluster-templates/details/drawer.html @@ -22,6 +22,7 @@
Labels
+
None
{$ key + '=' + value $}
diff --git a/magnum_ui/static/dashboard/container-infra/cluster-templates/details/overview.controller.js b/magnum_ui/static/dashboard/container-infra/cluster-templates/details/overview.controller.js index 15d68d7d..e4d4afba 100644 --- a/magnum_ui/static/dashboard/container-infra/cluster-templates/details/overview.controller.js +++ b/magnum_ui/static/dashboard/container-infra/cluster-templates/details/overview.controller.js @@ -30,6 +30,7 @@ var ctrl = this; ctrl.cluster_template = {}; ctrl.image_uuid = ""; + ctrl.objLen = objLen; $scope.context.loadPromise.then(onGetClusterTemplate); @@ -45,5 +46,13 @@ } }); } + + function objLen(obj) { + var length = 0; + if (typeof obj === 'object') { + length = Object.keys(obj).length; + } + return length; + } } })(); diff --git a/magnum_ui/static/dashboard/container-infra/cluster-templates/details/overview.html b/magnum_ui/static/dashboard/container-infra/cluster-templates/details/overview.html index 7fdd6525..69ec7c72 100644 --- a/magnum_ui/static/dashboard/container-infra/cluster-templates/details/overview.html +++ b/magnum_ui/static/dashboard/container-infra/cluster-templates/details/overview.html @@ -28,15 +28,15 @@
{$ ctrl.cluster_template.keypair_id $}
-
Flavor ID
-
{$ ctrl.cluster_template.flavor_id $}
+
{$ ctrl.cluster_template.flavor_id | noValue $}
Master Flavor ID
-
{$ ctrl.cluster_template.master_flavor_id $}
+
{$ ctrl.cluster_template.master_flavor_id | noValue $}
Volume Driver
-
{$ ctrl.cluster_template.volume_driver $}
+
{$ ctrl.cluster_template.volume_driver | noValue $}
Docker Storage Driver
-
{$ ctrl.cluster_template.docker_storage_driver $}
+
{$ ctrl.cluster_template.docker_storage_driver | noValue $}
Docker Volume Size
-
{$ ctrl.cluster_template.docker_volume_size | gb $}
+
{$ ctrl.cluster_template.docker_volume_size | gb | noValue $}
@@ -48,19 +48,19 @@
Network Driver
{$ ctrl.cluster_template.network_driver $}
HTTP Proxy
-
{$ ctrl.cluster_template.http_proxy $}
+
{$ ctrl.cluster_template.http_proxy | noValue $}
HTTPS Proxy
-
{$ ctrl.cluster_template.https_proxy $}
+
{$ ctrl.cluster_template.https_proxy | noValue $}
No Proxy
-
{$ ctrl.cluster_template.no_proxy $}
+
{$ ctrl.cluster_template.no_proxy | noValue $}
External Network ID
{$ ctrl.cluster_template.external_network_id $}
Fixed Network
-
{$ ctrl.cluster_template.fixed_network $}
+
{$ ctrl.cluster_template.fixed_network | noValue $}
Fixed Subnet
-
{$ ctrl.cluster_template.fixed_subnet $}
+
{$ ctrl.cluster_template.fixed_subnet | noValue $}
DNS
-
{$ ctrl.cluster_template.dns_nameserver $}
+
{$ ctrl.cluster_template.dns_nameserver | noValue $}
Master LB Enabled
{$ ctrl.cluster_template.master_lb_enabled | yesno $}
Floating IP Enabled
@@ -71,10 +71,9 @@

Labels


-
-
{$ key $}
-
{$ value $}
-
+
None
+
{$ key $}
+
{$ value $}
@@ -86,7 +85,7 @@
Created
{$ ctrl.cluster_template.created_at | date:'short' $}
Updated
-
{$ ctrl.cluster_template.updated_at | date:'short' $}
+
{$ ctrl.cluster_template.updated_at | date:'short' | noValue $}
ID
{$ ctrl.cluster_template.id $}