Config.deleteDefaultSyslogSeverity = function(req) {
// TODO: verify there is one key at root of data: 'default-severity'
// OR just filter on the request body
- var Categories = req.body;
+ var Categories = req.params.nulledCategories.split(',');
+ var promises = [];
return new Promise(function(resolve, reject) {
- var promises = Categories.map(function(categoryName) {
- return handleDeleteRequest(req, APIVersion + '/api/config/logging/sink/syslog/filter/category/' + categoryName);
+ promises.concat(Categories.map(function(categoryName) {
+ return handleDeleteRequest(req, APIVersion + '/api/config/logging/sink/syslog/filter/category/' + categoryName);
+ }));
+ return Promise.all(promises).then(
+ function(data) {
+ resolve({statusCode: 200, data: data[0]});
+ },
+ function(data) {
+ reject(data);
+ }
+ )
});
- return Promise.all(promises).then(
- function(data) {
- resolve(data[0]);
- },
- function(data) {
- reject(data);
- }
- )
- })
-
}
/*
/*
- *
+ *
* Copyright 2016 RIFT.IO Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
},
{
method: 'DELETE',
- endpoint: '/api/config/default-syslog-severity',
+ endpoint: '/api/config/default-syslog-severity/:nulledCategories',
apiHandler: loggingAPI['config'].deleteDefaultSyslogSeverity
},
{
/*
- *
+ *
* Copyright 2016 RIFT.IO Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
return new Promise(function(resolve, reject) {
let promises = [];
let remove = null;
- let change = $.ajax({
- url: apiUrl('api/aggregate'),
- type: 'PUT',
- beforeSend: Utils.addAuthorizationStub,
- data: loggingConfig,
- success: function(data) {
- resolve(data);
- },
- error: function(error) {
- console.log("There was an error updating the logging config data",
- error);
- reject(error);
- }
- });
- promises.push(change);
- /* Backend bug disallows deleting: RIFT-14910
-
if(nulledCategories.length > 0) {
remove = $.ajax({
// url: apiUrl('api/config/default-severity'),
- url: apiUrl('api/config/default-syslog-severity'),
+ url: apiUrl('api/config/default-syslog-severity/' + nulledCategories.join(',')),
type: 'DELETE',
beforeSend: Utils.addAuthorizationStub,
- data: nulledCategories,
success: function(data) {
resolve(data);
},
});
promises.push(remove);
}
- */
-
-
- Promise.all(promises).then(function(data){
+ Promise.all(promises).then(function(data) {
+ return $.ajax({
+ url: apiUrl('api/aggregate'),
+ type: 'PUT',
+ beforeSend: Utils.addAuthorizationStub,
+ data: loggingConfig,
+ success: function(data) {
+ resolve(data);
+ },
+ error: function(error) {
+ console.log("There was an error updating the logging config data",
+ error);
+ reject(error);
+ }
+ });
+ }).then(function(data){
resolve(data)
}, function(){
reject(arguments)
/*
- *
+ *
* Copyright 2016 RIFT.IO Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
// TODO/NOTE: Can't delete from model as sending a top-level payload with
// missing elements is not allowed!
// When backend supports it, in loggingSource change the order of operations
- // Delete first followed by save/put.
+ // // Delete first followed by save/put.
// _.remove(loggingConfig.sinks[sinkIndex].filter.category, {
// name: catsev.name
// });
sink.filter.category[catIndex] = catsev;
}
} else {
+ _.remove(nulledCategories, (v) => v == catsev.name);
+ this.setState({
+ nulledCategories: nulledCategories
+ });
sink.filter.category.push(catsev);
}
} else {