Skip to content

Commit

Permalink
Redirect enterprise_search to elasticsearch Urls
Browse files Browse the repository at this point in the history
  • Loading branch information
saikatsarkar056 committed Dec 19, 2024
1 parent 4af2706 commit b8c0e33
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import React from 'react';

import { Redirect, useLocation } from 'react-router-dom';

import { Routes, Route } from '@kbn/shared-ux-router';

import { NotFound } from '../applications/components/not_found';

const RedirectWithReplace = () => {
const location = useLocation();
const newPath = location.pathname.replace('/enterprise_search', '/elasticsearch');
return <Redirect to={newPath} />;
};

export const Applications = () => {
return (
<Routes>
<Route path="/enterprise_search/*" component={RedirectWithReplace} />
<Route>
<NotFound />
</Route>
</Routes>
);
};
21 changes: 21 additions & 0 deletions x-pack/plugins/enterprise_search/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,27 @@ export class EnterpriseSearchPlugin implements Plugin {
visibleIn: [],
});

core.application.register({
appRoute: '/app',
category: DEFAULT_APP_CATEGORIES.enterpriseSearch,
id: 'enterpriseSearchRedirect',
mount: async (params: AppMountParameters) => {
const kibanaDeps = await this.getKibanaDeps(core, params, cloud);
const { chrome, http } = kibanaDeps.core;
chrome.docTitle.change(ENTERPRISE_SEARCH_CONTENT_PLUGIN.NAME);

await this.getInitialData(http);
const pluginData = this.getPluginData();

const { renderApp } = await import('./applications');
const { Applications } = await import('./applications/enterprise_search_redirect');

return renderApp(Applications, kibanaDeps, pluginData);
},
title: 'EnterpriseSearchRedirect',
visibleIn: [],
});

if (plugins.home) {
plugins.home.featureCatalogue.registerSolution({
description: ENTERPRISE_SEARCH_OVERVIEW_PLUGIN.DESCRIPTION,
Expand Down

0 comments on commit b8c0e33

Please sign in to comment.