Skip to content
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

Allow unlimited websockets on Edge - also fix leaking websockets on monitoring page #2315

Merged
merged 1 commit into from
Oct 19, 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
23 changes: 12 additions & 11 deletions app/scripts/controllers/monitoring.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ angular.module('openshiftConsole')
$scope.renderOptions.showEventsSidebar = true;
$scope.renderOptions.collapseEventsSidebar = localStorage.getItem('monitoring.eventsidebar.collapsed') === 'true';


var limitWatches = $filter('isIE')();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonder if we shouldn't set LIMIT_WATCHES as a constant once in app.js. Then if we ever need to change it again, we're always consistent.

var DEFAULT_POLL_INTERVAL = 60 * 1000; // milliseconds
var watches = [];

$scope.kinds = [
Expand Down Expand Up @@ -281,17 +282,17 @@ angular.module('openshiftConsole')
$scope.project = project;
$scope.projectContext = context;

DataService.watch("pods", context, function(pods) {
watches.push(DataService.watch("pods", context, function(pods) {
$scope.podsByName = pods.by("metadata.name");
$scope.pods = orderByDate($scope.podsByName, true);
$scope.podsByOwnerUID = PodsService.groupByOwnerUID($scope.pods);
$scope.podsLoaded = true;
_.each($scope.pods, setPodLogVars);
filterPods();
Logger.log("pods", $scope.pods);
});
}));

DataService.watch({
watches.push(DataService.watch({
resource: 'statefulsets',
group: 'apps',
version: 'v1beta1'
Expand All @@ -301,31 +302,31 @@ angular.module('openshiftConsole')
// _.each($scope.statefulSets, setStatefulSetLogVars); // TODO: enable when we have the endpoint
filterStatefulSets();
Logger.log("statefulSets", $scope.statefulSets);
});
}, {poll: limitWatches, pollInterval: DEFAULT_POLL_INTERVAL}));

DataService.watch("replicationcontrollers", context, function(replicationControllers) {
watches.push(DataService.watch("replicationcontrollers", context, function(replicationControllers) {
$scope.replicationControllers = orderByDate(replicationControllers.by("metadata.name"), true);
$scope.replicationControllersLoaded = true;
_.each($scope.replicationControllers, setDeploymentLogVars);
filterDeployments();
Logger.log("replicationcontrollers", $scope.replicationControllers);
});
}));

DataService.watch("builds", context, function(builds) {
watches.push(DataService.watch("builds", context, function(builds) {
$scope.builds = orderByDate(builds.by("metadata.name"), true);
$scope.latestBuildByConfig = BuildsService.latestBuildByConfig($scope.builds);
$scope.buildsLoaded = true;
_.each($scope.builds, setBuildLogVars);
filterBuilds();
Logger.log("builds", $scope.builds);
});
}));

DataService.watch({ group: "extensions", resource: "replicasets" }, context, function(replicaSets) {
watches.push(DataService.watch({ group: "extensions", resource: "replicasets" }, context, function(replicaSets) {
$scope.replicaSets = orderByDate(replicaSets.by("metadata.name"), true);
$scope.replicaSetsLoaded = true;
filterReplicaSets();
Logger.log("replicasets", $scope.replicaSets);
});
}, {poll: limitWatches, pollInterval: DEFAULT_POLL_INTERVAL}));

$scope.$on('$destroy', function(){
DataService.unwatchAll(watches);
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/controllers/overview.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function OverviewController($scope,
RoutesService,
ServiceInstancesService) {
var overview = this;
var limitWatches = $filter('isIE')() || $filter('isEdge')();
var limitWatches = $filter('isIE')();
var DEFAULT_POLL_INTERVAL = 60 * 1000; // milliseconds

$scope.projectName = $routeParams.project;
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/controllers/replicaSet.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ angular.module('openshiftConsole')
$scope.logCanRun = !(_.includes(['New', 'Pending'], deploymentStatus(replicaSet)));
};

var limitWatches = $filter('isIE')() || $filter('isEdge')();
var limitWatches = $filter('isIE')();

ProjectsService
.get($routeParams.project)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

var counter = this;
var DISABLE_GLOBAL_EVENT_WATCH = _.get(Constants, 'DISABLE_GLOBAL_EVENT_WATCH');
var LIMIT_WATCHES = $filter('isIE')() || $filter('isEdge')();
var LIMIT_WATCHES = $filter('isIE')();

counter.hide = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

// kill switch if watching events is too expensive
var DISABLE_GLOBAL_EVENT_WATCH = _.get(Constants, 'DISABLE_GLOBAL_EVENT_WATCH');
var LIMIT_WATCHES = $filter('isIE')() || $filter('isEdge')();
var LIMIT_WATCHES = $filter('isIE')();

var drawer = this;

Expand Down
2 changes: 1 addition & 1 deletion app/scripts/directives/resourceServiceBindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function ResourceServiceBindings($filter,
ctrl.serviceInstances = [];
ctrl.showBindings = CatalogService.SERVICE_CATALOG_ENABLED && enableTechPreviewFeature('pod_presets');

var limitWatches = $filter('isIE')() || $filter('isEdge')();
var limitWatches = $filter('isIE')();
var DEFAULT_POLL_INTERVAL = 60 * 1000; // milliseconds
var watches = [];
var canI = $filter('canI');
Expand Down
96 changes: 51 additions & 45 deletions dist/scripts/scripts.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use strict";

function OverviewController(e, t, n, a, r, o, i, s, c, l, u, d, m, p, f, g, v, h, y, b, C, S, w, k, j, P) {
var R = this, I = t("isIE")() || t("isEdge")();
var R = this, I = t("isIE")();
e.projectName = n.project, R.catalogLandingPageEnabled = !l.DISABLE_SERVICE_CATALOG_LANDING_PAGE;
var E, T, N = t("annotation"), D = t("canI"), A = t("buildConfigForBuild"), B = t("deploymentIsInProgress"), L = t("imageObjectRef"), U = t("isJenkinsPipelineStrategy"), O = t("isNewerResource"), F = t("label"), x = t("podTemplate"), V = r.getPreferredVersion("servicebindings"), M = r.getPreferredVersion("clusterserviceclasses"), q = r.getPreferredVersion("serviceinstances"), z = r.getPreferredVersion("clusterserviceplans"), H = {}, G = {}, W = {}, K = R.state = {
alerts: {},
Expand Down Expand Up @@ -493,7 +493,7 @@ u.unwatchAll(at), $(window).off(".overview");
function ResourceServiceBindings(e, t, n, a, r) {
var o, i = this, s = e("enableTechPreviewFeature");
i.bindings = [], i.bindableServiceInstances = [], i.serviceClasses = [], i.serviceInstances = [], i.showBindings = a.SERVICE_CATALOG_ENABLED && s("pod_presets");
var c = e("isIE")() || e("isEdge")(), l = [], u = e("canI"), d = i.serviceBindingsVersion = t.getPreferredVersion("servicebindings"), m = t.getPreferredVersion("clusterserviceclasses"), p = t.getPreferredVersion("serviceinstances"), f = t.getPreferredVersion("clusterserviceplans"), g = function() {
var c = e("isIE")(), l = [], u = e("canI"), d = i.serviceBindingsVersion = t.getPreferredVersion("servicebindings"), m = t.getPreferredVersion("clusterserviceclasses"), p = t.getPreferredVersion("serviceinstances"), f = t.getPreferredVersion("clusterserviceplans"), g = function() {
i.apiObject && i.bindings && (i.bindings = n.getBindingsForResource(i.bindings, i.apiObject));
}, v = function() {
i.bindableServiceInstances = n.filterBindableServiceInstances(i.serviceInstances, i.serviceClasses, o), i.orderedServiceInstances = n.sortServiceInstances(i.serviceInstances, i.serviceClasses);
Expand Down Expand Up @@ -4864,7 +4864,7 @@ a.unwatchAll(i);
}));
} ]), angular.module("openshiftConsole").controller("MonitoringController", [ "$routeParams", "$location", "$scope", "$filter", "BuildsService", "DataService", "ImageStreamResolver", "KeywordService", "Logger", "MetricsService", "Navigate", "PodsService", "ProjectsService", "$rootScope", function(e, t, n, a, r, o, i, s, c, l, u, d, m, p) {
n.projectName = e.project, n.alerts = n.alerts || {}, n.renderOptions = n.renderOptions || {}, n.renderOptions.showEventsSidebar = !0, n.renderOptions.collapseEventsSidebar = "true" === localStorage.getItem("monitoring.eventsidebar.collapsed");
var f = [];
var f = a("isIE")(), g = [];
n.kinds = [ {
kind: "All"
}, {
Expand Down Expand Up @@ -4902,49 +4902,49 @@ replicaSets: {},
builds: {},
statefulSets: {}
};
var g = a("isNil");
var v = a("isNil");
n.filters = {
hideOlderResources: g(e.hideOlderResources) || "true" === e.hideOlderResources,
hideOlderResources: v(e.hideOlderResources) || "true" === e.hideOlderResources,
text: ""
};
var v, h, y, b;
var h, y, b, C;
l.isAvailable().then(function(e) {
n.metricsAvailable = e;
});
var C = a("orderObjectsByDate"), S = [ "metadata.name" ], w = [], k = function() {
n.filteredPods = s.filterForKeywords(b, S, w), n.filteredReplicationControllers = s.filterForKeywords(h, S, w), n.filteredReplicaSets = s.filterForKeywords(y, S, w), n.filteredBuilds = s.filterForKeywords(v, S, w), n.filteredStatefulSets = s.filterForKeywords(_.values(n.statefulSets), S, w);
}, j = function(e) {
var S = a("orderObjectsByDate"), w = [ "metadata.name" ], k = [], j = function() {
n.filteredPods = s.filterForKeywords(C, w, k), n.filteredReplicationControllers = s.filterForKeywords(y, w, k), n.filteredReplicaSets = s.filterForKeywords(b, w, k), n.filteredBuilds = s.filterForKeywords(h, w, k), n.filteredStatefulSets = s.filterForKeywords(_.values(n.statefulSets), w, k);
}, P = function(e) {
n.logOptions.pods[e.metadata.name] = {
container: e.spec.containers[0].name
}, n.logCanRun.pods[e.metadata.name] = !_.includes([ "New", "Pending", "Unknown" ], e.status.phase);
}, P = function(e) {
}, R = function(e) {
n.logOptions.replicationControllers[e.metadata.name] = {};
var t = a("annotation")(e, "deploymentVersion");
t && (n.logOptions.replicationControllers[e.metadata.name].version = t), n.logCanRun.replicationControllers[e.metadata.name] = !_.includes([ "New", "Pending" ], a("deploymentStatus")(e));
}, R = function(e) {
}, I = function(e) {
n.logOptions.builds[e.metadata.name] = {}, n.logCanRun.builds[e.metadata.name] = !_.includes([ "New", "Pending", "Error" ], e.status.phase);
}, I = function() {
n.filteredStatefulSets = s.filterForKeywords(_.values(n.statefulSets), S, w);
}, E = function() {
b = _.filter(n.pods, function(e) {
n.filteredStatefulSets = s.filterForKeywords(_.values(n.statefulSets), w, k);
}, T = function() {
C = _.filter(n.pods, function(e) {
return !n.filters.hideOlderResources || "Succeeded" !== e.status.phase && "Failed" !== e.status.phase;
}), n.filteredPods = s.filterForKeywords(b, S, w);
}, T = a("isIncompleteBuild"), N = a("buildConfigForBuild"), D = a("isRecentBuild"), A = function() {
}), n.filteredPods = s.filterForKeywords(C, w, k);
}, N = a("isIncompleteBuild"), D = a("buildConfigForBuild"), A = a("isRecentBuild"), B = function() {
moment().subtract(5, "m");
v = _.filter(n.builds, function(e) {
h = _.filter(n.builds, function(e) {
if (!n.filters.hideOlderResources) return !0;
if (T(e)) return !0;
var t = N(e);
return t ? n.latestBuildByConfig[t].metadata.name === e.metadata.name : D(e);
}), n.filteredBuilds = s.filterForKeywords(v, S, w);
}, B = a("deploymentStatus"), L = a("deploymentIsInProgress"), U = function() {
h = _.filter(n.replicationControllers, function(e) {
return !n.filters.hideOlderResources || (L(e) || "Active" === B(e));
}), n.filteredReplicationControllers = s.filterForKeywords(h, S, w);
}, O = function() {
y = _.filter(n.replicaSets, function(e) {
if (N(e)) return !0;
var t = D(e);
return t ? n.latestBuildByConfig[t].metadata.name === e.metadata.name : A(e);
}), n.filteredBuilds = s.filterForKeywords(h, w, k);
}, L = a("deploymentStatus"), U = a("deploymentIsInProgress"), O = function() {
y = _.filter(n.replicationControllers, function(e) {
return !n.filters.hideOlderResources || (U(e) || "Active" === L(e));
}), n.filteredReplicationControllers = s.filterForKeywords(y, w, k);
}, F = function() {
b = _.filter(n.replicaSets, function(e) {
return !n.filters.hideOlderResources || _.get(e, "status.replicas");
}), n.filteredReplicaSets = s.filterForKeywords(y, S, w);
}), n.filteredReplicaSets = s.filterForKeywords(b, w, k);
};
n.toggleItem = function(e, t, r) {
var o = $(e.target);
Expand Down Expand Up @@ -4988,34 +4988,40 @@ i = !n.expanded.statefulSets[r.metadata.name], n.expanded.statefulSets[r.metadat
var t = _.get(n, [ "podsByOwnerUID", e.metadata.uid ], []);
_.isEmpty(t) || u.toPodsForDeployment(e, t);
}, m.get(e.project).then(_.spread(function(e, a) {
n.project = e, n.projectContext = a, o.watch("pods", a, function(e) {
n.podsByName = e.by("metadata.name"), n.pods = C(n.podsByName, !0), n.podsByOwnerUID = d.groupByOwnerUID(n.pods), n.podsLoaded = !0, _.each(n.pods, j), E(), c.log("pods", n.pods);
}), o.watch({
n.project = e, n.projectContext = a, g.push(o.watch("pods", a, function(e) {
n.podsByName = e.by("metadata.name"), n.pods = S(n.podsByName, !0), n.podsByOwnerUID = d.groupByOwnerUID(n.pods), n.podsLoaded = !0, _.each(n.pods, P), T(), c.log("pods", n.pods);
})), g.push(o.watch({
resource: "statefulsets",
group: "apps",
version: "v1beta1"
}, a, function(e) {
n.statefulSets = e.by("metadata.name"), n.statefulSetsLoaded = !0, I(), c.log("statefulSets", n.statefulSets);
}), o.watch("replicationcontrollers", a, function(e) {
n.replicationControllers = C(e.by("metadata.name"), !0), n.replicationControllersLoaded = !0, _.each(n.replicationControllers, P), U(), c.log("replicationcontrollers", n.replicationControllers);
}), o.watch("builds", a, function(e) {
n.builds = C(e.by("metadata.name"), !0), n.latestBuildByConfig = r.latestBuildByConfig(n.builds), n.buildsLoaded = !0, _.each(n.builds, R), A(), c.log("builds", n.builds);
}), o.watch({
n.statefulSets = e.by("metadata.name"), n.statefulSetsLoaded = !0, E(), c.log("statefulSets", n.statefulSets);
}, {
poll: f,
pollInterval: 6e4
})), g.push(o.watch("replicationcontrollers", a, function(e) {
n.replicationControllers = S(e.by("metadata.name"), !0), n.replicationControllersLoaded = !0, _.each(n.replicationControllers, R), O(), c.log("replicationcontrollers", n.replicationControllers);
})), g.push(o.watch("builds", a, function(e) {
n.builds = S(e.by("metadata.name"), !0), n.latestBuildByConfig = r.latestBuildByConfig(n.builds), n.buildsLoaded = !0, _.each(n.builds, I), B(), c.log("builds", n.builds);
})), g.push(o.watch({
group: "extensions",
resource: "replicasets"
}, a, function(e) {
n.replicaSets = C(e.by("metadata.name"), !0), n.replicaSetsLoaded = !0, O(), c.log("replicasets", n.replicaSets);
}), n.$on("$destroy", function() {
o.unwatchAll(f);
n.replicaSets = S(e.by("metadata.name"), !0), n.replicaSetsLoaded = !0, F(), c.log("replicasets", n.replicaSets);
}, {
poll: f,
pollInterval: 6e4
})), n.$on("$destroy", function() {
o.unwatchAll(g);
}), n.$watch("filters.hideOlderResources", function() {
E(), A(), U(), O(), I();
T(), B(), O(), F(), E();
var e = t.search();
e.hideOlderResources = n.filters.hideOlderResources ? "true" : "false", t.replace().search(e);
}), n.$watch("kindSelector.selected.kind", function() {
var e = t.search();
e.kind = n.kindSelector.selected.kind, t.replace().search(e);
}), n.$watch("filters.text", _.debounce(function() {
n.filterKeywords = w = s.generateKeywords(n.filters.text), n.$apply(k);
n.filterKeywords = k = s.generateKeywords(n.filters.text), n.$apply(j);
}, 50, {
maxWait: 250
})), n.$watch("renderOptions.collapseEventsSidebar", function(e, t) {
Expand Down Expand Up @@ -5928,7 +5934,7 @@ e.metricsAvailable = t;
});
var P = t("deploymentStatus"), R = function(t) {
e.logCanRun = !_.includes([ "New", "Pending" ], P(t));
}, I = t("isIE")() || t("isEdge")();
}, I = t("isIE")();
g.get(n.project).then(_.spread(function(u, g) {
e.project = u, e.projectContext = g;
var h = {}, E = function() {
Expand Down Expand Up @@ -14432,7 +14438,7 @@ angular.module("openshiftConsole").component("notificationCounter", {
templateUrl: "views/directives/notifications/notification-counter.html",
bindings: {},
controller: [ "$filter", "$routeParams", "$rootScope", "Constants", function(e, t, n, a) {
var r = this, o = _.get(a, "DISABLE_GLOBAL_EVENT_WATCH"), i = e("isIE")() || e("isEdge")();
var r = this, o = _.get(a, "DISABLE_GLOBAL_EVENT_WATCH"), i = e("isIE")();
r.hide = !0;
var s = [], c = [], l = function(e, t) {
e && c.push(n.$on("NotificationDrawerWrapper.onUnreadNotifications", t));
Expand Down Expand Up @@ -14474,7 +14480,7 @@ u(), d();
angular.module("openshiftConsole").component("notificationDrawerWrapper", {
templateUrl: "views/directives/notifications/notification-drawer-wrapper.html",
controller: [ "$filter", "$interval", "$location", "$timeout", "$routeParams", "$rootScope", "Constants", "DataService", "EventsService", "NotificationsService", function(e, t, n, a, r, o, i, s, c) {
var l, u, d = _.get(i, "DISABLE_GLOBAL_EVENT_WATCH"), m = e("isIE")() || e("isEdge")(), p = this, f = [], g = {}, v = {}, h = {}, y = function(e) {
var l, u, d = _.get(i, "DISABLE_GLOBAL_EVENT_WATCH"), m = e("isIE")(), p = this, f = [], g = {}, v = {}, h = {}, y = function(e) {
e || (p.drawerHidden = !0);
}, b = function(e, t) {
return _.get(e, "params.project") !== _.get(t, "params.project");
Expand Down