Skip to content

Commit

Permalink
Adapt Wazuh app for Kibana v6.7.0 (#1334)
Browse files Browse the repository at this point in the history
* Adapt kibana app for elastic 6.7.0

* Adapt kibana app for elastic 6.7.0

* Fixed discover

* Prettier

* Update 6.7 files

* Update 6.7 loader

* Prettier

* Minor style fixes

* Bump Kibana version, updated README

* Corrected interval from "h" to "auto"

* Overwrite top nav style for 6.7.0

* Backport app icon
  • Loading branch information
Juanka Rodríguez authored and Jesús Ángel committed Mar 29, 2019
1 parent 0f9c982 commit c188f97
Show file tree
Hide file tree
Showing 37 changed files with 512 additions and 401 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

All notable changes to the Wazuh app project will be documented in this file.

## Wazuh v3.8.2 - Kibana v6.6.0 / v6.6.1 / v6.6.2 - Revision 419
## Wazuh v3.8.2 - Kibana v6.6.0 / v6.6.1 / v6.6.2 / v6.7.0 - Revision 419

### Added

- Support for Kibana v6.6.0 / v6.6.1 / v6.6.2
- Support for Kibana v6.6.0 / v6.6.1 / v6.6.2 / v6.7.0

### Fixed

Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ Visualize and analyze Wazuh alerts stored in Elasticsearch using our Kibana app

- Wazuh HIDS 3.8.2
- Wazuh RESTful API 3.8.2
- Kibana 6.6.2
- Elasticsearch 6.6.2
- Kibana 6.7.0
- Elasticsearch 6.7.0

## Installation

Install the app

```
sudo -u kibana NODE_OPTIONS="--max-old-space-size=3072" /usr/share/kibana/bin/kibana-plugin install https://packages.wazuh.com/wazuhapp/wazuhapp-3.8.2_6.6.2.zip
sudo -u kibana NODE_OPTIONS="--max-old-space-size=3072" /usr/share/kibana/bin/kibana-plugin install https://packages.wazuh.com/wazuhapp/wazuhapp-3.8.2_6.7.0.zip
```

Restart Kibana
Expand Down Expand Up @@ -90,7 +90,7 @@ chown -R kibana:kibana /usr/share/kibana/plugins
Install the app

```
sudo -u kibana NODE_OPTIONS="--max-old-space-size=3072" /usr/share/kibana/bin/kibana-plugin install https://packages.wazuh.com/wazuhapp/wazuhapp-3.8.2_6.6.2.zip
sudo -u kibana NODE_OPTIONS="--max-old-space-size=3072" /usr/share/kibana/bin/kibana-plugin install https://packages.wazuh.com/wazuhapp/wazuhapp-3.8.2_6.7.0.zip
```

Restart Kibana
Expand Down Expand Up @@ -162,6 +162,7 @@ service kibana restart
| 6.6.0 | 3.8.2 | /usr/share/kibana/bin/kibana-plugin install <https://packages.wazuh.com/wazuhapp/wazuhapp-3.8.2_6.6.0.zip> |
| 6.6.1 | 3.8.2 | /usr/share/kibana/bin/kibana-plugin install <https://packages.wazuh.com/wazuhapp/wazuhapp-3.8.2_6.6.1.zip> |
| 6.6.2 | 3.8.2 | /usr/share/kibana/bin/kibana-plugin install <https://packages.wazuh.com/wazuhapp/wazuhapp-3.8.2_6.6.2.zip> |
| 6.7.0 | 3.8.2 | /usr/share/kibana/bin/kibana-plugin install <https://packages.wazuh.com/wazuhapp/wazuhapp-3.8.2_6.7.0.zip> |


## Contribute
Expand Down
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@ export default kibana =>
id: 'wazuh',
title: 'Wazuh',
description: 'Wazuh app for Kibana',
icon: 'plugins/wazuh/img/icon.png',
icon: 'plugins/wazuh/img/icon.svg',
main: 'plugins/wazuh/app'
},
hacks: [
'plugins/wazuh/hack-icon-style'
],
__bundleProvider__(kbnServer) {
kbnServer.uiBundles.addPostLoader({
test: /\.pug$/,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"revision": "0419",
"code": "0419-1",
"kibana": {
"version": "6.6.2"
"version": "6.7.0"
},
"description": "Wazuh app",
"main": "index.js",
Expand Down
1 change: 1 addition & 0 deletions public/hack-icon-style.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import './less/icon-style.less';
5 changes: 5 additions & 0 deletions public/img/icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,15 @@
ng-class="{'kuiLocalMenuItem-isSelected': wzKbnTopNav.isCurrent('interval') }"
ng-show="timefilterValues.isAutoRefreshSelectorEnabled"
ng-click="wzKbnTopNav.toggle('interval')"
data-test-subj="globalRefreshButton"
>
<span ng-show="timefilterValues.refreshInterval.value === 0">
<span aria-hidden="true" class="kuiIcon fa-repeat"></span> Auto-refresh
<span aria-hidden="true" class="kuiIcon fa-repeat"></span>
<span
i18n-id="common.ui.timepicker.autoRefresh"
i18n-default-message="Auto-refresh"
>
</span>
</span>

<span
Expand All @@ -42,12 +48,12 @@
ng-show="timefilterValues.isTimeRangeSelectorEnabled"
class="kuiLocalMenuItem"
ng-click="back()"
aria-label="Move backward in time"
aria-label="{{ ::'common.ui.timepicker.moveBackardInTime' | i18n: { defaultMessage: 'Move backward in time' } }}"
>
<span
class="kuiIcon fa-chevron-left"
aria-hidden="true"
tooltip="Move backward in time"
tooltip="{{ ::'common.ui.timepicker.moveBackardInTime' | i18n: { defaultMessage: 'Move backward in time' } }}"
></span>
</button>

Expand All @@ -73,12 +79,12 @@
ng-show="timefilterValues.isTimeRangeSelectorEnabled"
class="kuiLocalMenuItem"
ng-click="forward()"
aria-label="Move forward in time"
aria-label="{{ ::'common.ui.timepicker.moveForwardInTime' | i18n: { defaultMessage: 'Move forward in time' } }}"
>
<span
aria-hidden="true"
class="kuiIcon fa-chevron-right"
tooltip="Move forward in time"
tooltip="{{ ::'common.ui.timepicker.moveForwardInTime' | i18n: { defaultMessage: 'Move forward in time' } }}"
></span>
</button>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
data-test-subj="breadcrumbs"
role="heading"
aria-level="1"
ng-if="showPluginBreadcrumbs"
>
<div
class="kuiLocalBreadcrumb"
Expand All @@ -14,7 +15,7 @@
href="{{ breadcrumb.href }}"
data-test-subj="lnkBreadcrumb{{$index}}"
>
{{ breadcrumb.display }}
{{ breadcrumb.display }}
</a>
</div>

Expand All @@ -33,4 +34,4 @@
>
{{ pageTitle }}
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const module = uiModules.get('kibana');
module.directive('wzBreadCrumbs', function() {
return {
restrict: 'E',
replace: true,
scope: {
omitCurrentPage: '=',
/**
Expand All @@ -28,7 +27,9 @@ module.directive('wzBreadCrumbs', function() {
useLinks: '='
},
template: breadCrumbsTemplate,
controller: function($scope) {
controller: function($scope, config) {
config.watch('k7design', val => ($scope.showPluginBreadcrumbs = !val));

function omitPagesFilter(crumb) {
return !$scope.omitPages || !$scope.omitPages.includes(crumb.id);
}
Expand All @@ -44,6 +45,15 @@ module.directive('wzBreadCrumbs', function() {
.getBreadcrumbs()
.filter(omitPagesFilter)
.filter(omitCurrentPageFilter);

const newBreadcrumbs = $scope.breadcrumbs.map(b => ({
text: b.display,
href: b.href
}));

if ($scope.pageTitle) {
newBreadcrumbs.push({ text: $scope.pageTitle });
}
}
);
}
Expand Down
29 changes: 14 additions & 15 deletions public/kibana-integrations/kbn_top_nav/kbn_top_nav.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
<div
class="kuiLocalNav"
ng-show="wzKbnTopNav.isVisible()"
data-test-subj="top-nav"
>
<div class="kuiLocalNav" style="border-bottom: none !important;" ng-show="wzKbnTopNav.isVisible()"
data-test-subj="top-nav">
<!-- Top row -->
<div class="kuiLocalNavRow">
<!-- Top left corner slot, e.g. breadcrumbs, title. -->
<div
class="kuiLocalNavRow__section"
data-transclude-slot="topLeftCorner"
></div>
<div class="kuiLocalNavRow__section" data-transclude-slot="topLeftCorner"></div>

<!-- Right-side: menu -->
<div class="kuiLocalNavRow__section">
<div class="kuiLocalMenu">
<button class="kuiLocalMenuItem" ng-repeat="menuItem in kbnTopNav.menuItems"
aria-label="{{::menuItem.description}}" aria-haspopup="{{!menuItem.hasFunction}}"
aria-expanded="{{kbnTopNav.isCurrent(menuItem.key)}}" aria-disabled="{{menuItem.disableButton()}}"
ng-class="{'kuiLocalMenuItem-isSelected': kbnTopNav.isCurrent(menuItem.key), 'kuiLocalMenuItem-isDisabled': menuItem.disableButton()}"
ng-click="kbnTopNav.handleClick(menuItem, $event)" ng-bind="menuItem.label" tooltip="{{menuItem.tooltip()}}"
tooltip-placement="bottom" tooltip-popup-delay="400" tooltip-append-to-body="1"
data-test-subj="{{menuItem.testId}}"></button>

<!-- Time-picker "menu item" -->
<wz-kbn-global-timepicker></wz-kbn-global-timepicker>
Expand All @@ -22,11 +23,9 @@
</div>

<!-- Dropdown content, e.g. time-picker. -->
<div
class="kuiLocalDropdown"
ng-show="wzKbnTopNav.rendered"
>
<button class="kuiLocalDropdownCloseButton" ng-click="wzKbnTopNav.close()" aria-label="Close">
<div class="kuiLocalDropdown" ng-show="wzKbnTopNav.rendered">
<button class="kuiLocalDropdownCloseButton" ng-click="wzKbnTopNav.close()"
aria-label="{{ ::'common.ui.topNav.closeAriaLabel' | i18n: { defaultMessage: 'Close' } }}">
<span class="kuiIcon fa-chevron-circle-up"></span>
</button>
<div id="template_wrapper">
Expand All @@ -38,4 +37,4 @@
<!-- Bottom row slot, e.g. tabs. -->
<div data-transclude-slot="bottomRow"></div>
</div>
</div>
</div>
20 changes: 11 additions & 9 deletions public/kibana-integrations/kibana-discover.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ import 'ui/doc_table/components/table_row';

// Research added (further checks needed)
import 'ui/doc_table/doc_table';
import 'ui/styles/sidebar.less';
import 'ui/styles/table.less';
import 'ui/doc_viewer/doc_viewer';
import 'ui/doc_title/doc_title';
import 'ui/style_compile/style_compile';
Expand Down Expand Up @@ -328,9 +326,11 @@ function discoverController(
}

const timeFieldName = $scope.indexPattern.timeFieldName;
const fields = timeFieldName
? [timeFieldName, ...selectedFields]
: selectedFields;
const hideTimeColumn = config.get('doc_table:hideTimeColumn');
const fields =
timeFieldName && !hideTimeColumn
? [timeFieldName, ...selectedFields]
: selectedFields;
return {
searchFields: fields,
selectFields: fields
Expand Down Expand Up @@ -524,7 +524,10 @@ function discoverController(
}
});

$scope.$watch('state.query', $scope.updateQueryAndFetch);
$scope.$watch('state.query', newQuery => {
const query = migrateLegacyQuery(newQuery);
$scope.updateQueryAndFetch({ query });
});

$scope.$watchMulti(
['rows', 'fetchStatus'],
Expand Down Expand Up @@ -630,7 +633,7 @@ function discoverController(
.catch(notify.error);
};

$scope.updateQueryAndFetch = function(query) {
$scope.updateQueryAndFetch = function({ query }) {
////////////////////////////////////////////////////////////////////////////
/////////////////////////////// WAZUH ///////////////////////////////////
////////////////////////////////////////////////////////////////////////////
Expand All @@ -644,8 +647,7 @@ function discoverController(
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////

$state.query = migrateLegacyQuery(query);
$state.query = query;
$scope.fetch();
};

Expand Down
19 changes: 15 additions & 4 deletions public/kibana-integrations/kibana-filter-bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export {
const module = uiModules.get('kibana');

module
.directive('filterBarW', function(Private, Promise, getAppState) {
.directive('filterBarW', function(Private, Promise, getAppState, i18n) {
const mapAndFlattenFilters = Private(
FilterBarLibMapAndFlattenFiltersProvider
);
Expand Down Expand Up @@ -66,20 +66,31 @@ module
return pill[pill.length - 1].offsetTop > 10;
};

const collapseFilterTooltip = i18n(
'common.ui.filterBar.collapseFilterTooltip',
{
defaultMessage: 'Collapse filter bar \n to show less'
}
);
const expandFilterTooltip = i18n(
'common.ui.filterBar.expandFilterTooltip',
{ defaultMessage: 'Expand filter bar \n to show more' }
);

$scope.filterNavToggle = {
isOpen: true,
tooltipContent: 'Collapse to hide filters'
tooltipContent: collapseFilterTooltip
};

$scope.toggleFilterShown = () => {
const collapser = $elem.find('.filter-nav-link__collapser');
const filterPanelPill = $elem.find('.filter-panel__pill');
if ($scope.filterNavToggle.isOpen) {
$scope.filterNavToggle.tooltipContent = 'Expand to show filters';
$scope.filterNavToggle.tooltipContent = expandFilterTooltip;
collapser.attr('aria-expanded', 'false');
filterPanelPill.attr('style', 'width: calc(100% - 80px)');
} else {
$scope.filterNavToggle.tooltipContent = 'Collapse to hide filters';
$scope.filterNavToggle.tooltipContent = collapseFilterTooltip;
collapser.attr('aria-expanded', 'true');
filterPanelPill.attr('style', 'width: auto');
}
Expand Down
Loading

0 comments on commit c188f97

Please sign in to comment.