Skip to content

Commit

Permalink
[share] hide 'Embed code' share option when buildFlavor is 'serverles…
Browse files Browse the repository at this point in the history
…s' (elastic#163104)

Closes elastic#161266

### Overview
PR hides 'Embed code' share option in serverless

### Test
* Start kibana with `yarn start --serverless=es`
* verify 'Embed code' is not displayed in Dashboard share option

---------

Co-authored-by: kibanamachine <[email protected]>
  • Loading branch information
2 people authored and bryce-b committed Aug 9, 2023
1 parent 7c49a6f commit 7176bd0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/plugins/share/public/plugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ describe('SharePlugin', () => {
expect.objectContaining({
getShareMenuItems: expect.any(Function),
}),
true, // disableEmbed - true because buildFlavor === 'serverless'
undefined
);
expect(start.toggleShareContextMenu).toBeDefined();
Expand All @@ -73,6 +74,7 @@ describe('SharePlugin', () => {
expect.objectContaining({
getShareMenuItems: expect.any(Function),
}),
true, // disableEmbed - true because buildFlavor === 'serverless'
anonymousAccessServiceProvider
);
expect(start.toggleShareContextMenu).toBeDefined();
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/share/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,12 @@ export class SharePlugin implements Plugin<SharePluginSetup, SharePluginStart> {
}

public start(core: CoreStart): SharePluginStart {
const disableEmbed = this.initializerContext.env.packageInfo.buildFlavor === 'serverless';
const sharingContextMenuStart = this.shareContextMenu.start(
core,
this.url!,
this.shareMenuRegistry.start(),
disableEmbed,
this.anonymousAccessServiceProvider
);

Expand Down
2 changes: 2 additions & 0 deletions src/plugins/share/public/services/share_menu_manager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export class ShareMenuManager {
core: CoreStart,
urlService: BrowserUrlService,
shareRegistry: ShareMenuRegistryStart,
disableEmbed: boolean,
anonymousAccessServiceProvider?: () => AnonymousAccessServiceContract
) {
return {
Expand All @@ -45,6 +46,7 @@ export class ShareMenuManager {
const anonymousAccess = anonymousAccessServiceProvider?.();
this.toggleShareContextMenu({
...options,
allowEmbed: disableEmbed ? false : options.allowEmbed,
onClose,
menuItems,
urlService,
Expand Down

0 comments on commit 7176bd0

Please sign in to comment.