Skip to content

Commit

Permalink
Change getHistory for syncHistoryLocations (#6591)
Browse files Browse the repository at this point in the history
* Change getHistory for syncHistoryLocations

* Update changelog

* Add comment

---------

Co-authored-by: Federico Rodriguez <[email protected]>
  • Loading branch information
yenienserrano and asteriscos authored Apr 17, 2024
1 parent fb58356 commit bca15ab
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ All notable changes to the Wazuh app project will be documented in this file.

### Changed

- Moved the plugin menu to platform applications into the side menu [#5840](https://github.com/wazuh/wazuh-dashboard-plugins/pull/5840) [#6226](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6226) [#6244](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6244) [#6176](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6176) [#6423](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6423) [#6510](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6510)
- Moved the plugin menu to platform applications into the side menu [#5840](https://github.com/wazuh/wazuh-dashboard-plugins/pull/5840) [#6226](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6226) [#6244](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6244) [#6176](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6176) [#6423](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6423) [#6510](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6510) [#6591](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6591)
- Changed dashboards. [#6035](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6035)
- Change the display order of tabs in all modules. [#6067](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6067)
- Upgraded the `axios` dependency to `1.6.1` [#6114](https://github.com/wazuh/wazuh-dashboard-plugins/pull/6114)
Expand Down
17 changes: 12 additions & 5 deletions plugins/main/public/kibana-integrations/discover/build_services.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,15 @@ import { VisualizationsStart } from 'src/plugins/visualizations/public';
import { SavedObjectOpenSearchDashboardsServices } from 'src/plugins/saved_objects/public';

//import { createSavedSearchesLoader, SavedSearch } from './saved_searches';
import { getHistory } from './kibana_services';
import { syncHistoryLocations } from './kibana_services';
import { OpenSearchDashboardsLegacyStart } from '../../../../../src/plugins/opensearch_dashboards_legacy/public';
import { UrlForwardingStart } from '../../../../../src/plugins/url_forwarding/public';
import { NavigationPublicPluginStart } from '../../../../../src/plugins/navigation/public';
import { getDataPlugin, getNavigationPlugin, getVisualizationsPlugin } from '../../kibana-services';
import {
getDataPlugin,
getNavigationPlugin,
getVisualizationsPlugin,
} from '../../kibana-services';
//import { DiscoverStartPlugins, SavedSearch } from '../../../../../src/plugins/discover/public';

export interface DiscoverServices {
Expand Down Expand Up @@ -77,9 +81,9 @@ export async function buildServices(
core: CoreStart,
plugins: any, //DiscoverStartPlugins,
context: PluginInitializerContext,
getEmbeddableInjector: any
getEmbeddableInjector: any,
): Promise<DiscoverServices> {
/* const services: SavedObjectOpenSearchDashboardsServices = {
/* const services: SavedObjectOpenSearchDashboardsServices = {
savedObjectsClient: core.savedObjects.client,
indexPatterns: plugins.data.indexPatterns,
search: plugins.data.search,
Expand All @@ -99,7 +103,10 @@ export async function buildServices(
getEmbeddableInjector,
/* getSavedSearchById: async (id: string) => savedObjectService.get(id),
getSavedSearchUrlById: async (id: string) => savedObjectService.urlFor(id), */
history: getHistory,
/* Discover currently uses two history instances:
one from Opensearch Dashboards Platform and another from history package.
getHistory is replaced by the following function that is used each time the Discover application is loaded to synchronise both instances */
history: syncHistoryLocations,
indexPatterns: getDataPlugin().indexPatterns,
inspector: plugins.inspector,
metadata: {
Expand Down
4 changes: 2 additions & 2 deletions plugins/main/public/kibana-integrations/kibana-discover.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ function discoverController(
filterManager,
timefilter,
toastNotifications,
history: getHistory,
history: syncHistoryLocations,
uiSettings: config,
visualizations,
} = getServices();
Expand All @@ -218,7 +218,7 @@ function discoverController(
: undefined;
};

const history = getHistory();
const history = syncHistoryLocations();

const {
appStateContainer,
Expand Down
5 changes: 0 additions & 5 deletions plugins/main/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ import {
unregisterInterceptor,
} from './services/request-handler';
import { Applications, Categories } from './utils/applications';
import { syncHistoryLocations } from './kibana-integrations/discover/kibana_services';
import { euiPaletteColorBlind } from '@elastic/eui';

const innerAngularName = 'app/wazuh';
Expand Down Expand Up @@ -149,10 +148,6 @@ export class WazuhPlugin
setScopedHistory(params.history);
// This allows you to add the selectors to the navbar
setHeaderActionMenuMounter(params.setHeaderActionMenu);
// Discover currently uses two history instances:
// one from Kibana Platform and another from history package.
// Below function is used every time Discover app is loaded to synchronize both instances
syncHistoryLocations();
// Load application bundle
const { renderApp } = await import('./application');
// Get start services as specified in kibana.json
Expand Down

0 comments on commit bca15ab

Please sign in to comment.