wazuh-kibana-app/public/factories/tab-visualizations.js

80 lines
1.5 KiB
JavaScript
Raw Normal View History

2018-05-15 12:01:26 +00:00
/*
2018-05-15 14:11:35 +00:00
* Wazuh app - Factory to store visualization tabs
2018-06-19 14:40:03 +00:00
*
2018-05-15 12:01:26 +00:00
* Copyright (C) 2018 Wazuh, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Find more information about this on the LICENSE file.
*/
2018-09-10 08:32:49 +00:00
import { uiModules } from 'ui/modules';
2018-05-15 12:01:26 +00:00
2018-06-15 10:42:57 +00:00
const app = uiModules.get('app/wazuh', []);
2018-05-15 12:01:26 +00:00
2018-08-20 07:00:50 +00:00
class TabVisualizations {
2018-09-10 08:32:49 +00:00
constructor() {
this.agents = {
welcome: 0,
general: 7,
fim: 7,
pm: 4,
vuls: 7,
oscap: 13,
ciscat: 11,
audit: 15,
gdpr: 3,
pci: 3,
virustotal: 6,
configuration: 0
};
2018-09-10 08:32:49 +00:00
this.overview = {
welcome: 0,
general: 11,
fim: 10,
pm: 5,
vuls: 8,
oscap: 11,
ciscat: 11,
audit: 15,
pci: 6,
gdpr: 6,
aws: 10,
virustotal: 7
};
2018-09-10 08:32:49 +00:00
this.tabVisualizations = {};
this.currentTab = '';
}
2018-05-15 12:01:26 +00:00
2018-09-10 08:32:49 +00:00
setTab(tab) {
this.currentTab = tab;
}
getTab() {
return this.currentTab;
}
getItem(item) {
return this.tabVisualizations[item];
}
2018-05-15 12:01:26 +00:00
2018-09-10 08:32:49 +00:00
assign(tabs) {
if (typeof tabs === 'object') {
this.tabVisualizations = tabs;
} else if (typeof tabs === 'string') {
this.tabVisualizations =
tabs === 'overview' ? this.overview : this.agents;
2018-05-15 12:01:26 +00:00
}
2018-09-10 08:32:49 +00:00
}
2018-05-15 12:01:26 +00:00
2018-09-10 08:32:49 +00:00
removeAll() {
this.tabVisualizations = {};
}
2018-08-20 07:00:50 +00:00
}
2018-06-19 14:40:03 +00:00
2018-09-10 08:32:49 +00:00
app.service('tabVisualizations', TabVisualizations);