Skip to content

Commit 3d44d1c

Browse files
Merge pull request #2341 from rhamilto/storage-filter-empty-state
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)
2 parents d9e3c8a + de0f13b commit 3d44d1c

File tree

4 files changed

+29
-27
lines changed

4 files changed

+29
-27
lines changed

app/scripts/controllers/storage.js

+5-12
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ angular.module('openshiftConsole')
1515
$scope.labelSuggestions = {};
1616
$scope.alerts = $scope.alerts || {};
1717
$scope.outOfClaims = false;
18+
$scope.clearFilter = function() {
19+
LabelFilter.clear();
20+
};
1821

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

6669
function updateFilterWarning() {
67-
if (!LabelFilter.getLabelSelector().isEmpty() && $.isEmptyObject($scope.pvcs) && !$.isEmptyObject($scope.unfilteredPVCs)) {
68-
$scope.alerts["storage"] = {
69-
type: "warning",
70-
details: "The active filters are hiding all persistent volume claims."
71-
};
72-
$scope.filterWithZeroResults = true;
73-
}
74-
else {
75-
delete $scope.alerts["storage"];
76-
$scope.filterWithZeroResults = false;
77-
}
70+
$scope.filterWithZeroResults = !LabelFilter.getLabelSelector().isEmpty() && $.isEmptyObject($scope.pvcs) && !$.isEmptyObject($scope.unfilteredPVCs);
7871
}
7972

8073
LabelFilter.onActiveFiltersChanged(function(labelSelector) {
8174
// trigger a digest loop
82-
$scope.$apply(function() {
75+
$scope.$evalAsync(function() {
8376
$scope.pvcs = labelSelector.select($scope.unfilteredPVCs);
8477
updateFilterWarning();
8578
});

app/views/storage.html

+13-8
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,19 @@ <h1>
3232
Loading...
3333
</p>
3434
<div ng-if="pvcsLoaded" class="empty-state-message text-center">
35-
<h2>No persistent volume claims.</h2>
36-
<p ng-if="!filterWithZeroResults">
37-
No persistent volume claims have been added to project {{projectName}}.
38-
</p>
39-
<p ng-if="project && ('persistentvolumeclaims' | canI : 'create') && !filterWithZeroResults">
40-
<a ng-if="!outOfClaims" ng-href="project/{{project.metadata.name}}/create-pvc" class="btn btn-primary">Create Storage</a>
41-
<a ng-if="outOfClaims" href="" class="btn btn-primary disabled" aria-disabled="true">Create Storage</a>
42-
</p>
35+
<div ng-if="!filterWithZeroResults">
36+
<h2>No persistent volume claims.</h2>
37+
<p>
38+
No persistent volume claims have been added to project {{projectName}}.
39+
</p>
40+
<p ng-if="project && ('persistentvolumeclaims' | canI : 'create') && !filterWithZeroResults">
41+
<a ng-if="!outOfClaims" ng-href="project/{{project.metadata.name}}/create-pvc" class="btn btn-primary">Create Storage</a>
42+
<a ng-if="outOfClaims" href="" class="btn btn-primary disabled" aria-disabled="true">Create Storage</a>
43+
</p>
44+
</div>
45+
<div ng-if="filterWithZeroResults">
46+
<h2>The filter is hiding all persistent volume claims. <a href="" ng-click="clearFilter()">Clear Filter</a></h2>
47+
</div>
4348
</div>
4449
</div>
4550
<table ng-if="(pvcs | hashSize) > 0" class="table table-bordered table-mobile table-layout-fixed">

dist/scripts/scripts.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -6604,7 +6604,9 @@ r.unwatchAll(c);
66046604
});
66056605
}));
66066606
} ]), angular.module("openshiftConsole").controller("StorageController", [ "$routeParams", "$scope", "AlertMessageService", "DataService", "ProjectsService", "QuotaService", "$filter", "LabelFilter", "Logger", function(e, t, n, a, r, o, i, s, c) {
6607-
t.projectName = e.project, t.pvcs = {}, t.unfilteredPVCs = {}, t.labelSuggestions = {}, t.alerts = t.alerts || {}, t.outOfClaims = !1;
6607+
t.projectName = e.project, t.pvcs = {}, t.unfilteredPVCs = {}, t.labelSuggestions = {}, t.alerts = t.alerts || {}, t.outOfClaims = !1, t.clearFilter = function() {
6608+
s.clear();
6609+
};
66086610
var l = function() {
66096611
var e = n.isAlertPermanentlyHidden("storage-quota-limit-reached", t.projectName);
66106612
if (t.outOfClaims = o.isAnyStorageQuotaExceeded(t.quotas, t.clusterQuotas), !e && t.outOfClaims) {
@@ -6627,15 +6629,12 @@ return n.permanentlyHideAlert("storage-quota-limit-reached", t.projectName), !0;
66276629
}, u = [];
66286630
r.get(e.project).then(_.spread(function(e, n) {
66296631
function r() {
6630-
s.getLabelSelector().isEmpty() || !$.isEmptyObject(t.pvcs) || $.isEmptyObject(t.unfilteredPVCs) ? (delete t.alerts.storage, t.filterWithZeroResults = !1) : (t.alerts.storage = {
6631-
type: "warning",
6632-
details: "The active filters are hiding all persistent volume claims."
6633-
}, t.filterWithZeroResults = !0);
6632+
t.filterWithZeroResults = !s.getLabelSelector().isEmpty() && $.isEmptyObject(t.pvcs) && !$.isEmptyObject(t.unfilteredPVCs);
66346633
}
66356634
t.project = e, u.push(a.watch("persistentvolumeclaims", n, function(e) {
66366635
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);
66376636
})), s.onActiveFiltersChanged(function(e) {
6638-
t.$apply(function() {
6637+
t.$evalAsync(function() {
66396638
t.pvcs = e.select(t.unfilteredPVCs), r();
66406639
});
66416640
}), t.$on("$destroy", function() {

dist/scripts/templates.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -13589,15 +13589,20 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
1358913589
"Loading...\n" +
1359013590
"</p>\n" +
1359113591
"<div ng-if=\"pvcsLoaded\" class=\"empty-state-message text-center\">\n" +
13592+
"<div ng-if=\"!filterWithZeroResults\">\n" +
1359213593
"<h2>No persistent volume claims.</h2>\n" +
13593-
"<p ng-if=\"!filterWithZeroResults\">\n" +
13594+
"<p>\n" +
1359413595
"No persistent volume claims have been added to project {{projectName}}.\n" +
1359513596
"</p>\n" +
1359613597
"<p ng-if=\"project && ('persistentvolumeclaims' | canI : 'create') && !filterWithZeroResults\">\n" +
1359713598
"<a ng-if=\"!outOfClaims\" ng-href=\"project/{{project.metadata.name}}/create-pvc\" class=\"btn btn-primary\">Create Storage</a>\n" +
1359813599
"<a ng-if=\"outOfClaims\" href=\"\" class=\"btn btn-primary disabled\" aria-disabled=\"true\">Create Storage</a>\n" +
1359913600
"</p>\n" +
1360013601
"</div>\n" +
13602+
"<div ng-if=\"filterWithZeroResults\">\n" +
13603+
"<h2>The filter is hiding all persistent volume claims. <a href=\"\" ng-click=\"clearFilter()\">Clear Filter</a></h2>\n" +
13604+
"</div>\n" +
13605+
"</div>\n" +
1360113606
"</div>\n" +
1360213607
"<table ng-if=\"(pvcs | hashSize) > 0\" class=\"table table-bordered table-mobile table-layout-fixed\">\n" +
1360313608
"<colgroup>\n" +

0 commit comments

Comments
 (0)