Skip to content

Commit

Permalink
Merge pull request #2341 from rhamilto/storage-filter-empty-state
Browse files Browse the repository at this point in the history
Automatic merge from submit-queue.

Update storage filter empty state to new standard

I overlooked the filtered empty state message for storage in #2259.  This fixes that.

![screen shot 2017-10-23 at 11 05 38 am](https://user-images.githubusercontent.com/895728/31896715-765d8ffa-b7e2-11e7-9776-e9c5d36cc222.PNG)
  • Loading branch information
openshift-merge-robot committed Oct 23, 2017
2 parents d9e3c8a + de0f13b commit 3d44d1c
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 27 deletions.
17 changes: 5 additions & 12 deletions app/scripts/controllers/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ angular.module('openshiftConsole')
$scope.labelSuggestions = {};
$scope.alerts = $scope.alerts || {};
$scope.outOfClaims = false;
$scope.clearFilter = function() {
LabelFilter.clear();
};

var setOutOfClaimsWarning = function() {
var isHidden = AlertMessageService.isAlertPermanentlyHidden("storage-quota-limit-reached", $scope.projectName);
Expand Down Expand Up @@ -64,22 +67,12 @@ angular.module('openshiftConsole')
}));

function updateFilterWarning() {
if (!LabelFilter.getLabelSelector().isEmpty() && $.isEmptyObject($scope.pvcs) && !$.isEmptyObject($scope.unfilteredPVCs)) {
$scope.alerts["storage"] = {
type: "warning",
details: "The active filters are hiding all persistent volume claims."
};
$scope.filterWithZeroResults = true;
}
else {
delete $scope.alerts["storage"];
$scope.filterWithZeroResults = false;
}
$scope.filterWithZeroResults = !LabelFilter.getLabelSelector().isEmpty() && $.isEmptyObject($scope.pvcs) && !$.isEmptyObject($scope.unfilteredPVCs);
}

LabelFilter.onActiveFiltersChanged(function(labelSelector) {
// trigger a digest loop
$scope.$apply(function() {
$scope.$evalAsync(function() {
$scope.pvcs = labelSelector.select($scope.unfilteredPVCs);
updateFilterWarning();
});
Expand Down
21 changes: 13 additions & 8 deletions app/views/storage.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,19 @@ <h1>
Loading...
</p>
<div ng-if="pvcsLoaded" class="empty-state-message text-center">
<h2>No persistent volume claims.</h2>
<p ng-if="!filterWithZeroResults">
No persistent volume claims have been added to project {{projectName}}.
</p>
<p ng-if="project && ('persistentvolumeclaims' | canI : 'create') && !filterWithZeroResults">
<a ng-if="!outOfClaims" ng-href="project/{{project.metadata.name}}/create-pvc" class="btn btn-primary">Create Storage</a>
<a ng-if="outOfClaims" href="" class="btn btn-primary disabled" aria-disabled="true">Create Storage</a>
</p>
<div ng-if="!filterWithZeroResults">
<h2>No persistent volume claims.</h2>
<p>
No persistent volume claims have been added to project {{projectName}}.
</p>
<p ng-if="project && ('persistentvolumeclaims' | canI : 'create') && !filterWithZeroResults">
<a ng-if="!outOfClaims" ng-href="project/{{project.metadata.name}}/create-pvc" class="btn btn-primary">Create Storage</a>
<a ng-if="outOfClaims" href="" class="btn btn-primary disabled" aria-disabled="true">Create Storage</a>
</p>
</div>
<div ng-if="filterWithZeroResults">
<h2>The filter is hiding all persistent volume claims. <a href="" ng-click="clearFilter()">Clear Filter</a></h2>
</div>
</div>
</div>
<table ng-if="(pvcs | hashSize) > 0" class="table table-bordered table-mobile table-layout-fixed">
Expand Down
11 changes: 5 additions & 6 deletions dist/scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -6604,7 +6604,9 @@ r.unwatchAll(c);
});
}));
} ]), angular.module("openshiftConsole").controller("StorageController", [ "$routeParams", "$scope", "AlertMessageService", "DataService", "ProjectsService", "QuotaService", "$filter", "LabelFilter", "Logger", function(e, t, n, a, r, o, i, s, c) {
t.projectName = e.project, t.pvcs = {}, t.unfilteredPVCs = {}, t.labelSuggestions = {}, t.alerts = t.alerts || {}, t.outOfClaims = !1;
t.projectName = e.project, t.pvcs = {}, t.unfilteredPVCs = {}, t.labelSuggestions = {}, t.alerts = t.alerts || {}, t.outOfClaims = !1, t.clearFilter = function() {
s.clear();
};
var l = function() {
var e = n.isAlertPermanentlyHidden("storage-quota-limit-reached", t.projectName);
if (t.outOfClaims = o.isAnyStorageQuotaExceeded(t.quotas, t.clusterQuotas), !e && t.outOfClaims) {
Expand All @@ -6627,15 +6629,12 @@ return n.permanentlyHideAlert("storage-quota-limit-reached", t.projectName), !0;
}, u = [];
r.get(e.project).then(_.spread(function(e, n) {
function r() {
s.getLabelSelector().isEmpty() || !$.isEmptyObject(t.pvcs) || $.isEmptyObject(t.unfilteredPVCs) ? (delete t.alerts.storage, t.filterWithZeroResults = !1) : (t.alerts.storage = {
type: "warning",
details: "The active filters are hiding all persistent volume claims."
}, t.filterWithZeroResults = !0);
t.filterWithZeroResults = !s.getLabelSelector().isEmpty() && $.isEmptyObject(t.pvcs) && !$.isEmptyObject(t.unfilteredPVCs);
}
t.project = e, u.push(a.watch("persistentvolumeclaims", n, function(e) {
t.pvcsLoaded = !0, t.unfilteredPVCs = e.by("metadata.name"), s.addLabelSuggestionsFromResources(t.unfilteredPVCs, t.labelSuggestions), s.setLabelSuggestions(t.labelSuggestions), t.pvcs = s.getLabelSelector().select(t.unfilteredPVCs), r(), c.log("pvcs (subscribe)", t.unfilteredPVCs);
})), s.onActiveFiltersChanged(function(e) {
t.$apply(function() {
t.$evalAsync(function() {
t.pvcs = e.select(t.unfilteredPVCs), r();
});
}), t.$on("$destroy", function() {
Expand Down
7 changes: 6 additions & 1 deletion dist/scripts/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -13589,15 +13589,20 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
"Loading...\n" +
"</p>\n" +
"<div ng-if=\"pvcsLoaded\" class=\"empty-state-message text-center\">\n" +
"<div ng-if=\"!filterWithZeroResults\">\n" +
"<h2>No persistent volume claims.</h2>\n" +
"<p ng-if=\"!filterWithZeroResults\">\n" +
"<p>\n" +
"No persistent volume claims have been added to project {{projectName}}.\n" +
"</p>\n" +
"<p ng-if=\"project && ('persistentvolumeclaims' | canI : 'create') && !filterWithZeroResults\">\n" +
"<a ng-if=\"!outOfClaims\" ng-href=\"project/{{project.metadata.name}}/create-pvc\" class=\"btn btn-primary\">Create Storage</a>\n" +
"<a ng-if=\"outOfClaims\" href=\"\" class=\"btn btn-primary disabled\" aria-disabled=\"true\">Create Storage</a>\n" +
"</p>\n" +
"</div>\n" +
"<div ng-if=\"filterWithZeroResults\">\n" +
"<h2>The filter is hiding all persistent volume claims. <a href=\"\" ng-click=\"clearFilter()\">Clear Filter</a></h2>\n" +
"</div>\n" +
"</div>\n" +
"</div>\n" +
"<table ng-if=\"(pvcs | hashSize) > 0\" class=\"table table-bordered table-mobile table-layout-fixed\">\n" +
"<colgroup>\n" +
Expand Down

0 comments on commit 3d44d1c

Please sign in to comment.