RIFT-14916: Code added but commented out for removing cat severity filter
Signed-off-by: Laurence Maultsby <laurence.maultsby@riftio.com>
diff --git a/skyquake/plugins/logging/api/logging.js b/skyquake/plugins/logging/api/logging.js
index a3bc182..499a814 100644
--- a/skyquake/plugins/logging/api/logging.js
+++ b/skyquake/plugins/logging/api/logging.js
@@ -333,21 +333,21 @@
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);
- }
- )
- })
-
}
/*
diff --git a/skyquake/plugins/logging/routes.js b/skyquake/plugins/logging/routes.js
index 6c6df78..02b4514 100644
--- a/skyquake/plugins/logging/routes.js
+++ b/skyquake/plugins/logging/routes.js
@@ -1,5 +1,5 @@
/*
- *
+ *
* Copyright 2016 RIFT.IO Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -71,7 +71,7 @@
},
{
method: 'DELETE',
- endpoint: '/api/config/default-syslog-severity',
+ endpoint: '/api/config/default-syslog-severity/:nulledCategories',
apiHandler: loggingAPI['config'].deleteDefaultSyslogSeverity
},
{
diff --git a/skyquake/plugins/logging/src/loggingSource.js b/skyquake/plugins/logging/src/loggingSource.js
index 47e6e48..690d323 100644
--- a/skyquake/plugins/logging/src/loggingSource.js
+++ b/skyquake/plugins/logging/src/loggingSource.js
@@ -1,5 +1,5 @@
/*
- *
+ *
* Copyright 2016 RIFT.IO Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -66,7 +66,25 @@
return new Promise(function(resolve, reject) {
let promises = [];
let remove = null;
- let change = $.ajax({
+ if(nulledCategories.length > 0) {
+ remove = $.ajax({
+ // url: apiUrl('api/config/default-severity'),
+ url: apiUrl('api/config/default-syslog-severity/' + nulledCategories.join(',')),
+ type: 'DELETE',
+ beforeSend: Utils.addAuthorizationStub,
+ success: function(data) {
+ resolve(data);
+ },
+ error: function(error) {
+ console.log("There was an error updating the logging config data",
+ error);
+ reject(error);
+ }
+ });
+ promises.push(remove);
+ }
+ Promise.all(promises).then(function(data) {
+ return $.ajax({
url: apiUrl('api/aggregate'),
type: 'PUT',
beforeSend: Utils.addAuthorizationStub,
@@ -80,31 +98,7 @@
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'),
- type: 'DELETE',
- beforeSend: Utils.addAuthorizationStub,
- data: nulledCategories,
- success: function(data) {
- resolve(data);
- },
- error: function(error) {
- console.log("There was an error updating the logging config data",
- error);
- reject(error);
- }
- });
- promises.push(remove);
- }
- */
-
-
- Promise.all(promises).then(function(data){
+ }).then(function(data){
resolve(data)
}, function(){
reject(arguments)
diff --git a/skyquake/plugins/logging/src/loggingStore.js b/skyquake/plugins/logging/src/loggingStore.js
index d8f0d70..53575eb 100644
--- a/skyquake/plugins/logging/src/loggingStore.js
+++ b/skyquake/plugins/logging/src/loggingStore.js
@@ -1,5 +1,5 @@
/*
- *
+ *
* Copyright 2016 RIFT.IO Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -126,7 +126,7 @@
// 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
// });
@@ -134,6 +134,10 @@
sink.filter.category[catIndex] = catsev;
}
} else {
+ _.remove(nulledCategories, (v) => v == catsev.name);
+ this.setState({
+ nulledCategories: nulledCategories
+ });
sink.filter.category.push(catsev);
}
} else {