diff --git a/src/Common/Constants.ts b/src/Common/Constants.ts index e40977ded..537685a2c 100644 --- a/src/Common/Constants.ts +++ b/src/Common/Constants.ts @@ -99,6 +99,7 @@ export class Flights { public static readonly PhoenixNotebooks = "phoenixnotebooks"; public static readonly PhoenixFeatures = "phoenixfeatures"; public static readonly NotebooksDownBanner = "notebooksdownbanner"; + public static readonly PublicGallery = "publicgallery"; } export class AfecFeatures { diff --git a/src/Explorer/Controls/NotebookGallery/GalleryViewerComponent.tsx b/src/Explorer/Controls/NotebookGallery/GalleryViewerComponent.tsx index 4dc772481..07b73c0e6 100644 --- a/src/Explorer/Controls/NotebookGallery/GalleryViewerComponent.tsx +++ b/src/Explorer/Controls/NotebookGallery/GalleryViewerComponent.tsx @@ -21,6 +21,7 @@ import { Text, } from "@fluentui/react"; import * as React from "react"; +import { userContext } from "UserContext"; import { HttpStatusCodes } from "../../../Common/Constants"; import { handleError } from "../../../Common/ErrorHandlingUtils"; import { IGalleryItem, IJunoResponse, IPublicGalleryData, JunoClient } from "../../../Juno/JunoClient"; @@ -148,18 +149,23 @@ export class GalleryViewerComponent extends React.Component - -
- - - - - - - - Sort by - - - - - - - - - - - - - -
-
await this.publishToGallery(), - commandButtonLabel: publishLabel, - hasPopup: false, - disabled: false, - ariaLabel: publishLabel, - }); + if (userContext.features.publicGallery) { + saveButtonChildren.push({ + iconName: "PublishContent", + onCommandClick: async () => await this.publishToGallery(), + commandButtonLabel: publishLabel, + hasPopup: false, + disabled: false, + ariaLabel: publishLabel, + }); + } let buttons: CommandButtonComponentProps[] = [ { diff --git a/src/Explorer/Tree/ResourceTree.tsx b/src/Explorer/Tree/ResourceTree.tsx index 181fd07d6..dd8c3c9c6 100644 --- a/src/Explorer/Tree/ResourceTree.tsx +++ b/src/Explorer/Tree/ResourceTree.tsx @@ -299,7 +299,7 @@ export const ResourceTree: React.FC = ({ container }: Resourc }, ]; - if (item.type === NotebookContentItemType.Notebook) { + if (item.type === NotebookContentItemType.Notebook && userContext.features.publicGallery) { items.push({ label: "Publish to gallery", iconSrc: PublishIcon, diff --git a/src/Platform/Hosted/extractFeatures.ts b/src/Platform/Hosted/extractFeatures.ts index 6489068f0..8d6a763cc 100644 --- a/src/Platform/Hosted/extractFeatures.ts +++ b/src/Platform/Hosted/extractFeatures.ts @@ -38,6 +38,7 @@ export type Features = { phoenixNotebooks?: boolean; phoenixFeatures?: boolean; notebooksDownBanner: boolean; + publicGallery?: boolean; }; export function extractFeatures(given = new URLSearchParams(window.location.search)): Features { diff --git a/src/hooks/useKnockoutExplorer.ts b/src/hooks/useKnockoutExplorer.ts index de019e599..7a0330ff3 100644 --- a/src/hooks/useKnockoutExplorer.ts +++ b/src/hooks/useKnockoutExplorer.ts @@ -378,6 +378,9 @@ function updateContextsFromPortalMessage(inputs: DataExplorerInputsFrame) { if (inputs.flights.indexOf(Flights.NotebooksDownBanner) !== -1) { userContext.features.notebooksDownBanner = true; } + if (inputs.flights.indexOf(Flights.PublicGallery) !== -1) { + userContext.features.publicGallery = true; + } } }