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

97 lines
1.8 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
*
2019-01-14 16:36:47 +00:00
* Copyright (C) 2015-2019 Wazuh, Inc.
2018-05-15 12:01:26 +00:00
*
* 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-11 09:52:54 +00:00
export class TabVisualizations {
/**
* Class constructor
*/
2018-09-10 08:32:49 +00:00
constructor() {
this.agents = {
welcome: 0,
general: 7,
fim: 7,
pm: 4,
2018-10-08 10:26:34 +00:00
vuls: 10,
2018-09-10 08:32:49 +00:00
oscap: 13,
ciscat: 11,
audit: 15,
gdpr: 6,
pci: 6,
2018-09-10 08:32:49 +00:00
virustotal: 6,
2018-10-03 13:13:49 +00:00
configuration: 0,
osquery: 5
2018-09-10 08:32:49 +00:00
};
2018-09-10 08:32:49 +00:00
this.overview = {
welcome: 0,
2019-02-13 11:21:09 +00:00
general: 13,
2018-09-13 07:06:12 +00:00
fim: 8,
2018-09-10 08:32:49 +00:00
pm: 5,
2018-10-08 10:26:34 +00:00
vuls: 10,
2018-09-10 08:32:49 +00:00
oscap: 11,
ciscat: 11,
audit: 15,
2019-02-11 16:14:36 +00:00
pci: 5,
gdpr: 5,
2018-09-18 10:42:46 +00:00
aws: 6,
virustotal: 7,
2018-09-29 10:36:26 +00:00
osquery: 5
2018-09-10 08:32:49 +00:00
};
2018-09-10 08:32:49 +00:00
this.tabVisualizations = {};
this.currentTab = '';
}
2018-05-15 12:01:26 +00:00
/**
* Set given tab as current
2018-12-13 10:02:53 +00:00
* @param {Object} tab
*/
2018-09-10 08:32:49 +00:00
setTab(tab) {
this.currentTab = tab;
}
/**
* Get current tab
*/
2018-09-10 08:32:49 +00:00
getTab() {
return this.currentTab;
}
/**
* Get given item
2018-12-13 10:02:53 +00:00
* @param {String} item
*/
2018-09-10 08:32:49 +00:00
getItem(item) {
return this.tabVisualizations[item];
}
2018-05-15 12:01:26 +00:00
/**
* Assign tab visualization with given tabs
2018-12-13 10:02:53 +00:00
* @param {Object} tabs
*/
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
/**
* Remove all tab Visualizations
*/
2018-09-10 08:32:49 +00:00
removeAll() {
this.tabVisualizations = {};
}
2018-08-20 07:00:50 +00:00
}