Skip to content

Commit bcd6a15

Browse files
author
OpenShift Bot
authored
Merge pull request #2097 from benjaminapetersen/bpetersen/trello-api-groups-attach-pvc
Merged by openshift-bot
2 parents 5897e5b + 1fecac5 commit bcd6a15

File tree

4 files changed

+36
-30
lines changed

4 files changed

+36
-30
lines changed

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

+7-3
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ angular.module('openshiftConsole')
6767
subpage: 'Add Storage'
6868
});
6969

70+
$scope.pvcVersion = APIService.getPreferredVersion('persistentvolumeclaims');
71+
var resourceQuotasVersion = APIService.getPreferredVersion('resourcequotas');
72+
var appliedClusterResourceQuotasVersion = APIService.getPreferredVersion('appliedclusterresourcequotas');
73+
7074
ProjectsService
7175
.get($routeParams.project)
7276
.then(_.spread(function(project, context) {
@@ -132,18 +136,18 @@ angular.module('openshiftConsole')
132136
}
133137
);
134138

135-
DataService.list("persistentvolumeclaims", context).then(function(pvcs) {
139+
DataService.list($scope.pvcVersion, context).then(function(pvcs) {
136140
$scope.pvcs = orderByDisplayName(pvcs.by("metadata.name"));
137141
if (!_.isEmpty($scope.pvcs) && !$scope.attach.persistentVolumeClaim) {
138142
$scope.attach.persistentVolumeClaim = _.head($scope.pvcs);
139143
}
140144
});
141145

142-
DataService.list('resourcequotas', { namespace: $scope.projectName }, function(quotaData) {
146+
DataService.list(resourceQuotasVersion, { namespace: $scope.projectName }, function(quotaData) {
143147
$scope.quotas = quotaData.by('metadata.name');
144148
$scope.outOfClaims = QuotaService.isAnyStorageQuotaExceeded($scope.quotas, $scope.clusterQuotas);
145149
});
146-
DataService.list('appliedclusterresourcequotas', { namespace: $scope.projectName }, function(quotaData) {
150+
DataService.list(appliedClusterResourceQuotasVersion, { namespace: $scope.projectName }, function(quotaData) {
147151
$scope.clusterQuotas = quotaData.by('metadata.name');
148152
$scope.outOfClaims = QuotaService.isAnyStorageQuotaExceeded($scope.quotas, $scope.clusterQuotas);
149153
});

Diff for: app/views/attach-pvc.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ <h2 class="text-center">No persistent volume claims.</h2>
1414
but none are loaded on this project.
1515
</p>
1616

17-
<div ng-if="project && ('persistentvolumeclaims' | canI : 'create')" class="text-center">
17+
<div ng-if="project && (pvcVersion | canI : 'create')" class="text-center">
1818
<a ng-href="project/{{project.metadata.name}}/create-pvc"
1919
class="btn btn-primary">Create Storage</a>
2020
</div>
2121

22-
<p ng-if="project && !('persistentvolumeclaims' | canI : 'create')">
22+
<p ng-if="project && !(pvcVersion | canI : 'create')">
2323
To claim storage from a persistent volume, refer to the documentation on <a target="_blank" ng-href="{{'persistent_volumes' | helpLink}}">using persistent volumes</a>.
2424
</p>
2525

@@ -60,10 +60,10 @@ <h1>Add Storage to {{name}}</h1>
6060
</tbody>
6161
</table>
6262
</div>
63-
<div ng-if="!(project && ('persistentvolumeclaims' | canI : 'create'))" class="help-block">
63+
<div ng-if="!(project && (pvcVersion | canI : 'create'))" class="help-block">
6464
Select storage to use.
6565
</div>
66-
<div ng-if="project && ('persistentvolumeclaims' | canI : 'create')" class="help-block">
66+
<div ng-if="project && (pvcVersion | canI : 'create')" class="help-block">
6767
Select storage to use<span ng-if="!outOfClaims"> or <a ng-href="project/{{project.metadata.name}}/create-pvc" >create storage</a>.</span>
6868
<span ng-if="outOfClaims">. You cannot create new storage since you are at quota.</span>
6969
</div>

Diff for: dist/scripts/scripts.js

+21-19
Original file line numberDiff line numberDiff line change
@@ -8406,30 +8406,32 @@ name: t.name,
84068406
kind: t.kind,
84078407
namespace: t.project,
84088408
subpage: "Add Storage"
8409-
}), d.get(t.project).then(_.spread(function(r, d) {
8409+
}), n.pvcVersion = r.getPreferredVersion("persistentvolumeclaims");
8410+
var v = r.getPreferredVersion("resourcequotas"), y = r.getPreferredVersion("appliedclusterresourcequotas");
8411+
d.get(t.project).then(_.spread(function(r, d) {
84108412
if (n.project = r, o.canI(h, "update", t.project)) {
8411-
var m = e("orderByDisplayName"), f = e("getErrorDetails"), v = e("generateName"), y = function(e, t) {
8413+
var m = e("orderByDisplayName"), f = e("getErrorDetails"), b = e("generateName"), C = function(e, t) {
84128414
n.disableInputs = !0, u.addNotification({
84138415
id: "attach-pvc-error",
84148416
type: "error",
84158417
message: e,
84168418
details: t
84178419
});
8418-
}, b = function() {
8420+
}, S = function() {
84198421
u.hideNotification("attach-pvc-error");
84208422
};
8421-
n.$on("$destroy", b);
8422-
var C = function() {
8423+
n.$on("$destroy", S);
8424+
var w = function() {
84238425
a.history.back();
84248426
};
8425-
n.cancel = C;
8426-
var S = function(e) {
8427+
n.cancel = w;
8428+
var k = function(e) {
84278429
return n.attach.allContainers || n.attach.containers[e.name];
8428-
}, w = function() {
8430+
}, j = function() {
84298431
var e = _.get(n, "attach.resource.spec.template");
8430-
n.existingMountPaths = p.getMountPaths(e, S);
8432+
n.existingMountPaths = p.getMountPaths(e, k);
84318433
};
8432-
n.$watchGroup([ "attach.resource", "attach.allContainers" ], w), n.$watch("attach.containers", w, !0);
8434+
n.$watchGroup([ "attach.resource", "attach.allContainers" ], j), n.$watch("attach.containers", j, !0);
84338435
s.get(h, t.name, d).then(function(e) {
84348436
n.attach.resource = e, n.breadcrumbs = i.getBreadcrumbs({
84358437
object: e,
@@ -8439,23 +8441,23 @@ subpage: "Add Storage"
84398441
var t = _.get(e, "spec.template");
84408442
n.existingVolumeNames = p.getVolumeNames(t);
84418443
}, function(e) {
8442-
y(t.name + " could not be loaded.", f(e));
8443-
}), s.list("persistentvolumeclaims", d).then(function(e) {
8444+
C(t.name + " could not be loaded.", f(e));
8445+
}), s.list(n.pvcVersion, d).then(function(e) {
84448446
n.pvcs = m(e.by("metadata.name")), _.isEmpty(n.pvcs) || n.attach.persistentVolumeClaim || (n.attach.persistentVolumeClaim = _.head(n.pvcs));
8445-
}), s.list("resourcequotas", {
8447+
}), s.list(v, {
84468448
namespace: n.projectName
84478449
}, function(e) {
84488450
n.quotas = e.by("metadata.name"), n.outOfClaims = c.isAnyStorageQuotaExceeded(n.quotas, n.clusterQuotas);
8449-
}), s.list("appliedclusterresourcequotas", {
8451+
}), s.list(y, {
84508452
namespace: n.projectName
84518453
}, function(e) {
84528454
n.clusterQuotas = e.by("metadata.name"), n.outOfClaims = c.isAnyStorageQuotaExceeded(n.quotas, n.clusterQuotas);
84538455
}), n.attachPVC = function() {
8454-
if (n.disableInputs = !0, b(), n.attachPVCForm.$valid) {
8455-
n.attach.volumeName || (n.attach.volumeName = v("volume-"));
8456+
if (n.disableInputs = !0, S(), n.attachPVCForm.$valid) {
8457+
n.attach.volumeName || (n.attach.volumeName = b("volume-"));
84568458
var e = n.attach.resource, a = _.get(e, "spec.template"), r = n.attach.persistentVolumeClaim, o = n.attach.volumeName, i = n.attach.mountPath, c = n.attach.subPath, l = n.attach.readOnly;
84578459
i && angular.forEach(a.spec.containers, function(e) {
8458-
if (S(e)) {
8460+
if (k(e)) {
84598461
var t = p.createVolumeMount(o, i, c, l);
84608462
e.volumeMounts || (e.volumeMounts = []), e.volumeMounts.push(t);
84618463
}
@@ -8467,9 +8469,9 @@ i || (e = "No mount path was provided. The volume reference was added to the con
84678469
type: "success",
84688470
message: "Persistent volume claim " + r.metadata.name + " added to " + g(t.kind) + " " + t.name + ".",
84698471
details: e
8470-
}), C();
8472+
}), w();
84718473
}, function(e) {
8472-
y("An error occurred attaching the persistent volume claim to the " + g(t.kind) + ".", f(e)), n.disableInputs = !1;
8474+
C("An error occurred attaching the persistent volume claim to the " + g(t.kind) + ".", f(e)), n.disableInputs = !1;
84738475
});
84748476
}
84758477
};

Diff for: dist/scripts/templates.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -984,10 +984,10 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
984984
"<p class=\"gutter-top\">\n" +
985985
"A <b>persistent volume claim</b> is required to attach to this {{kind | humanizeKind}}, but none are loaded on this project.\n" +
986986
"</p>\n" +
987-
"<div ng-if=\"project && ('persistentvolumeclaims' | canI : 'create')\" class=\"text-center\">\n" +
987+
"<div ng-if=\"project && (pvcVersion | canI : 'create')\" class=\"text-center\">\n" +
988988
"<a ng-href=\"project/{{project.metadata.name}}/create-pvc\" class=\"btn btn-primary\">Create Storage</a>\n" +
989989
"</div>\n" +
990-
"<p ng-if=\"project && !('persistentvolumeclaims' | canI : 'create')\">\n" +
990+
"<p ng-if=\"project && !(pvcVersion | canI : 'create')\">\n" +
991991
"To claim storage from a persistent volume, refer to the documentation on <a target=\"_blank\" ng-href=\"{{'persistent_volumes' | helpLink}}\">using persistent volumes</a>.\n" +
992992
"</p>\n" +
993993
"<p ng-if=\"attach.resource\"><a ng-href=\"{{attach.resource | navigateResourceURL}}\">Back to {{kind | humanizeKind}} {{name}}</a></p>\n" +
@@ -1021,10 +1021,10 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
10211021
"</tbody>\n" +
10221022
"</table>\n" +
10231023
"</div>\n" +
1024-
"<div ng-if=\"!(project && ('persistentvolumeclaims' | canI : 'create'))\" class=\"help-block\">\n" +
1024+
"<div ng-if=\"!(project && (pvcVersion | canI : 'create'))\" class=\"help-block\">\n" +
10251025
"Select storage to use.\n" +
10261026
"</div>\n" +
1027-
"<div ng-if=\"project && ('persistentvolumeclaims' | canI : 'create')\" class=\"help-block\">\n" +
1027+
"<div ng-if=\"project && (pvcVersion | canI : 'create')\" class=\"help-block\">\n" +
10281028
"Select storage to use<span ng-if=\"!outOfClaims\"> or <a ng-href=\"project/{{project.metadata.name}}/create-pvc\">create storage</a>.</span>\n" +
10291029
"<span ng-if=\"outOfClaims\">. You cannot create new storage since you are at quota.</span>\n" +
10301030
"</div>\n" +

0 commit comments

Comments
 (0)