Skip to content

Commit 6bc131a

Browse files
author
OpenShift Bot
authored
Merge pull request #1478 from benjaminapetersen/dedupe-other-resources
Merged by openshift-bot
2 parents 900019b + 1a4c66b commit 6bc131a

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

Diff for: app/scripts/controllers/otherResources.js

+8
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ angular.module('openshiftConsole')
5757
}).toString();
5858
};
5959

60+
var counts;
61+
$scope.isDuplicateKind = function(kind) {
62+
if(!counts) {
63+
counts = _.countBy($scope.kinds, 'kind');
64+
}
65+
return counts[kind] > 1;
66+
};
67+
6068
// get and clear any alerts
6169
AlertMessageService.getAlerts().forEach(function(alert) {
6270
$scope.alerts[alert.name] = alert.data;

Diff for: app/views/other-resources.html

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ <h1>Other Resources</h1>
1414
<ui-select-match placeholder="Choose a resource to list...">{{$select.selected.kind | humanizeKind : true}}</ui-select-match>
1515
<ui-select-choices repeat="kind in kinds | filter : {kind: $select.search} : matchKind | orderBy : 'kind'">
1616
<div ng-bind-html="(kind.kind | humanizeKind : true) | highlight: $select.search"></div>
17+
<small ng-if="isDuplicateKind(kind.kind)" ng-bind-html="kind.group | highlight: $select.search" class="text-muted"></small>
1718
</ui-select-choices>
1819
</ui-select>
1920
<div class="vertical-divider"></div>

Diff for: dist/scripts/scripts.js

+8-4
Original file line numberDiff line numberDiff line change
@@ -7542,10 +7542,14 @@ projectName:a.project,
75427542
kind:b,
75437543
group:_.get(c, "kindSelector.selected.group", "")
75447544
}).toString() :"";
7545+
};
7546+
var n;
7547+
c.isDuplicateKind = function(a) {
7548+
return n || (n = _.countBy(c.kinds, "kind")), n[a] > 1;
75457549
}, d.getAlerts().forEach(function(a) {
75467550
c.alerts[a.name] = a.data;
75477551
}), d.clearAlerts();
7548-
var n = function(a, b) {
7552+
var o = function(a, b) {
75497553
return _.some(c.kinds, function(c) {
75507554
return c.kind === a && (!c.group && !b || c.group === b);
75517555
});
@@ -7557,13 +7561,13 @@ resource:k.kindToResource(a.kind),
75577561
group:a.group || ""
75587562
};
75597563
return !!e.checkResource(b.resource) && e.canI(b, "list", c.projectName);
7560-
}), c.project = b, c.context = d, c.kindSelector.disabled = !1, a.kind && n(a.kind, a.group) && (_.set(c, "kindSelector.selected.kind", a.kind), _.set(c, "kindSelector.selected.group", a.group || ""));
7564+
}), c.project = b, c.context = d, c.kindSelector.disabled = !1, a.kind && o(a.kind, a.group) && (_.set(c, "kindSelector.selected.kind", a.kind), _.set(c, "kindSelector.selected.group", a.group || ""));
75617565
})), c.loadKind = m, c.$watch("kindSelector.selected", function() {
75627566
c.alerts = {}, m();
75637567
});
7564-
var o = h("humanizeKind");
7568+
var p = h("humanizeKind");
75657569
c.matchKind = function(a, b) {
7566-
return o(a).toLowerCase().indexOf(b.toLowerCase()) !== -1;
7570+
return p(a).toLowerCase().indexOf(b.toLowerCase()) !== -1;
75677571
}, i.onActiveFiltersChanged(function(a) {
75687572
c.$apply(function() {
75697573
c.resources = a.select(c.unfilteredResources), l();

Diff for: dist/scripts/templates.js

+1
Original file line numberDiff line numberDiff line change
@@ -11744,6 +11744,7 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function(
1174411744
"<ui-select-match placeholder=\"Choose a resource to list...\">{{$select.selected.kind | humanizeKind : true}}</ui-select-match>\n" +
1174511745
"<ui-select-choices repeat=\"kind in kinds | filter : {kind: $select.search} : matchKind | orderBy : 'kind'\">\n" +
1174611746
"<div ng-bind-html=\"(kind.kind | humanizeKind : true) | highlight: $select.search\"></div>\n" +
11747+
"<small ng-if=\"isDuplicateKind(kind.kind)\" ng-bind-html=\"kind.group | highlight: $select.search\" class=\"text-muted\"></small>\n" +
1174711748
"</ui-select-choices>\n" +
1174811749
"</ui-select>\n" +
1174911750
"<div class=\"vertical-divider\"></div>\n" +

0 commit comments

Comments
 (0)