mirror of
https://github.com/valitydev/wazuh-kibana-app.git
synced 2024-11-06 09:55:18 +00:00
Adapt for 7.8.0
This commit is contained in:
parent
4fc7f683fe
commit
bf198f8ae6
@ -10,13 +10,12 @@
|
||||
* Find more information about this on the LICENSE file.
|
||||
*/
|
||||
|
||||
// Imports the init module
|
||||
import { initApp } from './init';
|
||||
import { resolve } from 'path';
|
||||
import { WazuhPlugin, LegacySetup } from './server/plugin';
|
||||
|
||||
export default function(kibana) {
|
||||
export default (kibana) => {
|
||||
return new kibana.Plugin({
|
||||
require: ['kibana', 'elasticsearch', 'visualizations'],
|
||||
require: ['kibana', 'elasticsearch'],
|
||||
id: 'wazuh',
|
||||
name: 'wazuh',
|
||||
uiExports: {
|
||||
@ -24,7 +23,7 @@ export default function(kibana) {
|
||||
id: 'wazuh',
|
||||
title: 'Wazuh',
|
||||
description: 'Wazuh app for Kibana',
|
||||
icon: 'plugins/wazuh/img/icon.svg',
|
||||
icon: 'plugins/wazuh/img/icon_blue.svg',
|
||||
main: 'plugins/wazuh/app'
|
||||
},
|
||||
hacks: ['plugins/wazuh/icon-style'],
|
||||
@ -44,7 +43,16 @@ export default function(kibana) {
|
||||
}).default();
|
||||
},
|
||||
|
||||
init(server, options) {
|
||||
init(server) {
|
||||
const coreSetup = server.newPlatform.setup.core;
|
||||
const pluginsSetup: PluginsSetup = {
|
||||
discover: server.newPlatform.setup.plugins.discover
|
||||
};
|
||||
const legacySetup: LegacySetup = {
|
||||
server
|
||||
};
|
||||
|
||||
new WazuhPlugin().setup(coreSetup, pluginsSetup, legacySetup);
|
||||
// eslint-disable-line no-unused-vars
|
||||
const xpackMainPlugin = server.plugins.xpack_main;
|
||||
if (xpackMainPlugin) {
|
||||
@ -52,9 +60,9 @@ export default function(kibana) {
|
||||
|
||||
xpackMainPlugin.registerFeature({
|
||||
id: featureId,
|
||||
name: 'Wazuh',
|
||||
name: 'C',
|
||||
navLinkId: featureId,
|
||||
icon: '/plugins/wazuh/img/icon.svg',
|
||||
icon: '/plugins/wazuh/img/icon_blue.svg',
|
||||
app: [featureId],
|
||||
catalogue: [],
|
||||
privileges: {
|
||||
@ -79,9 +87,6 @@ export default function(kibana) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Add server routes and initialize the plugin here
|
||||
initApp(server, options);
|
||||
}
|
||||
});
|
||||
}
|
@ -4,7 +4,7 @@
|
||||
"revision": "0880",
|
||||
"code": "0880-0",
|
||||
"kibana": {
|
||||
"version": "7.7.1"
|
||||
"version": "7.8.0"
|
||||
},
|
||||
"description": "Wazuh app",
|
||||
"main": "index.js",
|
||||
|
@ -55,29 +55,25 @@
|
||||
float: right;
|
||||
}
|
||||
|
||||
.euiAccordion {
|
||||
.application .euiAccordion {
|
||||
margin: 0px -16px;
|
||||
border-top: none;
|
||||
border-bottom: 1px solid #d3dae6;
|
||||
}
|
||||
|
||||
.euiAccordion__triggerWrapper{
|
||||
.application .euiAccordion__triggerWrapper{
|
||||
padding: 0px 16px;
|
||||
}
|
||||
|
||||
.euiAccordion__triggerWrapper .euiTitle {
|
||||
.application .euiAccordion__triggerWrapper .euiTitle {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
/* .euiAccordion-isOpen .euiAccordion__childWrapper{
|
||||
height: unset!important;
|
||||
} */
|
||||
|
||||
.euiAccordion__childWrapper .flyout-row:not(.related-rules-row) .euiToolTipAnchor{
|
||||
.application .euiAccordion__childWrapper .flyout-row:not(.related-rules-row) .euiToolTipAnchor{
|
||||
//display: block!important;
|
||||
}
|
||||
|
||||
.euiAccordion__button {
|
||||
.application .euiAccordion__button {
|
||||
padding: 0px 0px 8px 0;
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,6 @@
|
||||
.wz-module-header-agent-wrapper, .wz-module-header-nav-wrapper{
|
||||
width: 100%;
|
||||
position: fixed;
|
||||
padding-left: 48px;
|
||||
z-index: 999;
|
||||
left: 0;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ export class ModulesHelper {
|
||||
);
|
||||
if (fields.length) {
|
||||
fields.forEach(field => {
|
||||
const attr = field.getAttribute('attr-field');
|
||||
const attr = field.getAttribute('data-attr-field');
|
||||
if (attr.startsWith('_')) {
|
||||
field.style.display = 'none';
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ wz-menu {
|
||||
.wz-menu-popover{
|
||||
position: fixed;
|
||||
top: 56px !important;
|
||||
left: 48px !important;
|
||||
left: 96px !important;
|
||||
border-radius: 0px 0px 4px 0px;
|
||||
max-height: unset!important;
|
||||
border-right: none!important;
|
||||
@ -107,7 +107,7 @@ wz-menu {
|
||||
}
|
||||
|
||||
.wz-menu-popover.wz-menu-popover-over{
|
||||
z-index: 11!important;
|
||||
z-index: 3000!important;
|
||||
}
|
||||
|
||||
.wz-menu-popover.wz-menu-popover-under{
|
||||
|
@ -9,8 +9,7 @@
|
||||
*
|
||||
* Find more information about this on the LICENSE file.
|
||||
*/
|
||||
import React, { Component } from 'react';
|
||||
import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
|
||||
import React, { Component, Fragment } from 'react';
|
||||
// Redux
|
||||
import store from '../../../../redux/store';
|
||||
|
||||
@ -22,8 +21,6 @@ import WzLogs from './mg-logs/logs';
|
||||
import WzReporting from './reporting/reporting-main';
|
||||
import WzConfiguration from './configuration/configuration-main';
|
||||
import WzStatistics from './statistics/statistics-main';
|
||||
// import { GroupsTable } from './groups/groups-table';
|
||||
// import { changeManagementSection } from '../../../../redux/reducers/managementReducers';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
class WzManagementMain extends Component {
|
||||
@ -44,20 +41,16 @@ class WzManagementMain extends Component {
|
||||
const { section } = this.props;
|
||||
const ruleset = ['ruleset', 'rules', 'decoders', 'lists'];
|
||||
return (
|
||||
<EuiFlexGroup>
|
||||
<EuiFlexItem style={{ marginBottom: 0 }}>
|
||||
<div>
|
||||
{(section === 'groups' && <WzGroups {...this.props} />) ||
|
||||
(section === 'status' && <WzStatus />) ||
|
||||
(section === 'reporting' && <WzReporting />) ||
|
||||
(section === 'statistics' && <WzStatistics />) ||
|
||||
(section === 'logs' && <WzLogs />) ||
|
||||
(section === 'configuration' && <WzConfiguration {...this.props.configurationProps} />) ||
|
||||
(ruleset.includes(section) && <WzRuleset />)
|
||||
}
|
||||
</div>
|
||||
</EuiFlexItem>
|
||||
</EuiFlexGroup>
|
||||
<Fragment>
|
||||
{(section === 'groups' && <WzGroups {...this.props} />) ||
|
||||
(section === 'status' && <WzStatus />) ||
|
||||
(section === 'reporting' && <WzReporting />) ||
|
||||
(section === 'statistics' && <WzStatistics />) ||
|
||||
(section === 'logs' && <WzLogs />) ||
|
||||
(section === 'configuration' && <WzConfiguration {...this.props.configurationProps} />) ||
|
||||
(ruleset.includes(section) && <WzRuleset />)
|
||||
}
|
||||
</Fragment>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -9,15 +9,10 @@
|
||||
*
|
||||
* Find more information about this on the LICENSE file.
|
||||
*/
|
||||
import chrome from 'ui/chrome';
|
||||
const IS_DARK_THEME = chrome.getUiSettingsClient().get('theme:darkMode');
|
||||
|
||||
/* eslint-disable no-undef */
|
||||
const newSS = document.createElement('link');
|
||||
const path = `../plugins/wazuh/less/${
|
||||
IS_DARK_THEME ? 'icon-style-w' : 'icon-style'
|
||||
}.css`;
|
||||
newSS.rel = 'stylesheet';
|
||||
newSS.href = path;
|
||||
newSS.href = '../plugins/wazuh/less/icon-style.css';
|
||||
document.getElementsByTagName('head')[0].appendChild(newSS);
|
||||
/* eslint-enable no-undef */
|
||||
|
@ -1,5 +0,0 @@
|
||||
<svg width="40.303738" height="44.000031" viewBox="0 0 10.663697 11.641675" version="1.1" id="svg8" xmlns="http://www.w3.org/2000/svg" xmlns:xlink= "http://www.w3.org/1999/xlink">
|
||||
<g id="layer2" transform="translate(-47.805736,-147.15347)">
|
||||
<path id="path874-3" d="m 55.670688,147.89073 -1.306598,2.74797 h -2.396404 l -1.431105,-2.74797 -0.99606,3.4906 -1.368118,1.56148 3.076068,2.82558 1.199668,2.76407 h 1.372514 l 1.133749,-2.71572 3.143452,-2.84903 -1.400345,-1.53658 z m -1.532176,7.37376 a 0.29295898,0.29295898 0 0 1 -0.118643,0.0997 0.38670583,0.38670583 0 0 1 -0.155278,0.0322 0.37791708,0.37791708 0 0 1 -0.146481,-0.0322 0.27831103,0.27831103 0 0 1 -0.114255,-0.0997 l -0.462875,-0.70016 -0.477523,0.70016 a 0.29295898,0.29295898 0 0 1 -0.114255,0.0997 0.38377626,0.38377626 0 0 1 -0.146481,0.0322 0.30907171,0.30907171 0 0 1 -0.273919,-0.13185 L 49.7573,153.05412 h 0.656229 l 2.003838,1.75776 0.401356,-0.62254 h 0.629862 l 0.439437,0.62546 2.030206,-1.83099 h 0.600566 z" class="a" style="fill:none;stroke:#000;stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"></path>
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 1.1 KiB |
@ -9,12 +9,7 @@ import {
|
||||
import { createTableRowDirective } from 'plugins/kibana/discover/np_ready/angular/doc_table/components/table_row';
|
||||
import { createInfiniteScrollDirective } from 'plugins/kibana/discover/np_ready/angular/doc_table/infinite_scroll';
|
||||
import { createDocViewerDirective } from 'plugins/kibana/discover/np_ready/angular/doc_viewer';
|
||||
import { createFieldSearchDirective } from 'plugins/kibana/discover/np_ready/components/field_chooser/discover_field_search_directive';
|
||||
import { createIndexPatternSelectDirective } from 'plugins/kibana/discover/np_ready/components/field_chooser/discover_index_pattern_directive';
|
||||
import { createStringFieldProgressBarDirective } from 'plugins/kibana/discover/np_ready/components/field_chooser/string_progress_bar';
|
||||
import { FieldNameDirectiveProvider } from 'plugins/kibana/discover/np_ready/angular/directives/field_name';
|
||||
import { createFieldChooserDirective } from 'plugins/kibana/discover/np_ready/components/field_chooser/field_chooser';
|
||||
import { createDiscoverFieldDirective } from 'plugins/kibana/discover/np_ready/components/field_chooser/discover_field';
|
||||
import { createDiscoverSidebarDirective } from 'plugins/kibana/discover/np_ready/components/sidebar';
|
||||
|
||||
const app = getAngularModule();
|
||||
|
||||
@ -27,9 +22,4 @@ app
|
||||
.directive('toolBarPagerButtons', createToolBarPagerButtonsDirective)
|
||||
.directive('kbnInfiniteScroll', createInfiniteScrollDirective)
|
||||
.directive('docViewer', createDocViewerDirective)
|
||||
.directive('fieldName', FieldNameDirectiveProvider)
|
||||
.directive('discoverFieldSearch', createFieldSearchDirective)
|
||||
.directive('discoverIndexPatternSelect', createIndexPatternSelectDirective)
|
||||
.directive('stringFieldProgressBar', createStringFieldProgressBarDirective)
|
||||
.directive('discoverField', createDiscoverFieldDirective)
|
||||
.directive('discFieldChooser', createFieldChooserDirective);
|
||||
.directive('discoverSidebar', createDiscoverSidebarDirective)
|
||||
|
@ -49,11 +49,11 @@ import { RequestAdapter } from '../../../../src/plugins/inspector/public';
|
||||
import { getSortArray, getSortForSearchSource } from 'plugins/kibana/discover/np_ready/angular/doc_table';
|
||||
import * as columnActions from 'plugins/kibana/discover/np_ready/angular/doc_table/actions/columns';
|
||||
|
||||
import { addHelpMenuToAppChrome } from 'plugins/kibana/discover/np_ready/components/help_menu/help_menu_util';
|
||||
import 'plugins/kibana/discover/np_ready/components/fetch_error';
|
||||
import { getPainlessError } from 'plugins/kibana/discover/np_ready/angular/get_painless_error';
|
||||
import { discoverResponseHandler } from 'plugins/kibana/discover/np_ready/angular/response_handler';
|
||||
import {
|
||||
getHistory,
|
||||
getRequestInspectorStats,
|
||||
getResponseInspectorStats,
|
||||
getServices,
|
||||
@ -68,7 +68,6 @@ import { buildServices } from 'plugins/kibana/discover/build_services';
|
||||
import { npStart } from 'ui/new_platform';
|
||||
import { WazuhConfig } from '../react-services/wazuh-config';
|
||||
import { ModulesHelper } from '../components/common/modules/modules-helper';
|
||||
import { start as visualizations } from '../../../../src/legacy/core_plugins/visualizations/public/np_ready/public/legacy';
|
||||
///////////
|
||||
|
||||
import {
|
||||
@ -90,10 +89,12 @@ const fetchStatuses = {
|
||||
|
||||
const app = uiModules.get('app/discover', []);
|
||||
const wazuhApp = getAngularModule('app/wazuh');
|
||||
const buildGetHistory = getHistory;
|
||||
app.run(async () => {
|
||||
const services = await buildServices(
|
||||
npStart.core,
|
||||
npStart.plugins
|
||||
npStart.plugins,
|
||||
buildGetHistory
|
||||
);
|
||||
setServices(services);
|
||||
});
|
||||
@ -140,7 +141,8 @@ function discoverController(
|
||||
(async () => {
|
||||
const services = await buildServices(
|
||||
npStart.core,
|
||||
npStart.plugins
|
||||
npStart.plugins,
|
||||
buildGetHistory
|
||||
);
|
||||
setServices(services);
|
||||
})();
|
||||
@ -149,16 +151,19 @@ function discoverController(
|
||||
core,
|
||||
chrome,
|
||||
data,
|
||||
history,
|
||||
filterManager,
|
||||
timefilter,
|
||||
toastNotifications,
|
||||
uiSettings: config
|
||||
history: getHistory,
|
||||
uiSettings: config,
|
||||
visualizations
|
||||
} = getServices();
|
||||
|
||||
const wazuhConfig = new WazuhConfig();
|
||||
const modulesHelper = ModulesHelper;
|
||||
|
||||
const history = getHistory();
|
||||
|
||||
const getTimeField = () => {
|
||||
return isDefaultType($scope.indexPattern) ? $scope.indexPattern.timeFieldName : undefined;
|
||||
};
|
||||
@ -199,7 +204,7 @@ function discoverController(
|
||||
{ filters: esFilters.FilterStateStore.APP_STATE }
|
||||
);
|
||||
|
||||
const appStateUnsubscribe = appStateContainer.subscribe(async newState => {
|
||||
const appStateUnsubscribe = appStateContainer.subscribe(async (newState) => {
|
||||
const { state: newStatePartial } = splitState(newState);
|
||||
const { state: oldStatePartial } = splitState(getPreviousAppState());
|
||||
|
||||
@ -209,7 +214,7 @@ function discoverController(
|
||||
|
||||
// detect changes that should trigger fetching of new data
|
||||
const changes = ['interval', 'sort', 'query'].filter(
|
||||
prop => !_.isEqual(newStatePartial[prop], oldStatePartial[prop])
|
||||
(prop) => !_.isEqual(newStatePartial[prop], oldStatePartial[prop])
|
||||
);
|
||||
|
||||
if (changes.length) {
|
||||
@ -228,7 +233,7 @@ function discoverController(
|
||||
}
|
||||
});
|
||||
|
||||
$scope.setIndexPattern = async id => {
|
||||
$scope.setIndexPattern = async (id) => {
|
||||
await replaceUrlAppState({ index: id });
|
||||
$route.reload();
|
||||
};
|
||||
@ -244,7 +249,7 @@ function discoverController(
|
||||
$scope.updateDataSource();
|
||||
},
|
||||
},
|
||||
error => addFatalError(core.fatalErrors, error)
|
||||
(error) => addFatalError(core.fatalErrors, error)
|
||||
)
|
||||
);
|
||||
|
||||
@ -252,7 +257,7 @@ function discoverController(
|
||||
requests: new RequestAdapter(),
|
||||
};
|
||||
|
||||
$scope.timefilterUpdateHandler = ranges => {
|
||||
$scope.timefilterUpdateHandler = (ranges) => {
|
||||
timefilter.setTime({
|
||||
from: moment(ranges.from).toISOString(),
|
||||
to: moment(ranges.to).toISOString(),
|
||||
@ -270,7 +275,7 @@ function discoverController(
|
||||
|
||||
$scope.$watch(
|
||||
() => uiCapabilities.discover.saveQuery,
|
||||
newCapability => {
|
||||
(newCapability) => {
|
||||
$scope.showSaveQuery = newCapability;
|
||||
}
|
||||
);
|
||||
@ -348,8 +353,8 @@ function discoverController(
|
||||
return $scope.fieldCounts;
|
||||
}
|
||||
|
||||
return await new Promise(resolve => {
|
||||
const unwatch = $scope.$watch('fetchStatus', newValue => {
|
||||
return await new Promise((resolve) => {
|
||||
const unwatch = $scope.$watch('fetchStatus', (newValue) => {
|
||||
if (newValue === fetchStatuses.COMPLETE) {
|
||||
unwatch();
|
||||
resolve($scope.fieldCounts);
|
||||
@ -406,8 +411,8 @@ function discoverController(
|
||||
fields: selectFields,
|
||||
metaFields: $scope.indexPattern.metaFields,
|
||||
conflictedTypesFields: $scope.indexPattern.fields
|
||||
.filter(f => f.type === 'conflict')
|
||||
.map(f => f.name),
|
||||
.filter((f) => f.type === 'conflict')
|
||||
.map((f) => f.name),
|
||||
indexPatternId: searchSource.getField('index').id,
|
||||
};
|
||||
};
|
||||
@ -544,7 +549,7 @@ function discoverController(
|
||||
$scope.updateTime();
|
||||
},
|
||||
},
|
||||
error => addFatalError(core.fatalErrors, error)
|
||||
(error) => addFatalError(core.fatalErrors, error)
|
||||
)
|
||||
);
|
||||
//Handling change oft the histogram interval
|
||||
@ -643,7 +648,7 @@ function discoverController(
|
||||
});
|
||||
})
|
||||
.then(onResults)
|
||||
.catch(error => {
|
||||
.catch((error) => {
|
||||
// If the request was aborted then no need to surface this error in the UI
|
||||
if (error instanceof Error && error.name === 'AbortError') return;
|
||||
|
||||
@ -682,7 +687,7 @@ function discoverController(
|
||||
}
|
||||
};
|
||||
|
||||
$scope.updateSavedQueryId = newSavedQueryId => {
|
||||
$scope.updateSavedQueryId = (newSavedQueryId) => {
|
||||
if (newSavedQueryId) {
|
||||
setAppState({ savedQuery: newSavedQueryId });
|
||||
} else {
|
||||
@ -737,6 +742,7 @@ function discoverController(
|
||||
if ($scope.vis.data.aggs.aggs[1]) {
|
||||
$scope.bucketInterval = $scope.vis.data.aggs.aggs[1].buckets.getInterval();
|
||||
}
|
||||
$scope.updateTime();
|
||||
}
|
||||
|
||||
$scope.hits = resp.hits.total;
|
||||
@ -747,9 +753,9 @@ function discoverController(
|
||||
// if we haven't counted yet, reset the counts
|
||||
const counts = ($scope.fieldCounts = $scope.fieldCounts || {});
|
||||
|
||||
$scope.rows.forEach(hit => {
|
||||
$scope.rows.forEach((hit) => {
|
||||
const fields = Object.keys($scope.indexPattern.flattenHit(hit));
|
||||
fields.forEach(fieldName => {
|
||||
fields.forEach((fieldName) => {
|
||||
counts[fieldName] = (counts[fieldName] || 0) + 1;
|
||||
});
|
||||
});
|
||||
@ -767,7 +773,7 @@ function discoverController(
|
||||
});
|
||||
inspectorRequest = inspectorAdapters.requests.start(title, { description });
|
||||
inspectorRequest.stats(getRequestInspectorStats($scope.searchSource));
|
||||
$scope.searchSource.getSearchRequestBody().then(body => {
|
||||
$scope.searchSource.getSearchRequestBody().then((body) => {
|
||||
inspectorRequest.json(body);
|
||||
});
|
||||
}
|
||||
@ -796,6 +802,7 @@ function discoverController(
|
||||
|
||||
$scope.resetQuery = function () {
|
||||
history.push(`/discover/${encodeURIComponent($route.current.params.id)}`);
|
||||
$route.reload();
|
||||
};
|
||||
|
||||
$scope.newQuery = function () {
|
||||
@ -831,10 +838,18 @@ function discoverController(
|
||||
// Wazuh. Set the size to 0 depending on the selected searchSource
|
||||
const size = noHits ? 0 : $scope.opts.sampleSize;
|
||||
searchSource
|
||||
.setField('index', $scope.indexPattern)
|
||||
.setField('size', size) // Wazuh. Use custom size
|
||||
.setField('sort', getSortForSearchSource($scope.state.sort, indexPattern))
|
||||
.setField('query', !$scope.state.query ? null : $scope.state.query)
|
||||
.setField('filter', filterManager.filters);
|
||||
.setField(
|
||||
'sort',
|
||||
getSortForSearchSource(
|
||||
$scope.state.sort,
|
||||
indexPattern,
|
||||
config.get('discover:sort:defaultOrder')
|
||||
)
|
||||
)
|
||||
.setField('query', $scope.state.query || null)
|
||||
.setField('filter', filterManager.getFilters());
|
||||
|
||||
//Wazuh update the visualizations
|
||||
$rootScope.$broadcast('updateVis');
|
||||
@ -1074,7 +1089,8 @@ function discoverController(
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
init();
|
||||
// Propagate current app state to url, then start syncing
|
||||
replaceUrlAppState().then(() => startStateSync());
|
||||
}
|
||||
}
|
@ -12,7 +12,6 @@
|
||||
import React, { Component } from 'react';
|
||||
|
||||
import $ from 'jquery';
|
||||
import { start as embeddables } from 'plugins/embeddable_api/np_ready/public/legacy';
|
||||
import { timefilter } from 'ui/timefilter';
|
||||
import dateMath from '@elastic/datemath';
|
||||
import { DiscoverPendingUpdates } from '../factories/discover-pending-updates';
|
||||
@ -26,9 +25,9 @@ import { updateMetric } from '../redux/actions/visualizationsActions';
|
||||
import { GenericRequest } from '../react-services/generic-request';
|
||||
import { npStart } from 'ui/new_platform';
|
||||
import { createSavedVisLoader } from './saved_visualizations';
|
||||
import { TypesService } from '../../../../src/legacy/core_plugins/visualizations/public';
|
||||
import { Vis } from '../../../../src/legacy/core_plugins/visualizations/public/np_ready/public/types';
|
||||
import { convertToSerializedVis } from '../../../../src/legacy/core_plugins/visualizations/public/np_ready/public/saved_visualizations/_saved_vis';
|
||||
import { TypesService } from '../../../../src/plugins/visualizations/public/vis_types';
|
||||
import { Vis } from '../../../../src/plugins/visualizations/public';
|
||||
import { convertToSerializedVis } from '../../../../src/plugins/visualizations/public/saved_visualizations/_saved_vis';
|
||||
import { toastNotifications } from 'ui/notify';
|
||||
import { getAngularModule } from 'plugins/kibana/discover/kibana_services';
|
||||
import { EuiLoadingChart } from '@elastic/eui';
|
||||
@ -57,6 +56,7 @@ class KibanaVis extends Component {
|
||||
const services = {
|
||||
savedObjectsClient: npStart.core.savedObjects.client,
|
||||
indexPatterns: npStart.plugins.data.indexPatterns,
|
||||
search: npStart.plugins.data.search,
|
||||
chrome: npStart.core.chrome,
|
||||
overlays: npStart.core.overlays
|
||||
};
|
||||
@ -65,7 +65,6 @@ class KibanaVis extends Component {
|
||||
...{ visualizationTypes: new TypesService().start() },
|
||||
}
|
||||
this.savedObjectLoaderVisualize = createSavedVisLoader(servicesForVisualizations);
|
||||
this.factory = null;
|
||||
this.visID = this.props.visID;
|
||||
this.tab = this.props.tab;
|
||||
}
|
||||
@ -198,10 +197,6 @@ class KibanaVis extends Component {
|
||||
query
|
||||
};
|
||||
|
||||
if (!this.factory) {
|
||||
this.factory = embeddables.getEmbeddableFactory('visualization');
|
||||
}
|
||||
|
||||
if (raw && discoverList.length) {
|
||||
// There are pending updates from the discover (which is the one who owns the true app state)
|
||||
|
||||
@ -219,7 +214,7 @@ class KibanaVis extends Component {
|
||||
// Visualization doesn't need "hits"
|
||||
this.visualization.searchSource.setField('size', 0);
|
||||
const vis = new Vis(this.visualization.visState.type, await convertToSerializedVis(this.visualization));
|
||||
this.visHandler = await this.factory.createFromObject(
|
||||
this.visHandler = await npStart.plugins.visualizations.__LEGACY.createVisEmbeddableFromObject(
|
||||
vis,
|
||||
visInput
|
||||
);
|
||||
|
@ -10,12 +10,11 @@
|
||||
* Find more information about this on the LICENSE file.
|
||||
*/
|
||||
import $ from 'jquery';
|
||||
import { start as embeddables } from 'plugins/embeddable_api/np_ready/public/legacy';
|
||||
import { timefilter } from 'ui/timefilter';
|
||||
import dateMath from '@elastic/datemath';
|
||||
import { npStart } from 'ui/new_platform';
|
||||
import { createSavedVisLoader } from './saved_visualizations';
|
||||
import { TypesService } from '../../../../src/legacy/core_plugins/visualizations/public';
|
||||
import { TypesService } from '../../../../src/plugins/visualizations/public/vis_types';
|
||||
import { getAngularModule } from 'plugins/kibana/discover/kibana_services';
|
||||
import { GenericRequest } from '../react-services/generic-request';
|
||||
import { ErrorHandler } from '../react-services/error-handler';
|
||||
@ -49,6 +48,7 @@ app.directive('kbnVis', function() {
|
||||
const services = {
|
||||
savedObjectsClient: npStart.core.savedObjects.client,
|
||||
indexPatterns: npStart.plugins.data.indexPatterns,
|
||||
search: npStart.plugins.data.search,
|
||||
chrome: npStart.core.chrome,
|
||||
overlays: npStart.core.overlays
|
||||
};
|
||||
@ -115,10 +115,6 @@ app.directive('kbnVis', function() {
|
||||
query
|
||||
};
|
||||
|
||||
if (!factory) {
|
||||
factory = embeddables.getEmbeddableFactory('visualization');
|
||||
}
|
||||
|
||||
if (raw && discoverList.length) {
|
||||
// There are pending updates from the discover (which is the one who owns the true app state)
|
||||
|
||||
@ -138,7 +134,7 @@ app.directive('kbnVis', function() {
|
||||
// Visualization doesn't need "hits"
|
||||
visualization.searchSource.setField('size', 0);
|
||||
|
||||
visHandler = await factory.createFromObject(
|
||||
visHandler = await npStart.plugins.visualizations.__LEGACY.createVisEmbeddableFromObject(
|
||||
visualization,
|
||||
visInput
|
||||
);
|
||||
@ -270,9 +266,6 @@ app.directive('kbnVis', function() {
|
||||
// Forcing a digest cycle
|
||||
$rootScope.$applyAsync();
|
||||
};
|
||||
|
||||
// Initializing the visualization
|
||||
let factory = null;
|
||||
}
|
||||
};
|
||||
});
|
||||
|
@ -104,7 +104,7 @@ export class SavedObjectLoader {
|
||||
async delete(ids: string | string[]) {
|
||||
const idsUsed = !Array.isArray(ids) ? [ids] : ids;
|
||||
|
||||
const deletions = idsUsed.map(id => {
|
||||
const deletions = idsUsed.map((id) => {
|
||||
// @ts-ignore
|
||||
const savedObject = new this.Class(id);
|
||||
return savedObject.delete();
|
||||
@ -118,11 +118,11 @@ export class SavedObjectLoader {
|
||||
coreNavLinks
|
||||
.getAll()
|
||||
.filter(
|
||||
link =>
|
||||
(link) =>
|
||||
link.linkToLastSubUrl &&
|
||||
idsUsed.find(deletedId => link.url && link.url.includes(deletedId)) !== undefined
|
||||
idsUsed.find((deletedId) => link.url && link.url.includes(deletedId)) !== undefined
|
||||
)
|
||||
.forEach(link => coreNavLinks.update(link.id, { url: link.baseUrl }));
|
||||
.forEach((link) => coreNavLinks.update(link.id, { url: link.baseUrl }));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -168,19 +168,19 @@ export class SavedObjectLoader {
|
||||
defaultSearchOperator: 'AND',
|
||||
fields,
|
||||
} as SavedObjectsFindOptions)
|
||||
.then(resp => {
|
||||
.then((resp) => {
|
||||
return {
|
||||
total: resp.total,
|
||||
hits: resp.savedObjects.map(savedObject => this.mapSavedObjectApiHits(savedObject)),
|
||||
hits: resp.savedObjects.map((savedObject) => this.mapSavedObjectApiHits(savedObject)),
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
find(search: string = '', size: number = 100) {
|
||||
return this.findAll(search, size).then(resp => {
|
||||
return this.findAll(search, size).then((resp) => {
|
||||
return {
|
||||
total: resp.total,
|
||||
hits: resp.hits.filter(savedObject => !savedObject.error),
|
||||
hits: resp.hits.filter((savedObject) => !savedObject.error),
|
||||
};
|
||||
});
|
||||
}
|
||||
|
@ -18,9 +18,9 @@
|
||||
*/
|
||||
import { SavedObjectLoader } from './saved_object_loader';
|
||||
import { SavedObjectKibanaServices } from '../../../../src/plugins/saved_objects/public';
|
||||
import { findListItems } from 'plugins/visualizations/np_ready/public/saved_visualizations/find_list_items';
|
||||
import { createSavedVisClass } from 'plugins/visualizations/np_ready/public/saved_visualizations/_saved_vis';
|
||||
import { TypesStart } from 'plugins/visualizations/vis_types';
|
||||
import { findListItems } from '../../../../src/plugins/visualizations/public/saved_visualizations/find_list_items';
|
||||
import { createSavedVisClass } from '../../../../src/plugins/visualizations/public/saved_visualizations/_saved_vis';
|
||||
import { TypesStart } from '../../../../src/plugins/visualizations/public/vis_types';
|
||||
|
||||
export interface SavedObjectKibanaServicesWithVisualizations extends SavedObjectKibanaServices {
|
||||
visualizationTypes: TypesStart;
|
||||
@ -74,5 +74,9 @@ export function createSavedVisLoader(services: SavedObjectKibanaServicesWithVisu
|
||||
}
|
||||
}
|
||||
const SavedVis = createSavedVisClass(services);
|
||||
return new SavedObjectLoaderVisualize(SavedVis, savedObjectsClient, services.chrome);
|
||||
return new SavedObjectLoaderVisualize(
|
||||
SavedVis,
|
||||
savedObjectsClient,
|
||||
services.chrome
|
||||
) as SavedObjectLoader & { findListItems: (search: string, size: number) => any };
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ export function createTopNavDirective() {
|
||||
return {
|
||||
restrict: 'E',
|
||||
template: '',
|
||||
compile: elem => {
|
||||
compile: (elem) => {
|
||||
const child = document.createElement('wz-top-nav-helper');
|
||||
|
||||
// Copy attributes to the child directive
|
||||
@ -44,7 +44,7 @@ export function createTopNavDirective() {
|
||||
$scope.$watch(
|
||||
() => {
|
||||
const config = $scope.$eval($attr.config) || [];
|
||||
return config.map(item => {
|
||||
return config.map((item) => {
|
||||
// Copy key into id, as it's a reserved react propery.
|
||||
// This is done for Angular directive backward compatibility.
|
||||
// In React only id is recognized.
|
||||
@ -59,7 +59,7 @@ export function createTopNavDirective() {
|
||||
return item.disableButton;
|
||||
});
|
||||
},
|
||||
newVal => {
|
||||
(newVal) => {
|
||||
$scope.disabledButtons = newVal;
|
||||
},
|
||||
true
|
||||
@ -71,7 +71,7 @@ export function createTopNavDirective() {
|
||||
};
|
||||
}
|
||||
|
||||
export const createTopNavHelper = ({ TopNavMenu }) => reactDirective => {
|
||||
export const createTopNavHelper = ({ TopNavMenu }) => (reactDirective) => {
|
||||
return reactDirective(TopNavMenu, [
|
||||
['config', { watchDepth: 'value' }],
|
||||
['disabledButtons', { watchDepth: 'reference' }],
|
||||
|
@ -1557,11 +1557,11 @@ div.euiPopover__panel.euiPopover__panel-isOpen.euiPopover__panel--bottom.wz-menu
|
||||
}
|
||||
|
||||
.chrHeaderWrapper--navIsLocked ~ .app-wrapper .wz-module-header-agent-wrapper {
|
||||
padding-left: 240px;
|
||||
padding-left: 320px;
|
||||
}
|
||||
|
||||
.chrHeaderWrapper--navIsLocked ~ .app-wrapper .wz-module-header-nav-wrapper {
|
||||
padding-left: 240px;
|
||||
padding-left: 320px;
|
||||
}
|
||||
|
||||
.icon-box-action {
|
||||
|
@ -380,7 +380,7 @@ md-divider.md-default-theme, md-divider {
|
||||
border-top: 1px solid #343741!important;
|
||||
}
|
||||
|
||||
.euiAccordion {
|
||||
.flyout-body .euiAccordion {
|
||||
border-bottom: 1px solid #343741!important;
|
||||
}
|
||||
|
||||
|
@ -1,23 +0,0 @@
|
||||
.euiNavDrawerGroup__item .euiListGroupItem__button .euiImage {
|
||||
filter: invert(100%);
|
||||
max-width: 18px;
|
||||
left: -1px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.euiNavDrawerGroup__item .euiListGroupItem__button .euiImage img{
|
||||
height: 18px;
|
||||
width: 18px;
|
||||
}
|
||||
|
||||
.euiNavDrawer:not(.euiNavDrawer-isExpanded) .euiNavDrawerGroup__item .euiListGroupItem__button .euiListGroupItem__label {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.euiNavDrawer:not(.euiNavDrawer-isExpanded) .euiNavDrawerGroup__item .euiListGroupItem__button .euiImage {
|
||||
margin-right: 0!important;
|
||||
}
|
||||
|
||||
.euiNavDrawer .euiNavDrawerGroup__item .euiListGroupItem__button .euiImage {
|
||||
margin-right: 10px;
|
||||
}
|
@ -1,21 +1,13 @@
|
||||
.euiNavDrawerGroup__item .euiListGroupItem__button .euiImage {
|
||||
left: -2px;
|
||||
max-width: 18px;
|
||||
.euiCollapsibleNav .euiCollapsibleNavGroup .euiListGroupItem__button .euiImage {
|
||||
max-width: 24px;
|
||||
}
|
||||
|
||||
.euiNavDrawerGroup__item .euiListGroupItem__button .euiImage img{
|
||||
height: 18px;
|
||||
width: 18px;
|
||||
.euiCollapsibleNav .euiCollapsibleNavGroup .euiListGroupItem__button .euiImage img{
|
||||
height: 24px;
|
||||
width: 24px;
|
||||
filter: brightness(0) saturate(100%) invert(24%) sepia(97%) saturate(1757%) hue-rotate(186deg) brightness(94%) contrast(101%);
|
||||
}
|
||||
|
||||
.euiNavDrawer:not(.euiNavDrawer-isExpanded) .euiNavDrawerGroup__item .euiListGroupItem__button .euiListGroupItem__label {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.euiNavDrawer:not(.euiNavDrawer-isExpanded) .euiNavDrawerGroup__item .euiListGroupItem__button .euiImage {
|
||||
margin-right: 0!important;
|
||||
}
|
||||
|
||||
.euiNavDrawer .euiNavDrawerGroup__item .euiListGroupItem__button .euiImage {
|
||||
margin-right: 10px;
|
||||
.euiCollapsibleNav .euiCollapsibleNavGroup .euiListGroupItem__button .euiImage {
|
||||
margin: 0px 8px 0px 0px
|
||||
}
|
@ -16,17 +16,13 @@
|
||||
|
||||
html{
|
||||
font-size: 14.5px!important;
|
||||
font-family: "Inter UI", -apple-system, BlinkMacSystemFont, "Segoe UI"!important;
|
||||
font-family: "Inter UI", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"!important;
|
||||
}
|
||||
|
||||
.h-100{
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#kibana-body{
|
||||
min-height: calc(~'100vh - 1px') !important;
|
||||
}
|
||||
|
||||
/* Margins */
|
||||
|
||||
.wz-margin-right-8 {
|
||||
|
@ -13,9 +13,11 @@ import { healthCheck } from './health-check';
|
||||
import { recentlyAccessed } from '../../../../../src/core/public/chrome/recently_accessed';
|
||||
import { createSavedSearchesLoader } from '../../../../../src/plugins/discover/public';
|
||||
import { npStart } from 'ui/new_platform';
|
||||
import {
|
||||
redirectWhenMissing,
|
||||
} from 'plugins/kibana/discover/kibana_services';
|
||||
|
||||
export function getSavedSearch(
|
||||
redirectWhenMissing,
|
||||
$location,
|
||||
$window,
|
||||
$route
|
||||
@ -23,12 +25,12 @@ export function getSavedSearch(
|
||||
const services = {
|
||||
savedObjectsClient: npStart.core.savedObjects.client,
|
||||
indexPatterns: npStart.plugins.data.indexPatterns,
|
||||
search: npStart.plugins.data.search,
|
||||
chrome: npStart.core.chrome,
|
||||
overlays: npStart.core.overlays,
|
||||
};
|
||||
|
||||
const savedSearches = createSavedSearchesLoader(services);
|
||||
|
||||
const currentParams = $location.search();
|
||||
const targetedAgent =
|
||||
currentParams && (currentParams.agent || currentParams.agent === '000');
|
||||
@ -58,6 +60,6 @@ export function getSavedSearch(
|
||||
'/management/kibana/objects/savedSearches/' +
|
||||
$route.current.params.id
|
||||
})
|
||||
);
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -86,7 +86,6 @@ function nestedResolve($q, errorHandler, $rootScope, $location, $window) {
|
||||
}
|
||||
|
||||
function savedSearch(
|
||||
redirectWhenMissing,
|
||||
$location,
|
||||
$window,
|
||||
$rootScope,
|
||||
@ -96,7 +95,6 @@ function savedSearch(
|
||||
if (!healthCheckStatus) return;
|
||||
assignPreviousLocation($rootScope, $location);
|
||||
return getSavedSearch(
|
||||
redirectWhenMissing,
|
||||
$location,
|
||||
$window,
|
||||
$route
|
||||
|
@ -5,37 +5,38 @@
|
||||
<wz-top-nav
|
||||
app-name="'discover'"
|
||||
config="topNavMenu"
|
||||
show-search-bar="tabView"
|
||||
show-filter-bar="tabView !== 'cluster-monitoring'"
|
||||
show-query-input="tabView !== 'cluster-monitoring'"
|
||||
show-date-picker="indexPattern.isTimeBased()"
|
||||
show-save-query="showSaveQuery && tabView !== 'cluster-monitoring'"
|
||||
index-patterns="[indexPattern]"
|
||||
on-query-submit="updateQuery"
|
||||
on-saved-query-id-change="updateSavedQueryId"
|
||||
query="state.query"
|
||||
saved-query-id="state.savedQuery"
|
||||
screen-title="screenTitle"
|
||||
show-search-bar="tabView"
|
||||
show-filter-bar="tabView !== 'cluster-monitoring'"
|
||||
show-query-input="tabView !== 'cluster-monitoring'"
|
||||
show-date-picker="indexPattern.isTimeBased()"
|
||||
show-save-query="showSaveQuery && tabView !== 'cluster-monitoring'"
|
||||
use-default-behaviors="true"
|
||||
>
|
||||
</wz-top-nav>
|
||||
</wz-top-nav>
|
||||
|
||||
<main ng-show="tabView !== 'cluster-monitoring'" class="container-fluid">
|
||||
<div ng-show="tabView === 'discover'" class="row">
|
||||
<div ng-show="tabView === 'discover'" class="col-md-2 sidebar-container collapsible-sidebar" id="discover-sidebar" data-test-subj="discover-sidebar">
|
||||
<main ng-show="tabView !== 'cluster-monitoring'" class="container-fluid">
|
||||
<div ng-show="tabView === 'discover'" class="row">
|
||||
<div ng-show="tabView === 'discover'" class="col-md-2 dscSidebar__container collapsible-sidebar" id="discover-sidebar" data-test-subj="discover-sidebar">
|
||||
<div class="dscFieldChooser">
|
||||
<disc-field-chooser
|
||||
<discover-sidebar
|
||||
columns="state.columns"
|
||||
hits="rows"
|
||||
field-counts="fieldCounts"
|
||||
index-pattern="searchSource.getField('index')"
|
||||
hits="rows"
|
||||
index-pattern-list="opts.indexPatternList"
|
||||
state="state"
|
||||
on-add-field="addColumn"
|
||||
on-add-filter="filterQuery"
|
||||
on-remove-field="removeColumn"
|
||||
selected-index-pattern="searchSource.getField('index')"
|
||||
set-index-pattern="setIndexPattern"
|
||||
state="state"
|
||||
>
|
||||
</disc-field-chooser>
|
||||
</discover-sidebar>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -103,6 +104,7 @@
|
||||
class="kuiLink"
|
||||
type="button"
|
||||
id="reload_saved_search"
|
||||
data-test-subj="resetSavedSearch"
|
||||
ng-click="resetQuery()"
|
||||
>
|
||||
{{::'kbn.discover.reloadSavedSearchButton' | i18n: {defaultMessage: 'Reset search'} }}
|
||||
|
46
server/plugin.ts
Normal file
46
server/plugin.ts
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
import {
|
||||
CoreSetup,
|
||||
CoreStart,
|
||||
Plugin,
|
||||
} from '../../../src/core/server';
|
||||
|
||||
import { WazuhPluginSetup, WazuhPluginStart } from './types';
|
||||
|
||||
import { initApp } from '../init';
|
||||
|
||||
interface LegacySetup {
|
||||
server: Legacy.server
|
||||
}
|
||||
|
||||
export class WazuhPlugin implements Plugin<WazuhPluginSetup, WazuhPluginStart> {
|
||||
public setup(core: CoreSetup, plugins: WazuhPluginSetup, __LEGACY: LegacySetup) {
|
||||
// Add server routes and initialize the plugin here
|
||||
initApp(__LEGACY.server);
|
||||
return {};
|
||||
}
|
||||
|
||||
public start(core: CoreStart) {
|
||||
return {};
|
||||
}
|
||||
|
||||
public stop() { }
|
||||
}
|
23
server/types.ts
Normal file
23
server/types.ts
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||
* license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright
|
||||
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||
* the Apache License, Version 2.0 (the "License"); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface WazuhPluginSetup {}
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface WazuhPluginStart {}
|
Loading…
Reference in New Issue
Block a user