Commit 8f48a964 by Samuel Padgett

Fix label selector for ApplicationsService

* Fix DataService so that it honors labelSelector on list
* Fix ApplicationsService to use the correct label selector
  for replicationcontrollers
parent 61adf8d0
...@@ -574,12 +574,12 @@ service("ApplicationsService", function($q, DataService) { ...@@ -574,12 +574,12 @@ service("ApplicationsService", function($q, DataService) {
// deployment config. Note: This will not return replication controllers that // deployment config. Note: This will not return replication controllers that
// have been orphaned by `oc delete dc/foo --cascade=false`. // have been orphaned by `oc delete dc/foo --cascade=false`.
var listStandaloneReplicationControllers = function(context) { var listStandaloneReplicationControllers = function(context) {
return DataService.list('replicationcontrollers', context, { return DataService.list('replicationcontrollers', context, null, {
http: { http: {
params: { params: {
// If the replica set has a `openshift.io/deployment-config-name` // If the replica set has a `openshift.io/deployment-config-name`
// label, it's managed by a deployment config. // label, it's managed by a deployment config.
labelSelector: "!openshift.io/deployment-config-name" labelSelector: "!openshift.io/deployment-config.name"
} }
} }
}); });
...@@ -589,7 +589,7 @@ service("ApplicationsService", function($q, DataService) { ...@@ -589,7 +589,7 @@ service("ApplicationsService", function($q, DataService) {
// Note: This will not return replica sets that have been orphaned by // Note: This will not return replica sets that have been orphaned by
// `oc delete deployment/foo --cascade=false`. // `oc delete deployment/foo --cascade=false`.
var listStandaloneReplicaSets = function(context) { var listStandaloneReplicaSets = function(context) {
return DataService.list({group: 'extensions', resource: 'replicasets'}, context, { return DataService.list({group: 'extensions', resource: 'replicasets'}, context, null, {
http: { http: {
params: { params: {
// If the replica set has a `pod-template-hash` label, it's managed // If the replica set has a `pod-template-hash` label, it's managed
...@@ -2343,6 +2343,7 @@ DataService.prototype.createStream = function(resource, name, context, opts, isR ...@@ -2343,6 +2343,7 @@ DataService.prototype.createStream = function(resource, name, context, opts, isR
DataService.prototype._startListOp = function(resource, context, opts) { DataService.prototype._startListOp = function(resource, context, opts) {
opts = opts || {}; opts = opts || {};
var params = _.get(opts, 'http.params') || {};
var key = this._uniqueKey(resource, null, context, opts); var key = this._uniqueKey(resource, null, context, opts);
// mark the operation as in progress // mark the operation as in progress
this._listInFlight(key, true); this._listInFlight(key, true);
...@@ -2359,7 +2360,7 @@ DataService.prototype.createStream = function(resource, name, context, opts, isR ...@@ -2359,7 +2360,7 @@ DataService.prototype.createStream = function(resource, name, context, opts, isR
method: 'GET', method: 'GET',
auth: {}, auth: {},
headers: headers, headers: headers,
url: self._urlForResource(resource, null, context, false, {namespace: project.metadata.name}) url: self._urlForResource(resource, null, context, false, _.assign({}, params, {namespace: project.metadata.name}))
}, opts.http || {})) }, opts.http || {}))
.success(function(data, status, headerFunc, config, statusText) { .success(function(data, status, headerFunc, config, statusText) {
self._listOpComplete(key, resource, context, opts, data); self._listOpComplete(key, resource, context, opts, data);
...@@ -2383,7 +2384,7 @@ DataService.prototype.createStream = function(resource, name, context, opts, isR ...@@ -2383,7 +2384,7 @@ DataService.prototype.createStream = function(resource, name, context, opts, isR
method: 'GET', method: 'GET',
auth: {}, auth: {},
headers: headers, headers: headers,
url: this._urlForResource(resource, null, context), url: this._urlForResource(resource, null, context, false, params),
}).success(function(data, status, headerFunc, config, statusText) { }).success(function(data, status, headerFunc, config, statusText) {
self._listOpComplete(key, resource, context, opts, data); self._listOpComplete(key, resource, context, opts, data);
}).error(function(data, status, headers, config) { }).error(function(data, status, headers, config) {
......
...@@ -2497,12 +2497,12 @@ service("ApplicationsService", ["$q", "DataService", function($q, DataService) { ...@@ -2497,12 +2497,12 @@ service("ApplicationsService", ["$q", "DataService", function($q, DataService) {
// deployment config. Note: This will not return replication controllers that // deployment config. Note: This will not return replication controllers that
// have been orphaned by `oc delete dc/foo --cascade=false`. // have been orphaned by `oc delete dc/foo --cascade=false`.
var listStandaloneReplicationControllers = function(context) { var listStandaloneReplicationControllers = function(context) {
return DataService.list('replicationcontrollers', context, { return DataService.list('replicationcontrollers', context, null, {
http: { http: {
params: { params: {
// If the replica set has a `openshift.io/deployment-config-name` // If the replica set has a `openshift.io/deployment-config-name`
// label, it's managed by a deployment config. // label, it's managed by a deployment config.
labelSelector: "!openshift.io/deployment-config-name" labelSelector: "!openshift.io/deployment-config.name"
} }
} }
}); });
...@@ -2512,7 +2512,7 @@ service("ApplicationsService", ["$q", "DataService", function($q, DataService) { ...@@ -2512,7 +2512,7 @@ service("ApplicationsService", ["$q", "DataService", function($q, DataService) {
// Note: This will not return replica sets that have been orphaned by // Note: This will not return replica sets that have been orphaned by
// `oc delete deployment/foo --cascade=false`. // `oc delete deployment/foo --cascade=false`.
var listStandaloneReplicaSets = function(context) { var listStandaloneReplicaSets = function(context) {
return DataService.list({group: 'extensions', resource: 'replicasets'}, context, { return DataService.list({group: 'extensions', resource: 'replicasets'}, context, null, {
http: { http: {
params: { params: {
// If the replica set has a `pod-template-hash` label, it's managed // If the replica set has a `pod-template-hash` label, it's managed
...@@ -4266,6 +4266,7 @@ DataService.prototype.createStream = function(resource, name, context, opts, isR ...@@ -4266,6 +4266,7 @@ DataService.prototype.createStream = function(resource, name, context, opts, isR
DataService.prototype._startListOp = function(resource, context, opts) { DataService.prototype._startListOp = function(resource, context, opts) {
opts = opts || {}; opts = opts || {};
var params = _.get(opts, 'http.params') || {};
var key = this._uniqueKey(resource, null, context, opts); var key = this._uniqueKey(resource, null, context, opts);
// mark the operation as in progress // mark the operation as in progress
this._listInFlight(key, true); this._listInFlight(key, true);
...@@ -4282,7 +4283,7 @@ DataService.prototype.createStream = function(resource, name, context, opts, isR ...@@ -4282,7 +4283,7 @@ DataService.prototype.createStream = function(resource, name, context, opts, isR
method: 'GET', method: 'GET',
auth: {}, auth: {},
headers: headers, headers: headers,
url: self._urlForResource(resource, null, context, false, {namespace: project.metadata.name}) url: self._urlForResource(resource, null, context, false, _.assign({}, params, {namespace: project.metadata.name}))
}, opts.http || {})) }, opts.http || {}))
.success(function(data, status, headerFunc, config, statusText) { .success(function(data, status, headerFunc, config, statusText) {
self._listOpComplete(key, resource, context, opts, data); self._listOpComplete(key, resource, context, opts, data);
...@@ -4306,7 +4307,7 @@ DataService.prototype.createStream = function(resource, name, context, opts, isR ...@@ -4306,7 +4307,7 @@ DataService.prototype.createStream = function(resource, name, context, opts, isR
method: 'GET', method: 'GET',
auth: {}, auth: {},
headers: headers, headers: headers,
url: this._urlForResource(resource, null, context), url: this._urlForResource(resource, null, context, false, params),
}).success(function(data, status, headerFunc, config, statusText) { }).success(function(data, status, headerFunc, config, statusText) {
self._listOpComplete(key, resource, context, opts, data); self._listOpComplete(key, resource, context, opts, data);
}).error(function(data, status, headers, config) { }).error(function(data, status, headers, config) {
......
...@@ -1051,10 +1051,10 @@ getPreferredVersion:getPreferredVersion ...@@ -1051,10 +1051,10 @@ getPreferredVersion:getPreferredVersion
}; };
} ]), angular.module("openshiftCommonServices").service("ApplicationsService", [ "$q", "DataService", function($q, DataService) { } ]), angular.module("openshiftCommonServices").service("ApplicationsService", [ "$q", "DataService", function($q, DataService) {
var listStandaloneReplicationControllers = function(context) { var listStandaloneReplicationControllers = function(context) {
return DataService.list("replicationcontrollers", context, { return DataService.list("replicationcontrollers", context, null, {
http:{ http:{
params:{ params:{
labelSelector:"!openshift.io/deployment-config-name" labelSelector:"!openshift.io/deployment-config.name"
} }
} }
}); });
...@@ -1062,7 +1062,7 @@ labelSelector:"!openshift.io/deployment-config-name" ...@@ -1062,7 +1062,7 @@ labelSelector:"!openshift.io/deployment-config-name"
return DataService.list({ return DataService.list({
group:"extensions", group:"extensions",
resource:"replicasets" resource:"replicasets"
}, context, { }, context, null, {
http:{ http:{
params:{ params:{
labelSelector:"!pod-template-hash" labelSelector:"!pod-template-hash"
...@@ -1798,7 +1798,7 @@ namespace:ns ...@@ -1798,7 +1798,7 @@ namespace:ns
return _.get(opts, "partialObjectMetadataList") ? url + "#" + ACCEPT_PARTIAL_OBJECT_METADATA_LIST :url; return _.get(opts, "partialObjectMetadataList") ? url + "#" + ACCEPT_PARTIAL_OBJECT_METADATA_LIST :url;
}, DataService.prototype._startListOp = function(resource, context, opts) { }, DataService.prototype._startListOp = function(resource, context, opts) {
opts = opts || {}; opts = opts || {};
var key = this._uniqueKey(resource, null, context, opts); var params = _.get(opts, "http.params") || {}, key = this._uniqueKey(resource, null, context, opts);
this._listInFlight(key, !0); this._listInFlight(key, !0);
var headers = {}; var headers = {};
opts.partialObjectMetadataList && (headers.Accept = ACCEPT_PARTIAL_OBJECT_METADATA_LIST); opts.partialObjectMetadataList && (headers.Accept = ACCEPT_PARTIAL_OBJECT_METADATA_LIST);
...@@ -1808,9 +1808,9 @@ $http(angular.extend({ ...@@ -1808,9 +1808,9 @@ $http(angular.extend({
method:"GET", method:"GET",
auth:{}, auth:{},
headers:headers, headers:headers,
url:self._urlForResource(resource, null, context, !1, { url:self._urlForResource(resource, null, context, !1, _.assign({}, params, {
namespace:project.metadata.name namespace:project.metadata.name
}) }))
}, opts.http || {})).success(function(data, status, headerFunc, config, statusText) { }, opts.http || {})).success(function(data, status, headerFunc, config, statusText) {
self._listOpComplete(key, resource, context, opts, data); self._listOpComplete(key, resource, context, opts, data);
}).error(function(data, status, headers, config) { }).error(function(data, status, headers, config) {
...@@ -1822,7 +1822,7 @@ delete self._listDeferredMap[key], deferred.reject(data, status, headers, config ...@@ -1822,7 +1822,7 @@ delete self._listDeferredMap[key], deferred.reject(data, status, headers, config
method:"GET", method:"GET",
auth:{}, auth:{},
headers:headers, headers:headers,
url:this._urlForResource(resource, null, context) url:this._urlForResource(resource, null, context, !1, params)
}).success(function(data, status, headerFunc, config, statusText) { }).success(function(data, status, headerFunc, config, statusText) {
self._listOpComplete(key, resource, context, opts, data); self._listOpComplete(key, resource, context, opts, data);
}).error(function(data, status, headers, config) { }).error(function(data, status, headers, config) {
......
...@@ -7,12 +7,12 @@ service("ApplicationsService", function($q, DataService) { ...@@ -7,12 +7,12 @@ service("ApplicationsService", function($q, DataService) {
// deployment config. Note: This will not return replication controllers that // deployment config. Note: This will not return replication controllers that
// have been orphaned by `oc delete dc/foo --cascade=false`. // have been orphaned by `oc delete dc/foo --cascade=false`.
var listStandaloneReplicationControllers = function(context) { var listStandaloneReplicationControllers = function(context) {
return DataService.list('replicationcontrollers', context, { return DataService.list('replicationcontrollers', context, null, {
http: { http: {
params: { params: {
// If the replica set has a `openshift.io/deployment-config-name` // If the replica set has a `openshift.io/deployment-config-name`
// label, it's managed by a deployment config. // label, it's managed by a deployment config.
labelSelector: "!openshift.io/deployment-config-name" labelSelector: "!openshift.io/deployment-config.name"
} }
} }
}); });
...@@ -22,7 +22,7 @@ service("ApplicationsService", function($q, DataService) { ...@@ -22,7 +22,7 @@ service("ApplicationsService", function($q, DataService) {
// Note: This will not return replica sets that have been orphaned by // Note: This will not return replica sets that have been orphaned by
// `oc delete deployment/foo --cascade=false`. // `oc delete deployment/foo --cascade=false`.
var listStandaloneReplicaSets = function(context) { var listStandaloneReplicaSets = function(context) {
return DataService.list({group: 'extensions', resource: 'replicasets'}, context, { return DataService.list({group: 'extensions', resource: 'replicasets'}, context, null, {
http: { http: {
params: { params: {
// If the replica set has a `pod-template-hash` label, it's managed // If the replica set has a `pod-template-hash` label, it's managed
......
...@@ -985,6 +985,7 @@ DataService.prototype.createStream = function(resource, name, context, opts, isR ...@@ -985,6 +985,7 @@ DataService.prototype.createStream = function(resource, name, context, opts, isR
DataService.prototype._startListOp = function(resource, context, opts) { DataService.prototype._startListOp = function(resource, context, opts) {
opts = opts || {}; opts = opts || {};
var params = _.get(opts, 'http.params') || {};
var key = this._uniqueKey(resource, null, context, opts); var key = this._uniqueKey(resource, null, context, opts);
// mark the operation as in progress // mark the operation as in progress
this._listInFlight(key, true); this._listInFlight(key, true);
...@@ -1001,7 +1002,7 @@ DataService.prototype.createStream = function(resource, name, context, opts, isR ...@@ -1001,7 +1002,7 @@ DataService.prototype.createStream = function(resource, name, context, opts, isR
method: 'GET', method: 'GET',
auth: {}, auth: {},
headers: headers, headers: headers,
url: self._urlForResource(resource, null, context, false, {namespace: project.metadata.name}) url: self._urlForResource(resource, null, context, false, _.assign({}, params, {namespace: project.metadata.name}))
}, opts.http || {})) }, opts.http || {}))
.success(function(data, status, headerFunc, config, statusText) { .success(function(data, status, headerFunc, config, statusText) {
self._listOpComplete(key, resource, context, opts, data); self._listOpComplete(key, resource, context, opts, data);
...@@ -1025,7 +1026,7 @@ DataService.prototype.createStream = function(resource, name, context, opts, isR ...@@ -1025,7 +1026,7 @@ DataService.prototype.createStream = function(resource, name, context, opts, isR
method: 'GET', method: 'GET',
auth: {}, auth: {},
headers: headers, headers: headers,
url: this._urlForResource(resource, null, context), url: this._urlForResource(resource, null, context, false, params),
}).success(function(data, status, headerFunc, config, statusText) { }).success(function(data, status, headerFunc, config, statusText) {
self._listOpComplete(key, resource, context, opts, data); self._listOpComplete(key, resource, context, opts, data);
}).error(function(data, status, headers, config) { }).error(function(data, status, headers, config) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment