Skip to content

Commit 1ee46ca

Browse files
Update CreatePersistentVolumeClaimController to use getPreferredVersion
1 parent 6dde77e commit 1ee46ca

File tree

2 files changed

+24
-19
lines changed

2 files changed

+24
-19
lines changed

app/scripts/controllers/createPersistentVolumeClaim.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ angular.module('openshiftConsole')
1313
$routeParams,
1414
$scope,
1515
$window,
16+
APIService,
1617
ApplicationGenerator,
1718
AuthorizationService,
1819
DataService,
@@ -24,6 +25,8 @@ angular.module('openshiftConsole')
2425
$scope.accessModes="ReadWriteOnce";
2526
$scope.claim = {};
2627

28+
var perpersistentVolumeClaimsVersion = APIService.getPreferredVersion('buildconfigs');
29+
2730
$scope.breadcrumbs = [
2831
{
2932
title: "Storage",
@@ -49,7 +52,7 @@ angular.module('openshiftConsole')
4952
.then(_.spread(function(project, context) {
5053
$scope.project = project;
5154

52-
if (!AuthorizationService.canI('persistentvolumeclaims', 'create', $routeParams.project)) {
55+
if (!AuthorizationService.canI(perpersistentVolumeClaimsVersion, 'create', $routeParams.project)) {
5356
Navigate.toErrorPage('You do not have authority to create persistent volume claims in project ' + $routeParams.project + '.', 'access_denied');
5457
return;
5558
}
@@ -59,7 +62,7 @@ angular.module('openshiftConsole')
5962
if ($scope.createPersistentVolumeClaimForm.$valid) {
6063
$scope.disableInputs = true;
6164
var claim = generatePersistentVolumeClaim();
62-
DataService.create('persistentvolumeclaims', null, claim, context)
65+
DataService.create(perpersistentVolumeClaimsVersion, null, claim, context)
6366
.then(function(claim) { // Success
6467
NotificationsService.addNotification({
6568
type: "success",

dist/scripts/scripts.js

+19-17
Original file line numberDiff line numberDiff line change
@@ -8675,22 +8675,24 @@ kubernetes: n.VERSION.kubernetes
86758675
};
86768676
} ]), angular.module("openshiftConsole").controller("CommandLineController", [ "$scope", "DataService", "AuthService", "Constants", function(e, t, n, a) {
86778677
n.withUser(), e.cliDownloadURL = a.CLI, e.cliDownloadURLPresent = e.cliDownloadURL && !_.isEmpty(e.cliDownloadURL), e.loginBaseURL = t.openshiftAPIBaseUrl(), a.DISABLE_COPY_LOGIN_COMMAND || (e.sessionToken = n.UserStore().getToken());
8678-
} ]), angular.module("openshiftConsole").controller("CreatePersistentVolumeClaimController", [ "$filter", "$routeParams", "$scope", "$window", "ApplicationGenerator", "AuthorizationService", "DataService", "Navigate", "NotificationsService", "ProjectsService", "keyValueEditorUtils", function(e, t, n, a, r, o, i, s, c, l, u) {
8679-
n.projectName = t.project, n.accessModes = "ReadWriteOnce", n.claim = {}, n.breadcrumbs = [ {
8678+
} ]), angular.module("openshiftConsole").controller("CreatePersistentVolumeClaimController", [ "$filter", "$routeParams", "$scope", "$window", "APIService", "ApplicationGenerator", "AuthorizationService", "DataService", "Navigate", "NotificationsService", "ProjectsService", "keyValueEditorUtils", function(e, t, n, a, r, o, i, s, c, l, u, d) {
8679+
n.projectName = t.project, n.accessModes = "ReadWriteOnce", n.claim = {};
8680+
var p = r.getPreferredVersion("buildconfigs");
8681+
n.breadcrumbs = [ {
86808682
title: "Storage",
86818683
link: "project/" + n.projectName + "/browse/storage"
86828684
}, {
86838685
title: "Create Storage"
86848686
} ];
8685-
var d = function() {
8686-
c.hideNotification("create-pvc-error");
8687+
var m = function() {
8688+
l.hideNotification("create-pvc-error");
86878689
};
8688-
n.$on("$destroy", d);
8689-
var p = function() {
8690+
n.$on("$destroy", m);
8691+
var f = function() {
86908692
a.history.back();
86918693
};
8692-
n.cancel = p, l.get(t.project).then(_.spread(function(a, r) {
8693-
function l() {
8694+
n.cancel = f, u.get(t.project).then(_.spread(function(a, r) {
8695+
function o() {
86948696
var e = {
86958697
kind: "PersistentVolumeClaim",
86968698
apiVersion: "v1",
@@ -8708,30 +8710,30 @@ requests: {}
87088710
e.spec.accessModes = [ n.claim.accessModes || "ReadWriteOnce" ];
87098711
var t = n.claim.unit || "Mi";
87108712
if (e.spec.resources.requests.storage = n.claim.amount + t, n.claim.selectedLabels) {
8711-
var a = u.mapEntries(u.compactEntries(n.claim.selectedLabels));
8713+
var a = d.mapEntries(d.compactEntries(n.claim.selectedLabels));
87128714
_.isEmpty(a) || _.set(e, "spec.selector.matchLabels", a);
87138715
}
87148716
return n.claim.storageClass && "No Storage Class" !== n.claim.storageClass.metadata.name && (e.metadata.annotations["volume.beta.kubernetes.io/storage-class"] = n.claim.storageClass.metadata.name), e;
87158717
}
8716-
n.project = a, o.canI("persistentvolumeclaims", "create", t.project) ? n.createPersistentVolumeClaim = function() {
8717-
if (d(), n.createPersistentVolumeClaimForm.$valid) {
8718+
n.project = a, i.canI(p, "create", t.project) ? n.createPersistentVolumeClaim = function() {
8719+
if (m(), n.createPersistentVolumeClaimForm.$valid) {
87188720
n.disableInputs = !0;
8719-
var t = l();
8720-
i.create("persistentvolumeclaims", null, t, r).then(function(e) {
8721-
c.addNotification({
8721+
var t = o();
8722+
s.create(p, null, t, r).then(function(e) {
8723+
l.addNotification({
87228724
type: "success",
87238725
message: "Persistent volume claim " + e.metadata.name + " successfully created."
8724-
}), p();
8726+
}), f();
87258727
}, function(t) {
8726-
n.disableInputs = !1, c.addNotification({
8728+
n.disableInputs = !1, l.addNotification({
87278729
id: "create-pvc-error",
87288730
type: "error",
87298731
message: "An error occurred requesting storage.",
87308732
details: e("getErrorDetails")(t)
87318733
});
87328734
});
87338735
}
8734-
} : s.toErrorPage("You do not have authority to create persistent volume claims in project " + t.project + ".", "access_denied");
8736+
} : c.toErrorPage("You do not have authority to create persistent volume claims in project " + t.project + ".", "access_denied");
87358737
}));
87368738
} ]), angular.module("openshiftConsole").directive("buildClose", [ "$window", function(e) {
87378739
var t = function(e) {

0 commit comments

Comments
 (0)