diff --git a/app/scripts/directives/oscPersistentVolumeClaim.js b/app/scripts/directives/oscPersistentVolumeClaim.js index 1a82b0d22f..18cb29c90e 100644 --- a/app/scripts/directives/oscPersistentVolumeClaim.js +++ b/app/scripts/directives/oscPersistentVolumeClaim.js @@ -45,6 +45,21 @@ angular.module("openshiftConsole") }]; scope.claim.selectedLabels = []; + var previousLabels = []; + scope.$watch('useLabels', function(useLabels, previousValue) { + if (useLabels === previousValue) { + return; + } + + // Prefill the previous values if the checkbox was unchecked and checked again. + if (useLabels) { + scope.claim.selectedLabels = previousLabels; + } else { + previousLabels = scope.claim.selectedLabels; + scope.claim.selectedLabels = []; + } + }); + scope.groupUnits = function(unit) { switch (unit.value) { case 'Mi': diff --git a/app/views/directives/osc-persistent-volume-claim.html b/app/views/directives/osc-persistent-volume-claim.html index 37e0f0ce3b..dbc7e836c3 100644 --- a/app/views/directives/osc-persistent-volume-claim.html +++ b/app/views/directives/osc-persistent-volume-claim.html @@ -58,7 +58,7 @@
- + A unique name for the storage claim within the project.
-
+
Name is required. @@ -201,30 +201,22 @@
- -
- Use - label selectors - to request storage. +
+ +
- -
-
- -
- Enter a label and value to use for your storage. - -
- -
+
+ +
diff --git a/dist/scripts/scripts.js b/dist/scripts/scripts.js index 67fd9d9403..45b23c2ab0 100644 --- a/dist/scripts/scripts.js +++ b/dist/scripts/scripts.js @@ -10037,7 +10037,11 @@ label: "GB" }, { value: "T", label: "TB" -} ], i.claim.selectedLabels = [], i.groupUnits = function(e) { +} ], i.claim.selectedLabels = []; +var l = []; +i.$watch("useLabels", function(e, t) { +e !== t && (e ? i.claim.selectedLabels = l : (l = i.claim.selectedLabels, i.claim.selectedLabels = [])); +}), i.groupUnits = function(e) { switch (e.value) { case "Mi": case "Gi": @@ -10053,10 +10057,10 @@ return ""; }, i.showComputeUnitsHelp = function() { r.showComputeUnitsHelp(); }; -var l = function() { +var u = function() { var e = i.claim.amount && c(i.claim.amount + i.claim.unit), t = _.has(i, "limits.min") && c(i.limits.min), n = _.has(i, "limits.max") && c(i.limits.max), a = !0, r = !0; e && t && (a = e >= t), e && n && (r = e <= n), i.persistentVolumeClaimForm.capacity.$setValidity("limitRangeMin", a), i.persistentVolumeClaimForm.capacity.$setValidity("limitRangeMax", r); -}, u = function() { +}, d = function() { var e = a.isAnyStorageQuotaExceeded(i.quotas, i.clusterQuotas), t = a.willRequestExceedQuota(i.quotas, i.clusterQuotas, "requests.storage", i.claim.amount + i.claim.unit); i.persistentVolumeClaimForm.capacity.$setValidity("willExceedStorage", !t), i.persistentVolumeClaimForm.capacity.$setValidity("outOfClaims", !e); }; @@ -10092,12 +10096,12 @@ var t = e.by("metadata.name"); if (!_.isEmpty(t)) { i.limits = n.getEffectiveLimitRange(t, "storage", "PersistentVolumeClaim"); var a; -i.limits.min && i.limits.max && c(i.limits.min) === c(i.limits.max) && (a = s(i.limits.max), i.claim.amount = Number(a[0]), i.claim.unit = a[1], i.capacityReadOnly = !0), i.$watchGroup([ "claim.amount", "claim.unit" ], l); +i.limits.min && i.limits.max && c(i.limits.min) === c(i.limits.max) && (a = s(i.limits.max), i.claim.amount = Number(a[0]), i.claim.unit = a[1], i.capacityReadOnly = !0), i.$watchGroup([ "claim.amount", "claim.unit" ], u); } }), t.list("resourcequotas", { namespace: i.projectName }, function(e) { -i.quotas = e.by("metadata.name"), i.$watchGroup([ "claim.amount", "claim.unit" ], u); +i.quotas = e.by("metadata.name"), i.$watchGroup([ "claim.amount", "claim.unit" ], d); }), t.list("appliedclusterresourcequotas", { namespace: i.projectName }, function(e) { diff --git a/dist/scripts/templates.js b/dist/scripts/templates.js index 7fba7337f5..230fded09b 100644 --- a/dist/scripts/templates.js +++ b/dist/scripts/templates.js @@ -8187,13 +8187,13 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function( "\n" + "
\n" + "\n" + - "\n" + + "\n" + "\n" + "\n" + "
\n" + "A unique name for the storage claim within the project.\n" + "
\n" + - "
\n" + + "
\n" + "\n" + "Name is required.\n" + "\n" + @@ -8304,23 +8304,18 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function( "
\n" + "\n" + "
\n" + - "\n" + - "
\n" + - "Use\n" + - "label selectors\n" + - "to request storage.\n" + - "
\n" + - "
\n" + - "
\n" + - "\n" + - "
\n" + - "Enter a label and value to use for your storage.\n" + - "
\n" + + "
\n" + + "\n" + + "
\n" + "Learn More \n" + "
\n" + "
\n" + - "\n" + - "
\n" + + "
\n" + + "\n" + + "\n" + "
\n" + "\n" + ""