mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-21 09:51:11 +00:00
Batch of small fixes for RightPaneForm and AddDatabasePane components (#780)
This commit is contained in:
@@ -9,7 +9,6 @@ const expandConsole = jest.fn();
|
||||
const props = {
|
||||
expandConsole,
|
||||
formError: "",
|
||||
formErrorDetail: "",
|
||||
isExecuting: false,
|
||||
submitButtonText: "Load",
|
||||
onSubmit,
|
||||
|
||||
@@ -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<RightPaneFormProps> = ({
|
||||
expandConsole,
|
||||
formError,
|
||||
formErrorDetail,
|
||||
isExecuting,
|
||||
onSubmit,
|
||||
submitButtonText,
|
||||
@@ -29,18 +27,17 @@ export const RightPaneForm: FunctionComponent<RightPaneFormProps> = ({
|
||||
onSubmit();
|
||||
};
|
||||
|
||||
const panelInfoErrorProps: PanelInfoErrorProps = {
|
||||
messageType: "error",
|
||||
message: formError,
|
||||
formError: formError !== "",
|
||||
showErrorDetails: formErrorDetail !== "",
|
||||
openNotificationConsole: expandConsole,
|
||||
};
|
||||
|
||||
return (
|
||||
<>
|
||||
<PanelInfoErrorComponent {...panelInfoErrorProps} />
|
||||
<form className="panelFormWrapper" onSubmit={handleOnSubmit}>
|
||||
{formError && (
|
||||
<PanelInfoErrorComponent
|
||||
messageType="error"
|
||||
message={formError}
|
||||
showErrorDetails={true}
|
||||
openNotificationConsole={expandConsole}
|
||||
/>
|
||||
)}
|
||||
{children}
|
||||
{!isSubmitButtonHidden && <PanelFooterComponent buttonLabel={submitButtonText} />}
|
||||
</form>
|
||||
|
||||
@@ -4,18 +4,10 @@ exports[`Right Pane Form should render Default properly 1`] = `
|
||||
<RightPaneForm
|
||||
expandConsole={[MockFunction]}
|
||||
formError=""
|
||||
formErrorDetail=""
|
||||
isExecuting={false}
|
||||
onSubmit={[MockFunction]}
|
||||
submitButtonText="Load"
|
||||
>
|
||||
<PanelInfoErrorComponent
|
||||
formError={false}
|
||||
message=""
|
||||
messageType="error"
|
||||
openNotificationConsole={[MockFunction]}
|
||||
showErrorDetails={false}
|
||||
/>
|
||||
<form
|
||||
className="panelFormWrapper"
|
||||
onSubmit={[Function]}
|
||||
|
||||
Reference in New Issue
Block a user