fixing broken breadcrumb link for index management (#27164) (#27172)

This commit is contained in:
Bill McConaghy 2018-12-13 19:11:59 -05:00 committed by GitHub
parent 73e7ac28f5
commit 73df41bd70
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View file

@ -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>

View file

@ -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 { I18nProvider } from '@kbn/i18n/react';
@ -21,6 +21,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>
@ -39,6 +40,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);
@ -49,7 +53,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);
});