X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FUI.git;a=blobdiff_plain;f=skyquake%2Fplugins%2Flogging%2Fsrc%2FloggingSource.js;h=dfba1677a5268ab64412d621bb0d15d0fc91a1f0;hp=47e6e48ae0f01cfd0038287685c6156fab07a061;hb=28412d0042632687d765d239cbb3ff0523a131b9;hpb=27eea26c0b90dc1482aa785837b7c56da6090eaf diff --git a/skyquake/plugins/logging/src/loggingSource.js b/skyquake/plugins/logging/src/loggingSource.js index 47e6e48ae..dfba1677a 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,30 +66,33 @@ export default { 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); + if(loggingConfig.hasOwnProperty('allowDuplicateEvents')) { + promises.push($.ajax({ + url: apiUrl('api/config/allow-duplicate-events'), + type: 'PUT', + beforeSend: Utils.addAuthorizationStub, + data: { + allowDuplicateEvents: loggingConfig.allowDuplicateEvents + }, + success: function(data) { + if (!loggingConfig.allowDuplicateEvents) { + delete state.loggingConfig.allowDuplicateEvents } - }); - promises.push(change); - /* Backend bug disallows deleting: RIFT-14910 - + resolve(data); + }, + error: function(error) { + console.log("There was an error updating the logging config data", + error); + reject(error); + } + })) + } 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); }, @@ -101,10 +104,22 @@ export default { }); 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)