[6.x] Fixes i18n issue in space nav selector (#26742) (#27025)

Backports the following commits to 6.x:
 - Fixes i18n issue in space nav selector  (#26742)
This commit is contained in:
Larry Gregory 2018-12-12 07:49:06 -05:00 committed by GitHub
parent a87f486afd
commit cd7087b985
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,6 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { I18nProvider } from '@kbn/i18n/react';
import { constant } from 'lodash';
import { SpacesManager } from 'plugins/spaces/lib/spaces_manager';
// @ts-ignore
@ -13,8 +14,8 @@ import { NavControlPopover } from 'plugins/spaces/views/nav_control/nav_control_
import { PathProvider } from 'plugins/xpack_main/services/path';
import { UserProfileProvider } from 'plugins/xpack_main/services/user_profile';
import React from 'react';
import ReactDOM from 'react-dom';
import { render, unmountComponentAtNode } from 'react-dom';
import ReactDOM from 'react-dom';
import { NavControlSide } from 'ui/chrome/directives/header_global_nav';
// @ts-ignore
import { uiModules } from 'ui/modules';
@ -59,13 +60,15 @@ module.controller(
$scope.$parent.$watch('isVisible', function isVisibleWatcher(isVisible: boolean) {
if (isVisible && !mounted && !pathProvider.isUnauthenticated()) {
render(
<NavControlPopover
spacesManager={spacesManager}
activeSpace={activeSpace}
userProfile={userProfile}
anchorPosition={'rightCenter'}
buttonClass={SpacesGlobalNavButton}
/>,
<I18nProvider>
<NavControlPopover
spacesManager={spacesManager}
activeSpace={activeSpace}
userProfile={userProfile}
anchorPosition={'rightCenter'}
buttonClass={SpacesGlobalNavButton}
/>
</I18nProvider>,
domNode
);
mounted = true;
@ -113,13 +116,15 @@ chromeHeaderNavControlsRegistry.register(
spacesManager = new SpacesManager($http, chrome, spaceSelectorURL);
ReactDOM.render(
<NavControlPopover
spacesManager={spacesManager}
activeSpace={activeSpace}
userProfile={userProfile}
anchorPosition="downLeft"
buttonClass={SpacesHeaderNavButton}
/>,
<I18nProvider>
<NavControlPopover
spacesManager={spacesManager}
activeSpace={activeSpace}
userProfile={userProfile}
anchorPosition="downLeft"
buttonClass={SpacesHeaderNavButton}
/>
</I18nProvider>,
el
);
},