Commit 871f3176 by Sam Padgett Committed by GitHub

Merge pull request #64 from spadgett/cascade-delete

DataService.delete should cascade by default
parents 23923bd9 26496544
......@@ -1146,14 +1146,18 @@ angular.module('openshiftCommonServices')
var deferred = $q.defer();
var self = this;
var data, headers = {};
var data = {
kind: "DeleteOptions",
apiVersion: "v1",
// Default to "Foreground" (cascading) if no propagationPolicy was given.
propagationPolicy: opts.propagationPolicy || "Foreground"
};
var headers = {
'Content-Type': 'application/json'
};
// Differentiate between 0 and undefined
if (_.has(opts, 'gracePeriodSeconds')) {
data = {
kind: "DeleteOptions",
apiVersion: "v1",
gracePeriodSeconds: opts.gracePeriodSeconds
};
headers['Content-Type'] = 'application/json';
data.gracePeriodSeconds = opts.gracePeriodSeconds;
}
this._getNamespace(resource, context, opts).then(function(ns){
$http(angular.extend({
......
......@@ -2492,14 +2492,18 @@ angular.module('openshiftCommonServices')
var deferred = $q.defer();
var self = this;
var data, headers = {};
var data = {
kind: "DeleteOptions",
apiVersion: "v1",
// Default to "Foreground" (cascading) if no propagationPolicy was given.
propagationPolicy: opts.propagationPolicy || "Foreground"
};
var headers = {
'Content-Type': 'application/json'
};
// Differentiate between 0 and undefined
if (_.has(opts, 'gracePeriodSeconds')) {
data = {
kind: "DeleteOptions",
apiVersion: "v1",
gracePeriodSeconds: opts.gracePeriodSeconds
};
headers['Content-Type'] = 'application/json';
data.gracePeriodSeconds = opts.gracePeriodSeconds;
}
this._getNamespace(resource, context, opts).then(function(ns){
$http(angular.extend({
......
......@@ -1025,12 +1025,14 @@ var key = this._uniqueKey(resource, null, context, _.get(opts, "http.params")),
return callback && deferred.promise.then(callback), this._isCached(key) ? deferred.resolve(this._data(key)) :this._listInFlight(key) || this._startListOp(resource, context, opts), deferred.promise;
}, DataService.prototype["delete"] = function(resource, name, context, opts) {
resource = APIService.toResourceGroupVersion(resource), opts = opts || {};
var data, deferred = $q.defer(), self = this, headers = {};
return _.has(opts, "gracePeriodSeconds") && (data = {
var data, deferred = $q.defer(), self = this, headers = {}, data = {
kind:"DeleteOptions",
apiVersion:"v1",
gracePeriodSeconds:opts.gracePeriodSeconds
}, headers["Content-Type"] = "application/json"), this._getNamespace(resource, context, opts).then(function(ns) {
propagationPolicy:opts.propagationPolicy || "Foreground"
}, headers = {
"Content-Type":"application/json"
};
return _.has(opts, "gracePeriodSeconds") && (data.gracePeriodSeconds = opts.gracePeriodSeconds), this._getNamespace(resource, context, opts).then(function(ns) {
$http(angular.extend({
method:"DELETE",
auth:{},
......
......@@ -147,14 +147,18 @@ angular.module('openshiftCommonServices')
var deferred = $q.defer();
var self = this;
var data, headers = {};
var data = {
kind: "DeleteOptions",
apiVersion: "v1",
// Default to "Foreground" (cascading) if no propagationPolicy was given.
propagationPolicy: opts.propagationPolicy || "Foreground"
};
var headers = {
'Content-Type': 'application/json'
};
// Differentiate between 0 and undefined
if (_.has(opts, 'gracePeriodSeconds')) {
data = {
kind: "DeleteOptions",
apiVersion: "v1",
gracePeriodSeconds: opts.gracePeriodSeconds
};
headers['Content-Type'] = 'application/json';
data.gracePeriodSeconds = opts.gracePeriodSeconds;
}
this._getNamespace(resource, context, opts).then(function(ns){
$http(angular.extend({
......
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