Skip to content

Commit 27ddc69

Browse files
disambiguate kinds on other resources by showing group
1 parent 521e60a commit 27ddc69

File tree

5 files changed

+31
-5
lines changed

5 files changed

+31
-5
lines changed

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

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

60+
var countKinds = function() {
61+
return _.countBy($scope.kinds, function(kind) {
62+
return kind.kind;
63+
});
64+
};
65+
66+
var counts;
67+
$scope.isDuplicateKind = function(kind) {
68+
if(!counts) {
69+
counts = countKinds();
70+
}
71+
return counts[kind] > 1;
72+
};
73+
6074
// get and clear any alerts
6175
AlertMessageService.getAlerts().forEach(function(alert) {
6276
$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

+12-4
Original file line numberDiff line numberDiff line change
@@ -7478,10 +7478,18 @@ projectName:a.project,
74787478
kind:b,
74797479
group:_.get(c, "kindSelector.selected.group", "")
74807480
}).toString() :"";
7481+
};
7482+
var n, o = function() {
7483+
return _.countBy(c.kinds, function(a) {
7484+
return a.kind;
7485+
});
7486+
};
7487+
c.isDuplicateKind = function(a) {
7488+
return n || (n = o()), n[a] > 1;
74817489
}, d.getAlerts().forEach(function(a) {
74827490
c.alerts[a.name] = a.data;
74837491
}), d.clearAlerts();
7484-
var n = function(a, b) {
7492+
var p = function(a, b) {
74857493
return _.some(c.kinds, function(c) {
74867494
return c.kind === a && (!c.group && !b || c.group === b);
74877495
});
@@ -7493,13 +7501,13 @@ resource:k.kindToResource(a.kind),
74937501
group:a.group || ""
74947502
};
74957503
return !!e.checkResource(b.resource) && e.canI(b, "list", c.projectName);
7496-
}), 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 || ""));
7504+
}), c.project = b, c.context = d, c.kindSelector.disabled = !1, a.kind && p(a.kind, a.group) && (_.set(c, "kindSelector.selected.kind", a.kind), _.set(c, "kindSelector.selected.group", a.group || ""));
74977505
})), c.loadKind = m, c.$watch("kindSelector.selected", function() {
74987506
c.alerts = {}, m();
74997507
});
7500-
var o = h("humanizeKind");
7508+
var q = h("humanizeKind");
75017509
c.matchKind = function(a, b) {
7502-
return o(a).toLowerCase().indexOf(b.toLowerCase()) !== -1;
7510+
return q(a).toLowerCase().indexOf(b.toLowerCase()) !== -1;
75037511
}, i.onActiveFiltersChanged(function(a) {
75047512
c.$apply(function() {
75057513
c.resources = a.select(c.unfilteredResources), l();

Diff for: dist/scripts/templates.js

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

Diff for: dist/scripts/vendor.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -60806,7 +60806,9 @@ var b = "<none>", c = "<none>";
6080660806
return a && a.kind && (b = a.kind), a && a.apiVersion && (c = a.apiVersion), "The API version " + c + " for kind " + b + " is not supported by this server";
6080760807
}, t = function(c) {
6080860808
var e = [], f = d.AVAILABLE_KINDS_BLACKLIST;
60809-
return _.each(a, function(a) {
60809+
return _.each(_.pick(a, function(a, b) {
60810+
return "openshift" !== b;
60811+
}), function(a) {
6081060812
_.each(a.resources.v1, function(a) {
6081160813
if (a.namespaced || c) {
6081260814
if (a.name.indexOf("/") >= 0 || _.contains(f, a.kind)) return;

0 commit comments

Comments
 (0)