Skip to content

Commit fd83d82

Browse files
Add logic to dedupe kinds by ignoring "openshift" namespace in APIService.calculateAvailableKinds()
1 parent bd07787 commit fd83d82

File tree

7 files changed

+1467
-588
lines changed

7 files changed

+1467
-588
lines changed

dist/origin-web-common-services.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -471,8 +471,10 @@ angular.module('openshiftCommonServices')
471471
var kinds = [];
472472
var rejectedKinds = Constants.AVAILABLE_KINDS_BLACKLIST;
473473

474-
// Legacy openshift and k8s kinds
475-
_.each(API_CFG, function(api) {
474+
// ignore the legacy openshift kinds, these have been migrated to api groups
475+
_.each(_.pick(API_CFG, function(value, key) {
476+
return key !== 'openshift';
477+
}), function(api) {
476478
_.each(api.resources.v1, function(resource) {
477479
if (resource.namespaced || includeClusterScoped) {
478480
// Exclude subresources and any rejected kinds

dist/origin-web-common.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -1817,8 +1817,10 @@ angular.module('openshiftCommonServices')
18171817
var kinds = [];
18181818
var rejectedKinds = Constants.AVAILABLE_KINDS_BLACKLIST;
18191819

1820-
// Legacy openshift and k8s kinds
1821-
_.each(API_CFG, function(api) {
1820+
// ignore the legacy openshift kinds, these have been migrated to api groups
1821+
_.each(_.pick(API_CFG, function(value, key) {
1822+
return key !== 'openshift';
1823+
}), function(api) {
18221824
_.each(api.resources.v1, function(resource) {
18231825
if (resource.namespaced || includeClusterScoped) {
18241826
// Exclude subresources and any rejected kinds

dist/origin-web-common.min.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,9 @@ var kind = "<none>", version = "<none>";
741741
return apiObject && apiObject.kind && (kind = apiObject.kind), apiObject && apiObject.apiVersion && (version = apiObject.apiVersion), "The API version " + version + " for kind " + kind + " is not supported by this server";
742742
}, calculateAvailableKinds = function(includeClusterScoped) {
743743
var kinds = [], rejectedKinds = Constants.AVAILABLE_KINDS_BLACKLIST;
744-
return _.each(API_CFG, function(api) {
744+
return _.each(_.pick(API_CFG, function(value, key) {
745+
return "openshift" !== key;
746+
}), function(api) {
745747
_.each(api.resources.v1, function(resource) {
746748
if (resource.namespaced || includeClusterScoped) {
747749
if (resource.name.indexOf("/") >= 0 || _.contains(rejectedKinds, resource.kind)) return;

src/services/apiService.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,10 @@ angular.module('openshiftCommonServices')
268268
var kinds = [];
269269
var rejectedKinds = Constants.AVAILABLE_KINDS_BLACKLIST;
270270

271-
// Legacy openshift and k8s kinds
272-
_.each(API_CFG, function(api) {
271+
// ignore the legacy openshift kinds, these have been migrated to api groups
272+
_.each(_.pick(API_CFG, function(value, key) {
273+
return key !== 'openshift';
274+
}), function(api) {
273275
_.each(api.resources.v1, function(resource) {
274276
if (resource.namespaced || includeClusterScoped) {
275277
// Exclude subresources and any rejected kinds

test/.jshintrc

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"node": true,
3+
"browser": true,
4+
"esversion": 6,
5+
"bitwise": true,
6+
"camelcase": false,
7+
"curly": true,
8+
"eqeqeq": true,
9+
"immed": true,
10+
"indent": 2,
11+
"latedef": true,
12+
"newcap": false,
13+
"noarg": true,
14+
"quotmark": false,
15+
"regexp": true,
16+
"smarttabs": true,
17+
"strict": true,
18+
"sub" : true,
19+
"undef": true,
20+
"unused": true,
21+
"expr" : true,
22+
"globals": {
23+
"ace": false,
24+
"after": false,
25+
"afterEach": false,
26+
"afterAll": false,
27+
"angular": false,
28+
"by": false,
29+
"before": false,
30+
"beforeAll": false,
31+
"beforeEach": false,
32+
"browser": false,
33+
"describe": false,
34+
"element" : false,
35+
"expect": false,
36+
"inject": false,
37+
"it": false,
38+
"xit": false,
39+
"jasmine": false,
40+
"spyOn": false,
41+
"hawtioPluginLoader": false,
42+
"HawtioCore": false,
43+
"Logger" : false,
44+
"LabelSelector": false,
45+
"moment": false,
46+
"Messenger" : false,
47+
"protractor" : false,
48+
"URI": false,
49+
"ZeroClipboard": false,
50+
"$": false,
51+
"_" : false
52+
53+
}
54+
}

0 commit comments

Comments
 (0)