Skip to content

Commit

Permalink
[FIX][Kibana][7.16.x-7.17.x] Fix error when building the visualizatio…
Browse files Browse the repository at this point in the history
…ns (#4196)

* fix: fix error when building the core visualizations
  - fix error in the `Agents` section caused by a not defined class.

* changelog: add PR entry
  • Loading branch information
Desvelao authored Jun 3, 2022
1 parent 4b5823b commit a8c8dc3
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 18 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ All notable changes to the Wazuh app project will be documented in this file.

### Changed

- Replaced the visualization of `Status` panel in `Agents` [#4166](https://github.com/wazuh/wazuh-kibana-app/pull/4166)
- Replaced the visualization of `Status` panel in `Agents` [#4166](https://github.com/wazuh/wazuh-kibana-app/pull/4166) [#4196](https://github.com/wazuh/wazuh-kibana-app/pull/4196)
- Replaced the visualization of policy in `Modules/Security configuration assessment/Inventory` [#4166](https://github.com/wazuh/wazuh-kibana-app/pull/4166)
- Consistency in the colors and labels used for the agent status [#4166](https://github.com/wazuh/wazuh-kibana-app/pull/4166)
- Replaced how the full and partial scan dates are displayed in the `Details` panel of `Vulnerabilities/Inventory` [#4169](https://github.com/wazuh/wazuh-kibana-app/pull/4169)
Expand Down
8 changes: 0 additions & 8 deletions public/controllers/agent/components/agents-preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,6 @@ export const AgentsPreview = compose(
this._isMount && this.setState({
showAgentsEvolutionVisualization: true
});
const tabVisualizations = new TabVisualizations();
tabVisualizations.removeAll();
tabVisualizations.setTab('general');
tabVisualizations.assign({
general: 1,
});
const filterHandler = new FilterHandler(AppState.getCurrentPattern());
await VisFactoryHandler.buildOverviewVisualizations(filterHandler, 'general', null);
}
}

Expand Down
13 changes: 4 additions & 9 deletions public/kibana-integrations/kibana-vis.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import { updateMetric } from '../redux/actions/visualizationsActions';
import { GenericRequest } from '../react-services/generic-request';
import { createSavedVisLoader } from './visualizations/saved_visualizations';
import { WzDatePicker } from '../components/wz-date-picker/wz-date-picker';
import { Vis } from '../../../../src/plugins/visualizations/public';
import {
EuiLoadingChart,
EuiLoadingSpinner,
Expand Down Expand Up @@ -286,14 +285,10 @@ class KibanaVis extends Component {
this.visualization
);

// In Kibana 7.10.2, there is a bug when creating the visualization with `createVis` method of the Visualization plugin that doesn't pass the `visState` parameter to the `Vis` class constructor.
// This does the `.params`, `.uiState` and `.id` properties of the visualization are not set correctly in the `Vis` class constructor. This bug causes
// that the visualization, for example, doesn't use the defined colors in the `.uiStateJSON` property.
// `createVis` method of Visualizations plugin: https://github.com/elastic/kibana/blob/v7.10.2/src/plugins/visualizations/public/plugin.ts#L207-L211
// `Vis` class constructor: https://github.com/elastic/kibana/blob/v7.10.2/src/plugins/visualizations/public/vis.ts#L99-L104
// This problem is fixed replicating the logic of Visualization plugin's `createVis` method and pass the expected parameters to the `Vis` class constructor.
const vis = new Vis(visState.type, visState);
await vis.setState(visState);
const vis = await getVisualizationsPlugin().createVis(
this.visualization.visState.type,
visState
);

this.visHandler = await getVisualizationsPlugin().__LEGACY.createVisEmbeddableFromObject(
vis,
Expand Down

0 comments on commit a8c8dc3

Please sign in to comment.