dc28aa4cc8ee866783d7240ce22882025654dab7
3 * Copyright 2016 RIFT.IO Inc
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 let rw
= require('utils/rw.js');
19 var API_SERVER
= rw
.getSearchParams(window
.location
).api_server
;
20 var loggingActions
= require('./loggingActions.js');
21 var Utils
= require('utils/utils.js');
22 import $ from 'jquery';
24 function apiUrl(endpoint
) {
25 return endpoint
.replace(/\/$/,'') + '?api_server=' + API_SERVER
;
30 * Retrieve the logging configuration data from the Node API server
32 getLoggingConfig: function() {
33 //console.log("LoggingSource.getLoggingConfig called");
35 remote: function(state
) {
36 return new Promise(function(resolve
, reject
) {
37 //console.log("loggingSource.getLoggingConfig called");
39 url
: apiUrl('api/aggregate'),
41 beforeSend
: Utils
.addAuthorizationStub
,
42 success: function(data
) {
43 //console.log("LoggingSource.getLoggingConfig success call. data=", data);
47 console
.log("Error getting logging config details");
52 success
: loggingActions
.getLoggingConfigSuccess
,
53 error
: loggingActions
.getLoggingConfigError
57 * Update the logging configuration data on the server
58 * @param {object} state - Reference to parent store state
59 * @param {object} loggingConfig - logging configuration data
60 * @return {[type]} [description]
63 updateLoggingConfig: function () {
65 remote: function(state
, nulledCategories
, loggingConfig
) {
66 return new Promise(function(resolve
, reject
) {
69 // if(nulledCategories.length > 0) {
71 // // url: apiUrl('api/config/default-severity'),
72 // url: apiUrl('api/config/default-syslog-severity/' + nulledCategories.join(',')),
74 // beforeSend: Utils.addAuthorizationStub,
75 // success: function(data) {
78 // error: function(error) {
79 // console.log("There was an error updating the logging config data",
84 // promises.push(remove);
86 Promise
.all(promises
).then(function(data
) {
88 url
: apiUrl('api/aggregate'),
90 beforeSend
: Utils
.addAuthorizationStub
,
92 success: function(data
) {
95 error: function(error
) {
96 console
.log("There was an error updating the logging config data",
101 }).then(function(data
){
110 success
: loggingActions
.putLoggingConfigSuccess
,
111 error
: loggingActions
.putLoggingConfigError