From 4a3f0dcef01faf5ff6e96d9dd09fd2d1620fe157 Mon Sep 17 00:00:00 2001 From: Ameed Ashour Date: Sun, 4 Feb 2018 05:38:24 -0500 Subject: [PATCH] Network topology "Graph" tab always shows nothing Network topology "Graph" tab always says "There are no networks, routers, or connected instances to display." This happens after a fix for bug 1661350 (commit f35eaa2d13fc5aff31b9a83dc729cc20b91fc611) was merged. The problem with that in checking the length of object. So always will be equal undefined, also check the object before getting filled. Closes-Bug: #1747196 Change-Id: I72dd8d2b472677411635f58309c780a8d602ffe3 --- .../static/js/horizon.networktopology.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/openstack_dashboard/static/js/horizon.networktopology.js b/openstack_dashboard/static/js/horizon.networktopology.js index ffb32b6860..f8d97ff749 100644 --- a/openstack_dashboard/static/js/horizon.networktopology.js +++ b/openstack_dashboard/static/js/horizon.networktopology.js @@ -145,12 +145,6 @@ horizon.network_topology = { // set up loader first thing self.$loading_template.show(); - if (self.data.networks.length === undefined) { - $('.loader-inline').remove(); - $(self.svg_container).addClass('noinfo'); - return; - } - self.create_vis(); self.force_direction(0.05,70,-700); if(horizon.networktopologyloader.model !== null) { @@ -165,6 +159,13 @@ horizon.network_topology = { angular.element('#networktopology').on('change', function() { self.retrieve_network_info(true); + if(angular.equals(self.data.networks,{}) && angular.equals(self.data.routers,{}) && + angular.equals(self.data.servers,{})){ + $('.loader-inline').remove(); + angular.element('#topologyCanvasContainer').find('svg').remove(); + $(self.svg_container).addClass('noinfo'); + return; + } }); // register for message notifications