Skip to content

Commit

Permalink
Update WorkplaceSearch to render its header actions from app, not plu…
Browse files Browse the repository at this point in the history
…gin.ts
  • Loading branch information
cee-chen committed Sep 28, 2020
1 parent 4fc393d commit 6925b13
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { KibanaLogic } from '../shared/kibana';
import { HttpLogic } from '../shared/http';
import { AppLogic } from './app_logic';
import { Layout } from '../shared/layout';
import { WorkplaceSearchNav } from './components/layout/nav';
import { WorkplaceSearchNav, WorkplaceSearchHeaderActions } from './components/layout';

import { SETUP_GUIDE_PATH } from './routes';

Expand All @@ -31,10 +31,14 @@ export const WorkplaceSearch: React.FC<IInitialAppData> = (props) => {
export const WorkplaceSearchConfigured: React.FC<IInitialAppData> = (props) => {
const { hasInitialized } = useValues(AppLogic);
const { initializeAppData } = useActions(AppLogic);
const { renderHeaderActions } = useValues(KibanaLogic);
const { errorConnecting, readOnlyMode } = useValues(HttpLogic);

useEffect(() => {
if (!hasInitialized) initializeAppData(props);
if (!hasInitialized) {
initializeAppData(props);
renderHeaderActions(WorkplaceSearchHeaderActions);
}
}, [hasInitialized]);

return (
Expand Down
9 changes: 1 addition & 8 deletions x-pack/plugins/enterprise_search/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,9 @@ export class EnterpriseSearchPlugin implements Plugin {
await this.getInitialData(http);
const pluginData = this.getPluginData();

const { renderApp, renderHeaderActions } = await import('./applications');
const { renderApp } = await import('./applications');
const { WorkplaceSearch } = await import('./applications/workplace_search');

const { WorkplaceSearchHeaderActions } = await import(
'./applications/workplace_search/components/layout'
);
params.setHeaderActionMenu((element) =>
renderHeaderActions(WorkplaceSearchHeaderActions, element)
);

return renderApp(WorkplaceSearch, kibanaDeps, pluginData);
},
});
Expand Down

0 comments on commit 6925b13

Please sign in to comment.