mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-03-28 04:29:13 +00:00
Show submit button by default in GenericRightPaneComponent & other fixes (#144)
* Bug fixes * Fix build
This commit is contained in:
parent
f44a3da568
commit
dde2ca75c4
@ -16,7 +16,7 @@ export interface GenericRightPaneProps {
|
|||||||
onSubmit: () => void;
|
onSubmit: () => void;
|
||||||
submitButtonText: string;
|
submitButtonText: string;
|
||||||
title: string;
|
title: string;
|
||||||
isSubmitButtonVisible?: boolean;
|
isSubmitButtonHidden?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GenericRightPaneState {
|
export interface GenericRightPaneState {
|
||||||
@ -108,7 +108,7 @@ export class GenericRightPaneComponent extends React.Component<GenericRightPaneP
|
|||||||
<div className="paneFooter">
|
<div className="paneFooter">
|
||||||
<div className="leftpanel-okbut">
|
<div className="leftpanel-okbut">
|
||||||
<PrimaryButton
|
<PrimaryButton
|
||||||
style={{ visibility: this.props.isSubmitButtonVisible ? "visible" : "hidden" }}
|
style={{ visibility: this.props.isSubmitButtonHidden ? "hidden" : "visible" }}
|
||||||
ariaLabel="Submit"
|
ariaLabel="Submit"
|
||||||
title="Submit"
|
title="Submit"
|
||||||
onClick={this.props.onSubmit}
|
onClick={this.props.onSubmit}
|
||||||
|
@ -52,7 +52,7 @@ export class PublishNotebookPaneAdapter implements ReactAdapter {
|
|||||||
submitButtonText: "Publish",
|
submitButtonText: "Publish",
|
||||||
onClose: () => this.close(),
|
onClose: () => this.close(),
|
||||||
onSubmit: () => this.submit(),
|
onSubmit: () => this.submit(),
|
||||||
isSubmitButtonVisible: this.isCodeOfConductAccepted
|
isSubmitButtonHidden: !this.isCodeOfConductAccepted
|
||||||
};
|
};
|
||||||
|
|
||||||
const publishNotebookPaneProps: PublishNotebookPaneProps = {
|
const publishNotebookPaneProps: PublishNotebookPaneProps = {
|
||||||
|
@ -285,7 +285,7 @@ export class PublishNotebookPaneComponent extends React.Component<PublishNoteboo
|
|||||||
<GalleryCardComponent
|
<GalleryCardComponent
|
||||||
data={{
|
data={{
|
||||||
id: undefined,
|
id: undefined,
|
||||||
name: this.props.notebookName,
|
name: this.state.notebookName,
|
||||||
description: this.state.notebookDescription,
|
description: this.state.notebookDescription,
|
||||||
gitSha: undefined,
|
gitSha: undefined,
|
||||||
tags: this.state.notebookTags.split(","),
|
tags: this.state.notebookTags.split(","),
|
||||||
|
@ -39,7 +39,6 @@ export class UploadItemsPaneAdapter implements ReactAdapter {
|
|||||||
formErrorDetail: this.formErrorDetail,
|
formErrorDetail: this.formErrorDetail,
|
||||||
id: "uploaditemspane",
|
id: "uploaditemspane",
|
||||||
isExecuting: this.isExecuting,
|
isExecuting: this.isExecuting,
|
||||||
isSubmitButtonVisible: true,
|
|
||||||
title: "Upload Items",
|
title: "Upload Items",
|
||||||
submitButtonText: "Upload",
|
submitButtonText: "Upload",
|
||||||
onClose: () => this.close(),
|
onClose: () => this.close(),
|
||||||
|
@ -147,6 +147,30 @@ export default class NotebookTabV2 extends TabsBase {
|
|||||||
const cellCodeType = "code";
|
const cellCodeType = "code";
|
||||||
const cellMarkdownType = "markdown";
|
const cellMarkdownType = "markdown";
|
||||||
const cellRawType = "raw";
|
const cellRawType = "raw";
|
||||||
|
|
||||||
|
const saveButtonChildren = [];
|
||||||
|
if (this.container.notebookManager?.gitHubOAuthService.isLoggedIn()) {
|
||||||
|
saveButtonChildren.push({
|
||||||
|
iconName: "Copy",
|
||||||
|
onCommandClick: () => this.copyNotebook(),
|
||||||
|
commandButtonLabel: copyToLabel,
|
||||||
|
hasPopup: false,
|
||||||
|
disabled: false,
|
||||||
|
ariaLabel: copyToLabel
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.container.isGalleryPublishEnabled()) {
|
||||||
|
saveButtonChildren.push({
|
||||||
|
iconName: "PublishContent",
|
||||||
|
onCommandClick: async () => await this.publishToGallery(),
|
||||||
|
commandButtonLabel: publishLabel,
|
||||||
|
hasPopup: false,
|
||||||
|
disabled: false,
|
||||||
|
ariaLabel: publishLabel
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
let buttons: CommandButtonComponentProps[] = [
|
let buttons: CommandButtonComponentProps[] = [
|
||||||
{
|
{
|
||||||
iconSrc: SaveIcon,
|
iconSrc: SaveIcon,
|
||||||
@ -156,34 +180,17 @@ export default class NotebookTabV2 extends TabsBase {
|
|||||||
hasPopup: false,
|
hasPopup: false,
|
||||||
disabled: false,
|
disabled: false,
|
||||||
ariaLabel: saveLabel,
|
ariaLabel: saveLabel,
|
||||||
children: this.container.isGalleryPublishEnabled()
|
children: saveButtonChildren.length && [
|
||||||
? [
|
{
|
||||||
{
|
iconName: "Save",
|
||||||
iconName: "Save",
|
onCommandClick: () => this.notebookComponentAdapter.notebookSave(),
|
||||||
onCommandClick: () => this.notebookComponentAdapter.notebookSave(),
|
commandButtonLabel: saveLabel,
|
||||||
commandButtonLabel: saveLabel,
|
hasPopup: false,
|
||||||
hasPopup: false,
|
disabled: false,
|
||||||
disabled: false,
|
ariaLabel: saveLabel
|
||||||
ariaLabel: saveLabel
|
},
|
||||||
},
|
...saveButtonChildren
|
||||||
{
|
]
|
||||||
iconName: "Copy",
|
|
||||||
onCommandClick: () => this.copyNotebook(),
|
|
||||||
commandButtonLabel: copyToLabel,
|
|
||||||
hasPopup: false,
|
|
||||||
disabled: false,
|
|
||||||
ariaLabel: copyToLabel
|
|
||||||
},
|
|
||||||
{
|
|
||||||
iconName: "PublishContent",
|
|
||||||
onCommandClick: async () => await this.publishToGallery(),
|
|
||||||
commandButtonLabel: publishLabel,
|
|
||||||
hasPopup: false,
|
|
||||||
disabled: false,
|
|
||||||
ariaLabel: publishLabel
|
|
||||||
}
|
|
||||||
]
|
|
||||||
: undefined
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
iconSrc: null,
|
iconSrc: null,
|
||||||
|
@ -546,43 +546,52 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
|||||||
(activeTab as any).notebookPath() === item.path
|
(activeTab as any).notebookPath() === item.path
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
contextMenu: createFileContextMenu
|
contextMenu: createFileContextMenu && this.createFileContextMenu(item),
|
||||||
? [
|
|
||||||
{
|
|
||||||
label: "Rename",
|
|
||||||
iconSrc: NotebookIcon,
|
|
||||||
onClick: () => this.container.renameNotebook(item)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Delete",
|
|
||||||
iconSrc: DeleteIcon,
|
|
||||||
onClick: () => {
|
|
||||||
this.container.showOkCancelModalDialog(
|
|
||||||
"Confirm delete",
|
|
||||||
`Are you sure you want to delete "${item.name}"`,
|
|
||||||
"Delete",
|
|
||||||
() => this.container.deleteNotebookFile(item).then(() => this.triggerRender()),
|
|
||||||
"Cancel",
|
|
||||||
undefined
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Copy to ...",
|
|
||||||
iconSrc: CopyIcon,
|
|
||||||
onClick: () => this.copyNotebook(item)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "Download",
|
|
||||||
iconSrc: NotebookIcon,
|
|
||||||
onClick: () => this.container.downloadFile(item)
|
|
||||||
}
|
|
||||||
]
|
|
||||||
: undefined,
|
|
||||||
data: item
|
data: item
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private createFileContextMenu(item: NotebookContentItem): TreeNodeMenuItem[] {
|
||||||
|
let items: TreeNodeMenuItem[] = [
|
||||||
|
{
|
||||||
|
label: "Rename",
|
||||||
|
iconSrc: NotebookIcon,
|
||||||
|
onClick: () => this.container.renameNotebook(item)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Delete",
|
||||||
|
iconSrc: DeleteIcon,
|
||||||
|
onClick: () => {
|
||||||
|
this.container.showOkCancelModalDialog(
|
||||||
|
"Confirm delete",
|
||||||
|
`Are you sure you want to delete "${item.name}"`,
|
||||||
|
"Delete",
|
||||||
|
() => this.container.deleteNotebookFile(item).then(() => this.triggerRender()),
|
||||||
|
"Cancel",
|
||||||
|
undefined
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Copy to ...",
|
||||||
|
iconSrc: CopyIcon,
|
||||||
|
onClick: () => this.copyNotebook(item)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Download",
|
||||||
|
iconSrc: NotebookIcon,
|
||||||
|
onClick: () => this.container.downloadFile(item)
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
// "Copy to ..." isn't needed if github locations are not available
|
||||||
|
if (!this.container.notebookManager?.gitHubOAuthService.isLoggedIn()) {
|
||||||
|
items = items.filter(item => item.label !== "Copy to ...");
|
||||||
|
}
|
||||||
|
|
||||||
|
return items;
|
||||||
|
}
|
||||||
|
|
||||||
private copyNotebook = async (item: NotebookContentItem) => {
|
private copyNotebook = async (item: NotebookContentItem) => {
|
||||||
const content = await this.container.readFile(item);
|
const content = await this.container.readFile(item);
|
||||||
if (content) {
|
if (content) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user