Skip to content

Commit

Permalink
Fixed ts errors
Browse files Browse the repository at this point in the history
  • Loading branch information
cqliu1 committed Oct 20, 2021
1 parent d1e5c8a commit 18a4c89
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,18 +202,6 @@ export const ElementMenu: FunctionComponent<Props> = ({ elements, addElement })
closePopover();
},
},
// TODO: Remove this menu option. This is a temporary menu options just for testing,
// will be removed once toolbar is implemented
isByValueEnabled
? {
name: 'Lens',
icon: <EuiIcon type="lensApp" size="m" />,
onClick: () => {
createNewEmbeddable();
closePopover();
},
}
: {},
],
};
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,4 @@
* 2.0.
*/

import React, { FC, useCallback } from 'react';
import { useLocation } from 'react-router-dom';
import { trackCanvasUiMetric, METRIC_TYPE } from '../../../../public/lib/ui_metric';
import { CANVAS_APP } from '../../../../common/lib';
import { ElementMenu as Component, Props } from './element_menu.component';
import { useEmbeddablesService } from '../../../services';

export const ElementMenu: FC<Omit<Props, 'createNewEmbeddable'>> = (props) => {
const embeddablesService = useEmbeddablesService();
const stateTransferService = embeddablesService.getStateTransfer();
const { pathname, search } = useLocation();

const createNewEmbeddable = useCallback(() => {
const path = '#/';
const appId = 'lens';

if (trackCanvasUiMetric) {
trackCanvasUiMetric(METRIC_TYPE.CLICK, `${appId}:create`);
}

stateTransferService.navigateToEditor(appId, {
path,
state: {
originatingApp: CANVAS_APP,
originatingPath: `#/${pathname}${search}`,
},
});
}, [pathname, search, stateTransferService]);

return <Component {...props} createNewEmbeddable={createNewEmbeddable} />;
};
export * from 'element_menu.component';

0 comments on commit 18a4c89

Please sign in to comment.