Skip to content

Commit 8244a38

Browse files
Merge pull request #2315 from jwforres/edge-websockets
Automatic merge from submit-queue. Allow unlimited websockets on Edge - also fix leaking websockets on monitoring page
2 parents 768d51d + 6d093bf commit 8244a38

File tree

7 files changed

+68
-61
lines changed

7 files changed

+68
-61
lines changed

Diff for: app/scripts/controllers/monitoring.js

+12-11
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ angular.module('openshiftConsole')
2929
$scope.renderOptions.showEventsSidebar = true;
3030
$scope.renderOptions.collapseEventsSidebar = localStorage.getItem('monitoring.eventsidebar.collapsed') === 'true';
3131

32-
32+
var limitWatches = $filter('isIE')();
33+
var DEFAULT_POLL_INTERVAL = 60 * 1000; // milliseconds
3334
var watches = [];
3435

3536
$scope.kinds = [
@@ -281,17 +282,17 @@ angular.module('openshiftConsole')
281282
$scope.project = project;
282283
$scope.projectContext = context;
283284

284-
DataService.watch("pods", context, function(pods) {
285+
watches.push(DataService.watch("pods", context, function(pods) {
285286
$scope.podsByName = pods.by("metadata.name");
286287
$scope.pods = orderByDate($scope.podsByName, true);
287288
$scope.podsByOwnerUID = PodsService.groupByOwnerUID($scope.pods);
288289
$scope.podsLoaded = true;
289290
_.each($scope.pods, setPodLogVars);
290291
filterPods();
291292
Logger.log("pods", $scope.pods);
292-
});
293+
}));
293294

294-
DataService.watch({
295+
watches.push(DataService.watch({
295296
resource: 'statefulsets',
296297
group: 'apps',
297298
version: 'v1beta1'
@@ -301,31 +302,31 @@ angular.module('openshiftConsole')
301302
// _.each($scope.statefulSets, setStatefulSetLogVars); // TODO: enable when we have the endpoint
302303
filterStatefulSets();
303304
Logger.log("statefulSets", $scope.statefulSets);
304-
});
305+
}, {poll: limitWatches, pollInterval: DEFAULT_POLL_INTERVAL}));
305306

306-
DataService.watch("replicationcontrollers", context, function(replicationControllers) {
307+
watches.push(DataService.watch("replicationcontrollers", context, function(replicationControllers) {
307308
$scope.replicationControllers = orderByDate(replicationControllers.by("metadata.name"), true);
308309
$scope.replicationControllersLoaded = true;
309310
_.each($scope.replicationControllers, setDeploymentLogVars);
310311
filterDeployments();
311312
Logger.log("replicationcontrollers", $scope.replicationControllers);
312-
});
313+
}));
313314

314-
DataService.watch("builds", context, function(builds) {
315+
watches.push(DataService.watch("builds", context, function(builds) {
315316
$scope.builds = orderByDate(builds.by("metadata.name"), true);
316317
$scope.latestBuildByConfig = BuildsService.latestBuildByConfig($scope.builds);
317318
$scope.buildsLoaded = true;
318319
_.each($scope.builds, setBuildLogVars);
319320
filterBuilds();
320321
Logger.log("builds", $scope.builds);
321-
});
322+
}));
322323

323-
DataService.watch({ group: "extensions", resource: "replicasets" }, context, function(replicaSets) {
324+
watches.push(DataService.watch({ group: "extensions", resource: "replicasets" }, context, function(replicaSets) {
324325
$scope.replicaSets = orderByDate(replicaSets.by("metadata.name"), true);
325326
$scope.replicaSetsLoaded = true;
326327
filterReplicaSets();
327328
Logger.log("replicasets", $scope.replicaSets);
328-
});
329+
}, {poll: limitWatches, pollInterval: DEFAULT_POLL_INTERVAL}));
329330

330331
$scope.$on('$destroy', function(){
331332
DataService.unwatchAll(watches);

Diff for: app/scripts/controllers/overview.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function OverviewController($scope,
5757
RoutesService,
5858
ServiceInstancesService) {
5959
var overview = this;
60-
var limitWatches = $filter('isIE')() || $filter('isEdge')();
60+
var limitWatches = $filter('isIE')();
6161
var DEFAULT_POLL_INTERVAL = 60 * 1000; // milliseconds
6262

6363
$scope.projectName = $routeParams.project;

Diff for: app/scripts/controllers/replicaSet.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ angular.module('openshiftConsole')
8282
$scope.logCanRun = !(_.includes(['New', 'Pending'], deploymentStatus(replicaSet)));
8383
};
8484

85-
var limitWatches = $filter('isIE')() || $filter('isEdge')();
85+
var limitWatches = $filter('isIE')();
8686

8787
ProjectsService
8888
.get($routeParams.project)

Diff for: app/scripts/directives/notifications/notificationCounter.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
var counter = this;
2121
var DISABLE_GLOBAL_EVENT_WATCH = _.get(Constants, 'DISABLE_GLOBAL_EVENT_WATCH');
22-
var LIMIT_WATCHES = $filter('isIE')() || $filter('isEdge')();
22+
var LIMIT_WATCHES = $filter('isIE')();
2323

2424
counter.hide = true;
2525

Diff for: app/scripts/directives/notifications/notificationDrawerWrapper.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

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

4040
var drawer = this;
4141

Diff for: app/scripts/directives/resourceServiceBindings.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function ResourceServiceBindings($filter,
3535
ctrl.serviceInstances = [];
3636
ctrl.showBindings = CatalogService.SERVICE_CATALOG_ENABLED && enableTechPreviewFeature('pod_presets');
3737

38-
var limitWatches = $filter('isIE')() || $filter('isEdge')();
38+
var limitWatches = $filter('isIE')();
3939
var DEFAULT_POLL_INTERVAL = 60 * 1000; // milliseconds
4040
var watches = [];
4141
var canI = $filter('canI');

Diff for: dist/scripts/scripts.js

+51-45
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use strict";
22

33
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) {
4-
var R = this, I = t("isIE")() || t("isEdge")();
4+
var R = this, I = t("isIE")();
55
e.projectName = n.project, R.catalogLandingPageEnabled = !l.DISABLE_SERVICE_CATALOG_LANDING_PAGE;
66
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 = {
77
alerts: {},
@@ -493,7 +493,7 @@ u.unwatchAll(at), $(window).off(".overview");
493493
function ResourceServiceBindings(e, t, n, a, r) {
494494
var o, i = this, s = e("enableTechPreviewFeature");
495495
i.bindings = [], i.bindableServiceInstances = [], i.serviceClasses = [], i.serviceInstances = [], i.showBindings = a.SERVICE_CATALOG_ENABLED && s("pod_presets");
496-
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() {
496+
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() {
497497
i.apiObject && i.bindings && (i.bindings = n.getBindingsForResource(i.bindings, i.apiObject));
498498
}, v = function() {
499499
i.bindableServiceInstances = n.filterBindableServiceInstances(i.serviceInstances, i.serviceClasses, o), i.orderedServiceInstances = n.sortServiceInstances(i.serviceInstances, i.serviceClasses);
@@ -4869,7 +4869,7 @@ a.unwatchAll(i);
48694869
}));
48704870
} ]), 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) {
48714871
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");
4872-
var f = [];
4872+
var f = a("isIE")(), g = [];
48734873
n.kinds = [ {
48744874
kind: "All"
48754875
}, {
@@ -4907,49 +4907,49 @@ replicaSets: {},
49074907
builds: {},
49084908
statefulSets: {}
49094909
};
4910-
var g = a("isNil");
4910+
var v = a("isNil");
49114911
n.filters = {
4912-
hideOlderResources: g(e.hideOlderResources) || "true" === e.hideOlderResources,
4912+
hideOlderResources: v(e.hideOlderResources) || "true" === e.hideOlderResources,
49134913
text: ""
49144914
};
4915-
var v, h, y, b;
4915+
var h, y, b, C;
49164916
l.isAvailable().then(function(e) {
49174917
n.metricsAvailable = e;
49184918
});
4919-
var C = a("orderObjectsByDate"), S = [ "metadata.name" ], w = [], k = function() {
4920-
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);
4921-
}, j = function(e) {
4919+
var S = a("orderObjectsByDate"), w = [ "metadata.name" ], k = [], j = function() {
4920+
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);
4921+
}, P = function(e) {
49224922
n.logOptions.pods[e.metadata.name] = {
49234923
container: e.spec.containers[0].name
49244924
}, n.logCanRun.pods[e.metadata.name] = !_.includes([ "New", "Pending", "Unknown" ], e.status.phase);
4925-
}, P = function(e) {
4925+
}, R = function(e) {
49264926
n.logOptions.replicationControllers[e.metadata.name] = {};
49274927
var t = a("annotation")(e, "deploymentVersion");
49284928
t && (n.logOptions.replicationControllers[e.metadata.name].version = t), n.logCanRun.replicationControllers[e.metadata.name] = !_.includes([ "New", "Pending" ], a("deploymentStatus")(e));
4929-
}, R = function(e) {
4929+
}, I = function(e) {
49304930
n.logOptions.builds[e.metadata.name] = {}, n.logCanRun.builds[e.metadata.name] = !_.includes([ "New", "Pending", "Error" ], e.status.phase);
4931-
}, I = function() {
4932-
n.filteredStatefulSets = s.filterForKeywords(_.values(n.statefulSets), S, w);
49334931
}, E = function() {
4934-
b = _.filter(n.pods, function(e) {
4932+
n.filteredStatefulSets = s.filterForKeywords(_.values(n.statefulSets), w, k);
4933+
}, T = function() {
4934+
C = _.filter(n.pods, function(e) {
49354935
return !n.filters.hideOlderResources || "Succeeded" !== e.status.phase && "Failed" !== e.status.phase;
4936-
}), n.filteredPods = s.filterForKeywords(b, S, w);
4937-
}, T = a("isIncompleteBuild"), N = a("buildConfigForBuild"), D = a("isRecentBuild"), A = function() {
4936+
}), n.filteredPods = s.filterForKeywords(C, w, k);
4937+
}, N = a("isIncompleteBuild"), D = a("buildConfigForBuild"), A = a("isRecentBuild"), B = function() {
49384938
moment().subtract(5, "m");
4939-
v = _.filter(n.builds, function(e) {
4939+
h = _.filter(n.builds, function(e) {
49404940
if (!n.filters.hideOlderResources) return !0;
4941-
if (T(e)) return !0;
4942-
var t = N(e);
4943-
return t ? n.latestBuildByConfig[t].metadata.name === e.metadata.name : D(e);
4944-
}), n.filteredBuilds = s.filterForKeywords(v, S, w);
4945-
}, B = a("deploymentStatus"), L = a("deploymentIsInProgress"), U = function() {
4946-
h = _.filter(n.replicationControllers, function(e) {
4947-
return !n.filters.hideOlderResources || (L(e) || "Active" === B(e));
4948-
}), n.filteredReplicationControllers = s.filterForKeywords(h, S, w);
4949-
}, O = function() {
4950-
y = _.filter(n.replicaSets, function(e) {
4941+
if (N(e)) return !0;
4942+
var t = D(e);
4943+
return t ? n.latestBuildByConfig[t].metadata.name === e.metadata.name : A(e);
4944+
}), n.filteredBuilds = s.filterForKeywords(h, w, k);
4945+
}, L = a("deploymentStatus"), U = a("deploymentIsInProgress"), O = function() {
4946+
y = _.filter(n.replicationControllers, function(e) {
4947+
return !n.filters.hideOlderResources || (U(e) || "Active" === L(e));
4948+
}), n.filteredReplicationControllers = s.filterForKeywords(y, w, k);
4949+
}, F = function() {
4950+
b = _.filter(n.replicaSets, function(e) {
49514951
return !n.filters.hideOlderResources || _.get(e, "status.replicas");
4952-
}), n.filteredReplicaSets = s.filterForKeywords(y, S, w);
4952+
}), n.filteredReplicaSets = s.filterForKeywords(b, w, k);
49534953
};
49544954
n.toggleItem = function(e, t, r) {
49554955
var o = $(e.target);
@@ -4993,34 +4993,40 @@ i = !n.expanded.statefulSets[r.metadata.name], n.expanded.statefulSets[r.metadat
49934993
var t = _.get(n, [ "podsByOwnerUID", e.metadata.uid ], []);
49944994
_.isEmpty(t) || u.toPodsForDeployment(e, t);
49954995
}, m.get(e.project).then(_.spread(function(e, a) {
4996-
n.project = e, n.projectContext = a, o.watch("pods", a, function(e) {
4997-
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);
4998-
}), o.watch({
4996+
n.project = e, n.projectContext = a, g.push(o.watch("pods", a, function(e) {
4997+
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);
4998+
})), g.push(o.watch({
49994999
resource: "statefulsets",
50005000
group: "apps",
50015001
version: "v1beta1"
50025002
}, a, function(e) {
5003-
n.statefulSets = e.by("metadata.name"), n.statefulSetsLoaded = !0, I(), c.log("statefulSets", n.statefulSets);
5004-
}), o.watch("replicationcontrollers", a, function(e) {
5005-
n.replicationControllers = C(e.by("metadata.name"), !0), n.replicationControllersLoaded = !0, _.each(n.replicationControllers, P), U(), c.log("replicationcontrollers", n.replicationControllers);
5006-
}), o.watch("builds", a, function(e) {
5007-
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);
5008-
}), o.watch({
5003+
n.statefulSets = e.by("metadata.name"), n.statefulSetsLoaded = !0, E(), c.log("statefulSets", n.statefulSets);
5004+
}, {
5005+
poll: f,
5006+
pollInterval: 6e4
5007+
})), g.push(o.watch("replicationcontrollers", a, function(e) {
5008+
n.replicationControllers = S(e.by("metadata.name"), !0), n.replicationControllersLoaded = !0, _.each(n.replicationControllers, R), O(), c.log("replicationcontrollers", n.replicationControllers);
5009+
})), g.push(o.watch("builds", a, function(e) {
5010+
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);
5011+
})), g.push(o.watch({
50095012
group: "extensions",
50105013
resource: "replicasets"
50115014
}, a, function(e) {
5012-
n.replicaSets = C(e.by("metadata.name"), !0), n.replicaSetsLoaded = !0, O(), c.log("replicasets", n.replicaSets);
5013-
}), n.$on("$destroy", function() {
5014-
o.unwatchAll(f);
5015+
n.replicaSets = S(e.by("metadata.name"), !0), n.replicaSetsLoaded = !0, F(), c.log("replicasets", n.replicaSets);
5016+
}, {
5017+
poll: f,
5018+
pollInterval: 6e4
5019+
})), n.$on("$destroy", function() {
5020+
o.unwatchAll(g);
50155021
}), n.$watch("filters.hideOlderResources", function() {
5016-
E(), A(), U(), O(), I();
5022+
T(), B(), O(), F(), E();
50175023
var e = t.search();
50185024
e.hideOlderResources = n.filters.hideOlderResources ? "true" : "false", t.replace().search(e);
50195025
}), n.$watch("kindSelector.selected.kind", function() {
50205026
var e = t.search();
50215027
e.kind = n.kindSelector.selected.kind, t.replace().search(e);
50225028
}), n.$watch("filters.text", _.debounce(function() {
5023-
n.filterKeywords = w = s.generateKeywords(n.filters.text), n.$apply(k);
5029+
n.filterKeywords = k = s.generateKeywords(n.filters.text), n.$apply(j);
50245030
}, 50, {
50255031
maxWait: 250
50265032
})), n.$watch("renderOptions.collapseEventsSidebar", function(e, t) {
@@ -5933,7 +5939,7 @@ e.metricsAvailable = t;
59335939
});
59345940
var P = t("deploymentStatus"), R = function(t) {
59355941
e.logCanRun = !_.includes([ "New", "Pending" ], P(t));
5936-
}, I = t("isIE")() || t("isEdge")();
5942+
}, I = t("isIE")();
59375943
g.get(n.project).then(_.spread(function(u, g) {
59385944
e.project = u, e.projectContext = g;
59395945
var h = {}, E = function() {
@@ -14439,7 +14445,7 @@ angular.module("openshiftConsole").component("notificationCounter", {
1443914445
templateUrl: "views/directives/notifications/notification-counter.html",
1444014446
bindings: {},
1444114447
controller: [ "$filter", "$routeParams", "$rootScope", "Constants", function(e, t, n, a) {
14442-
var r = this, o = _.get(a, "DISABLE_GLOBAL_EVENT_WATCH"), i = e("isIE")() || e("isEdge")();
14448+
var r = this, o = _.get(a, "DISABLE_GLOBAL_EVENT_WATCH"), i = e("isIE")();
1444314449
r.hide = !0;
1444414450
var s = [], c = [], l = function(e, t) {
1444514451
e && c.push(n.$on("NotificationDrawerWrapper.onUnreadNotifications", t));
@@ -14481,7 +14487,7 @@ u(), d();
1448114487
angular.module("openshiftConsole").component("notificationDrawerWrapper", {
1448214488
templateUrl: "views/directives/notifications/notification-drawer-wrapper.html",
1448314489
controller: [ "$filter", "$interval", "$location", "$timeout", "$routeParams", "$rootScope", "Constants", "DataService", "EventsService", "NotificationsService", function(e, t, n, a, r, o, i, s, c) {
14484-
var l, u, d = _.get(i, "DISABLE_GLOBAL_EVENT_WATCH"), m = e("isIE")() || e("isEdge")(), p = this, f = [], g = {}, v = {}, h = {}, y = function(e) {
14490+
var l, u, d = _.get(i, "DISABLE_GLOBAL_EVENT_WATCH"), m = e("isIE")(), p = this, f = [], g = {}, v = {}, h = {}, y = function(e) {
1448514491
e || (p.drawerHidden = !0);
1448614492
}, b = function(e, t) {
1448714493
return _.get(e, "params.project") !== _.get(t, "params.project");

0 commit comments

Comments
 (0)