From aa29759b1b1c3e432c5b27977f84ac597b2f503d Mon Sep 17 00:00:00 2001 From: Ari Zellner Date: Thu, 8 Jun 2017 12:55:31 +0300 Subject: [PATCH] fix empty settings error in containers topology --- .../topology/container_topology_controller.js | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/app/assets/javascripts/controllers/topology/container_topology_controller.js b/app/assets/javascripts/controllers/topology/container_topology_controller.js index a708f452e4a1..0d3ecc9881b9 100644 --- a/app/assets/javascripts/controllers/topology/container_topology_controller.js +++ b/app/assets/javascripts/controllers/topology/container_topology_controller.js @@ -218,21 +218,23 @@ function ContainerTopologyCtrl($scope, $http, $interval, topologyService, $windo $scope.relations = data.data.relations; $scope.kinds = data.data.kinds; icons = data.data.icons; - var size_limit = data.data.settings.containers_max_items; if (currentSelectedKinds && (Object.keys(currentSelectedKinds).length !== Object.keys($scope.kinds).length)) { $scope.kinds = currentSelectedKinds; - } else if (size_limit > 0) { - var remove_hierarchy = ['Container', - 'ContainerGroup', - 'ContainerReplicator', - 'ContainerService', - 'ContainerRoute', - 'Host', - 'Vm', - 'ContainerNode', - 'ContainerManager']; - $scope.kinds = topologyService.reduce_kinds($scope.items, $scope.kinds, size_limit, remove_hierarchy); + } else if (data.data.settings && data.data.settings.containers_max_items) { + var size_limit = data.data.settings.containers_max_items; + if (size_limit > 0) { + var remove_hierarchy = ['Container', + 'ContainerGroup', + 'ContainerReplicator', + 'ContainerService', + 'ContainerRoute', + 'Host', + 'Vm', + 'ContainerNode', + 'ContainerManager']; + $scope.kinds = topologyService.reduce_kinds($scope.items, $scope.kinds, size_limit, remove_hierarchy); + } } }