From ef214a6918cb606d27b9d9fc8905e9b0074ecd92 Mon Sep 17 00:00:00 2001 From: Samuel Padgett Date: Mon, 30 Nov 2015 14:58:29 -0500 Subject: [PATCH] Hide old deployments in the topology view --- assets/app/scripts/controllers/overview.js | 37 +++++++++++++- assets/app/views/project.html | 4 +- pkg/assets/bindata.go | 57 +++++++++++++--------- 3 files changed, 70 insertions(+), 28 deletions(-) diff --git a/assets/app/scripts/controllers/overview.js b/assets/app/scripts/controllers/overview.js index 4a385d9790c1..73373fc2ba89 100644 --- a/assets/app/scripts/controllers/overview.js +++ b/assets/app/scripts/controllers/overview.js @@ -406,6 +406,32 @@ angular.module('openshiftConsole') topologyItems[makeId(service)] = service; }); + var isRecentDeployment = $filter('isRecentDeployment'); + $scope.isVisibleDeployment = function(deployment) { + // If this is a replication controller and not a deployment, then it's visible. + var dcName = annotationFilter(deployment, 'deploymentConfig'); + if (!dcName) { + return true; + } + + // If the deployment is active, it's visible. + if (hashSizeFilter($scope.podsByDeployment[deployment.metadata.name]) > 0) { + return true; + } + + // Otherwise, show the deployment only if it's the latest. + if (!$scope.deploymentConfigs) { + return false; + } + + var dc = $scope.deploymentConfigs[dcName]; + if (!dc) { + return false; + } + + return isRecentDeployment(deployment, dc); + }; + // Add everything related to services, each of these tables are in // standard form with string keys, pointing to a map of further // name -> resource mappings. @@ -420,9 +446,16 @@ angular.module('openshiftConsole') var service = $scope.services[serviceName]; if (!serviceName || service) { angular.forEach(resources, function(resource) { - if (map !== $scope.monopodsByService || showMonopod(resource)) { - topologyItems[makeId(resource)] = resource; + // Filter some items to be consistent with the tiles view. + if (map === $scope.monopodsByService && !showMonopod(resource)) { + return; } + + if (map === $scope.deploymentsByService && !$scope.isVisibleDeployment(resource)) { + return; + } + + topologyItems[makeId(resource)] = resource; }); } }); diff --git a/assets/app/views/project.html b/assets/app/views/project.html index 9a0abf73fb7b..a7b67f47ce8d 100644 --- a/assets/app/views/project.html +++ b/assets/app/views/project.html @@ -166,8 +166,8 @@

+ ng-if="isVisibleDeployment(deployment)" + class="animate-repeat"> 0) return !0; +if (!a.deploymentConfigs) return !1; +var f = a.deploymentConfigs[e]; +return f ? g(b, f) :!1; +}, [ a.podsByService, a.monopodsByService, a.deploymentsByService, a.deploymentConfigsByService, a.routesByService ].forEach(function(c) { +angular.forEach(c, function(d, e) { +var g = a.services[e]; +(!e || g) && angular.forEach(d, function(d) { +(c !== a.monopodsByService || p(d)) && (c !== a.deploymentsByService || a.isVisibleDeployment(d)) && (f[b(d)] = d); +}); +}); +}), [ a.podsByService, a.monopodsByService, a.routesByService ].forEach(function(c) { +angular.forEach(c, function(c, d) { +var f = a.services[d]; +f && angular.forEach(c, function(a) { +e.push({ source:b(f), target:b(a) }); }); }); -}), angular.forEach(a.podsByDeployment, function(e, f) { -var g = a.deployments[f]; -b(g) in d && angular.forEach(e, function(a) { -d[b(a)] = a, c.push({ +}), angular.forEach(a.podsByDeployment, function(c, d) { +var g = a.deployments[d]; +b(g) in f && angular.forEach(c, function(a) { +f[b(a)] = a, e.push({ source:b(g), target:b(a) }); }); -}), angular.forEach(a.deployments, function(d, e) { -var f, g = d.metadata.annotations || {}, h = g["openshift.io/deployment-config.name"] || e; -h && a.deploymentConfigs && (f = a.deploymentConfigs[h], f && c.push({ +}), angular.forEach(a.deployments, function(c, d) { +var f, g = c.metadata.annotations || {}, h = g["openshift.io/deployment-config.name"] || d; +h && a.deploymentConfigs && (f = a.deploymentConfigs[h], f && e.push({ source:b(f), -target:b(d) +target:b(c) })); }), a.$evalAsync(function() { -a.topologyItems = d, a.topologyRelations = c; +a.topologyItems = f, a.topologyRelations = e; }); } function x() { @@ -9461,7 +9470,7 @@ var _scriptsTemplatesJs = []byte(`angular.module('openshiftConsoleTemplates', [] "\n" + "\n" + "
\n" + - "
0 || (deployment | isRecentDeployment : deploymentConfigs[deploymentConfigId]) || !(deployment | isDeployment)\" class=\"animate-repeat\">\n" + + "
\n" + "\n" + "\n" + "\n" +