mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2024-11-25 15:06:55 +00:00
Added publicgallery flight (#1262)
* added publicgallery flag * fixed PR comments
This commit is contained in:
parent
27423e2321
commit
da1169d0e2
@ -99,6 +99,7 @@ export class Flights {
|
|||||||
public static readonly PhoenixNotebooks = "phoenixnotebooks";
|
public static readonly PhoenixNotebooks = "phoenixnotebooks";
|
||||||
public static readonly PhoenixFeatures = "phoenixfeatures";
|
public static readonly PhoenixFeatures = "phoenixfeatures";
|
||||||
public static readonly NotebooksDownBanner = "notebooksdownbanner";
|
public static readonly NotebooksDownBanner = "notebooksdownbanner";
|
||||||
|
public static readonly PublicGallery = "publicgallery";
|
||||||
}
|
}
|
||||||
|
|
||||||
export class AfecFeatures {
|
export class AfecFeatures {
|
||||||
|
@ -21,6 +21,7 @@ import {
|
|||||||
Text,
|
Text,
|
||||||
} from "@fluentui/react";
|
} from "@fluentui/react";
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
|
import { userContext } from "UserContext";
|
||||||
import { HttpStatusCodes } from "../../../Common/Constants";
|
import { HttpStatusCodes } from "../../../Common/Constants";
|
||||||
import { handleError } from "../../../Common/ErrorHandlingUtils";
|
import { handleError } from "../../../Common/ErrorHandlingUtils";
|
||||||
import { IGalleryItem, IJunoResponse, IPublicGalleryData, JunoClient } from "../../../Juno/JunoClient";
|
import { IGalleryItem, IJunoResponse, IPublicGalleryData, JunoClient } from "../../../Juno/JunoClient";
|
||||||
@ -148,18 +149,23 @@ export class GalleryViewerComponent extends React.Component<GalleryViewerCompone
|
|||||||
public render(): JSX.Element {
|
public render(): JSX.Element {
|
||||||
this.traceViewGallery();
|
this.traceViewGallery();
|
||||||
|
|
||||||
const tabs: GalleryTabInfo[] = [
|
const tabs: GalleryTabInfo[] = [];
|
||||||
this.createPublicGalleryTab(
|
if (userContext.features.publicGallery) {
|
||||||
GalleryTab.PublicGallery,
|
tabs.push(
|
||||||
this.state.publicNotebooks,
|
this.createPublicGalleryTab(
|
||||||
this.state.isCodeOfConductAccepted
|
GalleryTab.PublicGallery,
|
||||||
),
|
this.state.publicNotebooks,
|
||||||
this.createSamplesTab(GalleryTab.OfficialSamples, this.state.sampleNotebooks),
|
this.state.isCodeOfConductAccepted
|
||||||
];
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
tabs.push(this.createSamplesTab(GalleryTab.OfficialSamples, this.state.sampleNotebooks));
|
||||||
|
|
||||||
if (this.props.container) {
|
if (this.props.container) {
|
||||||
tabs.push(this.createFavoritesTab(GalleryTab.Favorites, this.state.favoriteNotebooks));
|
tabs.push(this.createFavoritesTab(GalleryTab.Favorites, this.state.favoriteNotebooks));
|
||||||
tabs.push(this.createPublishedNotebooksTab(GalleryTab.Published, this.state.publishedNotebooks));
|
if (userContext.features.publicGallery) {
|
||||||
|
tabs.push(this.createPublishedNotebooksTab(GalleryTab.Published, this.state.publishedNotebooks));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const pivotProps: IPivotProps = {
|
const pivotProps: IPivotProps = {
|
||||||
|
@ -8,95 +8,6 @@ exports[`GalleryViewerComponent renders 1`] = `
|
|||||||
onLinkClick={[Function]}
|
onLinkClick={[Function]}
|
||||||
selectedKey="OfficialSamples"
|
selectedKey="OfficialSamples"
|
||||||
>
|
>
|
||||||
<PivotItem
|
|
||||||
headerText="Public gallery"
|
|
||||||
itemKey="PublicGallery"
|
|
||||||
key="PublicGallery"
|
|
||||||
style={
|
|
||||||
Object {
|
|
||||||
"marginTop": 20,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
className="publicGalleryTabContainer"
|
|
||||||
>
|
|
||||||
<Stack
|
|
||||||
tokens={
|
|
||||||
Object {
|
|
||||||
"childrenGap": 10,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<Stack
|
|
||||||
horizontal={true}
|
|
||||||
tokens={
|
|
||||||
Object {
|
|
||||||
"childrenGap": 20,
|
|
||||||
"padding": 10,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
wrap={true}
|
|
||||||
>
|
|
||||||
<StackItem
|
|
||||||
grow={true}
|
|
||||||
>
|
|
||||||
<StyledSearchBox
|
|
||||||
onChange={[Function]}
|
|
||||||
placeholder="Search"
|
|
||||||
/>
|
|
||||||
</StackItem>
|
|
||||||
<StackItem>
|
|
||||||
<StyledLabelBase>
|
|
||||||
Sort by
|
|
||||||
</StyledLabelBase>
|
|
||||||
</StackItem>
|
|
||||||
<StackItem
|
|
||||||
styles={
|
|
||||||
Object {
|
|
||||||
"root": Object {
|
|
||||||
"minWidth": 200,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<Dropdown
|
|
||||||
onChange={[Function]}
|
|
||||||
options={
|
|
||||||
Array [
|
|
||||||
Object {
|
|
||||||
"key": 0,
|
|
||||||
"text": "Most viewed",
|
|
||||||
},
|
|
||||||
Object {
|
|
||||||
"key": 1,
|
|
||||||
"text": "Most downloaded",
|
|
||||||
},
|
|
||||||
Object {
|
|
||||||
"key": 3,
|
|
||||||
"text": "Most recent",
|
|
||||||
},
|
|
||||||
Object {
|
|
||||||
"key": 2,
|
|
||||||
"text": "Most favorited",
|
|
||||||
},
|
|
||||||
]
|
|
||||||
}
|
|
||||||
selectedKey={0}
|
|
||||||
/>
|
|
||||||
</StackItem>
|
|
||||||
<StackItem>
|
|
||||||
<InfoComponent />
|
|
||||||
</StackItem>
|
|
||||||
</Stack>
|
|
||||||
<StackItem>
|
|
||||||
<StyledSpinnerBase
|
|
||||||
size={3}
|
|
||||||
/>
|
|
||||||
</StackItem>
|
|
||||||
</Stack>
|
|
||||||
</div>
|
|
||||||
</PivotItem>
|
|
||||||
<PivotItem
|
<PivotItem
|
||||||
headerText="Official samples"
|
headerText="Official samples"
|
||||||
itemKey="OfficialSamples"
|
itemKey="OfficialSamples"
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { stringifyNotebook, toJS } from "@nteract/commutable";
|
import { stringifyNotebook, toJS } from "@nteract/commutable";
|
||||||
import * as ko from "knockout";
|
import * as ko from "knockout";
|
||||||
import * as Q from "q";
|
import * as Q from "q";
|
||||||
|
import { userContext } from "UserContext";
|
||||||
import ClearAllOutputsIcon from "../../../images/notebook/Notebook-clear-all-outputs.svg";
|
import ClearAllOutputsIcon from "../../../images/notebook/Notebook-clear-all-outputs.svg";
|
||||||
import CopyIcon from "../../../images/notebook/Notebook-copy.svg";
|
import CopyIcon from "../../../images/notebook/Notebook-copy.svg";
|
||||||
import CutIcon from "../../../images/notebook/Notebook-cut.svg";
|
import CutIcon from "../../../images/notebook/Notebook-cut.svg";
|
||||||
@ -129,14 +130,16 @@ export default class NotebookTabV2 extends NotebookTabBase {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
saveButtonChildren.push({
|
if (userContext.features.publicGallery) {
|
||||||
iconName: "PublishContent",
|
saveButtonChildren.push({
|
||||||
onCommandClick: async () => await this.publishToGallery(),
|
iconName: "PublishContent",
|
||||||
commandButtonLabel: publishLabel,
|
onCommandClick: async () => await this.publishToGallery(),
|
||||||
hasPopup: false,
|
commandButtonLabel: publishLabel,
|
||||||
disabled: false,
|
hasPopup: false,
|
||||||
ariaLabel: publishLabel,
|
disabled: false,
|
||||||
});
|
ariaLabel: publishLabel,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
let buttons: CommandButtonComponentProps[] = [
|
let buttons: CommandButtonComponentProps[] = [
|
||||||
{
|
{
|
||||||
|
@ -299,7 +299,7 @@ export const ResourceTree: React.FC<ResourceTreeProps> = ({ container }: Resourc
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
if (item.type === NotebookContentItemType.Notebook) {
|
if (item.type === NotebookContentItemType.Notebook && userContext.features.publicGallery) {
|
||||||
items.push({
|
items.push({
|
||||||
label: "Publish to gallery",
|
label: "Publish to gallery",
|
||||||
iconSrc: PublishIcon,
|
iconSrc: PublishIcon,
|
||||||
|
@ -38,6 +38,7 @@ export type Features = {
|
|||||||
phoenixNotebooks?: boolean;
|
phoenixNotebooks?: boolean;
|
||||||
phoenixFeatures?: boolean;
|
phoenixFeatures?: boolean;
|
||||||
notebooksDownBanner: boolean;
|
notebooksDownBanner: boolean;
|
||||||
|
publicGallery?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
export function extractFeatures(given = new URLSearchParams(window.location.search)): Features {
|
export function extractFeatures(given = new URLSearchParams(window.location.search)): Features {
|
||||||
|
@ -378,6 +378,9 @@ function updateContextsFromPortalMessage(inputs: DataExplorerInputsFrame) {
|
|||||||
if (inputs.flights.indexOf(Flights.NotebooksDownBanner) !== -1) {
|
if (inputs.flights.indexOf(Flights.NotebooksDownBanner) !== -1) {
|
||||||
userContext.features.notebooksDownBanner = true;
|
userContext.features.notebooksDownBanner = true;
|
||||||
}
|
}
|
||||||
|
if (inputs.flights.indexOf(Flights.PublicGallery) !== -1) {
|
||||||
|
userContext.features.publicGallery = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user