Solving conflicts

This commit is contained in:
Jesús Ángel González 2018-04-02 10:23:41 +02:00
commit 555266db69
8 changed files with 138 additions and 100 deletions

View File

@ -1,48 +1,65 @@
# Change Log
All notable changes to the Wazuh app project will be documented in this file.
## Wazuh v3.2.1 - Kibana v6.2.2 - Revision 387
## Wazuh v3.2.2 - Kibana v6.2.2/v6.2.3 - Revision 388
### Added
- **New logging system** ([#307](https://github.com/wazuh/wazuh-kibana-app/pull/307)):
- New module implemented to **write app logs**.
- Now **a trace is stored every time the app is re/started**.
- Currently, the `initialize.js` and `monitoring.js` files **works with this system**.
- **Note**: the logs will live under `/var/log/wazuh/wazuhapp.log` on Linux systems, on Windows systems they will live under `kibana/plugins/`. **It rotates the log whenever it reaches 100MB**.
- **Better cookies handling** ([#308](https://github.com/wazuh/wazuh-kibana-app/pull/308)):
- New field on the `.wazuh-version` index to store the **last time the Kibana server was restarted**.
- This is used to **check if the cookies have consistency** with the current sever status.
- Now the app is clever and **takes decissions depending on new consistency checks**.
- **New design for the *Agents/Configuration* tab** ([#310](https://github.com/wazuh/wazuh-kibana-app/pull/310)):
- Support for Wazuh v3.2.2.
- Support for Elastic Stack v6.2.2/v6.2.3.
- Added the `errorHandler` service to the `dataHandler` factory ([#340](https://github.com/wazuh/wazuh-kibana-app/pull/340)).
### Changed
- Increased the query size when fetching the index pattern list ([#339](https://github.com/wazuh/wazuh-kibana-app/pull/339)).
### Fixed
- Fixed a bug where several `agent.id` filters were created at the same time when navigating between *Agents* and *Groups* with different selected agents ([#342](https://github.com/wazuh/wazuh-kibana-app/pull/342)).
- Fixed logic on the index-pattern selector which wasn't showing the currently selected pattern the very first time a user opened the app ([#345](https://github.com/wazuh/wazuh-kibana-app/pull/345)).
### Removed
- Removed clear API password on `checkPattern` response ([#339](https://github.com/wazuh/wazuh-kibana-app/pull/339)).
## Wazuh v3.2.1 - Kibana v6.2.2/v6.2.3 - Revision 387
### Added
- New logging system ([#307](https://github.com/wazuh/wazuh-kibana-app/pull/307)):
- New module implemented to write app logs.
- Now a trace is stored every time the app is re/started.
- Currently, the `initialize.js` and `monitoring.js` files works with this system.
- Note: the logs will live under `/var/log/wazuh/wazuhapp.log` on Linux systems, on Windows systems they will live under `kibana/plugins/`. It rotates the log whenever it reaches 100MB.
- Better cookies handling ([#308](https://github.com/wazuh/wazuh-kibana-app/pull/308)):
- New field on the `.wazuh-version` index to store the last time the Kibana server was restarted.
- This is used to check if the cookies have consistency with the current sever status.
- Now the app is clever and takes decissions depending on new consistency checks.
- New design for the *Agents/Configuration* tab ([#310](https://github.com/wazuh/wazuh-kibana-app/pull/310)):
- The style is the same as the *Manager/Configuration* tab.
- Added two more sections: **CIS-CAT and Commands** ([#315](https://github.com/wazuh/wazuh-kibana-app/pull/315)).
- Added two more sections: CIS-CAT and Commands ([#315](https://github.com/wazuh/wazuh-kibana-app/pull/315)).
- Added a new card that will appear when there's no group configuration at all ([#323](https://github.com/wazuh/wazuh-kibana-app/pull/323)).
- **Added *"group"* column on the agents list in *Agents*** ([#312](https://github.com/wazuh/wazuh-kibana-app/pull/312)):
- Added *"group"* column on the agents list in *Agents* ([#312](https://github.com/wazuh/wazuh-kibana-app/pull/312)):
- If you click on the group, it will redirect the user to the specified group in *Manager/Groups*.
- **New option for the `config.yml` file, `ip.selector`** ([#313](https://github.com/wazuh/wazuh-kibana-app/pull/313)):
- Define if the app will **show or not the index pattern selector on the top navbar**.
- New option for the `config.yml` file, `ip.selector` ([#313](https://github.com/wazuh/wazuh-kibana-app/pull/313)):
- Define if the app will show or not the index pattern selector on the top navbar.
- This setting is set to `true` by default.
- **More CSS cleanup and reordering** ([#315](https://github.com/wazuh/wazuh-kibana-app/pull/315)):
- More CSS cleanup and reordering ([#315](https://github.com/wazuh/wazuh-kibana-app/pull/315)):
- New `typography.less` file.
- New `layout.less` file.
- Removed `cleaned.less` file.
- Reordering and cleaning of existing CSS files, including removal of unused classes, renaming, and more.
- The *Settings* tab has been refactored to correct some visual errors with some card components.
- Small refactoring to some components from *Manager/Ruleset* ([#323](https://github.com/wazuh/wazuh-kibana-app/pull/323)).
- **New design for the top navbar** ([#326](https://github.com/wazuh/wazuh-kibana-app/pull/326)):
- New design for the top navbar ([#326](https://github.com/wazuh/wazuh-kibana-app/pull/326)):
- Cleaned and refactored code
- Revamped design, smaller and with minor details to follow the rest of Wazuh app guidelines.
- **New design for the wz-chip component** to follow the new Wazuh app guidelines ([#323](https://github.com/wazuh/wazuh-kibana-app/pull/323)).
- Added **more descriptive error messages** when the user inserts bad credentials on the *Add new API* form in the *Settings* tab ([#331](https://github.com/wazuh/wazuh-kibana-app/pull/331)).
- Added a new CSS class to **truncate overflowing text** on tables and metric ribbons ([#332](https://github.com/wazuh/wazuh-kibana-app/pull/332)).
- New design for the wz-chip component to follow the new Wazuh app guidelines ([#323](https://github.com/wazuh/wazuh-kibana-app/pull/323)).
- Added more descriptive error messages when the user inserts bad credentials on the *Add new API* form in the *Settings* tab ([#331](https://github.com/wazuh/wazuh-kibana-app/pull/331)).
- Added a new CSS class to truncate overflowing text on tables and metric ribbons ([#332](https://github.com/wazuh/wazuh-kibana-app/pull/332)).
- Support for Elastic Stack v6.2.2/v6.2.3.
### Changed
- **Improved the initialization system** ([#317](https://github.com/wazuh/wazuh-kibana-app/pull/317)):
- Now the app will **re-create the index-pattern** if the user deletes the currently used by the Wazuh app.
- The fieldset is now **automatically refreshed** if the app detects mismatches.
- Now every index-pattern is **dynamically formatted** (for example, to enable the URLs in the *Vulnerabilities* tab).
- Several **code refactoring** for a better handling of possible use cases.
- And the best thing, **it's no longer needed to insert the sample alert!**
- **Improvements and changes to index-patterns** ([#320](https://github.com/wazuh/wazuh-kibana-app/pull/320) & [#333](https://github.com/wazuh/wazuh-kibana-app/pull/333)):
- Improved the initialization system ([#317](https://github.com/wazuh/wazuh-kibana-app/pull/317)):
- Now the app will re-create the index-pattern if the user deletes the currently used by the Wazuh app.
- The fieldset is now automatically refreshed if the app detects mismatches.
- Now every index-pattern is dynamically formatted (for example, to enable the URLs in the *Vulnerabilities* tab).
- Several code refactoring for a better handling of possible use cases.
- And the best thing, it's no longer needed to insert the sample alert!
- Improvements and changes to index-patterns ([#320](https://github.com/wazuh/wazuh-kibana-app/pull/320) & [#333](https://github.com/wazuh/wazuh-kibana-app/pull/333)):
- New route, `/get-list`, to fetch the index pattern list.
- Removed and changed several functions for a proper management of index-patterns.
- Improved the compatibility with user-created index-patterns, known to have unpredictable IDs.
@ -50,14 +67,14 @@ All notable changes to the Wazuh app project will be documented in this file.
- Ignored custom index patterns with auto-generated ID on the initialization process.
- Now it uses the value set on the `config.yml` file.
- If the index pattern is no longer available, the cookie will be overwritten.
- **Improvements to the monitoring module** ([#322](https://github.com/wazuh/wazuh-kibana-app/pull/322)):
- Improvements to the monitoring module ([#322](https://github.com/wazuh/wazuh-kibana-app/pull/322)):
- Minor refactoring to the whole module.
- Now the `wazuh-monitoring` index pattern is regenerated if it's missing.
- And the best thing, **it's no longer needed to insert the monitoring template!**
- Now the app healthcheck system only checks if the API and app **have the same `major.minor` version** ([#311](https://github.com/wazuh/wazuh-kibana-app/pull/311)):
- And the best thing, it's no longer needed to insert the monitoring template!
- Now the app healthcheck system only checks if the API and app have the same `major.minor` version ([#311](https://github.com/wazuh/wazuh-kibana-app/pull/311)):
- Previously, the API and app had to be on the same `major.minor.patch` version.
- Adjusted space between title and value in some cards showing Manager or Agent configurations ([#315](https://github.com/wazuh/wazuh-kibana-app/pull/315)).
- Changed **red and green colours to more saturated ones**, following Kibana style ([#315](https://github.com/wazuh/wazuh-kibana-app/pull/315)).
- Changed red and green colours to more saturated ones, following Kibana style ([#315](https://github.com/wazuh/wazuh-kibana-app/pull/315)).
### Fixed
- Fixed bug on Firefox browser who was not properly showing the tables with the scroll pagination functionality ([#314](https://github.com/wazuh/wazuh-kibana-app/pull/314)).
@ -68,22 +85,22 @@ All notable changes to the Wazuh app project will be documented in this file.
## Wazuh v3.2.1 - Kibana v6.2.2 - Revision 386
### Added
- **New design for the *Manager/Groups* tab** ([#295](https://github.com/wazuh/wazuh-kibana-app/pull/295)).
- **New design for the *Manager/Configuration* tab** ([#297](https://github.com/wazuh/wazuh-kibana-app/pull/297)).
- **New design of agents statistics for the *Agents* tab** ([#299](https://github.com/wazuh/wazuh-kibana-app/pull/299)).
- **Added information ribbon into *Overview/Agent SCAP* tabs** ([#303](https://github.com/wazuh/wazuh-kibana-app/pull/303)).
- **Added information ribbon into *Overview/Agent VirusTotal* tabs** ([#306](https://github.com/wazuh/wazuh-kibana-app/pull/306)).
- **Added information ribbon into *Overview AWS* tab** ([#306](https://github.com/wazuh/wazuh-kibana-app/pull/306)).
- New design for the *Manager/Groups* tab ([#295](https://github.com/wazuh/wazuh-kibana-app/pull/295)).
- New design for the *Manager/Configuration* tab ([#297](https://github.com/wazuh/wazuh-kibana-app/pull/297)).
- New design of agents statistics for the *Agents* tab ([#299](https://github.com/wazuh/wazuh-kibana-app/pull/299)).
- Added information ribbon into *Overview/Agent SCAP* tabs ([#303](https://github.com/wazuh/wazuh-kibana-app/pull/303)).
- Added information ribbon into *Overview/Agent VirusTotal* tabs ([#306](https://github.com/wazuh/wazuh-kibana-app/pull/306)).
- Added information ribbon into *Overview AWS* tab ([#306](https://github.com/wazuh/wazuh-kibana-app/pull/306)).
### Changed
- **Refactoring of HTML and CSS code throughout the whole Wazuh app** ([#294](https://github.com/wazuh/wazuh-kibana-app/pull/294), [#302](https://github.com/wazuh/wazuh-kibana-app/pull/302) & [#305](https://github.com/wazuh/wazuh-kibana-app/pull/305)):
- Refactoring of HTML and CSS code throughout the whole Wazuh app ([#294](https://github.com/wazuh/wazuh-kibana-app/pull/294), [#302](https://github.com/wazuh/wazuh-kibana-app/pull/302) & [#305](https://github.com/wazuh/wazuh-kibana-app/pull/305)):
- A big milestone for the project was finally achieved with this refactoring.
- We've removed the **Bootstrap** dependency from the `package.json` file.
- We've **removed and merged many duplicated rules**.
- We've removed HTML and `angular-md` overriding rules. Now we have **more own-made classes to avoid undesired results on the UI**.
- We've removed the Bootstrap dependency from the `package.json` file.
- We've removed and merged many duplicated rules.
- We've removed HTML and `angular-md` overriding rules. Now we have more own-made classes to avoid undesired results on the UI.
- Also, this update brings tons of minor bugfixes related with weird HTML code.
- **Wazuh app visualizations reviewed** ([#301](https://github.com/wazuh/wazuh-kibana-app/pull/301)):
- The **number of used buckets has been limited**, since most of the table visualizations were surpassing acceptable limits.
- Wazuh app visualizations reviewed ([#301](https://github.com/wazuh/wazuh-kibana-app/pull/301)):
- The number of used buckets has been limited, since most of the table visualizations were surpassing acceptable limits.
- Some visualizations have been checked to see if they make complete sense on what they mean to show to the user.
- Modified some app components for better follow-up of Kibana guidelines ([#290](https://github.com/wazuh/wazuh-kibana-app/pull/290) & [#297](https://github.com/wazuh/wazuh-kibana-app/pull/297)).
- Also, some elements were modified on the *Discover* tab in order to correct some mismatches.
@ -101,16 +118,16 @@ All notable changes to the Wazuh app project will be documented in this file.
## Wazuh v3.2.1 - Kibana v6.2.2 - Revision 385
### Added
- Support for **Wazuh v3.2.1**.
- **Brand-new first redesign for the app user interface** ([#278](https://github.com/wazuh/wazuh-kibana-app/pull/278)):
- This is the **very first iteration** of a *work-in-progress* **UX redesign** for the Wazuh app.
- The overall interface has been refreshed, **removing some unnecessary colors and shadow effects**.
- The metric visualizations have been **replaced by an information ribbon** under the filter search bar, reducing the amount of space they occupied.
- Support for Wazuh v3.2.1.
- Brand-new first redesign for the app user interface ([#278](https://github.com/wazuh/wazuh-kibana-app/pull/278)):
- This is the very first iteration of a *work-in-progress* UX redesign for the Wazuh app.
- The overall interface has been refreshed, removing some unnecessary colors and shadow effects.
- The metric visualizations have been replaced by an information ribbon under the filter search bar, reducing the amount of space they occupied.
- A new service was implemented for a proper handling of the metric visualizations watchers ([#280](https://github.com/wazuh/wazuh-kibana-app/pull/280)).
- The rest of the app visualizations now have a **new, more detailed card design**.
- New **shards and replicas settings** to the `config.yml` file ([#277](https://github.com/wazuh/wazuh-kibana-app/pull/277)):
- Now you can apply **custom values** to the shards and replicas for the `.wazuh` and `.wazuh-version` indices.
- **Warning**: This feature only works before the installation process. If you modify this settings after installing the app, they won't be applied at all.
- The rest of the app visualizations now have a new, more detailed card design.
- New shards and replicas settings to the `config.yml` file ([#277](https://github.com/wazuh/wazuh-kibana-app/pull/277)):
- Now you can apply custom values to the shards and replicas for the `.wazuh` and `.wazuh-version` indices.
- This feature only works before the installation process. If you modify this settings after installing the app, they won't be applied at all.
### Changed
- Now clicking again on the *Groups* tab on *Manager* will properly reload the tab and redirect to the beginning ([#274](https://github.com/wazuh/wazuh-kibana-app/pull/274)).
@ -132,15 +149,15 @@ All notable changes to the Wazuh app project will be documented in this file.
## Wazuh v3.2.0 - Kibana v6.2.2 - Revision 384
### Added
- **New directives** for the Wazuh app: `wz-table`, `wz-table-header` and `wz-search-bar` ([#263](https://github.com/wazuh/wazuh-kibana-app/pull/263)):
- New directives for the Wazuh app: `wz-table`, `wz-table-header` and `wz-search-bar` ([#263](https://github.com/wazuh/wazuh-kibana-app/pull/263)):
- Maintainable and reusable components for a better structured app.
- Several files have been changed, renamed and moved to new folders, following *best practices*.
- The progress bar is now within its proper directive ([#266](https://github.com/wazuh/wazuh-kibana-app/pull/266)).
- Minor typos and refactoring changes for the new directives.
- Support for **Elastic Stack v6.2.2**.
- Support for Elastic Stack v6.2.2.
### Changed
- **App buttons have been refactored**. Unified CSS and HTML for buttons, providing the same structure for them ([#269](https://github.com/wazuh/wazuh-kibana-app/pull/269)).
- App buttons have been refactored. Unified CSS and HTML for buttons, providing the same structure for them ([#269](https://github.com/wazuh/wazuh-kibana-app/pull/269)).
- The API list on Settings now shows the latest inserted API at the beggining of the list ([#261](https://github.com/wazuh/wazuh-kibana-app/pull/261)).
- The check for the currently applied pattern has been improved, providing clever handling of Elasticsearch errors ([#271](https://github.com/wazuh/wazuh-kibana-app/pull/271)).
- Now on *Settings*, when the Add or Edit API form is active, if you press the other button, it will make the previous one disappear, getting a clearer interface ([#9df1e31](https://github.com/wazuh/wazuh-kibana-app/commit/9df1e317903edf01c81eba068da6d20a8a1ea7c2)).
@ -158,11 +175,11 @@ All notable changes to the Wazuh app project will be documented in this file.
- Removed the `implicitFilters` service ([#270](https://github.com/wazuh/wazuh-kibana-app/pull/270)).
- Removed visualizations loading status trace from controllers and visualization directive ([#270](https://github.com/wazuh/wazuh-kibana-app/pull/270)).
## [v3.2.0]
## Wazuh v3.2.0 - Kibana v6.2.1 - Revision 383
### Added
- Support for **Wazuh 3.2.0**.
- Compatibility with **Kibana 6.1.0** to **Kibana 6.2.1**.
- New tab for **vulnerability detector** alerts.
- Support for Wazuh 3.2.0.
- Compatibility with Kibana 6.1.0 to Kibana 6.2.1.
- New tab for vulnerability detector alerts.
### Changed
- The app now shows the index pattern selector only if the list length is greater than 1.
@ -185,24 +202,24 @@ All notable changes to the Wazuh app project will be documented in this file.
### Removed
- Removed the `travis.yml` file.
## [v3.1.0]
## Wazuh v3.1.0 - Kibana v6.1.3 - Revision 380
### Added
- Support for **Wazuh 3.1.0**.
- Compatibility with **Kibana 6.1.3**.
- Support for Wazuh 3.1.0.
- Compatibility with Kibana 6.1.3.
- New error handler for better app errors reporting.
- New extension for **Amazon Web Services** alerts.
- New extension for **VirusTotal** alerts.
- New **agent configuration** tab:
- New extension for Amazon Web Services alerts.
- New extension for VirusTotal alerts.
- New agent configuration tab:
- Visualize the current group configuration for the currently selected agent on the App.
- Navigate through the different tabs to see which configuration is being used.
- Check the synchronization status for the configuration.
- View the current group of the agent and click on it to go to the Groups tab.
- New **initial healthcheck** for cheking some app components.
- New **YAML config file**:
- New initial healthcheck for cheking some app components.
- New YAML config file:
- Define the initial index pattern.
- Define specific checks for the healthcheck.
- Define the default extensions when adding new APIs.
- New **index pattern selector dropdown** on the top navbar.
- New index pattern selector dropdown on the top navbar.
- The app will reload applying the new index pattern.
- Added new icons for some sections of the app.
@ -231,18 +248,18 @@ All notable changes to the Wazuh app project will be documented in this file.
- Removed index pattern configuration from the `package.json` file.
- Removed unnecessary dependencies from the `package.json` file.
## [v3.0.0]
## Wazuh v3.0.0 - Kibana v6.1.0 - Revision 371
### Added
- You can **configure the initial index-pattern** used by the plugin in the initialPattern variable of the app's package.json.
- You can configure the initial index-pattern used by the plugin in the initialPattern variable of the app's package.json.
- Auto `.wazuh` reindex from Wazuh 2.x - Kibana 5.x to Wazuh 3.x - Kibana 6.x.
- The API credentials will be automatically migrated to the new installation.
- Dynamically changed the index-pattern used by going to the **Settings -> Pattern** tab.
- Dynamically changed the index-pattern used by going to the Settings -> Pattern tab.
- Wazuh alerts compatibility auto detection.
- New loader for visualizations.
- Better performance: now the tabs use the same Discover tab, only changing the current filters.
- New **Groups** tab.
- New Groups tab.
- Now you can check your groups configuration (search its agents and configuration files).
- The **Logs** tab has been improved.
- The Logs tab has been improved.
- You can sort by field and the view has been improved.
- Achieved a clearer interface with implicit filters per tab showed as unremovable chips.
@ -253,8 +270,8 @@ All notable changes to the Wazuh app project will be documented in this file.
- New sync system to wait for Elasticsearch JS.
- Decoupling selected API and pattern from backend and moved to client side.
## [v2.1.0]
## Added
## Wazuh v2.1.0 - Kibana v5.6.1 - Revision 345
### Added
- Loading icon while Wazuh loads the visualizations.
- Add/Delete/Restart agents.
- OS agent filter
@ -262,7 +279,7 @@ All notable changes to the Wazuh app project will be documented in this file.
### Changed
- Using genericReq when possible.
## [v2.0.1]
## Wazuh v2.0.1 - Kibana v5.5.1 - Revision 339
### Changed
- New index in Elasticsearch to save Wazuh set up configuration
- Short URL's is now supported

View File

@ -51,6 +51,7 @@ Visualize and analyze Wazuh alerts stored in Elasticsearch using our Kibana app
| 6.2.1 | 3.2.0 | /usr/share/kibana/bin/kibana-plugin install https://packages.wazuh.com/wazuhapp/wazuhapp-3.2.0_6.2.1.zip |
| 6.2.2 | 3.2.0 | /usr/share/kibana/bin/kibana-plugin install https://packages.wazuh.com/wazuhapp/wazuhapp-3.2.0_6.2.2.zip |
| 6.2.2 | 3.2.1 | /usr/share/kibana/bin/kibana-plugin install https://packages.wazuh.com/wazuhapp/wazuhapp-3.2.1_6.2.2.zip |
| 6.2.3 | 3.2.1 | /usr/share/kibana/bin/kibana-plugin install https://packages.wazuh.com/wazuhapp/wazuhapp-3.2.1_6.2.3.zip |
## Upgrade

View File

@ -1,9 +1,9 @@
{
"name": "wazuh",
"version": "3.2.1",
"revision": "0386",
"revision": "0387",
"kibana": {
"version": "6.2.2"
"version": "6.2.3"
},
"description": "Wazuh App",
"main": "index.js",

View File

@ -290,6 +290,7 @@ app.controller('agentsController',
if(metricService.hasItems()) metricService.destroyWatchers();
$rootScope.ownHandlers = [];
$rootScope.comeFrom = 'agents';
$location.search('_a',null);
$location.search('tab', 'groups');
$location.path('/manager');
};

View File

@ -130,26 +130,12 @@ app.controller('settingsController', function ($scope, $rootScope, $http, $route
const patternList = await genericReq.request('GET','/get-list',{});
$scope.indexPatterns = patternList.data.data;
const currentPattern = await genericReq.request('GET', '/api/wazuh-elastic/current-pattern');
// Useful to show the applied pattern withou API or any data (very first time)
const config = await genericReq.request('GET', '/api/wazuh-api/configuration', {});
appState.setPatternSelector(typeof config.data.data['ip.selector'] !== 'undefined' ? config.data.data['ip.selector'] : true)
$rootScope.showSelector = appState.getPatternSelector();
if(!$rootScope.$$phase) $rootScope.$digest();
if(!patternList.data.data.length){
$rootScope.blankScreenError = 'Sorry but no valid index patterns were found'
$location.search('tab',null);
$location.path('/blank-screen');
return;
}
if(!appState.getCurrentPattern()) appState.setCurrentPattern(currentPattern.data.data);
else {
const filtered = patternList.data.data.filter(item => item.id.includes(appState.getCurrentPattern()))
if(!filtered.length) appState.setCurrentPattern(patternList.data.data[0].id)
}
const data = await genericReq.request('GET', '/api/wazuh-api/apiEntries');
for(const entry of data.data) $scope.showEditForm[entry._id] = false;

View File

@ -4,7 +4,8 @@ const app = require('ui/modules').get('app/wazuh', []);
app.directive('wzMenu',function(){
return {
controller: function ($scope, $window, $rootScope, appState, patternHandler, courier, errorHandler) {
controller: function ($scope, $window, $rootScope, appState, patternHandler, courier, errorHandler,genericReq) {
$rootScope.showSelector = appState.getPatternSelector();
if(!$rootScope.$$phase) $rootScope.$digest();
@ -23,11 +24,39 @@ app.directive('wzMenu',function(){
const load = async () => {
try {
// Get the configuration to check if pattern selector is enabled
const config = await genericReq.request('GET', '/api/wazuh-api/configuration', {});
appState.setPatternSelector(typeof config.data.data['ip.selector'] !== 'undefined' ? config.data.data['ip.selector'] : true)
// Abort if we have disabled the pattern selector
if(!appState.getPatternSelector()) return;
const data = await courier.indexPatterns.get(appState.getCurrentPattern());
// Show the pattern selector
$rootScope.showSelector = true;
let filtered = false;
// If there is no current pattern, fetch it
if(!appState.getCurrentPattern()) {
const currentPattern = await genericReq.request('GET', '/api/wazuh-elastic/current-pattern');
appState.setCurrentPattern(currentPattern.data.data);
} else {
// If there is current pattern, check if there is some pattern
const patternList = await genericReq.request('GET','/get-list',{});
if(!patternList.data.data.length){
$rootScope.blankScreenError = 'Sorry but no valid index patterns were found'
$location.search('tab',null);
$location.path('/blank-screen');
return;
}
// Check if the current pattern cookie is valid
filtered = patternList.data.data.filter(item => item.id.includes(appState.getCurrentPattern()))
if(!filtered.length) appState.setCurrentPattern(patternList.data.data[0].id)
}
const data = filtered ? filtered : await courier.indexPatterns.get(appState.getCurrentPattern());
$scope.theresPattern = true;
$scope.currentPattern = data.title;
const list = await patternHandler.getPatternList();
// Getting the list of index patterns
@ -36,6 +65,7 @@ app.directive('wzMenu',function(){
$scope.currentSelectedPattern = appState.getCurrentPattern();
}
if(!$scope.$$phase) $scope.$digest();
if(!$rootScope.$$phase) $rootScope.$digest();
return;
} catch (error) {
errorHandler.handle(error,'Directives - Menu');

View File

@ -1,6 +1,6 @@
let app = require('ui/modules').get('app/wazuh', []);
app.factory('DataHandler', function ($q, apiReq) {
app.factory('DataHandler', function ($q, apiReq,errorHandler) {
class DataHandler {
constructor() {
this.items = [];
@ -74,7 +74,10 @@ app.factory('DataHandler', function ($q, apiReq) {
deferred.resolve(true);
}
})
.catch(err => this.busy = false);
.catch(error => {
this.busy = false;
errorHandler.handle(error,'Datahandler factory');
});
return deferred.promise;
}
@ -120,7 +123,7 @@ app.factory('DataHandler', function ($q, apiReq) {
.then(function (data) {
this.items.splice(index, 1);
}.bind(this))
.catch(console.error);
.catch(error => errorHandler.handle(error,'Datahandler factory'));
}
search () {
@ -161,7 +164,7 @@ app.factory('DataHandler', function ($q, apiReq) {
this.offset = items.length;
deferred.resolve(true);
})
.catch(console.error);
.catch(error => errorHandler.handle(error,'Datahandler factory'));
return deferred.promise;
}

View File

@ -76,7 +76,7 @@
</div>
<div layout="row" class="wz-padding-top-10 wz-line-height">
If the API is <code>active (running)</code> please check its configuration below.
If the API is&nbsp;<code>active (running)</code> please check its configuration below.
</div>
</md-card-content>
</md-card>