Skip to content

Commit

Permalink
fixing broken breadcrumb link for index management (#27164)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmcconaghy authored Dec 13, 2018
1 parent cb48cd6 commit 0efc605
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion x-pack/plugins/index_management/public/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
*/

import React from 'react';
import { Switch, Route } from 'react-router-dom';
import { Switch, Route, Redirect } from 'react-router-dom';
import { BASE_PATH } from '../common/constants';
import { IndexList } from './sections/index_list';

export const App = () => (
<div>
<Switch>
<Redirect exact from={`${BASE_PATH}`} to={`${BASE_PATH}indices`}/>
<Route exact path={`${BASE_PATH}indices`} component={IndexList} />
<Route path={`${BASE_PATH}indices/filter/:filter?`} component={IndexList}/>
</Switch>
Expand Down
8 changes: 6 additions & 2 deletions x-pack/plugins/index_management/public/register_routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import React from 'react';
import { render } from 'react-dom';
import { render, unmountComponentAtNode } from 'react-dom';
import { Provider } from 'react-redux';
import { HashRouter } from 'react-router-dom';
import { i18n } from '@kbn/i18n';
Expand All @@ -23,6 +23,7 @@ import template from './main.html';
import { manageAngularLifecycle } from './lib/manage_angular_lifecycle';
import { indexManagementStore } from './store';

let elem;
const renderReact = async (elem) => {
render(
<I18nProvider>
Expand All @@ -49,6 +50,9 @@ routes.when(`${BASE_PATH}:view?/:action?/:id?`, {
controllerAs: 'indexManagement',
controller: class IndexManagementController {
constructor($scope, $route, $http, kbnUrl, $rootScope) {
// clean up previously rendered React app if one exists
// this happens because of React Router redirects
elem && unmountComponentAtNode(elem);
// NOTE: We depend upon Angular's $http service because it's decorated with interceptors,
// e.g. to check license status per request.
setHttpClient($http);
Expand All @@ -59,7 +63,7 @@ routes.when(`${BASE_PATH}:view?/:action?/:id?`, {
}
});
$scope.$$postDigest(() => {
const elem = document.getElementById('indexManagementReactRoot');
elem = document.getElementById('indexManagementReactRoot');
renderReact(elem);
manageAngularLifecycle($scope, $route, elem);
});
Expand Down

0 comments on commit 0efc605

Please sign in to comment.