Skip to content

Commit

Permalink
Fixes i18n issue in space nav selector (#26742)
Browse files Browse the repository at this point in the history
## Summary

Wraps the Spaces `NavControlPopover` in `<I18nProvider>`.

Fixes #26736
  • Loading branch information
legrego authored and chrisronline committed Dec 12, 2018
1 parent 2078beb commit 90e88b2
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions x-pack/plugins/spaces/public/views/nav_control/nav_control.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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';
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
);
},
Expand Down

0 comments on commit 90e88b2

Please sign in to comment.