Skip to content

Commit

Permalink
Fixes!
Browse files Browse the repository at this point in the history
  • Loading branch information
clintandrewhall committed Jan 26, 2021
1 parent d311e43 commit 8ca4297
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 29 deletions.
2 changes: 1 addition & 1 deletion src/plugins/presentation_util/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"declaration": true,
"declarationMap": true
},
"include": ["common/**/*", "public/**/*", ".storybook/**/*"],
"include": ["common/**/*", "public/**/*", "storybook/**/*", "../../../typings/**/*"],
"references": [
{ "path": "../../core/tsconfig.json" },
{ "path": "../dashboard/tsconfig.json" },
Expand Down
33 changes: 25 additions & 8 deletions x-pack/plugins/lens/kibana.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
{
"configPath": [
"xpack",
"lens"
],
"extraPublicDirs": [
"common/constants"
],
"id": "lens",
"version": "8.0.0",
"kibanaVersion": "kibana",
"server": true,
"ui": true,
"optionalPlugins": [
"usageCollection",
"taskManager",
"globalSearch",
"savedObjectsTagging"
],
"requiredBundles": [
"savedObjects",
"kibanaUtils",
"kibanaReact",
"embeddable",
"lensOss"
],
"requiredPlugins": [
"data",
"charts",
Expand All @@ -15,10 +32,10 @@
"charts",
"uiActions",
"embeddable",
"share"
"share",
"presentationUtil"
],
"optionalPlugins": ["usageCollection", "taskManager", "globalSearch", "savedObjectsTagging"],
"configPath": ["xpack", "lens"],
"extraPublicDirs": ["common/constants"],
"requiredBundles": ["savedObjects", "kibanaUtils", "kibanaReact", "embeddable", "lensOss", "presentationUtil"]
"server": true,
"ui": true,
"version": "8.0.0"
}
1 change: 0 additions & 1 deletion x-pack/plugins/lens/public/app_plugin/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,6 @@ export function App({
isVisible={state.isSaveModalVisible}
originatingApp={state.isLinkedToOriginatingApp ? incomingState?.originatingApp : undefined}
allowByValueEmbeddables={dashboardFeatureFlag.allowByValueEmbeddables}
savedObjectsClient={savedObjectsClient}
savedObjectsTagging={savedObjectsTagging}
tagsIds={tagsIds}
onSave={runSave}
Expand Down
39 changes: 25 additions & 14 deletions x-pack/plugins/lens/public/app_plugin/mounter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import React, { useCallback } from 'react';
import React, { FC, useCallback } from 'react';

import { AppMountParameters, CoreSetup } from 'kibana/public';
import { FormattedMessage, I18nProvider } from '@kbn/i18n/react';
Expand Down Expand Up @@ -39,9 +39,15 @@ export async function mountApp(
createEditorFrame: EditorFrameStart['createInstance'];
getByValueFeatureFlag: () => Promise<DashboardFeatureFlagConfig>;
attributeService: () => Promise<LensAttributeService>;
getPresentationUtilContext: () => Promise<FC>;
}
) {
const { createEditorFrame, getByValueFeatureFlag, attributeService } = mountProps;
const {
createEditorFrame,
getByValueFeatureFlag,
attributeService,
getPresentationUtilContext,
} = mountProps;
const [coreStart, startDependencies] = await core.getStartServices();
const { data, navigation, embeddable, savedObjectsTagging } = startDependencies;

Expand Down Expand Up @@ -196,21 +202,26 @@ export async function mountApp(
});

params.element.classList.add('lnsAppWrapper');

const PresentationUtilContext = await getPresentationUtilContext();

render(
<I18nProvider>
<KibanaContextProvider services={lensServices}>
<HashRouter>
<Switch>
<Route exact path="/edit/:id" component={EditorRoute} />
<Route
exact
path={`/${LENS_EDIT_BY_VALUE}`}
render={(routeProps) => <EditorRoute {...routeProps} editByValue />}
/>
<Route exact path="/" component={EditorRoute} />
<Route path="/" component={NotFound} />
</Switch>
</HashRouter>
<PresentationUtilContext>
<HashRouter>
<Switch>
<Route exact path="/edit/:id" component={EditorRoute} />
<Route
exact
path={`/${LENS_EDIT_BY_VALUE}`}
render={(routeProps) => <EditorRoute {...routeProps} editByValue />}
/>
<Route exact path="/" component={EditorRoute} />
<Route path="/" component={NotFound} />
</Switch>
</HashRouter>
</PresentationUtilContext>
</KibanaContextProvider>
</I18nProvider>,
params.element
Expand Down
5 changes: 0 additions & 5 deletions x-pack/plugins/lens/public/app_plugin/save_modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import React from 'react';
import { i18n } from '@kbn/i18n';

import { SavedObjectsStart } from '../../../../../src/core/public';

import { Document } from '../persistence';
import type { SavedObjectTaggingPluginStart } from '../../../saved_objects_tagging/public';

Expand All @@ -29,8 +27,6 @@ export interface Props {
originatingApp?: string;
allowByValueEmbeddables: boolean;

savedObjectsClient: SavedObjectsStart['client'];

savedObjectsTagging?: SavedObjectTaggingPluginStart;
tagsIds: string[];

Expand All @@ -51,7 +47,6 @@ export const SaveModal = (props: Props) => {
const {
originatingApp,
savedObjectsTagging,
savedObjectsClient,
tagsIds,
lastKnownDoc,
allowByValueEmbeddables,
Expand Down
9 changes: 9 additions & 0 deletions x-pack/plugins/lens/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { NavigationPublicPluginStart } from '../../../../src/plugins/navigation/
import { UrlForwardingSetup } from '../../../../src/plugins/url_forwarding/public';
import { GlobalSearchPluginSetup } from '../../global_search/public';
import { ChartsPluginSetup, ChartsPluginStart } from '../../../../src/plugins/charts/public';
import { PresentationUtilPluginStart } from '../../../../src/plugins/presentation_util/public';
import { EmbeddableStateTransfer } from '../../../../src/plugins/embeddable/public';
import { EditorFrameService } from './editor_frame_service';
import {
Expand Down Expand Up @@ -72,6 +73,7 @@ export interface LensPluginStartDependencies {
embeddable: EmbeddableStart;
charts: ChartsPluginStart;
savedObjectsTagging?: SavedObjectTaggingPluginStart;
presentationUtil: PresentationUtilPluginStart;
}

export interface LensPublicStart {
Expand Down Expand Up @@ -173,6 +175,12 @@ export class LensPlugin {
return deps.dashboard.dashboardFeatureFlagConfig;
};

const getPresentationUtilContext = async () => {
const [, deps] = await core.getStartServices();
const { ContextProvider } = deps.presentationUtil;
return ContextProvider;
};

core.application.register({
id: 'lens',
title: NOT_INTERNATIONALIZED_PRODUCT_NAME,
Expand All @@ -184,6 +192,7 @@ export class LensPlugin {
createEditorFrame: this.createEditorFrame!,
attributeService: this.attributeService!,
getByValueFeatureFlag,
getPresentationUtilContext,
});
},
});
Expand Down

0 comments on commit 8ca4297

Please sign in to comment.