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
2a98c3d5
Commit
2a98c3d5
authored
Sep 18, 2017
by
Sam Padgett
Committed by
GitHub
Sep 18, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #189 from spadgett/standalone-rc-rs
Use label selectors in ApplicationsService
parents
83d3897e
0efa77bb
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
137 additions
and
23 deletions
+137
-23
origin-web-common-services.js
dist/origin-web-common-services.js
+37
-5
origin-web-common.js
dist/origin-web-common.js
+37
-5
origin-web-common.min.js
dist/origin-web-common.min.js
+26
-8
applicationsService.js
src/services/applicationsService.js
+37
-5
No files found.
dist/origin-web-common-services.js
View file @
2a98c3d5
...
...
@@ -555,7 +555,37 @@ angular.module('openshiftCommonServices')
;
'use strict'
;
angular
.
module
(
"openshiftCommonServices"
).
service
(
"ApplicationsService"
,
function
(
$filter
,
$q
,
DataService
)
{
service
(
"ApplicationsService"
,
function
(
$q
,
DataService
)
{
// List replication controllers in a namespace that are NOT managed by a
// deployment config. Note: This will not return replication controllers that
// have been orphaned by `oc delete dc/foo --cascade=false`.
var
listStandaloneReplicationControllers
=
function
(
context
)
{
return
DataService
.
list
(
'replicationcontrollers'
,
context
,
{
http
:
{
params
:
{
// If the replica set has a `openshift.io/deployment-config-name`
// label, it's managed by a deployment config.
labelSelector
:
"!openshift.io/deployment-config-name"
}
}
});
};
// List replica sets in a namespace that are NOT managed by a deployment.
// Note: This will not return replica sets that have been orphaned by
// `oc delete deployment/foo --cascade=false`.
var
listStandaloneReplicaSets
=
function
(
context
)
{
return
DataService
.
list
({
group
:
'extensions'
,
resource
:
'replicasets'
},
context
,
{
http
:
{
params
:
{
// If the replica set has a `pod-template-hash` label, it's managed
// by a deployment.
labelSelector
:
"!pod-template-hash"
}
}
});
};
var
getApplications
=
function
(
context
)
{
var
deferred
=
$q
.
defer
();
...
...
@@ -563,16 +593,16 @@ service("ApplicationsService", function($filter, $q, DataService) {
// Load all the "application" types
promises
.
push
(
DataService
.
list
(
'deploymentconfigs'
,
context
));
promises
.
push
(
DataService
.
list
(
'replicationcontrollers'
,
context
));
promises
.
push
(
listStandaloneReplicationControllers
(
context
));
promises
.
push
(
DataService
.
list
({
group
:
'apps'
,
resource
:
'deployments'
},
context
));
promises
.
push
(
DataService
.
list
({
group
:
'extensions'
,
resource
:
'replicasets'
},
context
));
promises
.
push
(
listStandaloneReplicaSets
(
context
));
promises
.
push
(
DataService
.
list
({
group
:
'apps'
,
resource
:
'statefulsets'
},
context
));
$q
.
all
(
promises
).
then
(
_
.
spread
(
function
(
deploymentConfigData
,
replicationControllerData
,
deploymentData
,
replicaSetData
,
statefulSetData
)
{
var
deploymentConfigs
=
_
.
toArray
(
deploymentConfigData
.
by
(
'metadata.name'
));
var
replicationControllers
=
_
.
reject
(
replicationControllerData
.
by
(
'metadata.name'
),
$filter
(
'hasDeploymentConfig
'
));
var
replicationControllers
=
_
.
toArray
(
replicationControllerData
.
by
(
'metadata.name
'
));
var
deployments
=
_
.
toArray
(
deploymentData
.
by
(
'metadata.name'
));
var
replicaSets
=
_
.
reject
(
replicaSetData
.
by
(
'metadata.name'
),
$filter
(
'hasDeployment
'
));
var
replicaSets
=
_
.
toArray
(
replicaSetData
.
by
(
'metadata.name
'
));
var
statefulSets
=
_
.
toArray
(
statefulSetData
.
by
(
'metadata.name'
));
var
apiObjects
=
deploymentConfigs
.
concat
(
deployments
)
...
...
@@ -588,6 +618,8 @@ service("ApplicationsService", function($filter, $q, DataService) {
};
return
{
listStandaloneReplicationControllers
:
listStandaloneReplicationControllers
,
listStandaloneReplicaSets
:
listStandaloneReplicaSets
,
getApplications
:
getApplications
};
});
...
...
dist/origin-web-common.js
View file @
2a98c3d5
...
...
@@ -2440,7 +2440,37 @@ angular.module('openshiftCommonServices')
;
'use strict'
;
angular
.
module
(
"openshiftCommonServices"
).
service
(
"ApplicationsService"
,
[
"$filter"
,
"$q"
,
"DataService"
,
function
(
$filter
,
$q
,
DataService
)
{
service
(
"ApplicationsService"
,
[
"$q"
,
"DataService"
,
function
(
$q
,
DataService
)
{
// List replication controllers in a namespace that are NOT managed by a
// deployment config. Note: This will not return replication controllers that
// have been orphaned by `oc delete dc/foo --cascade=false`.
var
listStandaloneReplicationControllers
=
function
(
context
)
{
return
DataService
.
list
(
'replicationcontrollers'
,
context
,
{
http
:
{
params
:
{
// If the replica set has a `openshift.io/deployment-config-name`
// label, it's managed by a deployment config.
labelSelector
:
"!openshift.io/deployment-config-name"
}
}
});
};
// List replica sets in a namespace that are NOT managed by a deployment.
// Note: This will not return replica sets that have been orphaned by
// `oc delete deployment/foo --cascade=false`.
var
listStandaloneReplicaSets
=
function
(
context
)
{
return
DataService
.
list
({
group
:
'extensions'
,
resource
:
'replicasets'
},
context
,
{
http
:
{
params
:
{
// If the replica set has a `pod-template-hash` label, it's managed
// by a deployment.
labelSelector
:
"!pod-template-hash"
}
}
});
};
var
getApplications
=
function
(
context
)
{
var
deferred
=
$q
.
defer
();
...
...
@@ -2448,16 +2478,16 @@ service("ApplicationsService", ["$filter", "$q", "DataService", function($filter
// Load all the "application" types
promises
.
push
(
DataService
.
list
(
'deploymentconfigs'
,
context
));
promises
.
push
(
DataService
.
list
(
'replicationcontrollers'
,
context
));
promises
.
push
(
listStandaloneReplicationControllers
(
context
));
promises
.
push
(
DataService
.
list
({
group
:
'apps'
,
resource
:
'deployments'
},
context
));
promises
.
push
(
DataService
.
list
({
group
:
'extensions'
,
resource
:
'replicasets'
},
context
));
promises
.
push
(
listStandaloneReplicaSets
(
context
));
promises
.
push
(
DataService
.
list
({
group
:
'apps'
,
resource
:
'statefulsets'
},
context
));
$q
.
all
(
promises
).
then
(
_
.
spread
(
function
(
deploymentConfigData
,
replicationControllerData
,
deploymentData
,
replicaSetData
,
statefulSetData
)
{
var
deploymentConfigs
=
_
.
toArray
(
deploymentConfigData
.
by
(
'metadata.name'
));
var
replicationControllers
=
_
.
reject
(
replicationControllerData
.
by
(
'metadata.name'
),
$filter
(
'hasDeploymentConfig
'
));
var
replicationControllers
=
_
.
toArray
(
replicationControllerData
.
by
(
'metadata.name
'
));
var
deployments
=
_
.
toArray
(
deploymentData
.
by
(
'metadata.name'
));
var
replicaSets
=
_
.
reject
(
replicaSetData
.
by
(
'metadata.name'
),
$filter
(
'hasDeployment
'
));
var
replicaSets
=
_
.
toArray
(
replicaSetData
.
by
(
'metadata.name
'
));
var
statefulSets
=
_
.
toArray
(
statefulSetData
.
by
(
'metadata.name'
));
var
apiObjects
=
deploymentConfigs
.
concat
(
deployments
)
...
...
@@ -2473,6 +2503,8 @@ service("ApplicationsService", ["$filter", "$q", "DataService", function($filter
};
return
{
listStandaloneReplicationControllers
:
listStandaloneReplicationControllers
,
listStandaloneReplicaSets
:
listStandaloneReplicaSets
,
getApplications
:
getApplications
};
}]);
...
...
dist/origin-web-common.min.js
View file @
2a98c3d5
...
...
@@ -960,26 +960,44 @@ invalidObjectKindOrVersion:invalidObjectKindOrVersion,
unsupportedObjectKindOrVersion
:
unsupportedObjectKindOrVersion
,
availableKinds
:
availableKinds
};
}
]),
angular
.
module
(
"openshiftCommonServices"
).
service
(
"ApplicationsService"
,
[
"$filter"
,
"$q"
,
"DataService"
,
function
(
$filter
,
$q
,
DataService
)
{
var
getApplications
=
function
(
context
)
{
}
]),
angular
.
module
(
"openshiftCommonServices"
).
service
(
"ApplicationsService"
,
[
"$q"
,
"DataService"
,
function
(
$q
,
DataService
)
{
var
listStandaloneReplicationControllers
=
function
(
context
)
{
return
DataService
.
list
(
"replicationcontrollers"
,
context
,
{
http
:{
params
:{
labelSelector
:
"!openshift.io/deployment-config-name"
}
}
});
},
listStandaloneReplicaSets
=
function
(
context
)
{
return
DataService
.
list
({
group
:
"extensions"
,
resource
:
"replicasets"
},
context
,
{
http
:{
params
:{
labelSelector
:
"!pod-template-hash"
}
}
});
},
getApplications
=
function
(
context
)
{
var
deferred
=
$q
.
defer
(),
promises
=
[];
return
promises
.
push
(
DataService
.
list
(
"deploymentconfigs"
,
context
)),
promises
.
push
(
DataService
.
list
(
"replicationcontrollers"
,
context
)),
promises
.
push
(
DataService
.
list
({
return
promises
.
push
(
DataService
.
list
(
"deploymentconfigs"
,
context
)),
promises
.
push
(
listStandaloneReplicationControllers
(
context
)),
promises
.
push
(
DataService
.
list
({
group
:
"apps"
,
resource
:
"deployments"
},
context
)),
promises
.
push
(
DataService
.
list
({
group
:
"extensions"
,
resource
:
"replicasets"
},
context
)),
promises
.
push
(
DataService
.
list
({
},
context
)),
promises
.
push
(
listStandaloneReplicaSets
(
context
)),
promises
.
push
(
DataService
.
list
({
group
:
"apps"
,
resource
:
"statefulsets"
},
context
)),
$q
.
all
(
promises
).
then
(
_
.
spread
(
function
(
deploymentConfigData
,
replicationControllerData
,
deploymentData
,
replicaSetData
,
statefulSetData
)
{
var
deploymentConfigs
=
_
.
toArray
(
deploymentConfigData
.
by
(
"metadata.name"
)),
replicationControllers
=
_
.
reject
(
replicationControllerData
.
by
(
"metadata.name"
),
$filter
(
"hasDeploymentConfig"
)),
deployments
=
_
.
toArray
(
deploymentData
.
by
(
"metadata.name"
)),
replicaSets
=
_
.
reject
(
replicaSetData
.
by
(
"metadata.name"
),
$filter
(
"hasDeployment
"
)),
statefulSets
=
_
.
toArray
(
statefulSetData
.
by
(
"metadata.name"
)),
apiObjects
=
deploymentConfigs
.
concat
(
deployments
).
concat
(
replicationControllers
).
concat
(
replicaSets
).
concat
(
statefulSets
);
var
deploymentConfigs
=
_
.
toArray
(
deploymentConfigData
.
by
(
"metadata.name"
)),
replicationControllers
=
_
.
toArray
(
replicationControllerData
.
by
(
"metadata.name"
)),
deployments
=
_
.
toArray
(
deploymentData
.
by
(
"metadata.name"
)),
replicaSets
=
_
.
toArray
(
replicaSetData
.
by
(
"metadata.name
"
)),
statefulSets
=
_
.
toArray
(
statefulSetData
.
by
(
"metadata.name"
)),
apiObjects
=
deploymentConfigs
.
concat
(
deployments
).
concat
(
replicationControllers
).
concat
(
replicaSets
).
concat
(
statefulSets
);
deferred
.
resolve
(
_
.
sortBy
(
apiObjects
,
[
"metadata.name"
,
"kind"
]));
}),
function
(
e
)
{
deferred
.
reject
(
e
);
}),
deferred
.
promise
;
};
return
{
listStandaloneReplicationControllers
:
listStandaloneReplicationControllers
,
listStandaloneReplicaSets
:
listStandaloneReplicaSets
,
getApplications
:
getApplications
};
}
]),
angular
.
module
(
"openshiftCommonServices"
).
provider
(
"AuthService"
,
function
()
{
...
...
src/services/applicationsService.js
View file @
2a98c3d5
'use strict'
;
angular
.
module
(
"openshiftCommonServices"
).
service
(
"ApplicationsService"
,
function
(
$filter
,
$q
,
DataService
)
{
service
(
"ApplicationsService"
,
function
(
$q
,
DataService
)
{
// List replication controllers in a namespace that are NOT managed by a
// deployment config. Note: This will not return replication controllers that
// have been orphaned by `oc delete dc/foo --cascade=false`.
var
listStandaloneReplicationControllers
=
function
(
context
)
{
return
DataService
.
list
(
'replicationcontrollers'
,
context
,
{
http
:
{
params
:
{
// If the replica set has a `openshift.io/deployment-config-name`
// label, it's managed by a deployment config.
labelSelector
:
"!openshift.io/deployment-config-name"
}
}
});
};
// List replica sets in a namespace that are NOT managed by a deployment.
// Note: This will not return replica sets that have been orphaned by
// `oc delete deployment/foo --cascade=false`.
var
listStandaloneReplicaSets
=
function
(
context
)
{
return
DataService
.
list
({
group
:
'extensions'
,
resource
:
'replicasets'
},
context
,
{
http
:
{
params
:
{
// If the replica set has a `pod-template-hash` label, it's managed
// by a deployment.
labelSelector
:
"!pod-template-hash"
}
}
});
};
var
getApplications
=
function
(
context
)
{
var
deferred
=
$q
.
defer
();
...
...
@@ -9,16 +39,16 @@ service("ApplicationsService", function($filter, $q, DataService) {
// Load all the "application" types
promises
.
push
(
DataService
.
list
(
'deploymentconfigs'
,
context
));
promises
.
push
(
DataService
.
list
(
'replicationcontrollers'
,
context
));
promises
.
push
(
listStandaloneReplicationControllers
(
context
));
promises
.
push
(
DataService
.
list
({
group
:
'apps'
,
resource
:
'deployments'
},
context
));
promises
.
push
(
DataService
.
list
({
group
:
'extensions'
,
resource
:
'replicasets'
},
context
));
promises
.
push
(
listStandaloneReplicaSets
(
context
));
promises
.
push
(
DataService
.
list
({
group
:
'apps'
,
resource
:
'statefulsets'
},
context
));
$q
.
all
(
promises
).
then
(
_
.
spread
(
function
(
deploymentConfigData
,
replicationControllerData
,
deploymentData
,
replicaSetData
,
statefulSetData
)
{
var
deploymentConfigs
=
_
.
toArray
(
deploymentConfigData
.
by
(
'metadata.name'
));
var
replicationControllers
=
_
.
reject
(
replicationControllerData
.
by
(
'metadata.name'
),
$filter
(
'hasDeploymentConfig
'
));
var
replicationControllers
=
_
.
toArray
(
replicationControllerData
.
by
(
'metadata.name
'
));
var
deployments
=
_
.
toArray
(
deploymentData
.
by
(
'metadata.name'
));
var
replicaSets
=
_
.
reject
(
replicaSetData
.
by
(
'metadata.name'
),
$filter
(
'hasDeployment
'
));
var
replicaSets
=
_
.
toArray
(
replicaSetData
.
by
(
'metadata.name
'
));
var
statefulSets
=
_
.
toArray
(
statefulSetData
.
by
(
'metadata.name'
));
var
apiObjects
=
deploymentConfigs
.
concat
(
deployments
)
...
...
@@ -34,6 +64,8 @@ service("ApplicationsService", function($filter, $q, DataService) {
};
return
{
listStandaloneReplicationControllers
:
listStandaloneReplicationControllers
,
listStandaloneReplicaSets
:
listStandaloneReplicaSets
,
getApplications
:
getApplications
};
});
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