wazuh-kibana-app/public/services/appState.js

63 lines
2.0 KiB
JavaScript
Raw Normal View History

require('ui/modules').get('app/wazuh', []).service('appState', function ($cookies, $window) {
2017-10-30 09:14:36 +00:00
return {
getExtensions: () => {
2018-01-17 17:55:59 +00:00
const data = {
2017-10-30 09:14:36 +00:00
extensions: $cookies.getObject('extensions')
};
2018-01-17 17:55:59 +00:00
if(typeof data.extensions === 'undefined'){
return {
extensions : {
audit : true,
pci : true,
oscap : true,
aws : true,
virustotal: true
2018-01-17 17:55:59 +00:00
}
}
}
return data;
2017-10-30 09:14:36 +00:00
},
2017-11-13 11:49:22 +00:00
setExtensions: extensions => {
var exp = new Date();
exp.setDate(exp.getDate() + 365);
2017-10-30 09:14:36 +00:00
if (extensions) {
$cookies.putObject('extensions', extensions, { 'expires': exp });
2017-10-30 09:14:36 +00:00
}
},
getClusterInfo: () => {
return $cookies.getObject('_clusterInfo');
},
2017-11-13 11:49:22 +00:00
setClusterInfo: cluster_info => {
var exp = new Date();
exp.setDate(exp.getDate() + 365);
2017-10-30 09:14:36 +00:00
if (cluster_info) {
$cookies.putObject('_clusterInfo', cluster_info, { 'expires': exp });
2017-10-30 09:14:36 +00:00
}
},
getCurrentPattern: () => {
return $cookies.getObject('_currentPattern');
},
setCurrentPattern: newPattern => {
var exp = new Date();
exp.setDate(exp.getDate() + 365);
if (newPattern) {
$cookies.putObject('_currentPattern', newPattern, { 'expires': exp });
}
},
getCurrentAPI: () => {
return $cookies.getObject('API');
},
removeCurrentAPI: () => {
return $cookies.remove('API');
},
setCurrentAPI: API => {
var exp = new Date();
exp.setDate(exp.getDate() + 365);
if (API) {
$cookies.putObject('API', API, { 'expires': exp});
}
2017-10-30 09:14:36 +00:00
}
};
});