diff --git a/src/Explorer/Panes/PublishNotebookPaneAdapter.tsx b/src/Explorer/Panes/PublishNotebookPaneAdapter.tsx
index 3af78a4c2..c51d708dd 100644
--- a/src/Explorer/Panes/PublishNotebookPaneAdapter.tsx
+++ b/src/Explorer/Panes/PublishNotebookPaneAdapter.tsx
@@ -44,7 +44,6 @@ export class PublishNotebookPaneAdapter implements ReactAdapter {
const props: GenericRightPaneProps = {
container: this.container,
- content: this.createContent(),
formError: this.formError,
formErrorDetail: this.formErrorDetail,
id: "publishnotebookpane",
@@ -56,7 +55,39 @@ export class PublishNotebookPaneAdapter implements ReactAdapter {
isSubmitButtonVisible: this.isCodeOfConductAccepted
};
- return
;
+ const publishNotebookPaneProps: PublishNotebookPaneProps = {
+ notebookName: this.name,
+ notebookDescription: "",
+ notebookTags: "",
+ notebookAuthor: this.author,
+ notebookCreatedDate: new Date().toISOString(),
+ notebookObject: this.notebookObject,
+ notebookParentDomElement: this.parentDomElement,
+ onChangeName: (newValue: string) => (this.name = newValue),
+ onChangeDescription: (newValue: string) => (this.description = newValue),
+ onChangeTags: (newValue: string) => (this.tags = newValue),
+ onChangeImageSrc: (newValue: string) => (this.imageSrc = newValue),
+ onError: this.createFormErrorForLargeImageSelection,
+ clearFormError: this.clearFormError
+ };
+
+ return (
+
+ {!this.isCodeOfConductAccepted ? (
+
+ {
+ this.isCodeOfConductAccepted = true;
+ this.triggerRender();
+ }}
+ />
+
+ ) : (
+
+ )}
+
+ );
}
public triggerRender(): void {
@@ -166,38 +197,6 @@ export class PublishNotebookPaneAdapter implements ReactAdapter {
this.triggerRender();
};
- private createContent = (): JSX.Element => {
- const publishNotebookPaneProps: PublishNotebookPaneProps = {
- notebookName: this.name,
- notebookDescription: "",
- notebookTags: "",
- notebookAuthor: this.author,
- notebookCreatedDate: new Date().toISOString(),
- notebookObject: this.notebookObject,
- notebookParentDomElement: this.parentDomElement,
- onChangeName: (newValue: string) => (this.name = newValue),
- onChangeDescription: (newValue: string) => (this.description = newValue),
- onChangeTags: (newValue: string) => (this.tags = newValue),
- onChangeImageSrc: (newValue: string) => (this.imageSrc = newValue),
- onError: this.createFormErrorForLargeImageSelection,
- clearFormError: this.clearFormError
- };
-
- return !this.isCodeOfConductAccepted ? (
-
- {
- this.isCodeOfConductAccepted = true;
- this.triggerRender();
- }}
- />
-
- ) : (
-
- );
- };
-
private reset = (): void => {
this.isOpened = false;
this.isExecuting = false;
diff --git a/src/Explorer/Panes/UploadItemsPaneAdapter.tsx b/src/Explorer/Panes/UploadItemsPaneAdapter.tsx
index 6858a8ed2..e6febec12 100644
--- a/src/Explorer/Panes/UploadItemsPaneAdapter.tsx
+++ b/src/Explorer/Panes/UploadItemsPaneAdapter.tsx
@@ -1,15 +1,13 @@
-import * as Constants from "../../Common/Constants";
import * as ErrorParserUtility from "../../Common/ErrorParserUtility";
import * as ko from "knockout";
+import * as NotificationConsoleUtils from "../../Utils/NotificationConsoleUtils";
import * as React from "react";
import * as ViewModels from "../../Contracts/ViewModels";
import { ConsoleDataType } from "../Menus/NotificationConsole/NotificationConsoleComponent";
-import { IconButton } from "office-ui-fabric-react/lib/Button";
import { GenericRightPaneComponent, GenericRightPaneProps } from "./GenericRightPaneComponent";
-import * as NotificationConsoleUtils from "../../Utils/NotificationConsoleUtils";
import { ReactAdapter } from "../../Bindings/ReactBindingHandler";
import { UploadDetailsRecord, UploadDetails } from "../../workers/upload/definitions";
-import InfoBubbleIcon from "../../../images/info-bubble.svg";
+import { UploadItemsPaneComponent, UploadItemsPaneProps } from "./UploadItemsPaneComponent";
import Explorer from "../Explorer";
const UPLOAD_FILE_SIZE_LIMIT = 2097152;
@@ -35,19 +33,30 @@ export class UploadItemsPaneAdapter implements ReactAdapter {
return undefined;
}
- const props: GenericRightPaneProps = {
+ const genericPaneProps: GenericRightPaneProps = {
container: this.container,
- content: this.createContent(),
formError: this.formError,
formErrorDetail: this.formErrorDetail,
id: "uploaditemspane",
isExecuting: this.isExecuting,
+ isSubmitButtonVisible: true,
title: "Upload Items",
submitButtonText: "Upload",
onClose: () => this.close(),
onSubmit: () => this.submit()
};
- return
;
+
+ const uploadItemsPaneProps: UploadItemsPaneProps = {
+ selectedFilesTitle: this.selectedFilesTitle,
+ updateSelectedFiles: this.updateSelectedFiles,
+ uploadFileData: this.uploadFileData
+ };
+
+ return (
+
+
+
+ );
}
public triggerRender(): void {
@@ -110,77 +119,6 @@ export class UploadItemsPaneAdapter implements ReactAdapter {
});
}
- private createContent = (): JSX.Element => {
- return
{this.createMainContentSection()}
;
- };
-
- private createMainContentSection = (): JSX.Element => {
- return (
-
-
-
Select JSON Files
-
-
-
- Select one or more JSON files to upload. Each file can contain a single JSON document or an array of JSON
- documents. The combined size of all files in an individual upload operation must be less than 2 MB. You
- can perform multiple upload operations for larger data sets.
-
-
-
-
-
-
-
-
File upload status
-
-
-
- FILE NAME |
- STATUS |
-
-
-
- {this.uploadFileData.map(
- (data: UploadDetailsRecord): JSX.Element => {
- return (
-
- {data.fileName} |
- {this.fileUploadSummaryText(data.numSucceeded, data.numFailed)} |
-
- );
- }
- )}
-
-
-
-
- );
- };
-
private updateSelectedFiles = (event: React.ChangeEvent
): void => {
this.selectedFiles = event.target.files;
this._updateSelectedFilesTitle();
@@ -212,21 +150,6 @@ export class UploadItemsPaneAdapter implements ReactAdapter {
return totalFileSize;
}
- private fileUploadSummaryText = (numSucceeded: number, numFailed: number): string => {
- return `${numSucceeded} items created, ${numFailed} errors`;
- };
-
- private onImportButtonClick = (): void => {
- document.getElementById("importDocsInput").click();
- };
-
- private onImportButtonKeyPress = (event: React.KeyboardEvent): void => {
- if (event.charCode === Constants.KeyCodes.Enter || event.charCode === Constants.KeyCodes.Space) {
- this.onImportButtonClick();
- event.stopPropagation();
- }
- };
-
private reset = (): void => {
this.isOpened = false;
this.isExecuting = false;
diff --git a/src/Explorer/Panes/UploadItemsPaneComponent.tsx b/src/Explorer/Panes/UploadItemsPaneComponent.tsx
new file mode 100644
index 000000000..998f6ff1b
--- /dev/null
+++ b/src/Explorer/Panes/UploadItemsPaneComponent.tsx
@@ -0,0 +1,97 @@
+import * as Constants from "../../Common/Constants";
+import * as React from "react";
+import { IconButton } from "office-ui-fabric-react/lib/Button";
+import { UploadDetailsRecord } from "../../workers/upload/definitions";
+import InfoBubbleIcon from "../../../images/info-bubble.svg";
+
+export interface UploadItemsPaneProps {
+ selectedFilesTitle: string;
+ updateSelectedFiles: (event: React.ChangeEvent) => void;
+ uploadFileData: UploadDetailsRecord[];
+}
+
+export class UploadItemsPaneComponent extends React.Component {
+ public render(): JSX.Element {
+ return (
+
+
+
+
Select JSON Files
+
+
+
+ Select one or more JSON files to upload. Each file can contain a single JSON document or an array of
+ JSON documents. The combined size of all files in an individual upload operation must be less than 2 MB.
+ You can perform multiple upload operations for larger data sets.
+
+
+
+
+
+
+
+
File upload status
+
+
+
+ FILE NAME |
+ STATUS |
+
+
+
+ {this.props.uploadFileData.map(
+ (data: UploadDetailsRecord): JSX.Element => {
+ return (
+
+ {data.fileName} |
+ {this.fileUploadSummaryText(data.numSucceeded, data.numFailed)} |
+
+ );
+ }
+ )}
+
+
+
+
+
+ );
+ }
+
+ private fileUploadSummaryText = (numSucceeded: number, numFailed: number): string => {
+ return `${numSucceeded} items created, ${numFailed} errors`;
+ };
+
+ private onImportButtonClick = (): void => {
+ document.getElementById("importDocsInput").click();
+ };
+
+ private onImportButtonKeyPress = (event: React.KeyboardEvent): void => {
+ if (event.charCode === Constants.KeyCodes.Enter || event.charCode === Constants.KeyCodes.Space) {
+ this.onImportButtonClick();
+ event.stopPropagation();
+ }
+ };
+}