Skip to content

Commit

Permalink
Support filtering provisioned services on overview
Browse files Browse the repository at this point in the history
  • Loading branch information
spadgett committed Apr 19, 2017
1 parent 69c571a commit 68158fa
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 21 deletions.
12 changes: 8 additions & 4 deletions app/scripts/controllers/newOverview.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ function OverviewController($scope,
_.size(overview.filteredReplicaSets) +
_.size(overview.filteredStatefulSets) +
_.size(overview.filteredMonopods) +
_.size(overview.state.serviceInstances);
_.size(overview.filteredServiceInstances);
};

// Show the "Get Started" message if the project is empty.
Expand Down Expand Up @@ -301,11 +301,15 @@ function OverviewController($scope,
};

var filterByLabel = function(items) {
return LabelFilter.getLabelSelector().select(items);
var labelSelector = LabelFilter.getLabelSelector();
if (labelSelector.isEmpty()) {
return items;
}
return labelSelector.select(items);
};

// Updated on viewBy changes to include the app label when appropriate.
var filterFields = ['metadata.name'];
var filterFields = ['metadata.name', 'spec.serviceClassName'];
var filterByName = function(items) {
return KeywordService.filterForKeywords(items, filterFields, state.filterKeywords);
};
Expand Down Expand Up @@ -338,6 +342,7 @@ function OverviewController($scope,
overview.filteredStatefulSets = filterItems(overview.statefulSets);
overview.filteredMonopods = filterItems(overview.monopods);
overview.filteredPipelineBuildConfigs = filterItems(overview.pipelineBuildConfigs);
overview.filteredServiceInstances = filterItems(state.orderedServiceInstances);
overview.filterActive = isFilterActive();
updateApps();
updateShowGetStarted();
Expand Down Expand Up @@ -1293,7 +1298,6 @@ function OverviewController($scope,
state.bindings = bindings.by('metadata.name');
overview.bindingsByInstanceRef = _.groupBy(state.bindings, 'spec.instanceRef.name');
refreshSecrets(context);
updateFilter();
}, {poll: limitWatches, pollInterval: DEFAULT_POLL_INTERVAL}));
}

Expand Down
6 changes: 3 additions & 3 deletions app/views/new-overview.html
Original file line number Diff line number Diff line change
Expand Up @@ -355,13 +355,13 @@ <h2>Other Resources</h2>
</div>

<!-- service instances appear the same way no matter the filter listBy option -->
<div ng-if="overview.state.serviceInstances | hashSize">
<h2 ng-if="overview.state.serviceInstances">
<div ng-if="overview.filteredServiceInstances.length">
<h2>
Provisioned Services
</h2>
<div class="list-pf">
<service-instance-row
ng-repeat="serviceInstance in overview.state.orderedServiceInstances"
ng-repeat="serviceInstance in overview.filteredServiceInstances"
api-object="serviceInstance"
bindings="overview.bindingsByInstanceRef[serviceInstance.metadata.name]"
state="overview.state"></service-instance-row>
Expand Down
4 changes: 1 addition & 3 deletions app/views/overview/_service-instance-row.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@
<div class="list-pf-name">
<h3>
<span ng-bind-html="row.displayName | highlightKeywords : row.state.filterKeywords"></span>
<div class="list-row-longname">
{{row.apiObject.metadata.name}}
</div>
<div ng-bind-html="row.apiObject.metadata.name | highlightKeywords : row.state.filterKeywords" class="list-row-longname"></div>
</h3>
<div class="status-icons">
<notification-icon ng-if="!row.expanded" alerts="row.notifications"></notification-icon>
Expand Down
11 changes: 6 additions & 5 deletions dist/scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ return _.get(a, "metadata.uid");
}, P = function() {
return _.size(v.deploymentConfigs) + _.size(v.vanillaReplicationControllers) + _.size(v.deployments) + _.size(v.vanillaReplicaSets) + _.size(v.statefulSets) + _.size(v.monopods) + _.size(v.state.serviceInstances);
}, Q = function() {
return _.size(v.filteredDeploymentConfigs) + _.size(v.filteredReplicationControllers) + _.size(v.filteredDeployments) + _.size(v.filteredReplicaSets) + _.size(v.filteredStatefulSets) + _.size(v.filteredMonopods) + _.size(v.state.serviceInstances);
return _.size(v.filteredDeploymentConfigs) + _.size(v.filteredReplicationControllers) + _.size(v.filteredDeployments) + _.size(v.filteredReplicaSets) + _.size(v.filteredStatefulSets) + _.size(v.filteredMonopods) + _.size(v.filteredServiceInstances);
}, R = function() {
v.size = P(), v.filteredSize = Q();
var a = 0 === v.size, b = v.deploymentConfigs && v.replicationControllers && v.deployments && v.replicaSets && v.statefulSets && v.pods && v.state.serviceInstances;
Expand Down Expand Up @@ -98,8 +98,9 @@ v.deploymentConfigsNoPipeline = _.sortBy(a, "metadata.name"), v.pipelineViewHasO
}, X = function() {
v.disableFilter = "pipeline" === v.viewBy && _.isEmpty(v.pipelineBuildConfigs);
}, Y = function(a) {
return n.getLabelSelector().select(a);
}, Z = [ "metadata.name" ], aa = function(a) {
var b = n.getLabelSelector();
return b.isEmpty() ? a :b.select(a);
}, Z = [ "metadata.name", "spec.serviceClassName" ], aa = function(a) {
return m.filterForKeywords(a, Z, L.filterKeywords);
}, ba = function(a) {
switch (v.filterBy) {
Expand All @@ -119,7 +120,7 @@ case "name":
return !_.isEmpty(L.filterKeywords);
}
}, da = function() {
v.filteredDeploymentConfigs = ba(v.deploymentConfigs), v.filteredReplicationControllers = ba(v.vanillaReplicationControllers), v.filteredDeployments = ba(v.deployments), v.filteredReplicaSets = ba(v.vanillaReplicaSets), v.filteredStatefulSets = ba(v.statefulSets), v.filteredMonopods = ba(v.monopods), v.filteredPipelineBuildConfigs = ba(v.pipelineBuildConfigs), v.filterActive = ca(), V(), R();
v.filteredDeploymentConfigs = ba(v.deploymentConfigs), v.filteredReplicationControllers = ba(v.vanillaReplicationControllers), v.filteredDeployments = ba(v.deployments), v.filteredReplicaSets = ba(v.vanillaReplicaSets), v.filteredStatefulSets = ba(v.statefulSets), v.filteredMonopods = ba(v.monopods), v.filteredPipelineBuildConfigs = ba(v.pipelineBuildConfigs), v.filteredServiceInstances = ba(L.orderedServiceInstances), v.filterActive = ca(), V(), R();
}, ea = c.project + "/overview/view-by";
v.viewBy = localStorage.getItem(ea) || "app", a.$watch(function() {
return v.viewBy;
Expand Down Expand Up @@ -469,7 +470,7 @@ pollInterval:x
group:"servicecatalog.k8s.io",
resource:"bindings"
}, c, function(a) {
L.bindings = a.by("metadata.name"), v.bindingsByInstanceRef = _.groupBy(L.bindings, "spec.instanceRef.name"), Va(c), da();
L.bindings = a.by("metadata.name"), v.bindingsByInstanceRef = _.groupBy(L.bindings, "spec.instanceRef.name"), Va(c);
}, {
poll:w,
pollInterval:x
Expand Down
10 changes: 4 additions & 6 deletions dist/scripts/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -11557,12 +11557,12 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
"</div>\n" +
"</div>\n" +
"\n" +
"<div ng-if=\"overview.state.serviceInstances | hashSize\">\n" +
"<h2 ng-if=\"overview.state.serviceInstances\">\n" +
"<div ng-if=\"overview.filteredServiceInstances.length\">\n" +
"<h2>\n" +
"Provisioned Services\n" +
"</h2>\n" +
"<div class=\"list-pf\">\n" +
"<service-instance-row ng-repeat=\"serviceInstance in overview.state.orderedServiceInstances\" api-object=\"serviceInstance\" bindings=\"overview.bindingsByInstanceRef[serviceInstance.metadata.name]\" state=\"overview.state\"></service-instance-row>\n" +
"<service-instance-row ng-repeat=\"serviceInstance in overview.filteredServiceInstances\" api-object=\"serviceInstance\" bindings=\"overview.bindingsByInstanceRef[serviceInstance.metadata.name]\" state=\"overview.state\"></service-instance-row>\n" +
"</div>\n" +
"</div>\n" +
"</div>\n" +
Expand Down Expand Up @@ -12710,9 +12710,7 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
"<div class=\"list-pf-name\">\n" +
"<h3>\n" +
"<span ng-bind-html=\"row.displayName | highlightKeywords : row.state.filterKeywords\"></span>\n" +
"<div class=\"list-row-longname\">\n" +
"{{row.apiObject.metadata.name}}\n" +
"</div>\n" +
"<div ng-bind-html=\"row.apiObject.metadata.name | highlightKeywords : row.state.filterKeywords\" class=\"list-row-longname\"></div>\n" +
"</h3>\n" +
"<div class=\"status-icons\">\n" +
"<notification-icon ng-if=\"!row.expanded\" alerts=\"row.notifications\"></notification-icon>\n" +
Expand Down

0 comments on commit 68158fa

Please sign in to comment.