Remove generic right pane component (#790)
Co-authored-by: Steve Faulkner <southpolesteve@gmail.com>
This commit is contained in:
parent
030a4dec3c
commit
6e9144b068
|
@ -1,12 +1,12 @@
|
||||||
jest.mock("../../../../Juno/JunoClient");
|
jest.mock("../../../../Juno/JunoClient");
|
||||||
import { shallow } from "enzyme";
|
import { shallow } from "enzyme";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { CodeOfConductComponent, CodeOfConductComponentProps } from ".";
|
|
||||||
import { HttpStatusCodes } from "../../../../Common/Constants";
|
import { HttpStatusCodes } from "../../../../Common/Constants";
|
||||||
import { JunoClient } from "../../../../Juno/JunoClient";
|
import { JunoClient } from "../../../../Juno/JunoClient";
|
||||||
|
import { CodeOfConduct, CodeOfConductProps } from "./CodeOfConduct";
|
||||||
|
|
||||||
describe("CodeOfConductComponent", () => {
|
describe("CodeOfConduct", () => {
|
||||||
let codeOfConductProps: CodeOfConductComponentProps;
|
let codeOfConductProps: CodeOfConductProps;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
const junoClient = new JunoClient();
|
const junoClient = new JunoClient();
|
||||||
|
@ -21,12 +21,12 @@ describe("CodeOfConductComponent", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("renders", () => {
|
it("renders", () => {
|
||||||
const wrapper = shallow(<CodeOfConductComponent {...codeOfConductProps} />);
|
const wrapper = shallow(<CodeOfConduct {...codeOfConductProps} />);
|
||||||
expect(wrapper).toMatchSnapshot();
|
expect(wrapper).toMatchSnapshot();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("onAcceptedCodeOfConductCalled", async () => {
|
it("onAcceptedCodeOfConductCalled", async () => {
|
||||||
const wrapper = shallow(<CodeOfConductComponent {...codeOfConductProps} />);
|
const wrapper = shallow(<CodeOfConduct {...codeOfConductProps} />);
|
||||||
wrapper.find(".genericPaneSubmitBtn").first().simulate("click");
|
wrapper.find(".genericPaneSubmitBtn").first().simulate("click");
|
||||||
await Promise.resolve();
|
await Promise.resolve();
|
||||||
expect(codeOfConductProps.onAcceptCodeOfConduct).toBeCalled();
|
expect(codeOfConductProps.onAcceptCodeOfConduct).toBeCalled();
|
|
@ -6,15 +6,15 @@ import { JunoClient } from "../../../../Juno/JunoClient";
|
||||||
import { Action } from "../../../../Shared/Telemetry/TelemetryConstants";
|
import { Action } from "../../../../Shared/Telemetry/TelemetryConstants";
|
||||||
import { trace, traceFailure, traceStart, traceSuccess } from "../../../../Shared/Telemetry/TelemetryProcessor";
|
import { trace, traceFailure, traceStart, traceSuccess } from "../../../../Shared/Telemetry/TelemetryProcessor";
|
||||||
|
|
||||||
export interface CodeOfConductComponentProps {
|
export interface CodeOfConductProps {
|
||||||
junoClient: JunoClient;
|
junoClient: JunoClient;
|
||||||
onAcceptCodeOfConduct: (result: boolean) => void;
|
onAcceptCodeOfConduct: (result: boolean) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const CodeOfConductComponent: FunctionComponent<CodeOfConductComponentProps> = ({
|
export const CodeOfConduct: FunctionComponent<CodeOfConductProps> = ({
|
||||||
junoClient,
|
junoClient,
|
||||||
onAcceptCodeOfConduct,
|
onAcceptCodeOfConduct,
|
||||||
}: CodeOfConductComponentProps) => {
|
}: CodeOfConductProps) => {
|
||||||
const descriptionPara1 = "Azure Cosmos DB Notebook Gallery - Code of Conduct";
|
const descriptionPara1 = "Azure Cosmos DB Notebook Gallery - Code of Conduct";
|
||||||
const descriptionPara2 = "The notebook public gallery contains notebook samples shared by users of Azure Cosmos DB.";
|
const descriptionPara2 = "The notebook public gallery contains notebook samples shared by users of Azure Cosmos DB.";
|
||||||
const descriptionPara3 = "In order to view and publish your samples to the gallery, you must accept the ";
|
const descriptionPara3 = "In order to view and publish your samples to the gallery, you must accept the ";
|
||||||
|
@ -47,7 +47,7 @@ export const CodeOfConductComponent: FunctionComponent<CodeOfConductComponentPro
|
||||||
startKey
|
startKey
|
||||||
);
|
);
|
||||||
|
|
||||||
handleError(error, "CodeOfConductComponent/acceptCodeOfConduct", "Failed to accept code of conduct");
|
handleError(error, "CodeOfConduct/acceptCodeOfConduct", "Failed to accept code of conduct");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`CodeOfConductComponent renders 1`] = `
|
exports[`CodeOfConduct renders 1`] = `
|
||||||
<Stack
|
<Stack
|
||||||
tokens={
|
tokens={
|
||||||
Object {
|
Object {
|
|
@ -1,123 +0,0 @@
|
||||||
import * as React from "react";
|
|
||||||
import { JunoClient } from "../../../Juno/JunoClient";
|
|
||||||
import { HttpStatusCodes, CodeOfConductEndpoints } from "../../../Common/Constants";
|
|
||||||
import { Stack, Text, Checkbox, PrimaryButton, Link } from "@fluentui/react";
|
|
||||||
import { getErrorMessage, getErrorStack, handleError } from "../../../Common/ErrorHandlingUtils";
|
|
||||||
import { trace, traceFailure, traceStart, traceSuccess } from "../../../Shared/Telemetry/TelemetryProcessor";
|
|
||||||
import { Action } from "../../../Shared/Telemetry/TelemetryConstants";
|
|
||||||
|
|
||||||
export interface CodeOfConductComponentProps {
|
|
||||||
junoClient: JunoClient;
|
|
||||||
onAcceptCodeOfConduct: (result: boolean) => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface CodeOfConductComponentState {
|
|
||||||
readCodeOfConduct: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class CodeOfConductComponent extends React.Component<CodeOfConductComponentProps, CodeOfConductComponentState> {
|
|
||||||
private viewCodeOfConductTraced: boolean;
|
|
||||||
private descriptionPara1: string;
|
|
||||||
private descriptionPara2: string;
|
|
||||||
private descriptionPara3: string;
|
|
||||||
private link1: { label: string; url: string };
|
|
||||||
|
|
||||||
constructor(props: CodeOfConductComponentProps) {
|
|
||||||
super(props);
|
|
||||||
|
|
||||||
this.state = {
|
|
||||||
readCodeOfConduct: false,
|
|
||||||
};
|
|
||||||
|
|
||||||
this.descriptionPara1 = "Azure Cosmos DB Notebook Gallery - Code of Conduct";
|
|
||||||
this.descriptionPara2 = "The notebook public gallery contains notebook samples shared by users of Azure Cosmos DB.";
|
|
||||||
this.descriptionPara3 = "In order to view and publish your samples to the gallery, you must accept the ";
|
|
||||||
this.link1 = { label: "code of conduct.", url: CodeOfConductEndpoints.codeOfConduct };
|
|
||||||
}
|
|
||||||
|
|
||||||
private async acceptCodeOfConduct(): Promise<void> {
|
|
||||||
const startKey = traceStart(Action.NotebooksGalleryAcceptCodeOfConduct);
|
|
||||||
|
|
||||||
try {
|
|
||||||
const response = await this.props.junoClient.acceptCodeOfConduct();
|
|
||||||
if (response.status !== HttpStatusCodes.OK && response.status !== HttpStatusCodes.NoContent) {
|
|
||||||
throw new Error(`Received HTTP ${response.status} when accepting code of conduct`);
|
|
||||||
}
|
|
||||||
|
|
||||||
traceSuccess(Action.NotebooksGalleryAcceptCodeOfConduct, {}, startKey);
|
|
||||||
|
|
||||||
this.props.onAcceptCodeOfConduct(response.data);
|
|
||||||
} catch (error) {
|
|
||||||
traceFailure(
|
|
||||||
Action.NotebooksGalleryAcceptCodeOfConduct,
|
|
||||||
{
|
|
||||||
error: getErrorMessage(error),
|
|
||||||
errorStack: getErrorStack(error),
|
|
||||||
},
|
|
||||||
startKey
|
|
||||||
);
|
|
||||||
|
|
||||||
handleError(error, "CodeOfConductComponent/acceptCodeOfConduct", "Failed to accept code of conduct");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private onChangeCheckbox = (): void => {
|
|
||||||
this.setState({ readCodeOfConduct: !this.state.readCodeOfConduct });
|
|
||||||
};
|
|
||||||
|
|
||||||
public render(): JSX.Element {
|
|
||||||
if (!this.viewCodeOfConductTraced) {
|
|
||||||
this.viewCodeOfConductTraced = true;
|
|
||||||
trace(Action.NotebooksGalleryViewCodeOfConduct);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Stack tokens={{ childrenGap: 20 }}>
|
|
||||||
<Stack.Item>
|
|
||||||
<Text style={{ fontWeight: 500, fontSize: "20px" }}>{this.descriptionPara1}</Text>
|
|
||||||
</Stack.Item>
|
|
||||||
|
|
||||||
<Stack.Item>
|
|
||||||
<Text>{this.descriptionPara2}</Text>
|
|
||||||
</Stack.Item>
|
|
||||||
|
|
||||||
<Stack.Item>
|
|
||||||
<Text>
|
|
||||||
{this.descriptionPara3}
|
|
||||||
<Link href={this.link1.url} target="_blank">
|
|
||||||
{this.link1.label}
|
|
||||||
</Link>
|
|
||||||
</Text>
|
|
||||||
</Stack.Item>
|
|
||||||
|
|
||||||
<Stack.Item>
|
|
||||||
<Checkbox
|
|
||||||
styles={{
|
|
||||||
label: {
|
|
||||||
margin: 0,
|
|
||||||
padding: "2 0 2 0",
|
|
||||||
},
|
|
||||||
text: {
|
|
||||||
fontSize: 12,
|
|
||||||
},
|
|
||||||
}}
|
|
||||||
label="I have read and accept the code of conduct."
|
|
||||||
onChange={this.onChangeCheckbox}
|
|
||||||
/>
|
|
||||||
</Stack.Item>
|
|
||||||
|
|
||||||
<Stack.Item>
|
|
||||||
<PrimaryButton
|
|
||||||
ariaLabel="Continue"
|
|
||||||
title="Continue"
|
|
||||||
onClick={async () => await this.acceptCodeOfConduct()}
|
|
||||||
tabIndex={0}
|
|
||||||
className="genericPaneSubmitBtn"
|
|
||||||
text="Continue"
|
|
||||||
disabled={!this.state.readCodeOfConduct}
|
|
||||||
/>
|
|
||||||
</Stack.Item>
|
|
||||||
</Stack>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -30,7 +30,7 @@ import * as GalleryUtils from "../../../Utils/GalleryUtils";
|
||||||
import Explorer from "../../Explorer";
|
import Explorer from "../../Explorer";
|
||||||
import { Dialog, DialogProps } from "../Dialog";
|
import { Dialog, DialogProps } from "../Dialog";
|
||||||
import { GalleryCardComponent, GalleryCardComponentProps } from "./Cards/GalleryCardComponent";
|
import { GalleryCardComponent, GalleryCardComponentProps } from "./Cards/GalleryCardComponent";
|
||||||
import { CodeOfConductComponent } from "./CodeOfConductComponent";
|
import { CodeOfConduct } from "./CodeOfConduct/CodeOfConduct";
|
||||||
import "./GalleryViewerComponent.less";
|
import "./GalleryViewerComponent.less";
|
||||||
import { InfoComponent } from "./InfoComponent/InfoComponent";
|
import { InfoComponent } from "./InfoComponent/InfoComponent";
|
||||||
|
|
||||||
|
@ -372,7 +372,7 @@ export class GalleryViewerComponent extends React.Component<GalleryViewerCompone
|
||||||
{acceptedCodeOfConduct === false && (
|
{acceptedCodeOfConduct === false && (
|
||||||
<Overlay isDarkThemed>
|
<Overlay isDarkThemed>
|
||||||
<div className="publicGalleryTabOverlayContent">
|
<div className="publicGalleryTabOverlayContent">
|
||||||
<CodeOfConductComponent
|
<CodeOfConduct
|
||||||
junoClient={this.props.junoClient}
|
junoClient={this.props.junoClient}
|
||||||
onAcceptCodeOfConduct={(result: boolean) => {
|
onAcceptCodeOfConduct={(result: boolean) => {
|
||||||
this.setState({ isCodeOfConductAccepted: result });
|
this.setState({ isCodeOfConductAccepted: result });
|
||||||
|
|
|
@ -67,7 +67,7 @@ import { SetupNoteBooksPanel } from "./Panes/SetupNotebooksPanel/SetupNotebooksP
|
||||||
import { StringInputPane } from "./Panes/StringInputPane/StringInputPane";
|
import { StringInputPane } from "./Panes/StringInputPane/StringInputPane";
|
||||||
import { AddTableEntityPanel } from "./Panes/Tables/AddTableEntityPanel";
|
import { AddTableEntityPanel } from "./Panes/Tables/AddTableEntityPanel";
|
||||||
import { EditTableEntityPanel } from "./Panes/Tables/EditTableEntityPanel";
|
import { EditTableEntityPanel } from "./Panes/Tables/EditTableEntityPanel";
|
||||||
import { TableQuerySelectPanel } from "./Panes/Tables/TableQuerySelectPanel";
|
import { TableQuerySelectPanel } from "./Panes/Tables/TableQuerySelectPanel/TableQuerySelectPanel";
|
||||||
import { UploadFilePane } from "./Panes/UploadFilePane/UploadFilePane";
|
import { UploadFilePane } from "./Panes/UploadFilePane/UploadFilePane";
|
||||||
import { UploadItemsPane } from "./Panes/UploadItemsPane/UploadItemsPane";
|
import { UploadItemsPane } from "./Panes/UploadItemsPane/UploadItemsPane";
|
||||||
import TableListViewModal from "./Tables/DataTable/TableEntityListViewModel";
|
import TableListViewModal from "./Tables/DataTable/TableEntityListViewModel";
|
||||||
|
@ -1379,7 +1379,7 @@ export default class Explorer {
|
||||||
this.showOkModalDialog("Unable to rename file", "This file is being edited. Please close the tab and try again.");
|
this.showOkModalDialog("Unable to rename file", "This file is being edited. Please close the tab and try again.");
|
||||||
} else {
|
} else {
|
||||||
this.openSidePanel(
|
this.openSidePanel(
|
||||||
"",
|
"Rename Notebook",
|
||||||
<StringInputPane
|
<StringInputPane
|
||||||
explorer={this}
|
explorer={this}
|
||||||
closePanel={() => {
|
closePanel={() => {
|
||||||
|
@ -1410,7 +1410,7 @@ export default class Explorer {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.openSidePanel(
|
this.openSidePanel(
|
||||||
"",
|
"Create new directory",
|
||||||
<StringInputPane
|
<StringInputPane
|
||||||
explorer={this}
|
explorer={this}
|
||||||
closePanel={() => {
|
closePanel={() => {
|
||||||
|
@ -1902,7 +1902,7 @@ export default class Explorer {
|
||||||
"Delete " + getDatabaseName(),
|
"Delete " + getDatabaseName(),
|
||||||
<DeleteDatabaseConfirmationPanel
|
<DeleteDatabaseConfirmationPanel
|
||||||
explorer={this}
|
explorer={this}
|
||||||
openNotificationConsole={this.expandConsole}
|
openNotificationConsole={() => this.expandConsole()}
|
||||||
closePanel={this.closeSidePanel}
|
closePanel={this.closeSidePanel}
|
||||||
selectedDatabase={this.findSelectedDatabase()}
|
selectedDatabase={this.findSelectedDatabase()}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -132,6 +132,7 @@ export const NewVertexComponent: FunctionComponent<INewVertexComponentProps> = (
|
||||||
onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
|
onChange={(event: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
onLabelChange(event);
|
onLabelChange(event);
|
||||||
}}
|
}}
|
||||||
|
autoFocus
|
||||||
/>
|
/>
|
||||||
<div className="actionCol"></div>
|
<div className="actionCol"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -9,10 +9,7 @@ import * as NotificationConsoleUtils from "../../../Utils/NotificationConsoleUti
|
||||||
import Explorer from "../../Explorer";
|
import Explorer from "../../Explorer";
|
||||||
import { NotebookContentItem, NotebookContentItemType } from "../../Notebook/NotebookContentItem";
|
import { NotebookContentItem, NotebookContentItemType } from "../../Notebook/NotebookContentItem";
|
||||||
import { ResourceTreeAdapter } from "../../Tree/ResourceTreeAdapter";
|
import { ResourceTreeAdapter } from "../../Tree/ResourceTreeAdapter";
|
||||||
import {
|
import { RightPaneForm, RightPaneFormProps } from "../RightPaneForm/RightPaneForm";
|
||||||
GenericRightPaneComponent,
|
|
||||||
GenericRightPaneProps,
|
|
||||||
} from "../GenericRightPaneComponent/GenericRightPaneComponent";
|
|
||||||
import { CopyNotebookPaneComponent, CopyNotebookPaneProps } from "./CopyNotebookPaneComponent";
|
import { CopyNotebookPaneComponent, CopyNotebookPaneProps } from "./CopyNotebookPaneComponent";
|
||||||
|
|
||||||
interface Location {
|
interface Location {
|
||||||
|
@ -42,7 +39,6 @@ export const CopyNotebookPane: FunctionComponent<CopyNotebookPanelProps> = ({
|
||||||
}: CopyNotebookPanelProps) => {
|
}: CopyNotebookPanelProps) => {
|
||||||
const [isExecuting, setIsExecuting] = useState<boolean>();
|
const [isExecuting, setIsExecuting] = useState<boolean>();
|
||||||
const [formError, setFormError] = useState<string>("");
|
const [formError, setFormError] = useState<string>("");
|
||||||
const [formErrorDetail, setFormErrorDetail] = useState<string>("");
|
|
||||||
const [pinnedRepos, setPinnedRepos] = useState<IPinnedRepo[]>();
|
const [pinnedRepos, setPinnedRepos] = useState<IPinnedRepo[]>();
|
||||||
const [selectedLocation, setSelectedLocation] = useState<Location>();
|
const [selectedLocation, setSelectedLocation] = useState<Location>();
|
||||||
|
|
||||||
|
@ -92,7 +88,6 @@ export const CopyNotebookPane: FunctionComponent<CopyNotebookPanelProps> = ({
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const errorMessage = getErrorMessage(error);
|
const errorMessage = getErrorMessage(error);
|
||||||
setFormError(`Failed to copy ${name} to ${destination}`);
|
setFormError(`Failed to copy ${name} to ${destination}`);
|
||||||
setFormErrorDetail(`${errorMessage}`);
|
|
||||||
handleError(errorMessage, "CopyNotebookPaneAdapter/submit", formError);
|
handleError(errorMessage, "CopyNotebookPaneAdapter/submit", formError);
|
||||||
} finally {
|
} finally {
|
||||||
clearMessage && clearMessage();
|
clearMessage && clearMessage();
|
||||||
|
@ -130,14 +125,10 @@ export const CopyNotebookPane: FunctionComponent<CopyNotebookPanelProps> = ({
|
||||||
setSelectedLocation(option?.data);
|
setSelectedLocation(option?.data);
|
||||||
};
|
};
|
||||||
|
|
||||||
const genericPaneProps: GenericRightPaneProps = {
|
const props: RightPaneFormProps = {
|
||||||
formError,
|
formError,
|
||||||
formErrorDetail,
|
|
||||||
id: "copynotebookpane",
|
|
||||||
isExecuting: isExecuting,
|
isExecuting: isExecuting,
|
||||||
title: "Copy notebook",
|
|
||||||
submitButtonText: "OK",
|
submitButtonText: "OK",
|
||||||
onClose: closePanel,
|
|
||||||
onSubmit: () => submit(),
|
onSubmit: () => submit(),
|
||||||
expandConsole: () => container.expandConsole(),
|
expandConsole: () => container.expandConsole(),
|
||||||
};
|
};
|
||||||
|
@ -149,8 +140,8 @@ export const CopyNotebookPane: FunctionComponent<CopyNotebookPanelProps> = ({
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<GenericRightPaneComponent {...genericPaneProps}>
|
<RightPaneForm {...props}>
|
||||||
<CopyNotebookPaneComponent {...copyNotebookPaneProps} />
|
<CopyNotebookPaneComponent {...copyNotebookPaneProps} />
|
||||||
</GenericRightPaneComponent>
|
</RightPaneForm>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -130,8 +130,8 @@ describe("Delete Collection Confirmation Pane", () => {
|
||||||
.hostNodes()
|
.hostNodes()
|
||||||
.simulate("change", { target: { value: selectedCollectionId } });
|
.simulate("change", { target: { value: selectedCollectionId } });
|
||||||
|
|
||||||
expect(wrapper.exists(".genericPaneSubmitBtn")).toBe(true);
|
expect(wrapper.exists("#sidePanelOkButton")).toBe(true);
|
||||||
wrapper.find(".genericPaneSubmitBtn").hostNodes().simulate("click");
|
wrapper.find("#sidePanelOkButton").hostNodes().simulate("submit");
|
||||||
expect(deleteCollection).toHaveBeenCalledWith(databaseId, selectedCollectionId);
|
expect(deleteCollection).toHaveBeenCalledWith(databaseId, selectedCollectionId);
|
||||||
|
|
||||||
wrapper.unmount();
|
wrapper.unmount();
|
||||||
|
@ -151,8 +151,8 @@ describe("Delete Collection Confirmation Pane", () => {
|
||||||
.hostNodes()
|
.hostNodes()
|
||||||
.simulate("change", { target: { value: feedbackText } });
|
.simulate("change", { target: { value: feedbackText } });
|
||||||
|
|
||||||
expect(wrapper.exists(".genericPaneSubmitBtn")).toBe(true);
|
expect(wrapper.exists("#sidePanelOkButton")).toBe(true);
|
||||||
wrapper.find(".genericPaneSubmitBtn").hostNodes().simulate("click");
|
wrapper.find("#sidePanelOkButton").hostNodes().simulate("submit");
|
||||||
expect(deleteCollection).toHaveBeenCalledWith(databaseId, selectedCollectionId);
|
expect(deleteCollection).toHaveBeenCalledWith(databaseId, selectedCollectionId);
|
||||||
|
|
||||||
const deleteFeedback = new DeleteFeedback(
|
const deleteFeedback = new DeleteFeedback(
|
||||||
|
|
|
@ -12,10 +12,7 @@ import { userContext } from "../../../UserContext";
|
||||||
import { getCollectionName } from "../../../Utils/APITypeUtils";
|
import { getCollectionName } from "../../../Utils/APITypeUtils";
|
||||||
import * as NotificationConsoleUtils from "../../../Utils/NotificationConsoleUtils";
|
import * as NotificationConsoleUtils from "../../../Utils/NotificationConsoleUtils";
|
||||||
import Explorer from "../../Explorer";
|
import Explorer from "../../Explorer";
|
||||||
import {
|
import { RightPaneForm, RightPaneFormProps } from "../RightPaneForm/RightPaneForm";
|
||||||
GenericRightPaneComponent,
|
|
||||||
GenericRightPaneProps,
|
|
||||||
} from "../GenericRightPaneComponent/GenericRightPaneComponent";
|
|
||||||
export interface DeleteCollectionConfirmationPaneProps {
|
export interface DeleteCollectionConfirmationPaneProps {
|
||||||
explorer: Explorer;
|
explorer: Explorer;
|
||||||
closePanel: () => void;
|
closePanel: () => void;
|
||||||
|
@ -35,7 +32,7 @@ export const DeleteCollectionConfirmationPane: FunctionComponent<DeleteCollectio
|
||||||
};
|
};
|
||||||
const collectionName = getCollectionName().toLocaleLowerCase();
|
const collectionName = getCollectionName().toLocaleLowerCase();
|
||||||
const paneTitle = "Delete " + collectionName;
|
const paneTitle = "Delete " + collectionName;
|
||||||
const submit = async (): Promise<void> => {
|
const onSubmit = async (): Promise<void> => {
|
||||||
const collection = explorer.findSelectedCollection();
|
const collection = explorer.findSelectedCollection();
|
||||||
if (!collection || inputCollectionName !== collection.id()) {
|
if (!collection || inputCollectionName !== collection.id()) {
|
||||||
const errorMessage = "Input " + collectionName + " name does not match the selected " + collectionName;
|
const errorMessage = "Input " + collectionName + " name does not match the selected " + collectionName;
|
||||||
|
@ -100,19 +97,15 @@ export const DeleteCollectionConfirmationPane: FunctionComponent<DeleteCollectio
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const genericPaneProps: GenericRightPaneProps = {
|
const props: RightPaneFormProps = {
|
||||||
formError: formError,
|
formError: formError,
|
||||||
formErrorDetail: formError,
|
|
||||||
id: "deleteCollectionpane",
|
|
||||||
isExecuting,
|
isExecuting,
|
||||||
title: paneTitle,
|
|
||||||
submitButtonText: "OK",
|
submitButtonText: "OK",
|
||||||
onClose: closePanel,
|
onSubmit,
|
||||||
onSubmit: submit,
|
|
||||||
expandConsole: () => explorer.expandConsole(),
|
expandConsole: () => explorer.expandConsole(),
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<GenericRightPaneComponent {...genericPaneProps}>
|
<RightPaneForm {...props}>
|
||||||
<div className="panelFormWrapper">
|
<div className="panelFormWrapper">
|
||||||
<div className="panelMainContent">
|
<div className="panelMainContent">
|
||||||
<div className="confirmDeleteInput">
|
<div className="confirmDeleteInput">
|
||||||
|
@ -150,6 +143,6 @@ export const DeleteCollectionConfirmationPane: FunctionComponent<DeleteCollectio
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</GenericRightPaneComponent>
|
</RightPaneForm>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -98,8 +98,8 @@ describe("Delete Database Confirmation Pane", () => {
|
||||||
.find("#confirmDatabaseId")
|
.find("#confirmDatabaseId")
|
||||||
.hostNodes()
|
.hostNodes()
|
||||||
.simulate("change", { target: { value: selectedDatabaseId } });
|
.simulate("change", { target: { value: selectedDatabaseId } });
|
||||||
expect(wrapper.exists("#sidePanelOkButton")).toBe(true);
|
expect(wrapper.exists("button")).toBe(true);
|
||||||
wrapper.find("#sidePanelOkButton").hostNodes().simulate("submit");
|
wrapper.find("button").hostNodes().simulate("submit");
|
||||||
expect(deleteDatabase).toHaveBeenCalledWith(selectedDatabaseId);
|
expect(deleteDatabase).toHaveBeenCalledWith(selectedDatabaseId);
|
||||||
wrapper.unmount();
|
wrapper.unmount();
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { useBoolean } from "@fluentui/react-hooks";
|
|
||||||
import { Text, TextField } from "@fluentui/react";
|
import { Text, TextField } from "@fluentui/react";
|
||||||
|
import { useBoolean } from "@fluentui/react-hooks";
|
||||||
import React, { FunctionComponent, useState } from "react";
|
import React, { FunctionComponent, useState } from "react";
|
||||||
import { Areas } from "../../Common/Constants";
|
import { Areas } from "../../Common/Constants";
|
||||||
import { deleteDatabase } from "../../Common/dataAccess/deleteDatabase";
|
import { deleteDatabase } from "../../Common/dataAccess/deleteDatabase";
|
||||||
|
@ -12,9 +12,8 @@ import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import { userContext } from "../../UserContext";
|
import { userContext } from "../../UserContext";
|
||||||
import { logConsoleError } from "../../Utils/NotificationConsoleUtils";
|
import { logConsoleError } from "../../Utils/NotificationConsoleUtils";
|
||||||
import Explorer from "../Explorer";
|
import Explorer from "../Explorer";
|
||||||
import { PanelFooterComponent } from "./PanelFooterComponent";
|
|
||||||
import { PanelInfoErrorComponent, PanelInfoErrorProps } from "./PanelInfoErrorComponent";
|
import { PanelInfoErrorComponent, PanelInfoErrorProps } from "./PanelInfoErrorComponent";
|
||||||
import { PanelLoadingScreen } from "./PanelLoadingScreen";
|
import { RightPaneForm, RightPaneFormProps } from "./RightPaneForm/RightPaneForm";
|
||||||
|
|
||||||
interface DeleteDatabaseConfirmationPanelProps {
|
interface DeleteDatabaseConfirmationPanelProps {
|
||||||
explorer: Explorer;
|
explorer: Explorer;
|
||||||
|
@ -23,36 +22,19 @@ interface DeleteDatabaseConfirmationPanelProps {
|
||||||
selectedDatabase: Database;
|
selectedDatabase: Database;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const DeleteDatabaseConfirmationPanel: FunctionComponent<DeleteDatabaseConfirmationPanelProps> = (
|
export const DeleteDatabaseConfirmationPanel: FunctionComponent<DeleteDatabaseConfirmationPanelProps> = ({
|
||||||
props: DeleteDatabaseConfirmationPanelProps
|
explorer,
|
||||||
): JSX.Element => {
|
openNotificationConsole,
|
||||||
|
closePanel,
|
||||||
|
selectedDatabase,
|
||||||
|
}: DeleteDatabaseConfirmationPanelProps): JSX.Element => {
|
||||||
const [isLoading, { setTrue: setLoadingTrue, setFalse: setLoadingFalse }] = useBoolean(false);
|
const [isLoading, { setTrue: setLoadingTrue, setFalse: setLoadingFalse }] = useBoolean(false);
|
||||||
|
|
||||||
const [formError, setFormError] = useState<string>("");
|
const [formError, setFormError] = useState<string>("");
|
||||||
const [databaseInput, setDatabaseInput] = useState<string>("");
|
const [databaseInput, setDatabaseInput] = useState<string>("");
|
||||||
const [databaseFeedbackInput, setDatabaseFeedbackInput] = useState<string>("");
|
const [databaseFeedbackInput, setDatabaseFeedbackInput] = useState<string>("");
|
||||||
|
|
||||||
const getPanelErrorProps = (): PanelInfoErrorProps => {
|
const submit = async (): Promise<void> => {
|
||||||
if (formError) {
|
|
||||||
return {
|
|
||||||
messageType: "error",
|
|
||||||
message: formError,
|
|
||||||
showErrorDetails: true,
|
|
||||||
openNotificationConsole: props.openNotificationConsole,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
messageType: "warning",
|
|
||||||
showErrorDetails: false,
|
|
||||||
message:
|
|
||||||
"Warning! The action you are about to take cannot be undone. Continuing will permanently delete this resource and all of its children resources.",
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
const submit = async (event: React.FormEvent<HTMLFormElement>): Promise<void> => {
|
|
||||||
const { selectedDatabase, explorer } = props;
|
|
||||||
event.preventDefault();
|
|
||||||
if (selectedDatabase?.id() && databaseInput !== selectedDatabase.id()) {
|
if (selectedDatabase?.id() && databaseInput !== selectedDatabase.id()) {
|
||||||
setFormError("Input database name does not match the selected database");
|
setFormError("Input database name does not match the selected database");
|
||||||
logConsoleError(`Error while deleting collection ${selectedDatabase && selectedDatabase.id()}`);
|
logConsoleError(`Error while deleting collection ${selectedDatabase && selectedDatabase.id()}`);
|
||||||
|
@ -69,7 +51,7 @@ export const DeleteDatabaseConfirmationPanel: FunctionComponent<DeleteDatabaseCo
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await deleteDatabase(selectedDatabase.id());
|
await deleteDatabase(selectedDatabase.id());
|
||||||
props.closePanel();
|
closePanel();
|
||||||
explorer.refreshAllDatabases();
|
explorer.refreshAllDatabases();
|
||||||
explorer.tabsManager.closeTabsByComparator((tab) => tab.node?.id() === selectedDatabase.id());
|
explorer.tabsManager.closeTabsByComparator((tab) => tab.node?.id() === selectedDatabase.id());
|
||||||
explorer.selectedNode(undefined);
|
explorer.selectedNode(undefined);
|
||||||
|
@ -121,13 +103,27 @@ export const DeleteDatabaseConfirmationPanel: FunctionComponent<DeleteDatabaseCo
|
||||||
};
|
};
|
||||||
|
|
||||||
const shouldRecordFeedback = (): boolean => {
|
const shouldRecordFeedback = (): boolean => {
|
||||||
const { explorer } = props;
|
|
||||||
return explorer.isLastNonEmptyDatabase() || (explorer.isLastDatabase() && explorer.isSelectedDatabaseShared());
|
return explorer.isLastNonEmptyDatabase() || (explorer.isLastDatabase() && explorer.isSelectedDatabaseShared());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const props: RightPaneFormProps = {
|
||||||
|
formError,
|
||||||
|
isExecuting: isLoading,
|
||||||
|
submitButtonText: "OK",
|
||||||
|
onSubmit: () => submit(),
|
||||||
|
expandConsole: openNotificationConsole,
|
||||||
|
};
|
||||||
|
|
||||||
|
const errorProps: PanelInfoErrorProps = {
|
||||||
|
messageType: "warning",
|
||||||
|
showErrorDetails: false,
|
||||||
|
message:
|
||||||
|
"Warning! The action you are about to take cannot be undone. Continuing will permanently delete this resource and all of its children resources.",
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<form className="panelFormWrapper" onSubmit={submit}>
|
<RightPaneForm {...props}>
|
||||||
<PanelInfoErrorComponent {...getPanelErrorProps()} />
|
{!formError && <PanelInfoErrorComponent {...errorProps} />}
|
||||||
<div className="panelMainContent">
|
<div className="panelMainContent">
|
||||||
<div className="confirmDeleteInput">
|
<div className="confirmDeleteInput">
|
||||||
<span className="mandatoryStar">* </span>
|
<span className="mandatoryStar">* </span>
|
||||||
|
@ -161,8 +157,6 @@ export const DeleteDatabaseConfirmationPanel: FunctionComponent<DeleteDatabaseCo
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<PanelFooterComponent buttonLabel="OK" />
|
</RightPaneForm>
|
||||||
{isLoading && <PanelLoadingScreen />}
|
|
||||||
</form>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
import { useBoolean } from "@fluentui/react-hooks";
|
|
||||||
import { IDropdownOption, IImageProps, Image, Stack, Text } from "@fluentui/react";
|
import { IDropdownOption, IImageProps, Image, Stack, Text } from "@fluentui/react";
|
||||||
|
import { useBoolean } from "@fluentui/react-hooks";
|
||||||
import React, { FunctionComponent, useState } from "react";
|
import React, { FunctionComponent, useState } from "react";
|
||||||
import AddPropertyIcon from "../../../../images/Add-property.svg";
|
import AddPropertyIcon from "../../../../images/Add-property.svg";
|
||||||
|
import { logConsoleError } from "../../../Utils/NotificationConsoleUtils";
|
||||||
import StoredProcedure from "../../Tree/StoredProcedure";
|
import StoredProcedure from "../../Tree/StoredProcedure";
|
||||||
import {
|
import { RightPaneForm, RightPaneFormProps } from "../RightPaneForm/RightPaneForm";
|
||||||
GenericRightPaneComponent,
|
|
||||||
GenericRightPaneProps,
|
|
||||||
} from "../GenericRightPaneComponent/GenericRightPaneComponent";
|
|
||||||
import { InputParameter } from "./InputParameter";
|
import { InputParameter } from "./InputParameter";
|
||||||
|
|
||||||
interface ExecuteSprocParamsPaneProps {
|
interface ExecuteSprocParamsPaneProps {
|
||||||
|
@ -35,24 +33,11 @@ export const ExecuteSprocParamsPane: FunctionComponent<ExecuteSprocParamsPanePro
|
||||||
const [partitionValue, setPartitionValue] = useState<string>(); // Defaulting to undefined here is important. It is not the same partition key as ""
|
const [partitionValue, setPartitionValue] = useState<string>(); // Defaulting to undefined here is important. It is not the same partition key as ""
|
||||||
const [selectedKey, setSelectedKey] = React.useState<IDropdownOption>({ key: "string", text: "" });
|
const [selectedKey, setSelectedKey] = React.useState<IDropdownOption>({ key: "string", text: "" });
|
||||||
const [formError, setFormError] = useState<string>("");
|
const [formError, setFormError] = useState<string>("");
|
||||||
const [formErrorsDetails, setFormErrorsDetails] = useState<string>("");
|
|
||||||
|
|
||||||
const onPartitionKeyChange = (event: React.FormEvent<HTMLDivElement>, item: IDropdownOption): void => {
|
const onPartitionKeyChange = (event: React.FormEvent<HTMLDivElement>, item: IDropdownOption): void => {
|
||||||
setSelectedKey(item);
|
setSelectedKey(item);
|
||||||
};
|
};
|
||||||
|
|
||||||
const genericPaneProps: GenericRightPaneProps = {
|
|
||||||
expandConsole,
|
|
||||||
formError: formError,
|
|
||||||
formErrorDetail: formErrorsDetails,
|
|
||||||
id: "executesprocparamspane",
|
|
||||||
isExecuting: isLoading,
|
|
||||||
title: "Input parameters",
|
|
||||||
submitButtonText: "Execute",
|
|
||||||
onClose: () => closePanel(),
|
|
||||||
onSubmit: () => submit(),
|
|
||||||
};
|
|
||||||
|
|
||||||
const validateUnwrappedParams = (): boolean => {
|
const validateUnwrappedParams = (): boolean => {
|
||||||
const unwrappedParams: UnwrappedExecuteSprocParam[] = paramKeyValues;
|
const unwrappedParams: UnwrappedExecuteSprocParam[] = paramKeyValues;
|
||||||
for (let i = 0; i < unwrappedParams.length; i++) {
|
for (let i = 0; i < unwrappedParams.length; i++) {
|
||||||
|
@ -66,7 +51,7 @@ export const ExecuteSprocParamsPane: FunctionComponent<ExecuteSprocParamsPanePro
|
||||||
|
|
||||||
const setInvalidParamError = (invalidParam: string): void => {
|
const setInvalidParamError = (invalidParam: string): void => {
|
||||||
setFormError(`Invalid param specified: ${invalidParam}`);
|
setFormError(`Invalid param specified: ${invalidParam}`);
|
||||||
setFormErrorsDetails(`Invalid param specified: ${invalidParam} is not a valid literal value`);
|
logConsoleError(`Invalid param specified: ${invalidParam} is not a valid literal value`);
|
||||||
};
|
};
|
||||||
|
|
||||||
const submit = (): void => {
|
const submit = (): void => {
|
||||||
|
@ -128,8 +113,16 @@ export const ExecuteSprocParamsPane: FunctionComponent<ExecuteSprocParamsPanePro
|
||||||
setParamKeyValues(cloneParamKeyValue);
|
setParamKeyValues(cloneParamKeyValue);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const props: RightPaneFormProps = {
|
||||||
|
expandConsole,
|
||||||
|
formError: formError,
|
||||||
|
isExecuting: isLoading,
|
||||||
|
submitButtonText: "Execute",
|
||||||
|
onSubmit: () => submit(),
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<GenericRightPaneComponent {...genericPaneProps}>
|
<RightPaneForm {...props}>
|
||||||
<div className="panelFormWrapper">
|
<div className="panelFormWrapper">
|
||||||
<div className="panelMainContent">
|
<div className="panelMainContent">
|
||||||
<InputParameter
|
<InputParameter
|
||||||
|
@ -169,6 +162,6 @@ export const ExecuteSprocParamsPane: FunctionComponent<ExecuteSprocParamsPanePro
|
||||||
</Stack>
|
</Stack>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</GenericRightPaneComponent>
|
</RightPaneForm>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,126 +0,0 @@
|
||||||
import { IconButton, PrimaryButton } from "@fluentui/react";
|
|
||||||
import React, { FunctionComponent, ReactNode } from "react";
|
|
||||||
import ErrorRedIcon from "../../../../images/error_red.svg";
|
|
||||||
import LoadingIndicatorIcon from "../../../../images/LoadingIndicator_3Squares.gif";
|
|
||||||
import { KeyCodes } from "../../../Common/Constants";
|
|
||||||
|
|
||||||
export interface GenericRightPaneProps {
|
|
||||||
expandConsole: () => void;
|
|
||||||
formError: string;
|
|
||||||
formErrorDetail: string;
|
|
||||||
id: string;
|
|
||||||
isExecuting: boolean;
|
|
||||||
onClose: () => void;
|
|
||||||
onSubmit: () => void;
|
|
||||||
submitButtonText: string;
|
|
||||||
title: string;
|
|
||||||
isSubmitButtonHidden?: boolean;
|
|
||||||
children?: ReactNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const GenericRightPaneComponent: FunctionComponent<GenericRightPaneProps> = ({
|
|
||||||
expandConsole,
|
|
||||||
formError,
|
|
||||||
formErrorDetail,
|
|
||||||
id,
|
|
||||||
isExecuting,
|
|
||||||
onClose,
|
|
||||||
onSubmit,
|
|
||||||
submitButtonText,
|
|
||||||
title,
|
|
||||||
isSubmitButtonHidden,
|
|
||||||
children,
|
|
||||||
}: GenericRightPaneProps) => {
|
|
||||||
const getPanelHeight = (): number => {
|
|
||||||
const notificationConsoleElement: HTMLElement = document.getElementById("explorerNotificationConsole");
|
|
||||||
return window.innerHeight - $(notificationConsoleElement).height();
|
|
||||||
};
|
|
||||||
|
|
||||||
const panelHeight: number = getPanelHeight();
|
|
||||||
|
|
||||||
const renderPanelHeader = (): JSX.Element => {
|
|
||||||
return (
|
|
||||||
<div className="firstdivbg headerline">
|
|
||||||
<span id="databaseTitle" role="heading" aria-level={2}>
|
|
||||||
{title}
|
|
||||||
</span>
|
|
||||||
<IconButton
|
|
||||||
ariaLabel="Close pane"
|
|
||||||
title="Close pane"
|
|
||||||
onClick={onClose}
|
|
||||||
tabIndex={0}
|
|
||||||
className="closePaneBtn"
|
|
||||||
iconProps={{ iconName: "Cancel" }}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const renderErrorSection = (): JSX.Element => {
|
|
||||||
return (
|
|
||||||
<div className="warningErrorContainer" aria-live="assertive" hidden={!formError}>
|
|
||||||
<div className="warningErrorContent">
|
|
||||||
<span>
|
|
||||||
<img className="paneErrorIcon" src={ErrorRedIcon} alt="Error" />
|
|
||||||
</span>
|
|
||||||
<span className="warningErrorDetailsLinkContainer">
|
|
||||||
<span className="formErrors" title={formError}>
|
|
||||||
{formError}
|
|
||||||
</span>
|
|
||||||
<a className="errorLink" role="link" hidden={!formErrorDetail} onClick={expandConsole}>
|
|
||||||
More details
|
|
||||||
</a>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const renderPanelFooter = (): JSX.Element => {
|
|
||||||
return (
|
|
||||||
<div className="paneFooter">
|
|
||||||
<div className="leftpanel-okbut">
|
|
||||||
<PrimaryButton
|
|
||||||
style={{ visibility: isSubmitButtonHidden ? "hidden" : "visible" }}
|
|
||||||
ariaLabel="Submit"
|
|
||||||
title="Submit"
|
|
||||||
onClick={onSubmit}
|
|
||||||
tabIndex={0}
|
|
||||||
className="genericPaneSubmitBtn"
|
|
||||||
text={submitButtonText}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const renderLoadingScreen = (): JSX.Element => {
|
|
||||||
return (
|
|
||||||
<div className="dataExplorerLoaderContainer dataExplorerPaneLoaderContainer" hidden={!isExecuting}>
|
|
||||||
<img className="dataExplorerLoader" src={LoadingIndicatorIcon} />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const onKeyDown = (event: React.KeyboardEvent<HTMLDivElement>): void => {
|
|
||||||
if (event.keyCode === KeyCodes.Escape) {
|
|
||||||
onClose();
|
|
||||||
event.stopPropagation();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div tabIndex={-1} onKeyDown={onKeyDown}>
|
|
||||||
<div className="contextual-pane-out" onClick={onClose}></div>
|
|
||||||
<div className="contextual-pane" id={id} style={{ height: panelHeight }} onKeyDown={onKeyDown}>
|
|
||||||
<div className="panelContentWrapper">
|
|
||||||
{renderPanelHeader()}
|
|
||||||
{renderErrorSection()}
|
|
||||||
{children}
|
|
||||||
{renderPanelFooter()}
|
|
||||||
</div>
|
|
||||||
{renderLoadingScreen()}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { useBoolean } from "@fluentui/react-hooks";
|
|
||||||
import { IImageProps, Image, ImageFit, Stack, TextField } from "@fluentui/react";
|
import { IImageProps, Image, ImageFit, Stack, TextField } from "@fluentui/react";
|
||||||
|
import { useBoolean } from "@fluentui/react-hooks";
|
||||||
import React, { FunctionComponent, useState } from "react";
|
import React, { FunctionComponent, useState } from "react";
|
||||||
import folderIcon from "../../../../images/folder_16x16.svg";
|
import folderIcon from "../../../../images/folder_16x16.svg";
|
||||||
import { logError } from "../../../Common/Logger";
|
import { logError } from "../../../Common/Logger";
|
||||||
|
@ -8,10 +8,7 @@ import { userContext } from "../../../UserContext";
|
||||||
import { logConsoleError, logConsoleInfo, logConsoleProgress } from "../../../Utils/NotificationConsoleUtils";
|
import { logConsoleError, logConsoleInfo, logConsoleProgress } from "../../../Utils/NotificationConsoleUtils";
|
||||||
import Explorer from "../../Explorer";
|
import Explorer from "../../Explorer";
|
||||||
import QueryTab from "../../Tabs/QueryTab";
|
import QueryTab from "../../Tabs/QueryTab";
|
||||||
import {
|
import { RightPaneForm, RightPaneFormProps } from "../RightPaneForm/RightPaneForm";
|
||||||
GenericRightPaneComponent,
|
|
||||||
GenericRightPaneProps,
|
|
||||||
} from "../GenericRightPaneComponent/GenericRightPaneComponent";
|
|
||||||
|
|
||||||
interface LoadQueryPaneProps {
|
interface LoadQueryPaneProps {
|
||||||
explorer: Explorer;
|
explorer: Explorer;
|
||||||
|
@ -24,7 +21,6 @@ export const LoadQueryPane: FunctionComponent<LoadQueryPaneProps> = ({
|
||||||
}: LoadQueryPaneProps): JSX.Element => {
|
}: LoadQueryPaneProps): JSX.Element => {
|
||||||
const [isLoading, { setTrue: setLoadingTrue, setFalse: setLoadingFalse }] = useBoolean(false);
|
const [isLoading, { setTrue: setLoadingTrue, setFalse: setLoadingFalse }] = useBoolean(false);
|
||||||
const [formError, setFormError] = useState<string>("");
|
const [formError, setFormError] = useState<string>("");
|
||||||
const [formErrorsDetails, setFormErrorsDetails] = useState<string>("");
|
|
||||||
const [selectedFileName, setSelectedFileName] = useState<string>("");
|
const [selectedFileName, setSelectedFileName] = useState<string>("");
|
||||||
const [selectedFiles, setSelectedFiles] = useState<FileList>();
|
const [selectedFiles, setSelectedFiles] = useState<FileList>();
|
||||||
|
|
||||||
|
@ -35,19 +31,6 @@ export const LoadQueryPane: FunctionComponent<LoadQueryPaneProps> = ({
|
||||||
className: "fileIcon",
|
className: "fileIcon",
|
||||||
};
|
};
|
||||||
|
|
||||||
const title = "Load Query";
|
|
||||||
const genericPaneProps: GenericRightPaneProps = {
|
|
||||||
expandConsole: () => explorer.expandConsole(),
|
|
||||||
formError: formError,
|
|
||||||
formErrorDetail: formErrorsDetails,
|
|
||||||
id: "loadQueryPane",
|
|
||||||
isExecuting: isLoading,
|
|
||||||
title,
|
|
||||||
submitButtonText: "Load",
|
|
||||||
onClose: () => closePanel(),
|
|
||||||
onSubmit: () => submit(),
|
|
||||||
};
|
|
||||||
|
|
||||||
const onFileSelected = (e: React.ChangeEvent<HTMLInputElement>): void => {
|
const onFileSelected = (e: React.ChangeEvent<HTMLInputElement>): void => {
|
||||||
const { files } = e.target;
|
const { files } = e.target;
|
||||||
setSelectedFiles(files);
|
setSelectedFiles(files);
|
||||||
|
@ -56,10 +39,8 @@ export const LoadQueryPane: FunctionComponent<LoadQueryPaneProps> = ({
|
||||||
|
|
||||||
const submit = async (): Promise<void> => {
|
const submit = async (): Promise<void> => {
|
||||||
setFormError("");
|
setFormError("");
|
||||||
setFormErrorsDetails("");
|
|
||||||
if (!selectedFiles || selectedFiles.length === 0) {
|
if (!selectedFiles || selectedFiles.length === 0) {
|
||||||
setFormError("No file specified");
|
setFormError("No file specified");
|
||||||
setFormErrorsDetails("No file specified. Please input a file.");
|
|
||||||
logConsoleError("Could not load query -- No file specified. Please input a file.");
|
logConsoleError("Could not load query -- No file specified. Please input a file.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -75,7 +56,6 @@ export const LoadQueryPane: FunctionComponent<LoadQueryPaneProps> = ({
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setLoadingFalse();
|
setLoadingFalse();
|
||||||
setFormError("Failed to load query");
|
setFormError("Failed to load query");
|
||||||
setFormErrorsDetails(`Failed to load query: ${error}`);
|
|
||||||
logConsoleError(`Failed to load query from file ${file.name}: ${error}`);
|
logConsoleError(`Failed to load query from file ${file.name}: ${error}`);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -100,14 +80,20 @@ export const LoadQueryPane: FunctionComponent<LoadQueryPaneProps> = ({
|
||||||
|
|
||||||
reader.onerror = (): void => {
|
reader.onerror = (): void => {
|
||||||
setFormError("Failed to load query");
|
setFormError("Failed to load query");
|
||||||
setFormErrorsDetails(`Failed to load query`);
|
|
||||||
logConsoleError(`Failed to load query from file ${file.name}`);
|
logConsoleError(`Failed to load query from file ${file.name}`);
|
||||||
};
|
};
|
||||||
return reader.readAsText(file);
|
return reader.readAsText(file);
|
||||||
};
|
};
|
||||||
|
const props: RightPaneFormProps = {
|
||||||
|
formError: formError,
|
||||||
|
isExecuting: isLoading,
|
||||||
|
submitButtonText: "Load",
|
||||||
|
onSubmit: () => submit(),
|
||||||
|
expandConsole: () => explorer.expandConsole(),
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<GenericRightPaneComponent {...genericPaneProps}>
|
<RightPaneForm {...props}>
|
||||||
<div className="panelFormWrapper">
|
<div className="panelFormWrapper">
|
||||||
<div className="panelMainContent">
|
<div className="panelMainContent">
|
||||||
<Stack horizontal>
|
<Stack horizontal>
|
||||||
|
@ -132,6 +118,6 @@ export const LoadQueryPane: FunctionComponent<LoadQueryPaneProps> = ({
|
||||||
</Stack>
|
</Stack>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</GenericRightPaneComponent>
|
</RightPaneForm>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,16 +1,12 @@
|
||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`Load Query Pane should render Default properly 1`] = `
|
exports[`Load Query Pane should render Default properly 1`] = `
|
||||||
<GenericRightPaneComponent
|
<RightPaneForm
|
||||||
expandConsole={[Function]}
|
expandConsole={[Function]}
|
||||||
formError=""
|
formError=""
|
||||||
formErrorDetail=""
|
|
||||||
id="loadQueryPane"
|
|
||||||
isExecuting={false}
|
isExecuting={false}
|
||||||
onClose={[Function]}
|
|
||||||
onSubmit={[Function]}
|
onSubmit={[Function]}
|
||||||
submitButtonText="Load"
|
submitButtonText="Load"
|
||||||
title="Load Query"
|
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className="panelFormWrapper"
|
className="panelFormWrapper"
|
||||||
|
@ -58,5 +54,5 @@ exports[`Load Query Pane should render Default properly 1`] = `
|
||||||
</Stack>
|
</Stack>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</GenericRightPaneComponent>
|
</RightPaneForm>
|
||||||
`;
|
`;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { shallow, ShallowWrapper } from "enzyme";
|
import { mount, shallow, ShallowWrapper } from "enzyme";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import * as ViewModels from "../../../Contracts/ViewModels";
|
import * as ViewModels from "../../../Contracts/ViewModels";
|
||||||
import Explorer from "../../Explorer";
|
import Explorer from "../../Explorer";
|
||||||
|
@ -36,7 +36,7 @@ describe("New Vertex Panel", () => {
|
||||||
it("should call form submit method", () => {
|
it("should call form submit method", () => {
|
||||||
const onSubmitSpy = jest.fn();
|
const onSubmitSpy = jest.fn();
|
||||||
|
|
||||||
const newWrapper = shallow(
|
const newWrapper = mount(
|
||||||
<NewVertexPanel
|
<NewVertexPanel
|
||||||
explorer={fakeExplorer}
|
explorer={fakeExplorer}
|
||||||
partitionKeyPropertyProp={undefined}
|
partitionKeyPropertyProp={undefined}
|
||||||
|
@ -61,7 +61,7 @@ describe("New Vertex Panel", () => {
|
||||||
|
|
||||||
const result = onSubmitSpy(fakeNewVertexData, onErrorSpy, onSuccessSpy);
|
const result = onSubmitSpy(fakeNewVertexData, onErrorSpy, onSuccessSpy);
|
||||||
|
|
||||||
const newWrapper = shallow(
|
const newWrapper = mount(
|
||||||
<NewVertexPanel
|
<NewVertexPanel
|
||||||
explorer={fakeExplorer}
|
explorer={fakeExplorer}
|
||||||
partitionKeyPropertyProp={undefined}
|
partitionKeyPropertyProp={undefined}
|
||||||
|
|
|
@ -3,9 +3,7 @@ import React, { FunctionComponent, useState } from "react";
|
||||||
import * as ViewModels from "../../../Contracts/ViewModels";
|
import * as ViewModels from "../../../Contracts/ViewModels";
|
||||||
import Explorer from "../../Explorer";
|
import Explorer from "../../Explorer";
|
||||||
import { NewVertexComponent } from "../../Graph/NewVertexComponent/NewVertexComponent";
|
import { NewVertexComponent } from "../../Graph/NewVertexComponent/NewVertexComponent";
|
||||||
import { PanelFooterComponent } from "../PanelFooterComponent";
|
import { RightPaneForm, RightPaneFormProps } from "../RightPaneForm/RightPaneForm";
|
||||||
import { PanelInfoErrorComponent } from "../PanelInfoErrorComponent";
|
|
||||||
import { PanelLoadingScreen } from "../PanelLoadingScreen";
|
|
||||||
export interface INewVertexPanelProps {
|
export interface INewVertexPanelProps {
|
||||||
explorer: Explorer;
|
explorer: Explorer;
|
||||||
partitionKeyPropertyProp: string;
|
partitionKeyPropertyProp: string;
|
||||||
|
@ -21,14 +19,10 @@ export const NewVertexPanel: FunctionComponent<INewVertexPanelProps> = ({
|
||||||
}: INewVertexPanelProps): JSX.Element => {
|
}: INewVertexPanelProps): JSX.Element => {
|
||||||
let newVertexDataValue: ViewModels.NewVertexData;
|
let newVertexDataValue: ViewModels.NewVertexData;
|
||||||
const [errorMessage, setErrorMessage] = useState<string>("");
|
const [errorMessage, setErrorMessage] = useState<string>("");
|
||||||
const [showErrorDetails, setShowErrorDetails] = useState<boolean>(false);
|
|
||||||
const [isLoading, { setTrue: setLoadingTrue, setFalse: setLoadingFalse }] = useBoolean(false);
|
const [isLoading, { setTrue: setLoadingTrue, setFalse: setLoadingFalse }] = useBoolean(false);
|
||||||
const buttonLabel = "OK";
|
|
||||||
|
|
||||||
const submit = (event: React.MouseEvent<HTMLFormElement>) => {
|
const submit = () => {
|
||||||
event.preventDefault();
|
|
||||||
setErrorMessage(undefined);
|
setErrorMessage(undefined);
|
||||||
setShowErrorDetails(false);
|
|
||||||
if (onSubmit !== undefined) {
|
if (onSubmit !== undefined) {
|
||||||
setLoadingTrue();
|
setLoadingTrue();
|
||||||
onSubmit(newVertexDataValue, onError, onSuccess);
|
onSubmit(newVertexDataValue, onError, onSuccess);
|
||||||
|
@ -37,7 +31,6 @@ export const NewVertexPanel: FunctionComponent<INewVertexPanelProps> = ({
|
||||||
|
|
||||||
const onError = (errorMsg: string) => {
|
const onError = (errorMsg: string) => {
|
||||||
setErrorMessage(errorMsg);
|
setErrorMessage(errorMsg);
|
||||||
setShowErrorDetails(true);
|
|
||||||
setLoadingFalse();
|
setLoadingFalse();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -49,17 +42,16 @@ export const NewVertexPanel: FunctionComponent<INewVertexPanelProps> = ({
|
||||||
const onChange = (newVertexData: ViewModels.NewVertexData) => {
|
const onChange = (newVertexData: ViewModels.NewVertexData) => {
|
||||||
newVertexDataValue = newVertexData;
|
newVertexDataValue = newVertexData;
|
||||||
};
|
};
|
||||||
|
const props: RightPaneFormProps = {
|
||||||
|
formError: errorMessage,
|
||||||
|
isExecuting: isLoading,
|
||||||
|
submitButtonText: "OK",
|
||||||
|
onSubmit: () => submit(),
|
||||||
|
expandConsole: openNotificationConsole,
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<form className="panelFormWrapper" onSubmit={(event: React.MouseEvent<HTMLFormElement>) => submit(event)}>
|
<RightPaneForm {...props}>
|
||||||
{errorMessage && (
|
|
||||||
<PanelInfoErrorComponent
|
|
||||||
message={errorMessage}
|
|
||||||
messageType="error"
|
|
||||||
showErrorDetails={showErrorDetails}
|
|
||||||
openNotificationConsole={openNotificationConsole}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
<div className="panelMainContent">
|
<div className="panelMainContent">
|
||||||
<NewVertexComponent
|
<NewVertexComponent
|
||||||
newVertexDataProp={newVertexDataValue}
|
newVertexDataProp={newVertexDataValue}
|
||||||
|
@ -67,8 +59,6 @@ export const NewVertexPanel: FunctionComponent<INewVertexPanelProps> = ({
|
||||||
onChangeProp={onChange}
|
onChangeProp={onChange}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<PanelFooterComponent buttonLabel={buttonLabel} />
|
</RightPaneForm>
|
||||||
{isLoading && <PanelLoadingScreen />}
|
|
||||||
</form>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`New Vertex Panel should render default property 1`] = `
|
exports[`New Vertex Panel should render default property 1`] = `
|
||||||
<form
|
<RightPaneForm
|
||||||
className="panelFormWrapper"
|
expandConsole={[Function]}
|
||||||
|
formError=""
|
||||||
|
isExecuting={false}
|
||||||
onSubmit={[Function]}
|
onSubmit={[Function]}
|
||||||
|
submitButtonText="OK"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className="panelMainContent"
|
className="panelMainContent"
|
||||||
|
@ -13,8 +16,5 @@ exports[`New Vertex Panel should render default property 1`] = `
|
||||||
partitionKeyPropertyProp=""
|
partitionKeyPropertyProp=""
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<PanelFooterComponent
|
</RightPaneForm>
|
||||||
buttonLabel="OK"
|
|
||||||
/>
|
|
||||||
</form>
|
|
||||||
`;
|
`;
|
||||||
|
|
|
@ -8,6 +8,7 @@ export interface PanelInfoErrorProps {
|
||||||
link?: string;
|
link?: string;
|
||||||
linkText?: string;
|
linkText?: string;
|
||||||
openNotificationConsole?: () => void;
|
openNotificationConsole?: () => void;
|
||||||
|
formError?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const PanelInfoErrorComponent: React.FunctionComponent<PanelInfoErrorProps> = ({
|
export const PanelInfoErrorComponent: React.FunctionComponent<PanelInfoErrorProps> = ({
|
||||||
|
|
|
@ -7,15 +7,12 @@ import { JunoClient } from "../../../Juno/JunoClient";
|
||||||
import { Action } from "../../../Shared/Telemetry/TelemetryConstants";
|
import { Action } from "../../../Shared/Telemetry/TelemetryConstants";
|
||||||
import { traceFailure, traceStart, traceSuccess } from "../../../Shared/Telemetry/TelemetryProcessor";
|
import { traceFailure, traceStart, traceSuccess } from "../../../Shared/Telemetry/TelemetryProcessor";
|
||||||
import * as NotificationConsoleUtils from "../../../Utils/NotificationConsoleUtils";
|
import * as NotificationConsoleUtils from "../../../Utils/NotificationConsoleUtils";
|
||||||
import { CodeOfConductComponent } from "../../Controls/NotebookGallery/CodeOfConductComponent";
|
import { CodeOfConduct } from "../../Controls/NotebookGallery/CodeOfConduct/CodeOfConduct";
|
||||||
import { GalleryTab } from "../../Controls/NotebookGallery/GalleryViewerComponent";
|
import { GalleryTab } from "../../Controls/NotebookGallery/GalleryViewerComponent";
|
||||||
import Explorer from "../../Explorer";
|
import Explorer from "../../Explorer";
|
||||||
import * as FileSystemUtil from "../../Notebook/FileSystemUtil";
|
import * as FileSystemUtil from "../../Notebook/FileSystemUtil";
|
||||||
import { SnapshotRequest } from "../../Notebook/NotebookComponent/types";
|
import { SnapshotRequest } from "../../Notebook/NotebookComponent/types";
|
||||||
import {
|
import { RightPaneForm, RightPaneFormProps } from "../RightPaneForm/RightPaneForm";
|
||||||
GenericRightPaneComponent,
|
|
||||||
GenericRightPaneProps,
|
|
||||||
} from "../GenericRightPaneComponent/GenericRightPaneComponent";
|
|
||||||
import { PublishNotebookPaneComponent, PublishNotebookPaneProps } from "./PublishNotebookPaneComponent";
|
import { PublishNotebookPaneComponent, PublishNotebookPaneProps } from "./PublishNotebookPaneComponent";
|
||||||
|
|
||||||
export interface PublishNotebookPaneAProps {
|
export interface PublishNotebookPaneAProps {
|
||||||
|
@ -155,7 +152,6 @@ export const PublishNotebookPane: FunctionComponent<PublishNotebookPaneAProps> =
|
||||||
clearPublishingMessage();
|
clearPublishingMessage();
|
||||||
setIsExecuting(false);
|
setIsExecuting(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
closePanel();
|
closePanel();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -170,15 +166,11 @@ export const PublishNotebookPane: FunctionComponent<PublishNotebookPaneAProps> =
|
||||||
setFormErrorDetail("");
|
setFormErrorDetail("");
|
||||||
};
|
};
|
||||||
|
|
||||||
const props: GenericRightPaneProps = {
|
const props: RightPaneFormProps = {
|
||||||
formError: formError,
|
formError: formError,
|
||||||
formErrorDetail: formErrorDetail,
|
|
||||||
id: "publishnotebookpane",
|
|
||||||
isExecuting: isExecuting,
|
isExecuting: isExecuting,
|
||||||
title: "Publish to gallery",
|
|
||||||
submitButtonText: "Publish",
|
submitButtonText: "Publish",
|
||||||
onSubmit: () => submit(),
|
onSubmit: () => submit(),
|
||||||
onClose: closePanel,
|
|
||||||
expandConsole: () => container.expandConsole(),
|
expandConsole: () => container.expandConsole(),
|
||||||
isSubmitButtonHidden: !isCodeOfConductAccepted,
|
isSubmitButtonHidden: !isCodeOfConductAccepted,
|
||||||
};
|
};
|
||||||
|
@ -201,10 +193,10 @@ export const PublishNotebookPane: FunctionComponent<PublishNotebookPaneAProps> =
|
||||||
onTakeSnapshot,
|
onTakeSnapshot,
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<GenericRightPaneComponent {...props}>
|
<RightPaneForm {...props}>
|
||||||
{!isCodeOfConductAccepted ? (
|
{!isCodeOfConductAccepted ? (
|
||||||
<div style={{ padding: "25px", marginTop: "10px" }}>
|
<div style={{ padding: "25px", marginTop: "10px" }}>
|
||||||
<CodeOfConductComponent
|
<CodeOfConduct
|
||||||
junoClient={junoClient}
|
junoClient={junoClient}
|
||||||
onAcceptCodeOfConduct={(isAccepted) => {
|
onAcceptCodeOfConduct={(isAccepted) => {
|
||||||
setIsCodeOfConductAccepted(isAccepted);
|
setIsCodeOfConductAccepted(isAccepted);
|
||||||
|
@ -214,6 +206,6 @@ export const PublishNotebookPane: FunctionComponent<PublishNotebookPaneAProps> =
|
||||||
) : (
|
) : (
|
||||||
<PublishNotebookPaneComponent {...publishNotebookPaneProps} />
|
<PublishNotebookPaneComponent {...publishNotebookPaneProps} />
|
||||||
)}
|
)}
|
||||||
</GenericRightPaneComponent>
|
</RightPaneForm>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { useBoolean } from "@fluentui/react-hooks";
|
|
||||||
import { Text, TextField } from "@fluentui/react";
|
import { Text, TextField } from "@fluentui/react";
|
||||||
|
import { useBoolean } from "@fluentui/react-hooks";
|
||||||
import React, { FunctionComponent, useState } from "react";
|
import React, { FunctionComponent, useState } from "react";
|
||||||
import { Areas, SavedQueries } from "../../../Common/Constants";
|
import { Areas, SavedQueries } from "../../../Common/Constants";
|
||||||
import { getErrorMessage, getErrorStack } from "../../../Common/ErrorHandlingUtils";
|
import { getErrorMessage, getErrorStack } from "../../../Common/ErrorHandlingUtils";
|
||||||
|
@ -9,10 +9,7 @@ import { traceFailure, traceStart, traceSuccess } from "../../../Shared/Telemetr
|
||||||
import { logConsoleError } from "../../../Utils/NotificationConsoleUtils";
|
import { logConsoleError } from "../../../Utils/NotificationConsoleUtils";
|
||||||
import Explorer from "../../Explorer";
|
import Explorer from "../../Explorer";
|
||||||
import QueryTab from "../../Tabs/QueryTab";
|
import QueryTab from "../../Tabs/QueryTab";
|
||||||
import {
|
import { RightPaneForm, RightPaneFormProps } from "../RightPaneForm/RightPaneForm";
|
||||||
GenericRightPaneComponent,
|
|
||||||
GenericRightPaneProps,
|
|
||||||
} from "../GenericRightPaneComponent/GenericRightPaneComponent";
|
|
||||||
|
|
||||||
interface SaveQueryPaneProps {
|
interface SaveQueryPaneProps {
|
||||||
explorer: Explorer;
|
explorer: Explorer;
|
||||||
|
@ -25,32 +22,16 @@ export const SaveQueryPane: FunctionComponent<SaveQueryPaneProps> = ({
|
||||||
}: SaveQueryPaneProps): JSX.Element => {
|
}: SaveQueryPaneProps): JSX.Element => {
|
||||||
const [isLoading, { setTrue: setLoadingTrue, setFalse: setLoadingFalse }] = useBoolean(false);
|
const [isLoading, { setTrue: setLoadingTrue, setFalse: setLoadingFalse }] = useBoolean(false);
|
||||||
const [formError, setFormError] = useState<string>("");
|
const [formError, setFormError] = useState<string>("");
|
||||||
const [formErrorsDetails, setFormErrorsDetails] = useState<string>("");
|
|
||||||
const [queryName, setQueryName] = useState<string>("");
|
const [queryName, setQueryName] = useState<string>("");
|
||||||
|
|
||||||
const setupSaveQueriesText = `For compliance reasons, we save queries in a container in your Azure Cosmos account, in a separate database called “${SavedQueries.DatabaseName}”. To proceed, we need to create a container in your account, estimated additional cost is $0.77 daily.`;
|
const setupSaveQueriesText = `For compliance reasons, we save queries in a container in your Azure Cosmos account, in a separate database called “${SavedQueries.DatabaseName}”. To proceed, we need to create a container in your account, estimated additional cost is $0.77 daily.`;
|
||||||
const title = "Save Query";
|
const title = "Save Query";
|
||||||
const { canSaveQueries } = explorer;
|
const { canSaveQueries } = explorer;
|
||||||
const genericPaneProps: GenericRightPaneProps = {
|
|
||||||
expandConsole: () => explorer.expandConsole(),
|
|
||||||
formError: formError,
|
|
||||||
formErrorDetail: formErrorsDetails,
|
|
||||||
id: "saveQueryPane",
|
|
||||||
isExecuting: isLoading,
|
|
||||||
title,
|
|
||||||
submitButtonText: canSaveQueries() ? "Save" : "Complete setup",
|
|
||||||
onClose: () => closePanel(),
|
|
||||||
onSubmit: () => {
|
|
||||||
canSaveQueries() ? submit() : setupQueries();
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
const submit = async (): Promise<void> => {
|
const submit = async (): Promise<void> => {
|
||||||
setFormError("");
|
setFormError("");
|
||||||
setFormErrorsDetails("");
|
|
||||||
if (!canSaveQueries()) {
|
if (!canSaveQueries()) {
|
||||||
setFormError("Cannot save query");
|
setFormError("Cannot save query");
|
||||||
setFormErrorsDetails("Failed to save query: account not set up to save queries");
|
|
||||||
logConsoleError("Failed to save query: account not setup to save queries");
|
logConsoleError("Failed to save query: account not setup to save queries");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,12 +39,10 @@ export const SaveQueryPane: FunctionComponent<SaveQueryPaneProps> = ({
|
||||||
const query: string = queryTab && queryTab.sqlQueryEditorContent();
|
const query: string = queryTab && queryTab.sqlQueryEditorContent();
|
||||||
if (!queryName || queryName.length === 0) {
|
if (!queryName || queryName.length === 0) {
|
||||||
setFormError("No query name specified");
|
setFormError("No query name specified");
|
||||||
setFormErrorsDetails("No query name specified. Please specify a query name.");
|
|
||||||
logConsoleError("Could not save query -- No query name specified. Please specify a query name.");
|
logConsoleError("Could not save query -- No query name specified. Please specify a query name.");
|
||||||
return;
|
return;
|
||||||
} else if (!query || query.length === 0) {
|
} else if (!query || query.length === 0) {
|
||||||
setFormError("Invalid query content specified");
|
setFormError("Invalid query content specified");
|
||||||
setFormErrorsDetails("Invalid query content specified. Please enter query content.");
|
|
||||||
logConsoleError("Could not save query -- Invalid query content specified. Please enter query content.");
|
logConsoleError("Could not save query -- Invalid query content specified. Please enter query content.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -97,7 +76,7 @@ export const SaveQueryPane: FunctionComponent<SaveQueryPaneProps> = ({
|
||||||
setLoadingFalse();
|
setLoadingFalse();
|
||||||
const errorMessage = getErrorMessage(error);
|
const errorMessage = getErrorMessage(error);
|
||||||
setFormError("Failed to save query");
|
setFormError("Failed to save query");
|
||||||
setFormErrorsDetails(`Failed to save query: ${errorMessage}`);
|
logConsoleError(`Failed to save query: ${errorMessage}`);
|
||||||
traceFailure(
|
traceFailure(
|
||||||
Action.SaveQuery,
|
Action.SaveQuery,
|
||||||
{
|
{
|
||||||
|
@ -142,14 +121,23 @@ export const SaveQueryPane: FunctionComponent<SaveQueryPaneProps> = ({
|
||||||
startKey
|
startKey
|
||||||
);
|
);
|
||||||
setFormError("Failed to setup a container for saved queries");
|
setFormError("Failed to setup a container for saved queries");
|
||||||
setFormErrorsDetails(`Failed to setup a container for saved queries: ${errorMessage}`);
|
logConsoleError(`Failed to setup a container for saved queries: ${errorMessage}`);
|
||||||
} finally {
|
} finally {
|
||||||
setLoadingFalse();
|
setLoadingFalse();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const props: RightPaneFormProps = {
|
||||||
|
expandConsole: () => explorer.expandConsole(),
|
||||||
|
formError: formError,
|
||||||
|
isExecuting: isLoading,
|
||||||
|
submitButtonText: canSaveQueries() ? "Save" : "Complete setup",
|
||||||
|
onSubmit: () => {
|
||||||
|
canSaveQueries() ? submit() : setupQueries();
|
||||||
|
},
|
||||||
|
};
|
||||||
return (
|
return (
|
||||||
<GenericRightPaneComponent {...genericPaneProps}>
|
<RightPaneForm {...props}>
|
||||||
<div className="panelFormWrapper">
|
<div className="panelFormWrapper">
|
||||||
<div className="panelMainContent">
|
<div className="panelMainContent">
|
||||||
{!canSaveQueries() ? (
|
{!canSaveQueries() ? (
|
||||||
|
@ -158,6 +146,7 @@ export const SaveQueryPane: FunctionComponent<SaveQueryPaneProps> = ({
|
||||||
<TextField
|
<TextField
|
||||||
id="saveQueryInput"
|
id="saveQueryInput"
|
||||||
label="Name"
|
label="Name"
|
||||||
|
autoFocus
|
||||||
styles={{ fieldGroup: { width: 300 } }}
|
styles={{ fieldGroup: { width: 300 } }}
|
||||||
onChange={(event, newInput?: string) => {
|
onChange={(event, newInput?: string) => {
|
||||||
setQueryName(newInput);
|
setQueryName(newInput);
|
||||||
|
@ -166,6 +155,6 @@ export const SaveQueryPane: FunctionComponent<SaveQueryPaneProps> = ({
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</GenericRightPaneComponent>
|
</RightPaneForm>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,16 +1,12 @@
|
||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
exports[`Save Query Pane should render Default properly 1`] = `
|
exports[`Save Query Pane should render Default properly 1`] = `
|
||||||
<GenericRightPaneComponent
|
<RightPaneForm
|
||||||
expandConsole={[Function]}
|
expandConsole={[Function]}
|
||||||
formError=""
|
formError=""
|
||||||
formErrorDetail=""
|
|
||||||
id="saveQueryPane"
|
|
||||||
isExecuting={false}
|
isExecuting={false}
|
||||||
onClose={[Function]}
|
|
||||||
onSubmit={[Function]}
|
onSubmit={[Function]}
|
||||||
submitButtonText="Complete setup"
|
submitButtonText="Complete setup"
|
||||||
title="Save Query"
|
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className="panelFormWrapper"
|
className="panelFormWrapper"
|
||||||
|
@ -25,5 +21,5 @@ exports[`Save Query Pane should render Default properly 1`] = `
|
||||||
</Text>
|
</Text>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</GenericRightPaneComponent>
|
</RightPaneForm>
|
||||||
`;
|
`;
|
||||||
|
|
|
@ -6,10 +6,7 @@ import Explorer from "../../Explorer";
|
||||||
import * as FileSystemUtil from "../../Notebook/FileSystemUtil";
|
import * as FileSystemUtil from "../../Notebook/FileSystemUtil";
|
||||||
import { NotebookContentItem } from "../../Notebook/NotebookContentItem";
|
import { NotebookContentItem } from "../../Notebook/NotebookContentItem";
|
||||||
import NotebookV2Tab from "../../Tabs/NotebookV2Tab";
|
import NotebookV2Tab from "../../Tabs/NotebookV2Tab";
|
||||||
import {
|
import { RightPaneForm, RightPaneFormProps } from "../RightPaneForm/RightPaneForm";
|
||||||
GenericRightPaneComponent,
|
|
||||||
GenericRightPaneProps,
|
|
||||||
} from "../GenericRightPaneComponent/GenericRightPaneComponent";
|
|
||||||
|
|
||||||
export interface StringInputPanelProps {
|
export interface StringInputPanelProps {
|
||||||
explorer: Explorer;
|
explorer: Explorer;
|
||||||
|
@ -40,7 +37,6 @@ export const StringInputPane: FunctionComponent<StringInputPanelProps> = ({
|
||||||
}: StringInputPanelProps): JSX.Element => {
|
}: StringInputPanelProps): JSX.Element => {
|
||||||
const [stringInput, setStringInput] = useState<string>(defaultInput);
|
const [stringInput, setStringInput] = useState<string>(defaultInput);
|
||||||
const [formErrors, setFormErrors] = useState<string>("");
|
const [formErrors, setFormErrors] = useState<string>("");
|
||||||
const [formErrorsDetails, setFormErrorsDetails] = useState<string>("");
|
|
||||||
const [isExecuting, setIsExecuting] = useState<boolean>(false);
|
const [isExecuting, setIsExecuting] = useState<boolean>(false);
|
||||||
|
|
||||||
const submit = async (): Promise<void> => {
|
const submit = async (): Promise<void> => {
|
||||||
|
@ -51,7 +47,6 @@ export const StringInputPane: FunctionComponent<StringInputPanelProps> = ({
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
setFormErrors("");
|
setFormErrors("");
|
||||||
setFormErrorsDetails("");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const clearMessage = logConsoleProgress(`${inProgressMessage} ${stringInput}`);
|
const clearMessage = logConsoleProgress(`${inProgressMessage} ${stringInput}`);
|
||||||
|
@ -78,32 +73,26 @@ export const StringInputPane: FunctionComponent<StringInputPanelProps> = ({
|
||||||
error = JSON.stringify(reason);
|
error = JSON.stringify(reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If it's an AjaxError (AjaxObservable), add more error
|
|
||||||
if (reason?.response?.message) {
|
if (reason?.response?.message) {
|
||||||
error += `. ${reason.response.message}`;
|
error += `. ${reason.response.message}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
setFormErrors(errorMessage);
|
setFormErrors(errorMessage);
|
||||||
setFormErrorsDetails(`${errorMessage}: ${error}`);
|
|
||||||
logConsoleError(`${errorMessage} ${stringInput}: ${error}`);
|
logConsoleError(`${errorMessage} ${stringInput}: ${error}`);
|
||||||
} finally {
|
} finally {
|
||||||
setIsExecuting(false);
|
setIsExecuting(false);
|
||||||
clearMessage();
|
clearMessage();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const genericPaneProps: GenericRightPaneProps = {
|
const props: RightPaneFormProps = {
|
||||||
formError: formErrors,
|
formError: formErrors,
|
||||||
formErrorDetail: formErrorsDetails,
|
|
||||||
id: "stringInputPane",
|
|
||||||
isExecuting: isExecuting,
|
isExecuting: isExecuting,
|
||||||
title: paneTitle,
|
|
||||||
submitButtonText: submitButtonLabel,
|
submitButtonText: submitButtonLabel,
|
||||||
onClose: closePanel,
|
|
||||||
onSubmit: submit,
|
onSubmit: submit,
|
||||||
expandConsole: () => container.expandConsole(),
|
expandConsole: () => container.expandConsole(),
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<GenericRightPaneComponent {...genericPaneProps}>
|
<RightPaneForm {...props}>
|
||||||
<div className="paneMainContent">
|
<div className="paneMainContent">
|
||||||
<TextField
|
<TextField
|
||||||
label={inputLabel}
|
label={inputLabel}
|
||||||
|
@ -117,6 +106,6 @@ export const StringInputPane: FunctionComponent<StringInputPanelProps> = ({
|
||||||
aria-label={inputLabel}
|
aria-label={inputLabel}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</GenericRightPaneComponent>
|
</RightPaneForm>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -3,7 +3,7 @@ import * as ko from "knockout";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import Explorer from "../../../Explorer";
|
import Explorer from "../../../Explorer";
|
||||||
import QueryViewModel from "../../../Tables/QueryBuilder/QueryViewModel";
|
import QueryViewModel from "../../../Tables/QueryBuilder/QueryViewModel";
|
||||||
import { TableQuerySelectPanel } from "./index";
|
import { TableQuerySelectPanel } from "./TableQuerySelectPanel";
|
||||||
|
|
||||||
describe("Table query select Panel", () => {
|
describe("Table query select Panel", () => {
|
||||||
const fakeExplorer = {} as Explorer;
|
const fakeExplorer = {} as Explorer;
|
|
@ -4,10 +4,7 @@ import { userContext } from "../../../../UserContext";
|
||||||
import Explorer from "../../../Explorer";
|
import Explorer from "../../../Explorer";
|
||||||
import * as Constants from "../../../Tables/Constants";
|
import * as Constants from "../../../Tables/Constants";
|
||||||
import QueryViewModel from "../../../Tables/QueryBuilder/QueryViewModel";
|
import QueryViewModel from "../../../Tables/QueryBuilder/QueryViewModel";
|
||||||
import {
|
import { RightPaneForm, RightPaneFormProps } from "../../RightPaneForm/RightPaneForm";
|
||||||
GenericRightPaneComponent,
|
|
||||||
GenericRightPaneProps,
|
|
||||||
} from "../../GenericRightPaneComponent/GenericRightPaneComponent";
|
|
||||||
|
|
||||||
interface TableQuerySelectPanelProps {
|
interface TableQuerySelectPanelProps {
|
||||||
explorer: Explorer;
|
explorer: Explorer;
|
||||||
|
@ -31,24 +28,20 @@ export const TableQuerySelectPanel: FunctionComponent<TableQuerySelectPanelProps
|
||||||
]);
|
]);
|
||||||
const [isAvailableColumnChecked, setIsAvailableColumnChecked] = useState<boolean>(true);
|
const [isAvailableColumnChecked, setIsAvailableColumnChecked] = useState<boolean>(true);
|
||||||
|
|
||||||
const genericPaneProps: GenericRightPaneProps = {
|
const onSubmit = (): void => {
|
||||||
formError: "",
|
|
||||||
formErrorDetail: "",
|
|
||||||
id: "querySelectPane",
|
|
||||||
isExecuting: false,
|
|
||||||
title: "Select Column",
|
|
||||||
submitButtonText: "OK",
|
|
||||||
onClose: () => closePanel(),
|
|
||||||
onSubmit: () => submit(),
|
|
||||||
expandConsole: () => explorer.expandConsole(),
|
|
||||||
};
|
|
||||||
|
|
||||||
const submit = (): void => {
|
|
||||||
queryViewModel.selectText(getParameters());
|
queryViewModel.selectText(getParameters());
|
||||||
queryViewModel.getSelectMessage();
|
queryViewModel.getSelectMessage();
|
||||||
closePanel();
|
closePanel();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const props: RightPaneFormProps = {
|
||||||
|
formError: "",
|
||||||
|
isExecuting: false,
|
||||||
|
submitButtonText: "OK",
|
||||||
|
onSubmit,
|
||||||
|
expandConsole: () => explorer.expandConsole(),
|
||||||
|
};
|
||||||
|
|
||||||
const handleClick = (isChecked: boolean, selectedColumn: string): void => {
|
const handleClick = (isChecked: boolean, selectedColumn: string): void => {
|
||||||
const columns = columnOptions.map((column) => {
|
const columns = columnOptions.map((column) => {
|
||||||
if (column.columnName === selectedColumn) {
|
if (column.columnName === selectedColumn) {
|
||||||
|
@ -128,7 +121,7 @@ export const TableQuerySelectPanel: FunctionComponent<TableQuerySelectPanelProps
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<GenericRightPaneComponent {...genericPaneProps}>
|
<RightPaneForm {...props}>
|
||||||
<div className="panelFormWrapper">
|
<div className="panelFormWrapper">
|
||||||
<div className="panelMainContent">
|
<div className="panelMainContent">
|
||||||
<Text>Select the columns that you want to query.</Text>
|
<Text>Select the columns that you want to query.</Text>
|
||||||
|
@ -153,6 +146,6 @@ export const TableQuerySelectPanel: FunctionComponent<TableQuerySelectPanelProps
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</GenericRightPaneComponent>
|
</RightPaneForm>
|
||||||
);
|
);
|
||||||
};
|
};
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -78,7 +78,7 @@ export const UploadFilePane: FunctionComponent<UploadFilePanelProps> = ({
|
||||||
return uploadFile(file.name, fileContent);
|
return uploadFile(file.name, fileContent);
|
||||||
};
|
};
|
||||||
|
|
||||||
const genericPaneProps: RightPaneFormProps = {
|
const props: RightPaneFormProps = {
|
||||||
expandConsole,
|
expandConsole,
|
||||||
formError: formErrors,
|
formError: formErrors,
|
||||||
isExecuting: isExecuting,
|
isExecuting: isExecuting,
|
||||||
|
@ -87,7 +87,7 @@ export const UploadFilePane: FunctionComponent<UploadFilePanelProps> = ({
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<RightPaneForm {...genericPaneProps}>
|
<RightPaneForm {...props}>
|
||||||
<div className="paneMainContent">
|
<div className="paneMainContent">
|
||||||
<Upload label="Select file to upload" accept={extensions} onUpload={updateSelectedFiles} />
|
<Upload label="Select file to upload" accept={extensions} onUpload={updateSelectedFiles} />
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -50,7 +50,7 @@ export const UploadItemsPane: FunctionComponent<UploadItemsPaneProps> = ({ explo
|
||||||
setFiles(event.target.files);
|
setFiles(event.target.files);
|
||||||
};
|
};
|
||||||
|
|
||||||
const genericPaneProps: RightPaneFormProps = {
|
const props: RightPaneFormProps = {
|
||||||
expandConsole: () => explorer.expandConsole(),
|
expandConsole: () => explorer.expandConsole(),
|
||||||
formError,
|
formError,
|
||||||
isExecuting: isExecuting,
|
isExecuting: isExecuting,
|
||||||
|
@ -89,7 +89,7 @@ export const UploadItemsPane: FunctionComponent<UploadItemsPaneProps> = ({ explo
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<RightPaneForm {...genericPaneProps}>
|
<RightPaneForm {...props}>
|
||||||
<div className="paneMainContent">
|
<div className="paneMainContent">
|
||||||
<Upload
|
<Upload
|
||||||
label="Select JSON Files"
|
label="Select JSON Files"
|
||||||
|
|
|
@ -892,6 +892,13 @@ exports[`Delete Database Confirmation Pane submit() Should call delete database
|
||||||
"id": [Function],
|
"id": [Function],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
>
|
||||||
|
<RightPaneForm
|
||||||
|
expandConsole={[Function]}
|
||||||
|
formError=""
|
||||||
|
isExecuting={false}
|
||||||
|
onSubmit={[Function]}
|
||||||
|
submitButtonText="OK"
|
||||||
>
|
>
|
||||||
<form
|
<form
|
||||||
className="panelFormWrapper"
|
className="panelFormWrapper"
|
||||||
|
@ -3659,5 +3666,6 @@ exports[`Delete Database Confirmation Pane submit() Should call delete database
|
||||||
</div>
|
</div>
|
||||||
</PanelFooterComponent>
|
</PanelFooterComponent>
|
||||||
</form>
|
</form>
|
||||||
|
</RightPaneForm>
|
||||||
</DeleteDatabaseConfirmationPanel>
|
</DeleteDatabaseConfirmationPanel>
|
||||||
`;
|
`;
|
||||||
|
|
|
@ -24,7 +24,7 @@ test("Cassandra keyspace and table CRUD", async () => {
|
||||||
await safeClick(explorer, `[data-test="${tableId}"] [aria-label="More"]`);
|
await safeClick(explorer, `[data-test="${tableId}"] [aria-label="More"]`);
|
||||||
await safeClick(explorer, 'button[role="menuitem"]:has-text("Delete Table")');
|
await safeClick(explorer, 'button[role="menuitem"]:has-text("Delete Table")');
|
||||||
await explorer.fill('text=* Confirm by typing the table id >> input[type="text"]', tableId);
|
await explorer.fill('text=* Confirm by typing the table id >> input[type="text"]', tableId);
|
||||||
await explorer.click('[aria-label="Submit"]');
|
await explorer.click('[aria-label="OK"]');
|
||||||
await explorer.click(`[data-test="${keyspaceId}"] [aria-label="More"]`);
|
await explorer.click(`[data-test="${keyspaceId}"] [aria-label="More"]`);
|
||||||
await explorer.click('button[role="menuitem"]:has-text("Delete Keyspace")');
|
await explorer.click('button[role="menuitem"]:has-text("Delete Keyspace")');
|
||||||
await explorer.click('text=* Confirm by typing the database id >> input[type="text"]');
|
await explorer.click('text=* Confirm by typing the database id >> input[type="text"]');
|
||||||
|
|
|
@ -26,7 +26,7 @@ test("Graph CRUD", async () => {
|
||||||
await safeClick(explorer, `[data-test="${containerId}"] [aria-label="More"]`);
|
await safeClick(explorer, `[data-test="${containerId}"] [aria-label="More"]`);
|
||||||
await safeClick(explorer, 'button[role="menuitem"]:has-text("Delete Graph")');
|
await safeClick(explorer, 'button[role="menuitem"]:has-text("Delete Graph")');
|
||||||
await explorer.fill('text=* Confirm by typing the graph id >> input[type="text"]', containerId);
|
await explorer.fill('text=* Confirm by typing the graph id >> input[type="text"]', containerId);
|
||||||
await explorer.click('[aria-label="Submit"]');
|
await explorer.click('[aria-label="OK"]');
|
||||||
await explorer.click(`[data-test="${databaseId}"] [aria-label="More"]`);
|
await explorer.click(`[data-test="${databaseId}"] [aria-label="More"]`);
|
||||||
await explorer.click('button[role="menuitem"]:has-text("Delete Database")');
|
await explorer.click('button[role="menuitem"]:has-text("Delete Database")');
|
||||||
await explorer.click('text=* Confirm by typing the database id >> input[type="text"]');
|
await explorer.click('text=* Confirm by typing the database id >> input[type="text"]');
|
||||||
|
|
|
@ -23,7 +23,7 @@ test("Mongo CRUD", async () => {
|
||||||
await safeClick(explorer, `.nodeItem >> text=${databaseId}`);
|
await safeClick(explorer, `.nodeItem >> text=${databaseId}`);
|
||||||
await safeClick(explorer, `.nodeItem >> text=${containerId}`);
|
await safeClick(explorer, `.nodeItem >> text=${containerId}`);
|
||||||
// Create indexing policy
|
// Create indexing policy
|
||||||
await safeClick(explorer, ".nodeItem >> text=Setting");
|
await safeClick(explorer, ".nodeItem >> text=Settings");
|
||||||
await explorer.click('button[role="tab"]:has-text("Indexing Policy")');
|
await explorer.click('button[role="tab"]:has-text("Indexing Policy")');
|
||||||
await explorer.click('[aria-label="Index Field Name 0"]');
|
await explorer.click('[aria-label="Index Field Name 0"]');
|
||||||
await explorer.fill('[aria-label="Index Field Name 0"]', "foo");
|
await explorer.fill('[aria-label="Index Field Name 0"]', "foo");
|
||||||
|
@ -37,7 +37,7 @@ test("Mongo CRUD", async () => {
|
||||||
await safeClick(explorer, `[data-test="${containerId}"] [aria-label="More"]`);
|
await safeClick(explorer, `[data-test="${containerId}"] [aria-label="More"]`);
|
||||||
await safeClick(explorer, 'button[role="menuitem"]:has-text("Delete Collection")');
|
await safeClick(explorer, 'button[role="menuitem"]:has-text("Delete Collection")');
|
||||||
await explorer.fill('text=* Confirm by typing the collection id >> input[type="text"]', containerId);
|
await explorer.fill('text=* Confirm by typing the collection id >> input[type="text"]', containerId);
|
||||||
await explorer.click('[aria-label="Submit"]');
|
await explorer.click('[aria-label="OK"]');
|
||||||
await explorer.click(`[data-test="${databaseId}"] [aria-label="More"]`);
|
await explorer.click(`[data-test="${databaseId}"] [aria-label="More"]`);
|
||||||
await explorer.click('button[role="menuitem"]:has-text("Delete Database")');
|
await explorer.click('button[role="menuitem"]:has-text("Delete Database")');
|
||||||
await explorer.click('text=* Confirm by typing the database id >> input[type="text"]');
|
await explorer.click('text=* Confirm by typing the database id >> input[type="text"]');
|
||||||
|
|
|
@ -26,7 +26,7 @@ test("Mongo CRUD", async () => {
|
||||||
await safeClick(explorer, `[data-test="${containerId}"] [aria-label="More"]`);
|
await safeClick(explorer, `[data-test="${containerId}"] [aria-label="More"]`);
|
||||||
await safeClick(explorer, 'button[role="menuitem"]:has-text("Delete Collection")');
|
await safeClick(explorer, 'button[role="menuitem"]:has-text("Delete Collection")');
|
||||||
await explorer.fill('text=* Confirm by typing the collection id >> input[type="text"]', containerId);
|
await explorer.fill('text=* Confirm by typing the collection id >> input[type="text"]', containerId);
|
||||||
await explorer.click('[aria-label="Submit"]');
|
await explorer.click('[aria-label="OK"]');
|
||||||
await explorer.click(`[data-test="${databaseId}"] [aria-label="More"]`);
|
await explorer.click(`[data-test="${databaseId}"] [aria-label="More"]`);
|
||||||
await explorer.click('button[role="menuitem"]:has-text("Delete Database")');
|
await explorer.click('button[role="menuitem"]:has-text("Delete Database")');
|
||||||
await explorer.click('text=* Confirm by typing the database id >> input[type="text"]');
|
await explorer.click('text=* Confirm by typing the database id >> input[type="text"]');
|
||||||
|
|
|
@ -23,7 +23,7 @@ test("SQL CRUD", async () => {
|
||||||
await safeClick(explorer, `[data-test="${containerId}"] [aria-label="More"]`);
|
await safeClick(explorer, `[data-test="${containerId}"] [aria-label="More"]`);
|
||||||
await safeClick(explorer, 'button[role="menuitem"]:has-text("Delete Container")');
|
await safeClick(explorer, 'button[role="menuitem"]:has-text("Delete Container")');
|
||||||
await explorer.fill('text=* Confirm by typing the container id >> input[type="text"]', containerId);
|
await explorer.fill('text=* Confirm by typing the container id >> input[type="text"]', containerId);
|
||||||
await explorer.click('[aria-label="Submit"]');
|
await explorer.click('[aria-label="OK"]');
|
||||||
await explorer.click(`[data-test="${databaseId}"] [aria-label="More"]`);
|
await explorer.click(`[data-test="${databaseId}"] [aria-label="More"]`);
|
||||||
await explorer.click('button[role="menuitem"]:has-text("Delete Database")');
|
await explorer.click('button[role="menuitem"]:has-text("Delete Database")');
|
||||||
await explorer.click('text=* Confirm by typing the database id >> input[type="text"]');
|
await explorer.click('text=* Confirm by typing the database id >> input[type="text"]');
|
||||||
|
|
|
@ -21,6 +21,6 @@ test("Tables CRUD", async () => {
|
||||||
await safeClick(explorer, `[data-test="${tableId}"] [aria-label="More"]`);
|
await safeClick(explorer, `[data-test="${tableId}"] [aria-label="More"]`);
|
||||||
await safeClick(explorer, 'button[role="menuitem"]:has-text("Delete Table")');
|
await safeClick(explorer, 'button[role="menuitem"]:has-text("Delete Table")');
|
||||||
await explorer.fill('text=* Confirm by typing the table id >> input[type="text"]', tableId);
|
await explorer.fill('text=* Confirm by typing the table id >> input[type="text"]', tableId);
|
||||||
await explorer.click('[aria-label="Submit"]');
|
await explorer.click('[aria-label="OK"]');
|
||||||
await expect(explorer).not.toHaveText(".dataResourceTree", tableId);
|
await expect(explorer).not.toHaveText(".dataResourceTree", tableId);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue