mirror of
https://github.com/valitydev/wazuh-kibana-app.git
synced 2024-11-06 09:55:18 +00:00
26 lines
1.0 KiB
JavaScript
26 lines
1.0 KiB
JavaScript
require('ui/modules').get('app/wazuh', [])
|
|
.service('patternHandler', function ($rootScope, $route, genericReq, courier, appState, errorHandler) {
|
|
return {
|
|
getPatternList: async () => {
|
|
try {
|
|
const patternList = await genericReq.request('GET','/get-list',{});
|
|
return patternList.data.data;
|
|
} catch (error) {
|
|
errorHandler.handle(error,'Pattern Handler (getPatternList)');
|
|
if(!$rootScope.$$phase) $rootScope.$digest();
|
|
}
|
|
},
|
|
changePattern: async selectedPattern => {
|
|
try {
|
|
const data = await genericReq.request('GET', `/api/wazuh-elastic/updatePattern/${selectedPattern}`);
|
|
appState.setCurrentPattern(selectedPattern);
|
|
return appState.getCurrentPattern();
|
|
} catch (error) {
|
|
errorHandler.handle(error,'Pattern Handler (changePattern)');
|
|
if(!$rootScope.$$phase) $rootScope.$digest();
|
|
}
|
|
|
|
}
|
|
};
|
|
});
|