diff --git a/src/sunstone/public/app/tabs/vnets-topology-tab.js b/src/sunstone/public/app/tabs/vnets-topology-tab.js index b26a5e6dba..ffed3068a1 100644 --- a/src/sunstone/public/app/tabs/vnets-topology-tab.js +++ b/src/sunstone/public/app/tabs/vnets-topology-tab.js @@ -25,6 +25,7 @@ define(function(require) { var Vis = require('vis'); var TemplateDashboard = require('hbs!./vnets-topology-tab/html'); + var TemplateEmptyTable = require('hbs!utils/tab-datatable/empty-table'); var _network; var _vnetList; @@ -120,26 +121,32 @@ define(function(require) { var i = 0; function _getVNet(index){ - var vnetId = item_list[index].VNET.ID; + var element = item_list[index]; + if (element !== undefined) { + var vnetId = element.VNET.ID; - OpenNebula.Network.show({ - data : { - id: vnetId - }, - timeout:true, - success: function(request,info){ - vnetList.push(info); + OpenNebula.Network.show({ + data : { + id: vnetId + }, + timeout:true, + success: function(request,info){ + vnetList.push(info); - i += 1; - if (i == item_list.length){ - _vnetList = vnetList; - _doTopology(); - } else { - _getVNet(i); - } - }, - error: Notifier.onError - }); + i += 1; + if (i == item_list.length){ + _vnetList = vnetList; + _doTopology(); + } else { + _getVNet(i); + } + }, + error: Notifier.onError + }); + } else { + _vnetList = vnetList; + $('#visgraph').html(TemplateEmptyTable()); + } } _getVNet(i); diff --git a/src/sunstone/public/app/tabs/vnets-topology-tab/html.hbs b/src/sunstone/public/app/tabs/vnets-topology-tab/html.hbs index 459145a70f..63e8396c17 100644 --- a/src/sunstone/public/app/tabs/vnets-topology-tab/html.hbs +++ b/src/sunstone/public/app/tabs/vnets-topology-tab/html.hbs @@ -14,4 +14,5 @@ {{! limitations under the License. }} {{! -------------------------------------------------------------------------- }} -
+