mirror of
https://github.com/valitydev/wazuh-kibana-app.git
synced 2024-11-07 02:15:24 +00:00
Adapting to Kibana 6.3.0 (in progress)
This commit is contained in:
parent
97f7ff4c5a
commit
c5353cad57
@ -157,6 +157,7 @@ const app = modules.get('apps/webinar_app', [])
|
||||
const thereIsData = visHandlers.hasData();
|
||||
$rootScope.rendered = thereIsData;
|
||||
if(!thereIsData) $rootScope.resultState = 'none'
|
||||
else $rootScope.resultState = 'ready'
|
||||
}
|
||||
// Forcing a digest cycle
|
||||
if(!$rootScope.$$phase) $rootScope.$digest();
|
||||
|
@ -125,10 +125,14 @@ const VisualizeLoaderProvider = ($compile, $rootScope, savedVisualizations) => {
|
||||
* @return {Promise} A promise, that resolves to the visualize loader.
|
||||
*/
|
||||
function getVisualizeLoader() {
|
||||
return chrome.dangerouslyGetActiveInjector().then($injector => {
|
||||
const Private = $injector.get('Private');
|
||||
return Private(VisualizeLoaderProvider);
|
||||
});
|
||||
const $injector = angular.element(document.body).injector();
|
||||
if (!$injector) {
|
||||
return Promise.reject('document.body had no angular context after bootstrapping');
|
||||
}
|
||||
const Private = $injector.get('Private');
|
||||
const result = Private(VisualizeLoaderProvider);
|
||||
return result;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,50 @@ import * as modules from 'ui/modules'
|
||||
const app = modules.get('app/wazuh', []);
|
||||
|
||||
app.service('commonData', function ($rootScope, $timeout, genericReq, appState, errorHandler, $location, shareAgent) {
|
||||
|
||||
const af = (filterHandler, tab, localChange, agent = false) => {
|
||||
try{
|
||||
const tabFilters = {
|
||||
general : { group: '' },
|
||||
fim : { group: 'syscheck' },
|
||||
pm : { group: 'rootcheck' },
|
||||
vuls : { group: 'vulnerability-detector' },
|
||||
oscap : { group: 'oscap' },
|
||||
audit : { group: 'audit' },
|
||||
pci : { group: 'pci_dss' },
|
||||
gdpr : { group: 'gdpr' },
|
||||
aws : { group: 'amazon' },
|
||||
virustotal: { group: 'virustotal' }
|
||||
};
|
||||
|
||||
const filters = [];
|
||||
const isCluster = appState.getClusterInfo().status == 'enabled';
|
||||
filters.push(filterHandler.managerQuery(
|
||||
isCluster ?
|
||||
appState.getClusterInfo().cluster :
|
||||
appState.getClusterInfo().manager,
|
||||
isCluster
|
||||
))
|
||||
|
||||
if(tab !== 'general'){
|
||||
if(tab === 'pci') {
|
||||
filters.push(filterHandler.pciQuery())
|
||||
} else if(tab === 'gdpr') {
|
||||
filters.push(filterHandler.gdprQuery())
|
||||
} else {
|
||||
filters.push(filterHandler.ruleGroupQuery(tabFilters[tab].group));
|
||||
}
|
||||
}
|
||||
if(agent) filters.push(filterHandler.agentQuery(agent));
|
||||
$rootScope.$emit('wzEventFilters',{filters, localChange});
|
||||
if(!$rootScope.$$listenerCount['wzEventFilters']){
|
||||
$timeout(100)
|
||||
.then(() => af(filterHandler, tab, localChange, agent = false))
|
||||
}
|
||||
} catch(error) {
|
||||
errorHandler.handle('An error occurred while creating custom filters for visualizations',agent ? 'Agents' : 'Overview',true);
|
||||
}
|
||||
};
|
||||
return {
|
||||
getGDPR: async () => {
|
||||
try {
|
||||
@ -41,49 +85,7 @@ app.service('commonData', function ($rootScope, $timeout, genericReq, appState,
|
||||
return Promise.reject(error);
|
||||
}
|
||||
},
|
||||
assignFilters: (filterHandler, tab, localChange, agent = false) => {
|
||||
try{
|
||||
const tabFilters = {
|
||||
general : { group: '' },
|
||||
fim : { group: 'syscheck' },
|
||||
pm : { group: 'rootcheck' },
|
||||
vuls : { group: 'vulnerability-detector' },
|
||||
oscap : { group: 'oscap' },
|
||||
audit : { group: 'audit' },
|
||||
pci : { group: 'pci_dss' },
|
||||
gdpr : { group: 'gdpr' },
|
||||
aws : { group: 'amazon' },
|
||||
virustotal: { group: 'virustotal' }
|
||||
};
|
||||
|
||||
const filters = [];
|
||||
const isCluster = appState.getClusterInfo().status == 'enabled';
|
||||
filters.push(filterHandler.managerQuery(
|
||||
isCluster ?
|
||||
appState.getClusterInfo().cluster :
|
||||
appState.getClusterInfo().manager,
|
||||
isCluster
|
||||
))
|
||||
|
||||
if(tab !== 'general'){
|
||||
if(tab === 'pci') {
|
||||
filters.push(filterHandler.pciQuery())
|
||||
} else if(tab === 'gdpr') {
|
||||
filters.push(filterHandler.gdprQuery())
|
||||
} else {
|
||||
filters.push(filterHandler.ruleGroupQuery(tabFilters[tab].group));
|
||||
}
|
||||
}
|
||||
if(agent) filters.push(filterHandler.agentQuery(agent));
|
||||
$rootScope.$emit('wzEventFilters',{filters, localChange});
|
||||
if(!$rootScope.$$listenerCount['wzEventFilters']){
|
||||
$timeout(100)
|
||||
.then(() => assignFilters(tab))
|
||||
}
|
||||
} catch(error) {
|
||||
errorHandler.handle('An error occurred while creating custom filters for visualizations',agent ? 'Agents' : 'Overview',true);
|
||||
}
|
||||
},
|
||||
assignFilters: (filterHandler, tab, localChange, agent = false) => af(filterHandler, tab, localChange, agent = false),
|
||||
validateRange: data => {
|
||||
const result = {
|
||||
duration : 'Unknown',
|
||||
|
@ -56,7 +56,7 @@
|
||||
<!-- End Discover search bar section -->
|
||||
|
||||
<!-- Loading status section -->
|
||||
<div layout="column" layout-align="center center" class="wazuh-loading" ng-if="tab !== 'welcome'" ng-show="resultState === 'ready' && tabView === 'panels' && !rendered">
|
||||
<div layout="column" layout-align="center center" class="wazuh-loading" ng-if="tab !== 'welcome'" ng-show="resultState === 'loading' && tabView === 'panels' && !rendered">
|
||||
<div class="percentage"><i class="fa fa-fw fa-spin fa-spinner" aria-hidden="true"></i></div>
|
||||
<div class="percentage">{{loadingStatus}}</div>
|
||||
</div>
|
||||
@ -70,7 +70,7 @@
|
||||
<!-- End report status section -->
|
||||
|
||||
<!-- No results section -->
|
||||
<div layout="row" ng-if="tab !== 'welcome'" ng-show="resultState !== 'ready' && tabView === 'panels'">
|
||||
<div layout="row" ng-if="tab !== 'welcome'" ng-show="resultState === 'none' && tabView === 'panels'">
|
||||
<md-card flex layout="column" class="wz-md-card">
|
||||
<md-card-content class="wz-text-center">
|
||||
<span>There are no results for selected time range. Try another one.</span>
|
||||
|
Loading…
Reference in New Issue
Block a user