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 143a0ff
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 25 deletions.
7 changes: 4 additions & 3 deletions app/scripts/controllers/newOverview.js
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 @@ -305,7 +305,7 @@ function OverviewController($scope,
};

// 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 +338,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 @@ -1281,6 +1282,7 @@ function OverviewController($scope,
setNotifications(instance, notifications);
});
sortServiceInstances();
updateLabelSuggestions(state.serviceInstances);
updateFilter();
}, {poll: limitWatches, pollInterval: DEFAULT_POLL_INTERVAL}));
}
Expand All @@ -1293,7 +1295,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
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
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
2 changes: 1 addition & 1 deletion bower.json
Expand Up @@ -26,7 +26,7 @@
"microplugin": "0.0.3",
"selectize": "0.12.1",
"messenger": "1.4.1",
"kubernetes-label-selector": "1.4.2",
"kubernetes-label-selector": "1.4.3",
"kubernetes-topology-graph": "0.0.23",
"kubernetes-container-terminal": "1.0.3",
"registry-image-widgets": "0.0.2",
Expand Down
10 changes: 5 additions & 5 deletions dist/scripts/scripts.js
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 @@ -99,7 +99,7 @@ v.deploymentConfigsNoPipeline = _.sortBy(a, "metadata.name"), v.pipelineViewHasO
v.disableFilter = "pipeline" === v.viewBy && _.isEmpty(v.pipelineBuildConfigs);
}, Y = function(a) {
return n.getLabelSelector().select(a);
}, Z = [ "metadata.name" ], aa = function(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 +119,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 @@ -461,15 +461,15 @@ resource:"instances"
L.serviceInstances = a.by("metadata.name"), _.each(L.serviceInstances, function(a) {
var b = t.getServiceInstanceAlerts(a);
ha(a, b);
}), Wa(), da();
}), Wa(), ua(L.serviceInstances), da();
}, {
poll:w,
pollInterval:x
})), g.ENABLE_TECH_PREVIEW_FEATURE.service_catalog_landing_page && Xa.push(h.watch({
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
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
5 changes: 1 addition & 4 deletions dist/scripts/vendor.js
Expand Up @@ -42801,10 +42801,7 @@ return $.isEmptyObject(this._conjuncts);
}, LabelSelector.prototype.each = function(a) {
angular.forEach(this._conjuncts, a);
}, LabelSelector.prototype.select = function(a) {
var b = {}, c = this;
return angular.forEach(a, function(a, d) {
c.matches(a) && (b[d] = a);
}), b;
return _.isArray(a) ? _.filter(a, this.matches, this) :_.pick(a, this.matches, this);
}, LabelSelector.prototype.matches = function(a) {
if (!a) return !1;
if (this.isEmpty()) return this._emptySelectsAll;
Expand Down

0 comments on commit 143a0ff

Please sign in to comment.