Skip to content

Commit c31be18

Browse files
author
OpenShift Bot
authored
Merge pull request openshift#2216 from spadgett/quota-undefined-used
Merged by openshift-bot
2 parents 2febc36 + d82c0c7 commit c31be18

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

app/scripts/services/quota.js

+14-11
Original file line numberDiff line numberDiff line change
@@ -175,17 +175,20 @@ angular.module("openshiftConsole")
175175
if (resource.kind === 'Pod' && type === 'pods') {
176176
return;
177177
}
178-
if (!isNil(q.hard[type])) {
179-
var quotaReachedAlert = getQuotaResourceReachedAlert(quota, resource, type);
180-
if (quotaReachedAlert) {
181-
alerts.push(quotaReachedAlert);
182-
}
183-
else if (type !== 'pods') {
184-
// Only calculate this if we havent already reached quota
185-
var requestedAlert = getRequestedResourceQuotaAlert(quota, resource, podTemplate, type);
186-
if (requestedAlert) {
187-
alerts.push(requestedAlert);
188-
}
178+
179+
if (!_.has(q, ['hard', type]) || !_.has(q, ['used', type])) {
180+
return;
181+
}
182+
183+
var quotaReachedAlert = getQuotaResourceReachedAlert(quota, resource, type);
184+
if (quotaReachedAlert) {
185+
alerts.push(quotaReachedAlert);
186+
}
187+
else if (type !== 'pods') {
188+
// Only calculate this if we havent already reached quota
189+
var requestedAlert = getRequestedResourceQuotaAlert(quota, resource, podTemplate, type);
190+
if (requestedAlert) {
191+
alerts.push(requestedAlert);
189192
}
190193
}
191194
});

dist/scripts/scripts.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3511,7 +3511,7 @@ target: "_blank"
35113511
var n = [], a = "Pod" === e.kind ? e : _.get(e, "spec.template");
35123512
return a ? (_.each([ "cpu", "memory", "requests.cpu", "requests.memory", "limits.cpu", "limits.memory", "pods" ], function(r) {
35133513
var o = t.status.total || t.status;
3514-
if (("Pod" !== e.kind || "pods" !== r) && !d(o.hard[r])) {
3514+
if (("Pod" !== e.kind || "pods" !== r) && _.has(o, [ "hard", r ]) && _.has(o, [ "used", r ])) {
35153515
var i = S(t, e, r);
35163516
if (i) n.push(i); else if ("pods" !== r) {
35173517
var s = k(t, e, a, r);

0 commit comments

Comments
 (0)