Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
origin-web-common
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Java-于龙
origin-web-common
Commits
176923e3
Commit
176923e3
authored
Jun 01, 2017
by
benjaminapetersen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove kind:jobs, group: batch from internal filter in APIService.calculateAvailableKinds()
parent
9137df07
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
13 deletions
+23
-13
origin-web-common-services.js
dist/origin-web-common-services.js
+1
-3
origin-web-common.js
dist/origin-web-common.js
+1
-3
origin-web-common.min.js
dist/origin-web-common.min.js
+1
-1
apiService.js
src/services/apiService.js
+1
-3
apiServiceSpec.js
test/spec/services/apiServiceSpec.js
+19
-3
No files found.
dist/origin-web-common-services.js
View file @
176923e3
...
...
@@ -518,9 +518,7 @@ angular.module('openshiftCommonServices')
// Exclude duplicate kinds we know about that map to the same storage as another group/kind
// This is unusual, so we are special casing these
if
(
group
.
name
===
"extensions"
&&
resource
.
kind
===
"HorizontalPodAutoscaler"
||
group
.
name
===
"batch"
&&
resource
.
kind
===
"Job"
)
{
if
(
group
.
name
===
"extensions"
&&
resource
.
kind
===
"HorizontalPodAutoscaler"
)
{
return
;
}
...
...
dist/origin-web-common.js
View file @
176923e3
...
...
@@ -2125,9 +2125,7 @@ angular.module('openshiftCommonServices')
// Exclude duplicate kinds we know about that map to the same storage as another group/kind
// This is unusual, so we are special casing these
if
(
group
.
name
===
"extensions"
&&
resource
.
kind
===
"HorizontalPodAutoscaler"
||
group
.
name
===
"batch"
&&
resource
.
kind
===
"Job"
)
{
if
(
group
.
name
===
"extensions"
&&
resource
.
kind
===
"HorizontalPodAutoscaler"
)
{
return
;
}
...
...
dist/origin-web-common.min.js
View file @
176923e3
...
...
@@ -844,7 +844,7 @@ _.each(group.versions[preferredVersion].resources, function(resource) {
_
.
contains
(
resource
.
name
,
"/"
)
||
_
.
find
(
rejectedKinds
,
{
kind
:
resource
.
kind
,
group
:
group
.
name
})
||
"extensions"
===
group
.
name
&&
"HorizontalPodAutoscaler"
===
resource
.
kind
||
"batch"
===
group
.
name
&&
"Job"
===
resource
.
kind
||
(
resource
.
namespaced
||
includeClusterScoped
)
&&
kinds
.
push
({
})
||
(
"extensions"
!==
group
.
name
||
"HorizontalPodAutoscaler"
!==
resource
.
kind
)
&&
(
resource
.
namespaced
||
includeClusterScoped
)
&&
kinds
.
push
({
kind
:
resource
.
kind
,
group
:
group
.
name
});
...
...
src/services/apiService.js
View file @
176923e3
...
...
@@ -315,9 +315,7 @@ angular.module('openshiftCommonServices')
// Exclude duplicate kinds we know about that map to the same storage as another group/kind
// This is unusual, so we are special casing these
if
(
group
.
name
===
"extensions"
&&
resource
.
kind
===
"HorizontalPodAutoscaler"
||
group
.
name
===
"batch"
&&
resource
.
kind
===
"Job"
)
{
if
(
group
.
name
===
"extensions"
&&
resource
.
kind
===
"HorizontalPodAutoscaler"
)
{
return
;
}
...
...
test/spec/services/apiServiceSpec.js
View file @
176923e3
...
...
@@ -309,15 +309,15 @@ describe("APIService", function() {
describe
(
'#availableKinds'
,
function
()
{
var
bothSample
=
[
'Binding'
,
'ConfigMap'
,
'DeploymentConfig'
,
'Event'
,
'LimitRange'
,
'Pod'
,
'ReplicaSet'
,
'Role'
,
'Service'
,
'Template'
];
var
bothSample
=
[
'Binding'
,
'ConfigMap'
,
'DeploymentConfig'
,
'Event'
,
'LimitRange'
,
'Pod'
,
'ReplicaSet'
,
'Role'
,
'Service'
,
'Template'
,
'Job'
];
var
onlyClusterSample
=
[
'ClusterResourceQuota'
,
'Namespace'
,
'OAuthAccessToken'
,
'PersistentVolume'
,
'ProjectRequest'
,
'User'
];
it
(
'should return list of kinds that are scoped to a namespace by default'
,
function
()
{
it
(
'should return
a
list of kinds that are scoped to a namespace by default'
,
function
()
{
var
namespacedKinds
=
_
.
map
(
APIService
.
availableKinds
(),
'kind'
);
expect
(
_
.
difference
(
bothSample
,
namespacedKinds
).
length
).
toEqual
(
0
);
});
it
(
'should not return
list
cluster scoped kinds by default'
,
function
()
{
it
(
'should not return
a list of
cluster scoped kinds by default'
,
function
()
{
var
namespacedKinds
=
_
.
map
(
APIService
.
availableKinds
(),
'kind'
);
expect
(
_
.
difference
(
onlyClusterSample
,
namespacedKinds
).
length
).
toEqual
(
onlyClusterSample
.
length
);
});
...
...
@@ -328,6 +328,7 @@ describe("APIService", function() {
expect
(
_
.
difference
(
onlyClusterSample
,
allKinds
).
length
).
toEqual
(
0
);
});
// kinds from the old /oapi should not be iterated at all.
it
(
'should not list kinds from the old /oapi namespace (that do not have a group)'
,
function
()
{
var
allKinds
=
APIService
.
availableKinds
(
true
);
...
...
@@ -393,6 +394,21 @@ describe("APIService", function() {
});
});
// this tests a hard-coded filter list within calculateAvailableKinds
it
(
'should not return duplicate kinds that map to the same storage as another group/kind'
,
function
()
{
var
allKinds
=
APIService
.
availableKinds
(
true
);
var
kindsToExclude
=
[{
kind
:
'HorizontalPodAutoscaler'
,
group
:
'extensions'
}];
// the same as above, but in the correct group, validating that we do still list these kinds
var
matchingKindsToInclude
=
[{
kind
:
'HorizontalPodAutoscaler'
,
group
:
'autoscaling'
}];
_
.
each
(
kindsToExclude
,
function
(
kind
)
{
expect
(
_
.
find
(
allKinds
,
kind
)).
toEqual
(
undefined
);
});
_
.
each
(
matchingKindsToInclude
,
function
(
kind
)
{
expect
(
_
.
find
(
allKinds
,
kind
)).
toEqual
(
kind
);
});
});
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment