diff --git a/src/Explorer/Controls/ThroughputInput/ThroughputInput.test.tsx b/src/Explorer/Controls/ThroughputInput/ThroughputInput.test.tsx index be6a8636f..899a87329 100644 --- a/src/Explorer/Controls/ThroughputInput/ThroughputInput.test.tsx +++ b/src/Explorer/Controls/ThroughputInput/ThroughputInput.test.tsx @@ -19,4 +19,14 @@ describe("ThroughputInput Pane", () => { it("should render Default properly", () => { expect(wrapper).toMatchSnapshot(); }); + + it("should switch mode properly", () => { + wrapper.find('[aria-label="Manual mode"]').simulate("change"); + expect(wrapper.find('[aria-label="Throughput header"]').at(0).text()).toBe( + "Container throughput (400 - unlimited RU/s)" + ); + + wrapper.find('[aria-label="Autoscale mode"]').simulate("change"); + expect(wrapper.find('[aria-label="Throughput header"]').at(0).text()).toBe("Container throughput (autoscale)"); + }); }); diff --git a/src/Explorer/Controls/ThroughputInput/ThroughputInput.tsx b/src/Explorer/Controls/ThroughputInput/ThroughputInput.tsx index b0c029d73..8b20d32db 100644 --- a/src/Explorer/Controls/ThroughputInput/ThroughputInput.tsx +++ b/src/Explorer/Controls/ThroughputInput/ThroughputInput.tsx @@ -101,7 +101,7 @@ export const ThroughputInput: FunctionComponent = ({
- + {getThroughputLabelText()} {PricingUtils.getRuToolTipText()} diff --git a/src/Explorer/Controls/ThroughputInput/__snapshots__/ThroughputInput.test.tsx.snap b/src/Explorer/Controls/ThroughputInput/__snapshots__/ThroughputInput.test.tsx.snap index cf430a1e0..4b0afb1ee 100644 --- a/src/Explorer/Controls/ThroughputInput/__snapshots__/ThroughputInput.test.tsx.snap +++ b/src/Explorer/Controls/ThroughputInput/__snapshots__/ThroughputInput.test.tsx.snap @@ -25,6 +25,7 @@ exports[`ThroughputInput Pane should render Default properly 1`] = ` *  this.expandConsole()} closePanel={this.closeSidePanel} /> ); diff --git a/src/Explorer/Panes/AddDatabasePanel/AddDatabasePanel.tsx b/src/Explorer/Panes/AddDatabasePanel/AddDatabasePanel.tsx index 6b8fbe08c..e1de2613b 100644 --- a/src/Explorer/Panes/AddDatabasePanel/AddDatabasePanel.tsx +++ b/src/Explorer/Panes/AddDatabasePanel/AddDatabasePanel.tsx @@ -48,7 +48,6 @@ export const AddDatabasePanel: FunctionComponent = ({ const [databaseCreateNewShared, setDatabaseCreateNewShared] = useState( subscriptionType !== SubscriptionType.EA && !isServerlessAccount() ); - const [formErrorsDetails, setFormErrorsDetails] = useState(); const [formErrors, setFormErrors] = useState(""); const [isExecuting, setIsExecuting] = useState(false); @@ -128,7 +127,6 @@ export const AddDatabasePanel: FunctionComponent = ({ setIsExecuting(false); const errorMessage = getErrorMessage(error); setFormErrors(errorMessage); - setFormErrorsDetails(errorMessage); const addDatabasePaneFailedMessage = { ...addDatabasePaneMessage, offerThroughput, @@ -167,7 +165,6 @@ export const AddDatabasePanel: FunctionComponent = ({ const props: RightPaneFormProps = { expandConsole: openNotificationConsole, formError: formErrors, - formErrorDetail: formErrorsDetails, isExecuting, submitButtonText: "OK", onSubmit, diff --git a/src/Explorer/Panes/PanelInfoErrorComponent.tsx b/src/Explorer/Panes/PanelInfoErrorComponent.tsx index 2ae836f64..50f6745ea 100644 --- a/src/Explorer/Panes/PanelInfoErrorComponent.tsx +++ b/src/Explorer/Panes/PanelInfoErrorComponent.tsx @@ -8,7 +8,6 @@ export interface PanelInfoErrorProps { link?: string; linkText?: string; openNotificationConsole?: () => void; - formError?: boolean; } export const PanelInfoErrorComponent: React.FunctionComponent = ({ @@ -18,7 +17,6 @@ export const PanelInfoErrorComponent: React.FunctionComponent { let icon: JSX.Element; if (messageType === "error") { @@ -30,25 +28,23 @@ export const PanelInfoErrorComponent: React.FunctionComponent - {icon} - - - {message} - {link && linkText && ( - - {linkText} - - )} - - {showErrorDetails && ( - - More details - + + {icon} + + + {message} + {link && linkText && ( + + {linkText} + )} - - - ) + + {showErrorDetails && ( + + More details + + )} + + ); }; diff --git a/src/Explorer/Panes/RightPaneForm/RightPaneForm.test.tsx b/src/Explorer/Panes/RightPaneForm/RightPaneForm.test.tsx index a2f3423e1..f35df1caa 100644 --- a/src/Explorer/Panes/RightPaneForm/RightPaneForm.test.tsx +++ b/src/Explorer/Panes/RightPaneForm/RightPaneForm.test.tsx @@ -9,7 +9,6 @@ const expandConsole = jest.fn(); const props = { expandConsole, formError: "", - formErrorDetail: "", isExecuting: false, submitButtonText: "Load", onSubmit, diff --git a/src/Explorer/Panes/RightPaneForm/RightPaneForm.tsx b/src/Explorer/Panes/RightPaneForm/RightPaneForm.tsx index 774399b23..7f8e14134 100644 --- a/src/Explorer/Panes/RightPaneForm/RightPaneForm.tsx +++ b/src/Explorer/Panes/RightPaneForm/RightPaneForm.tsx @@ -1,12 +1,11 @@ import React, { FunctionComponent, ReactNode } from "react"; import { PanelFooterComponent } from "../PanelFooterComponent"; -import { PanelInfoErrorComponent, PanelInfoErrorProps } from "../PanelInfoErrorComponent"; +import { PanelInfoErrorComponent } from "../PanelInfoErrorComponent"; import { PanelLoadingScreen } from "../PanelLoadingScreen"; export interface RightPaneFormProps { expandConsole: () => void; formError: string; - formErrorDetail: string; isExecuting: boolean; onSubmit: () => void; submitButtonText: string; @@ -17,7 +16,6 @@ export interface RightPaneFormProps { export const RightPaneForm: FunctionComponent = ({ expandConsole, formError, - formErrorDetail, isExecuting, onSubmit, submitButtonText, @@ -29,18 +27,17 @@ export const RightPaneForm: FunctionComponent = ({ onSubmit(); }; - const panelInfoErrorProps: PanelInfoErrorProps = { - messageType: "error", - message: formError, - formError: formError !== "", - showErrorDetails: formErrorDetail !== "", - openNotificationConsole: expandConsole, - }; - return ( <> -
+ {formError && ( + + )} {children} {!isSubmitButtonHidden && } diff --git a/src/Explorer/Panes/RightPaneForm/__snapshots__/RightPaneForm.test.tsx.snap b/src/Explorer/Panes/RightPaneForm/__snapshots__/RightPaneForm.test.tsx.snap index 30a9e3107..3438c3398 100644 --- a/src/Explorer/Panes/RightPaneForm/__snapshots__/RightPaneForm.test.tsx.snap +++ b/src/Explorer/Panes/RightPaneForm/__snapshots__/RightPaneForm.test.tsx.snap @@ -4,18 +4,10 @@ exports[`Right Pane Form should render Default properly 1`] = ` -
= ({ expandConsole, closePanel, }: SettingsPaneProps) => { - const [formErrors, setFormErrors] = useState(""); const [isExecuting, setIsExecuting] = useState(false); const [pageOption, setPageOption] = useState( LocalStorageUtility.getEntryNumber(StorageKey.ActualItemPerPage) === Constants.Queries.unlimitedItemsPerPage @@ -50,7 +49,6 @@ export const SettingsPane: FunctionComponent = ({ const shouldShowParallelismOption = userContext.apiType !== "Gremlin"; const handlerOnSubmit = (e: MouseEvent) => { - setFormErrors(""); setIsExecuting(true); LocalStorageUtility.setEntryNumber( @@ -104,8 +102,7 @@ export const SettingsPane: FunctionComponent = ({ const genericPaneProps: RightPaneFormProps = { expandConsole, - formError: formErrors, - formErrorDetail: "", + formError: "", isExecuting, submitButtonText: "Apply", onSubmit: () => handlerOnSubmit(undefined), diff --git a/src/Explorer/Panes/SettingsPane/__snapshots__/SettingsPane.test.tsx.snap b/src/Explorer/Panes/SettingsPane/__snapshots__/SettingsPane.test.tsx.snap index a7eb35a83..0af71bf15 100644 --- a/src/Explorer/Panes/SettingsPane/__snapshots__/SettingsPane.test.tsx.snap +++ b/src/Explorer/Panes/SettingsPane/__snapshots__/SettingsPane.test.tsx.snap @@ -4,7 +4,6 @@ exports[`Settings Pane should render Default properly 1`] = ` = ({ const [files, setFiles] = useState(); const [formErrors, setFormErrors] = useState(""); - const [formErrorsDetails, setFormErrorsDetails] = useState(""); const [isExecuting, setIsExecuting] = useState(false); const submit = () => { setFormErrors(""); - setFormErrorsDetails(""); if (!files || files.length === 0) { - setFormErrors("No file specified"); - setFormErrorsDetails("No file specified. Please input a file."); + setFormErrors("No file specified. Please input a file."); logConsoleError(`${errorMessage} -- No file specified. Please input a file.`); return; } @@ -49,7 +46,6 @@ export const UploadFilePane: FunctionComponent = ({ }, (error: string) => { setFormErrors(errorMessage); - setFormErrorsDetails(`${errorMessage}: ${error}`); logConsoleError(`${errorMessage} ${file.name}: ${error}`); } ) @@ -85,7 +81,6 @@ export const UploadFilePane: FunctionComponent = ({ const genericPaneProps: RightPaneFormProps = { expandConsole, formError: formErrors, - formErrorDetail: formErrorsDetails, isExecuting: isExecuting, submitButtonText: "Upload", onSubmit: submit, diff --git a/src/Explorer/Panes/UploadItemsPane/UploadItemsPane.tsx b/src/Explorer/Panes/UploadItemsPane/UploadItemsPane.tsx index e2ef3ddbc..b6a62ee5c 100644 --- a/src/Explorer/Panes/UploadItemsPane/UploadItemsPane.tsx +++ b/src/Explorer/Panes/UploadItemsPane/UploadItemsPane.tsx @@ -15,15 +15,14 @@ export const UploadItemsPane: FunctionComponent = ({ explo const [files, setFiles] = useState(); const [uploadFileData, setUploadFileData] = useState([]); const [formError, setFormError] = useState(""); - const [formErrorDetail, setFormErrorDetail] = useState(""); const [isExecuting, setIsExecuting] = useState(); const onSubmit = () => { setFormError(""); if (!files || files.length === 0) { - setFormError("No files specified"); - setFormErrorDetail("No files were specified. Please input at least one file."); + setFormError("No files were specified. Please input at least one file."); logConsoleError("Could not upload items -- No files were specified. Please input at least one file."); + return; } const selectedCollection = explorer.findSelectedCollection(); @@ -40,7 +39,6 @@ export const UploadItemsPane: FunctionComponent = ({ explo (error: Error) => { const errorMessage = getErrorMessage(error); setFormError(errorMessage); - setFormErrorDetail(errorMessage); } ) .finally(() => { @@ -55,7 +53,6 @@ export const UploadItemsPane: FunctionComponent = ({ explo const genericPaneProps: RightPaneFormProps = { expandConsole: () => explorer.expandConsole(), formError, - formErrorDetail, isExecuting: isExecuting, submitButtonText: "Upload", onSubmit, diff --git a/src/Explorer/Panes/UploadItemsPane/__snapshots__/UploadItemsPane.test.tsx.snap b/src/Explorer/Panes/UploadItemsPane/__snapshots__/UploadItemsPane.test.tsx.snap index c635538f7..5c34e367c 100644 --- a/src/Explorer/Panes/UploadItemsPane/__snapshots__/UploadItemsPane.test.tsx.snap +++ b/src/Explorer/Panes/UploadItemsPane/__snapshots__/UploadItemsPane.test.tsx.snap @@ -4,7 +4,6 @@ exports[`Upload Items Pane should render Default properly 1`] = `