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

50 lines
1.6 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: () => {
return {
extensions: $cookies.getObject('extensions')
};
},
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
}
};
});