Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Bug 1268891 - pods not always grouped when service selector should co…
…ver template of a dc/deployment
  • Loading branch information
jwforres committed Oct 19, 2015
1 parent 9f30446 commit 2944083
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 52 deletions.
9 changes: 6 additions & 3 deletions assets/app/scripts/controllers/overview.js
Expand Up @@ -19,7 +19,8 @@ angular.module('openshiftConsole')
LabelFilter, // for the label-selector widget in the navbar
Logger,
ImageStreamResolver,
ObjectDescriber) {
ObjectDescriber,
$parse) {
$scope.pods = {};
$scope.services = {};
$scope.routes = {};
Expand Down Expand Up @@ -227,7 +228,8 @@ angular.module('openshiftConsole')
$scope.deploymentConfigsByService = {"": {}};
angular.forEach($scope.deploymentConfigs, function(deploymentConfig, depName){
var foundMatch = false;
var depConfigSelector = new LabelSelector(deploymentConfig.spec.selector);
var getLabels = $parse('spec.template.metadata.labels');
var depConfigSelector = new LabelSelector(getLabels(deploymentConfig) || {});
angular.forEach($scope.unfilteredServices, function(service, name){
$scope.deploymentConfigsByService[name] = $scope.deploymentConfigsByService[name] || {};

Expand All @@ -249,7 +251,8 @@ angular.module('openshiftConsole')

angular.forEach($scope.deployments, function(deployment, depName){
var foundMatch = false;
var deploymentSelector = new LabelSelector(deployment.spec.selector);
var getLabels = $parse('spec.template.metadata.labels');
var deploymentSelector = new LabelSelector(getLabels(deployment) || {});
var depConfigName = annotationFilter(deployment, 'deploymentConfig') || "";

angular.forEach($scope.unfilteredServices, function(service, name){
Expand Down
98 changes: 49 additions & 49 deletions pkg/assets/bindata.go
Expand Up @@ -19653,8 +19653,8 @@ a.builds = b.by("metadata.name"), Logger.log("builds (subscribe)", a.builds);
}), a.$on("$destroy", function() {
c.unwatchAll(g);
});
} ]), angular.module("openshiftConsole").controller("OverviewController", [ "$scope", "DataService", "annotationFilter", "hashSizeFilter", "imageObjectRefFilter", "deploymentCausesFilter", "labelFilter", "LabelFilter", "Logger", "ImageStreamResolver", "ObjectDescriber", function(a, b, c, d, e, f, g, h, i, j, k) {
function l() {
} ]), angular.module("openshiftConsole").controller("OverviewController", [ "$scope", "DataService", "annotationFilter", "hashSizeFilter", "imageObjectRefFilter", "deploymentCausesFilter", "labelFilter", "LabelFilter", "Logger", "ImageStreamResolver", "ObjectDescriber", "$parse", function(a, b, c, d, e, f, g, h, i, j, k, l) {
function m() {
a.monopodsByService = {
"":{}
}, a.podsByService = {}, a.podsByDeployment = {};
Expand All @@ -19679,40 +19679,40 @@ angular.forEach(f, function(b) {
j = j || a.deploymentsByService[h] && a.deploymentsByService[h][b];
}), j || (a.monopodsByService[h] = a.monopodsByService[h] || {}, a.monopodsByService[h][e] = d);
}
}), 0 === f.length && 0 === g.length && m(d) && (a.monopodsByService[""][e] = d);
}), i.log("podsByDeployment", a.podsByDeployment), i.log("podsByService", a.podsByService), i.log("monopodsByService", a.monopodsByService), u();
}), 0 === f.length && 0 === g.length && n(d) && (a.monopodsByService[""][e] = d);
}), i.log("podsByDeployment", a.podsByDeployment), i.log("podsByService", a.podsByService), i.log("monopodsByService", a.monopodsByService), v();
}
function m(a) {
function n(a) {
return "Succeeded" === a.status.phase || "Terminated" === a.status.phase || "Failed" === a.status.phase ? !1 :g(a, "openshift.io/deployer-pod-for.name") ? !1 :c(a, "openshift.io/build.name") ? !1 :!0;
}
function n() {
function o() {
a.deploymentConfigsByService = {
"":{}
}, angular.forEach(a.deploymentConfigs, function(b, c) {
var d = !1, e = new LabelSelector(b.spec.selector);
angular.forEach(a.unfilteredServices, function(f, g) {
var d = !1, e = l("spec.template.metadata.labels"), f = new LabelSelector(e(b) || {});
angular.forEach(a.unfilteredServices, function(e, g) {
a.deploymentConfigsByService[g] = a.deploymentConfigsByService[g] || {};
var h = new LabelSelector(f.spec.selector);
h.covers(e) && (a.deploymentConfigsByService[g][c] = b, d = !0);
var h = new LabelSelector(e.spec.selector);
h.covers(f) && (a.deploymentConfigsByService[g][c] = b, d = !0);
}), d || (a.deploymentConfigsByService[""][c] = b);
});
}
function o() {
function p() {
var b = a.deploymentsByService = {
"":{}
}, d = a.deploymentsByServiceByDeploymentConfig = {
"":{}
};
angular.forEach(a.deployments, function(e, f) {
var g = !1, h = new LabelSelector(e.spec.selector), i = c(e, "deploymentConfig") || "";
var g = !1, h = l("spec.template.metadata.labels"), i = new LabelSelector(h(e) || {}), j = c(e, "deploymentConfig") || "";
angular.forEach(a.unfilteredServices, function(a, c) {
b[c] = b[c] || {}, d[c] = d[c] || {};
var j = new LabelSelector(a.spec.selector);
j.covers(h) && (b[c][f] = e, d[c][i] = d[c][i] || {}, d[c][i][f] = e, g = !0);
}), g || (b[""][f] = e, d[""][i] = d[""][i] || {}, d[""][i][f] = e);
var h = new LabelSelector(a.spec.selector);
h.covers(i) && (b[c][f] = e, d[c][j] = d[c][j] || {}, d[c][j][f] = e, g = !0);
}), g || (b[""][f] = e, d[""][j] = d[""][j] || {}, d[""][j][f] = e);
});
}
function p(a, b) {
function q(a, b) {
if (a && b && a.spec.triggers && b.spec.output.to) for (var c = 0; c < a.spec.triggers.length; c++) {
var d = a.spec.triggers[c];
if ("ImageChange" === d.type) {
Expand All @@ -19722,32 +19722,32 @@ d.builds = d.builds || {}, d.builds[b.metadata.name] = b;
}
}
}
function q() {
function r() {
var b = 0 === d(a.unfilteredServices) && 0 === d(a.pods) && 0 === d(a.deployments) && 0 === d(a.deploymentConfigs);
a.renderOptions.showSidebarRight = !b, a.renderOptions.showGetStarted = b;
}
function r() {
function s() {
h.getLabelSelector().isEmpty() || !$.isEmptyObject(a.services) || $.isEmptyObject(a.unfilteredServices) ? delete a.alerts.services :a.alerts.services = {
type:"warning",
details:"The active filters are hiding all services."
};
}
function s(a) {
function t(a) {
return "true" === c(a, "openshift.io/host.generated");
}
function t() {
function u() {
function b(a) {
return a.kind + a.metadata.uid;
}
x = null;
y = null;
var c = [], d = {};
angular.forEach(a.services, function(a) {
d[b(a)] = a;
}), [ a.podsByService, a.monopodsByService, a.deploymentsByService, a.deploymentConfigsByService, a.routesByService ].forEach(function(c) {
angular.forEach(c, function(e, f) {
var g = a.services[f];
(!f || g) && angular.forEach(e, function(e) {
(c !== a.monopodsByService || m(e)) && (d[b(e)] = e);
(c !== a.monopodsByService || n(e)) && (d[b(e)] = e);
});
});
}), [ a.podsByService, a.monopodsByService, a.routesByService ].forEach(function(d) {
Expand Down Expand Up @@ -19776,10 +19776,10 @@ target:b(d)
}));
}), a.topologyItems = d, a.topologyRelations = c, a.$digest();
}
function u() {
x || (x = window.setTimeout(t, 100));
function v() {
y || (y = window.setTimeout(u, 100));
}
function v(b) {
function w(b) {
a.topologySelection = b;
}
a.pods = {}, a.services = {}, a.routes = {}, a.routesByService = {}, a.displayRouteByService = {}, a.unfilteredServices = {}, a.deployments = {}, a.deploymentConfigs = void 0, a.builds = {}, a.imageStreams = {}, a.imagesByDockerReference = {}, a.imageStreamImageRefByDockerReference = {}, a.podsByService = {}, a.podsByDeployment = {}, a.monopodsByService = {}, a.deploymentsByServiceByDeploymentConfig = {}, a.deploymentsByService = {}, a.deploymentConfigsByService = {}, a.labelSuggestions = {}, a.alerts = a.alerts || {}, a.emptyMessage = "Loading...", a.renderOptions = a.renderOptions || {}, a.renderOptions.showSidebarRight = !1, a.topologyKinds = {
Expand All @@ -19789,56 +19789,56 @@ ReplicationController:location.href + "#vertex-ReplicationController",
Route:location.href + "#vertex-Route",
Service:location.href + "#vertex-Service"
}, a.topologySelection = null, a.topologyItems = {}, a.topologyRelations = [];
var w = [];
w.push(b.watch("pods", a, function(b) {
a.pods = b.by("metadata.name"), l(), q(), j.fetchReferencedImageStreamImages(a.pods, a.imagesByDockerReference, a.imageStreamImageRefByDockerReference, a), u(), i.log("pods", a.pods);
})), w.push(b.watch("services", a, function(b) {
a.unfilteredServices = b.by("metadata.name"), h.addLabelSuggestionsFromResources(a.unfilteredServices, a.labelSuggestions), h.setLabelSuggestions(a.labelSuggestions), a.services = h.getLabelSelector().select(a.unfilteredServices), o(), n(), l(), q(), a.emptyMessage = "No services to show", r(), u(), i.log("services (list)", a.services);
})), w.push(b.watch("routes", a, function(b) {
var x = [];
x.push(b.watch("pods", a, function(b) {
a.pods = b.by("metadata.name"), m(), r(), j.fetchReferencedImageStreamImages(a.pods, a.imagesByDockerReference, a.imageStreamImageRefByDockerReference, a), v(), i.log("pods", a.pods);
})), x.push(b.watch("services", a, function(b) {
a.unfilteredServices = b.by("metadata.name"), h.addLabelSuggestionsFromResources(a.unfilteredServices, a.labelSuggestions), h.setLabelSuggestions(a.labelSuggestions), a.services = h.getLabelSelector().select(a.unfilteredServices), p(), o(), m(), r(), a.emptyMessage = "No services to show", s(), v(), i.log("services (list)", a.services);
})), x.push(b.watch("routes", a, function(b) {
a.routes = b.by("metadata.name");
var c = a.routesByService = {}, d = a.displayRouteByService = {};
angular.forEach(a.routes, function(a, b) {
if ("Service" === a.spec.to.kind) {
var e = a.spec.to.name;
c[e] = c[e] || {}, c[e][b] = a, (!d[e] || !s(a) && s(d[e])) && (d[e] = a);
c[e] = c[e] || {}, c[e][b] = a, (!d[e] || !t(a) && t(d[e])) && (d[e] = a);
}
}), u(), i.log("routes (subscribe)", a.routesByService);
})), w.push(b.watch("replicationcontrollers", a, function(b, c, d) {
}), v(), i.log("routes (subscribe)", a.routesByService);
})), x.push(b.watch("replicationcontrollers", a, function(b, c, d) {
a.deployments = b.by("metadata.name"), d ? "DELETED" !== c && (d.causes = f(d)) :angular.forEach(a.deployments, function(a) {
a.causes = f(a);
}), o(), l(), q(), u(), i.log("deployments (subscribe)", a.deployments);
})), w.push(b.watch("imagestreams", a, function(b) {
a.imageStreams = b.by("metadata.name"), j.buildDockerRefMapForImageStreams(a.imageStreams, a.imageStreamImageRefByDockerReference), j.fetchReferencedImageStreamImages(a.pods, a.imagesByDockerReference, a.imageStreamImageRefByDockerReference, a), u(), i.log("imagestreams (subscribe)", a.imageStreams);
})), w.push(b.watch("deploymentconfigs", a, function(b, c, d) {
}), p(), m(), r(), v(), i.log("deployments (subscribe)", a.deployments);
})), x.push(b.watch("imagestreams", a, function(b) {
a.imageStreams = b.by("metadata.name"), j.buildDockerRefMapForImageStreams(a.imageStreams, a.imageStreamImageRefByDockerReference), j.fetchReferencedImageStreamImages(a.pods, a.imagesByDockerReference, a.imageStreamImageRefByDockerReference, a), v(), i.log("imagestreams (subscribe)", a.imageStreams);
})), x.push(b.watch("deploymentconfigs", a, function(b, c, d) {
a.deploymentConfigs = b.by("metadata.name"), c ? "DELETED" !== c && angular.forEach(a.builds, function(a) {
p(d, a);
q(d, a);
}) :angular.forEach(a.deploymentConfigs, function(b) {
angular.forEach(a.builds, function(a) {
p(b, a);
q(b, a);
});
}), n(), q(), u(), i.log("deploymentconfigs (subscribe)", a.deploymentConfigs);
})), w.push(b.watch("builds", a, function(b, c, d) {
}), o(), r(), v(), i.log("deploymentconfigs (subscribe)", a.deploymentConfigs);
})), x.push(b.watch("builds", a, function(b, c, d) {
a.builds = b.by("metadata.name"), c ? ("ADDED" === c || "MODIFIED" === c) && angular.forEach(a.deploymentConfigs, function(a) {
p(a, d);
q(a, d);
}) :angular.forEach(a.builds, function(b) {
angular.forEach(a.deploymentConfigs, function(a) {
p(a, b);
q(a, b);
});
}), u(), i.log("builds (subscribe)", a.builds);
}), v(), i.log("builds (subscribe)", a.builds);
})), h.onActiveFiltersChanged(function(b) {
a.$apply(function() {
a.services = b.select(a.unfilteredServices), r(), t();
a.services = b.select(a.unfilteredServices), s(), u();
});
});
var x = null;
var y = null;
a.$on("select", function(b, c) {
a.$apply(function() {
a.topologySelection = c, c ? k.setObject(c, c.kind) :k.clearObject();
});
}, !0), k.onResourceChanged(v), a.$watch("overviewMode", function(a) {
}, !0), k.onResourceChanged(w), a.$watch("overviewMode", function(a) {
"topology" === a && (k.source = null);
}), a.$on("$destroy", function() {
b.unwatchAll(w), window.clearTimeout(x), k.removeResourceChangedCallback(v);
b.unwatchAll(x), window.clearTimeout(y), k.removeResourceChangedCallback(w);
});
} ]), angular.module("openshiftConsole").controller("SettingsController", [ "$scope", "DataService", "AlertMessageService", "$filter", "$modal", "$location", "LabelFilter", "$timeout", "Logger", function(a, b, c, d, e, f, g, h, i) {
a.quotas = {}, a.limitRanges = {}, a.limitsByType = {}, a.labelSuggestions = {}, a.alerts = a.alerts || {}, a.emptyMessageQuotas = "Loading...", a.emptyMessageLimitRanges = "Loading...", a.renderOptions = a.renderOptions || {}, a.renderOptions.hideFilterWidget = !0;
Expand Down

0 comments on commit 2944083

Please sign in to comment.