Skip to content

Remove old routes watcher in the Services controller #1226

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions app/scripts/controllers/services.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,6 @@ angular.module('openshiftConsole')
Logger.log("services (subscribe)", $scope.unfilteredServices);
}));

watches.push(DataService.watch("routes", context, function(routes){
$scope.routes = routes.by("metadata.name");
$scope.emptyMessageRoutes = "No routes to show";
$scope.routesByService = routesByService($scope.routes);
Logger.log("routes (subscribe)", $scope.routesByService);
}));

function routesByService(routes) {
var routeMap = {};
angular.forEach(routes, function(route, routeName){
var to = route.spec.to;
if (to.kind === "Service") {
routeMap[to.name] = routeMap[to.name] || {};
routeMap[to.name][routeName] = route;
}
});
return routeMap;
}

function updateFilterWarning() {
if (!LabelFilter.getLabelSelector().isEmpty() && $.isEmptyObject($scope.services) && !$.isEmptyObject($scope.unfilteredServices)) {
$scope.alerts["services"] = {
Expand Down
15 changes: 3 additions & 12 deletions dist/scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -6670,26 +6670,17 @@ b.alerts[a.name] = a.data;
}), c.clearAlerts();
var i = [];
e.get(a.project).then(_.spread(function(a, c) {
function e(a) {
var b = {};
return angular.forEach(a, function(a, c) {
var d = a.spec.to;
"Service" === d.kind && (b[d.name] = b[d.name] || {}, b[d.name][c] = a);
}), b;
}
function f() {
function e() {
g.getLabelSelector().isEmpty() || !$.isEmptyObject(b.services) || $.isEmptyObject(b.unfilteredServices) ? delete b.alerts.services :b.alerts.services = {
type:"warning",
details:"The active filters are hiding all services."
};
}
b.project = a, i.push(d.watch("services", c, function(a) {
b.unfilteredServices = a.by("metadata.name"), g.addLabelSuggestionsFromResources(b.unfilteredServices, b.labelSuggestions), g.setLabelSuggestions(b.labelSuggestions), b.services = g.getLabelSelector().select(b.unfilteredServices), b.emptyMessage = "No services to show", f(), h.log("services (subscribe)", b.unfilteredServices);
})), i.push(d.watch("routes", c, function(a) {
b.routes = a.by("metadata.name"), b.emptyMessageRoutes = "No routes to show", b.routesByService = e(b.routes), h.log("routes (subscribe)", b.routesByService);
b.unfilteredServices = a.by("metadata.name"), g.addLabelSuggestionsFromResources(b.unfilteredServices, b.labelSuggestions), g.setLabelSuggestions(b.labelSuggestions), b.services = g.getLabelSelector().select(b.unfilteredServices), b.emptyMessage = "No services to show", e(), h.log("services (subscribe)", b.unfilteredServices);
})), g.onActiveFiltersChanged(function(a) {
b.$apply(function() {
b.services = a.select(b.unfilteredServices), f();
b.services = a.select(b.unfilteredServices), e();
});
}), b.$on("$destroy", function() {
d.unwatchAll(i);
Expand Down