diff --git a/src/Explorer/Panes/GitHubReposPane.html b/src/Explorer/Panes/GitHubReposPane.html
deleted file mode 100644
index 398acaeaf..000000000
--- a/src/Explorer/Panes/GitHubReposPane.html
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-

-
-
-
-
diff --git a/src/Explorer/Panes/GitHubReposPanel/GitHubReposPanel.test.tsx b/src/Explorer/Panes/GitHubReposPanel/GitHubReposPanel.test.tsx
new file mode 100644
index 000000000..3d12139f5
--- /dev/null
+++ b/src/Explorer/Panes/GitHubReposPanel/GitHubReposPanel.test.tsx
@@ -0,0 +1,19 @@
+import { shallow } from "enzyme";
+import React from "react";
+import { GitHubClient } from "../../../GitHub/GitHubClient";
+import { JunoClient } from "../../../Juno/JunoClient";
+import Explorer from "../../Explorer";
+import { GitHubReposPanel } from "./GitHubReposPanel";
+const props = {
+ explorer: new Explorer(),
+ closePanel: (): void => undefined,
+ gitHubClientProp: new GitHubClient((): void => undefined),
+ junoClientProp: new JunoClient(),
+ openNotificationConsole: (): void => undefined,
+};
+describe("GitHub Repos Panel", () => {
+ it("should render Default properly", () => {
+ const wrapper = shallow(
);
+ expect(wrapper).toMatchSnapshot();
+ });
+});
diff --git a/src/Explorer/Panes/GitHubReposPane.ts b/src/Explorer/Panes/GitHubReposPanel/GitHubReposPanel.tsx
similarity index 52%
rename from src/Explorer/Panes/GitHubReposPane.ts
rename to src/Explorer/Panes/GitHubReposPanel/GitHubReposPanel.tsx
index b360b1865..b7fd4aa82 100644
--- a/src/Explorer/Panes/GitHubReposPane.ts
+++ b/src/Explorer/Panes/GitHubReposPanel/GitHubReposPanel.tsx
@@ -1,27 +1,42 @@
-import _ from "underscore";
-import { Areas, HttpStatusCodes } from "../../Common/Constants";
-import * as ViewModels from "../../Contracts/ViewModels";
-import { GitHubClient, IGitHubPageInfo, IGitHubRepo } from "../../GitHub/GitHubClient";
-import { IPinnedRepo, JunoClient } from "../../Juno/JunoClient";
-import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
-import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
-import * as GitHubUtils from "../../Utils/GitHubUtils";
-import * as JunoUtils from "../../Utils/JunoUtils";
-import { AuthorizeAccessComponent } from "../Controls/GitHub/AuthorizeAccessComponent";
-import { GitHubReposComponent, GitHubReposComponentProps, RepoListItem } from "../Controls/GitHub/GitHubReposComponent";
-import { GitHubReposComponentAdapter } from "../Controls/GitHub/GitHubReposComponentAdapter";
-import { BranchesProps, PinnedReposProps, UnpinnedReposProps } from "../Controls/GitHub/ReposListComponent";
-import { ContextualPaneBase } from "./ContextualPaneBase";
-import { handleError } from "../../Common/ErrorHandlingUtils";
+import React from "react";
+import { Areas, HttpStatusCodes } from "../../../Common/Constants";
+import { handleError } from "../../../Common/ErrorHandlingUtils";
+import { GitHubClient, IGitHubPageInfo, IGitHubRepo } from "../../../GitHub/GitHubClient";
+import { IPinnedRepo, JunoClient } from "../../../Juno/JunoClient";
+import { Action, ActionModifiers } from "../../../Shared/Telemetry/TelemetryConstants";
+import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
+import * as GitHubUtils from "../../../Utils/GitHubUtils";
+import * as JunoUtils from "../../../Utils/JunoUtils";
+import { AuthorizeAccessComponent } from "../../Controls/GitHub/AuthorizeAccessComponent";
+import {
+ GitHubReposComponent,
+ GitHubReposComponentProps,
+ RepoListItem,
+} from "../../Controls/GitHub/GitHubReposComponent";
+import { ContentMainStyle } from "../../Controls/GitHub/GitHubStyleConstants";
+import { BranchesProps, PinnedReposProps, UnpinnedReposProps } from "../../Controls/GitHub/ReposListComponent";
+import Explorer from "../../Explorer";
+import { PanelInfoErrorComponent } from "../PanelInfoErrorComponent";
+import { PanelLoadingScreen } from "../PanelLoadingScreen";
-interface GitHubReposPaneOptions extends ViewModels.PaneOptions {
- gitHubClient: GitHubClient;
- junoClient: JunoClient;
+interface IGitHubReposPanelProps {
+ explorer: Explorer;
+ closePanel: () => void;
+ gitHubClientProp: GitHubClient;
+ junoClientProp: JunoClient;
+ openNotificationConsole: () => void;
}
-export class GitHubReposPane extends ContextualPaneBase {
+interface IGitHubReposPanelState {
+ showAuthorizationAcessState: boolean;
+ isExecuting: boolean;
+ errorMessage: string;
+ showErrorDetails: boolean;
+ gitHubReposState: GitHubReposComponentProps;
+}
+export class GitHubReposPanel extends React.Component
{
private static readonly PageSize = 30;
-
+ private isAddedRepo = false;
private gitHubClient: GitHubClient;
private junoClient: JunoClient;
@@ -29,73 +44,73 @@ export class GitHubReposPane extends ContextualPaneBase {
private pinnedReposProps: PinnedReposProps;
private unpinnedReposProps: UnpinnedReposProps;
- private gitHubReposProps: GitHubReposComponentProps;
- private gitHubReposAdapter: GitHubReposComponentAdapter;
-
private allGitHubRepos: IGitHubRepo[];
private allGitHubReposLastPageInfo?: IGitHubPageInfo;
private pinnedReposUpdated: boolean;
- constructor(options: GitHubReposPaneOptions) {
- super(options);
+ constructor(props: IGitHubReposPanelProps) {
+ super(props);
- this.gitHubClient = options.gitHubClient;
- this.junoClient = options.junoClient;
-
- this.branchesProps = {};
- this.pinnedReposProps = {
- repos: [],
- };
this.unpinnedReposProps = {
repos: [],
hasMore: true,
isLoading: true,
loadMore: (): Promise => this.loadMoreUnpinnedRepos(),
};
-
- this.gitHubReposProps = {
- showAuthorizeAccess: true,
- authorizeAccessProps: {
- scope: this.getOAuthScope(),
- authorizeAccess: (scope): void => this.connectToGitHub(scope),
- },
- reposListProps: {
- branchesProps: this.branchesProps,
- pinnedReposProps: this.pinnedReposProps,
- unpinnedReposProps: this.unpinnedReposProps,
- pinRepo: (item): Promise => this.pinRepo(item),
- unpinRepo: (item): Promise => this.unpinRepo(item),
- },
- addRepoProps: {
- container: this.container,
- getRepo: (owner, repo): Promise => this.getRepo(owner, repo),
- pinRepo: (item): Promise => this.pinRepo(item),
- },
- resetConnection: (): void => this.setup(true),
- onOkClick: (): Promise => this.submit(),
- onCancelClick: (): void => this.cancel(),
+ this.branchesProps = {};
+ this.pinnedReposProps = {
+ repos: [],
};
- this.gitHubReposAdapter = new GitHubReposComponentAdapter(this.gitHubReposProps);
this.allGitHubRepos = [];
this.allGitHubReposLastPageInfo = undefined;
this.pinnedReposUpdated = false;
+
+ this.state = {
+ showAuthorizationAcessState: true,
+ isExecuting: false,
+ errorMessage: "",
+ showErrorDetails: false,
+ gitHubReposState: {
+ showAuthorizeAccess: !this.props.explorer.notebookManager?.gitHubOAuthService.isLoggedIn(),
+ authorizeAccessProps: {
+ scope: this.getOAuthScope(),
+ authorizeAccess: (scope): void => this.connectToGitHub(scope),
+ },
+ reposListProps: {
+ branchesProps: this.branchesProps,
+ pinnedReposProps: this.pinnedReposProps,
+ unpinnedReposProps: this.unpinnedReposProps,
+ pinRepo: (item): Promise => this.pinRepo(item),
+ unpinRepo: (item): Promise => this.unpinRepo(item),
+ },
+ addRepoProps: {
+ container: this.props.explorer,
+ getRepo: (owner, repo): Promise => this.getRepo(owner, repo),
+ pinRepo: (item): Promise => this.pinRepo(item),
+ },
+ resetConnection: (): void => this.setup(true),
+ onOkClick: (): Promise => this.submit(),
+ onCancelClick: (): void => this.props.closePanel(),
+ },
+ };
+ this.gitHubClient = this.props.gitHubClientProp;
+ this.junoClient = this.props.junoClientProp;
+ }
+
+ componentDidMount(): void {
+ this.open();
}
public open(): void {
this.resetData();
this.setup();
-
- super.open();
}
public async submit(): Promise {
const pinnedReposUpdated = this.pinnedReposUpdated;
const reposToPin: IPinnedRepo[] = this.pinnedReposProps.repos.map((repo) => JunoUtils.toPinnedRepo(repo));
- // Submit resets data too
- super.submit();
-
if (pinnedReposUpdated) {
try {
const response = await this.junoClient.updatePinnedRepos(reposToPin);
@@ -109,57 +124,44 @@ export class GitHubReposPane extends ContextualPaneBase {
}
public resetData(): void {
- // Reset cached branches
this.branchesProps = {};
- this.gitHubReposProps.reposListProps.branchesProps = this.branchesProps;
- // Reset cached pinned and unpinned repos
this.pinnedReposProps.repos = [];
this.unpinnedReposProps.repos = [];
-
- // Reset cached repos
this.allGitHubRepos = [];
this.allGitHubReposLastPageInfo = undefined;
- // Reset flags
this.pinnedReposUpdated = false;
this.unpinnedReposProps.hasMore = true;
this.unpinnedReposProps.isLoading = true;
-
- this.triggerRender();
-
- super.resetData();
}
private getOAuthScope(): string {
return (
- this.container.notebookManager?.gitHubOAuthService.getTokenObservable()()?.scope ||
+ this.props.explorer.notebookManager?.gitHubOAuthService.getTokenObservable()()?.scope ||
AuthorizeAccessComponent.Scopes.Public.key
);
}
private setup(forceShowConnectToGitHub = false): void {
- forceShowConnectToGitHub || !this.container.notebookManager?.gitHubOAuthService.isLoggedIn()
+ forceShowConnectToGitHub || !this.props.explorer.notebookManager?.gitHubOAuthService.isLoggedIn()
? this.setupForConnectToGitHub()
: this.setupForManageRepos();
}
private setupForConnectToGitHub(): void {
- this.gitHubReposProps.showAuthorizeAccess = true;
- this.gitHubReposProps.authorizeAccessProps.scope = this.getOAuthScope();
- this.isExecuting(false);
- this.title(GitHubReposComponent.ConnectToGitHubTitle); // Used for telemetry
- this.triggerRender();
+ this.setState({
+ isExecuting: false,
+ });
}
private async setupForManageRepos(): Promise {
- this.gitHubReposProps.showAuthorizeAccess = false;
- this.isExecuting(false);
- this.title(GitHubReposComponent.ManageGitHubRepoTitle); // Used for telemetry
+ this.setState({
+ isExecuting: false,
+ });
TelemetryProcessor.trace(Action.NotebooksGitHubManageRepo, ActionModifiers.Mark, {
dataExplorerArea: Areas.Notebook,
});
- this.triggerRender();
this.refreshManageReposComponent();
}
@@ -182,15 +184,15 @@ export class GitHubReposPane extends ContextualPaneBase {
const branchesProps = this.branchesProps[GitHubUtils.toRepoFullName(repo.owner, repo.name)];
branchesProps.hasMore = true;
branchesProps.isLoading = true;
- this.triggerRender();
try {
const response = await this.gitHubClient.getBranchesAsync(
repo.owner,
repo.name,
- GitHubReposPane.PageSize,
+ GitHubReposPanel.PageSize,
branchesProps.lastPageInfo?.endCursor
);
+
if (response.status !== HttpStatusCodes.OK) {
throw new Error(`Received HTTP ${response.status} when fetching branches`);
}
@@ -205,19 +207,37 @@ export class GitHubReposPane extends ContextualPaneBase {
branchesProps.isLoading = false;
branchesProps.hasMore = branchesProps.lastPageInfo?.hasNextPage;
- this.triggerRender();
+ this.setState({
+ gitHubReposState: {
+ ...this.state.gitHubReposState,
+ reposListProps: {
+ ...this.state.gitHubReposState.reposListProps,
+ branchesProps: {
+ ...this.state.gitHubReposState.reposListProps.branchesProps,
+ [GitHubUtils.toRepoFullName(repo.owner, repo.name)]: branchesProps,
+ },
+ pinnedReposProps: {
+ repos: this.pinnedReposProps.repos,
+ },
+ unpinnedReposProps: {
+ ...this.state.gitHubReposState.reposListProps.unpinnedReposProps,
+ repos: this.unpinnedReposProps.repos,
+ },
+ },
+ },
+ });
}
private async loadMoreUnpinnedRepos(): Promise {
this.unpinnedReposProps.isLoading = true;
this.unpinnedReposProps.hasMore = true;
- this.triggerRender();
try {
const response = await this.gitHubClient.getReposAsync(
- GitHubReposPane.PageSize,
+ GitHubReposPanel.PageSize,
this.allGitHubReposLastPageInfo?.endCursor
);
+
if (response.status !== HttpStatusCodes.OK) {
throw new Error(`Received HTTP ${response.status} when fetching unpinned repos`);
}
@@ -233,7 +253,21 @@ export class GitHubReposPane extends ContextualPaneBase {
this.unpinnedReposProps.isLoading = false;
this.unpinnedReposProps.hasMore = this.allGitHubReposLastPageInfo?.hasNextPage;
- this.triggerRender();
+
+ this.setState({
+ gitHubReposState: {
+ ...this.state.gitHubReposState,
+ reposListProps: {
+ ...this.state.gitHubReposState.reposListProps,
+ unpinnedReposProps: {
+ ...this.state.gitHubReposState.reposListProps.unpinnedReposProps,
+ isLoading: this.unpinnedReposProps.isLoading,
+ hasMore: this.unpinnedReposProps.hasMore,
+ repos: this.unpinnedReposProps.repos,
+ },
+ },
+ },
+ });
}
private async getRepo(owner: string, repo: string): Promise {
@@ -242,7 +276,7 @@ export class GitHubReposPane extends ContextualPaneBase {
if (response.status !== HttpStatusCodes.OK) {
throw new Error(`Received HTTP ${response.status} when fetching repo`);
}
-
+ this.isAddedRepo = true;
return response.data;
} catch (error) {
handleError(error, "GitHubReposPane/getRepo", "Failed to fetch repo");
@@ -254,7 +288,7 @@ export class GitHubReposPane extends ContextualPaneBase {
this.pinnedReposUpdated = true;
const initialReposLength = this.pinnedReposProps.repos.length;
- const existingRepo = _.find(this.pinnedReposProps.repos, (repo) => repo.key === item.key);
+ const existingRepo = this.pinnedReposProps.repos.find((repo) => repo.key === item.key);
if (existingRepo) {
existingRepo.branches = item.branches;
} else {
@@ -262,7 +296,6 @@ export class GitHubReposPane extends ContextualPaneBase {
}
this.unpinnedReposProps.repos = this.calculateUnpinnedRepos();
- this.triggerRender();
if (this.pinnedReposProps.repos.length > initialReposLength) {
this.refreshBranchesForPinnedRepos();
@@ -273,7 +306,22 @@ export class GitHubReposPane extends ContextualPaneBase {
this.pinnedReposUpdated = true;
this.pinnedReposProps.repos = this.pinnedReposProps.repos.filter((pinnedRepo) => pinnedRepo.key !== item.key);
this.unpinnedReposProps.repos = this.calculateUnpinnedRepos();
- this.triggerRender();
+
+ this.setState({
+ gitHubReposState: {
+ ...this.state.gitHubReposState,
+ reposListProps: {
+ ...this.state.gitHubReposState.reposListProps,
+ pinnedReposProps: {
+ repos: this.pinnedReposProps.repos,
+ },
+ unpinnedReposProps: {
+ ...this.state.gitHubReposState.reposListProps.unpinnedReposProps,
+ repos: this.unpinnedReposProps.repos,
+ },
+ },
+ },
+ });
}
private async refreshManageReposComponent(): Promise {
@@ -284,12 +332,12 @@ export class GitHubReposPane extends ContextualPaneBase {
private async refreshPinnedRepoListItems(): Promise {
this.pinnedReposProps.repos = [];
- this.triggerRender();
try {
const response = await this.junoClient.getPinnedRepos(
- this.container.notebookManager?.gitHubOAuthService.getTokenObservable()()?.scope
+ this.props.explorer.notebookManager?.gitHubOAuthService.getTokenObservable()()?.scope
);
+
if (response.status !== HttpStatusCodes.OK && response.status !== HttpStatusCodes.NoContent) {
throw new Error(`Received HTTP ${response.status} when fetching pinned repos`);
}
@@ -305,7 +353,6 @@ export class GitHubReposPane extends ContextualPaneBase {
);
this.pinnedReposProps.repos = pinnedRepos;
- this.triggerRender();
}
} catch (error) {
handleError(error, "GitHubReposPane/refreshPinnedReposListItems", "Failed to fetch pinned repos");
@@ -322,28 +369,85 @@ export class GitHubReposPane extends ContextualPaneBase {
isLoading: true,
loadMore: (): Promise => this.loadMoreBranches(item.repo),
};
+ this.setState({
+ gitHubReposState: {
+ ...this.state.gitHubReposState,
+ reposListProps: {
+ ...this.state.gitHubReposState.reposListProps,
+ branchesProps: {
+ ...this.state.gitHubReposState.reposListProps.branchesProps,
+ [GitHubUtils.toRepoFullName(item.repo.owner, item.repo.name)]: this.branchesProps[item.key],
+ },
+ pinnedReposProps: {
+ repos: this.pinnedReposProps.repos,
+ },
+ unpinnedReposProps: {
+ ...this.state.gitHubReposState.reposListProps.unpinnedReposProps,
+ repos: this.unpinnedReposProps.repos,
+ },
+ },
+ },
+ });
this.loadMoreBranches(item.repo);
+ } else {
+ if (this.isAddedRepo === false) {
+ this.setState({
+ gitHubReposState: {
+ ...this.state.gitHubReposState,
+ reposListProps: {
+ ...this.state.gitHubReposState.reposListProps,
+ pinnedReposProps: {
+ repos: this.pinnedReposProps.repos,
+ },
+ unpinnedReposProps: {
+ ...this.state.gitHubReposState.reposListProps.unpinnedReposProps,
+ repos: this.unpinnedReposProps.repos,
+ },
+ },
+ },
+ });
+ }
}
});
+ this.isAddedRepo = false;
}
private async refreshUnpinnedRepoListItems(): Promise {
this.allGitHubRepos = [];
this.allGitHubReposLastPageInfo = undefined;
this.unpinnedReposProps.repos = [];
+
this.loadMoreUnpinnedRepos();
}
private connectToGitHub(scope: string): void {
- this.isExecuting(true);
+ this.setState({
+ isExecuting: true,
+ });
TelemetryProcessor.trace(Action.NotebooksGitHubAuthorize, ActionModifiers.Mark, {
dataExplorerArea: Areas.Notebook,
scopesSelected: scope,
});
- this.container.notebookManager?.gitHubOAuthService.startOAuth(scope);
+ this.props.explorer.notebookManager?.gitHubOAuthService.startOAuth(scope);
}
- private triggerRender(): void {
- this.gitHubReposAdapter.triggerRender();
+ render(): JSX.Element {
+ return (
+
+ );
}
}
diff --git a/src/Explorer/Panes/GitHubReposPanel/__snapshots__/GitHubReposPanel.test.tsx.snap b/src/Explorer/Panes/GitHubReposPanel/__snapshots__/GitHubReposPanel.test.tsx.snap
new file mode 100644
index 000000000..6b308f110
--- /dev/null
+++ b/src/Explorer/Panes/GitHubReposPanel/__snapshots__/GitHubReposPanel.test.tsx.snap
@@ -0,0 +1,1319 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`GitHub Repos Panel should render Default properly 1`] = `
+
+`;
diff --git a/src/Explorer/Panes/LoadQueryPane/LoadQueryPane.tsx b/src/Explorer/Panes/LoadQueryPane/LoadQueryPane.tsx
index 6a8fed727..d2079c010 100644
--- a/src/Explorer/Panes/LoadQueryPane/LoadQueryPane.tsx
+++ b/src/Explorer/Panes/LoadQueryPane/LoadQueryPane.tsx
@@ -37,7 +37,7 @@ export const LoadQueryPane: FunctionComponent = ({
const title = "Load Query";
const genericPaneProps: GenericRightPaneProps = {
- container: explorer,
+ expandConsole: () => explorer.expandConsole(),
formError: formError,
formErrorDetail: formErrorsDetails,
id: "loadQueryPane",
diff --git a/src/Explorer/Panes/LoadQueryPane/__snapshots__/LoadQueryPane.test.tsx.snap b/src/Explorer/Panes/LoadQueryPane/__snapshots__/LoadQueryPane.test.tsx.snap
index ee672aa5c..badff47b7 100644
--- a/src/Explorer/Panes/LoadQueryPane/__snapshots__/LoadQueryPane.test.tsx.snap
+++ b/src/Explorer/Panes/LoadQueryPane/__snapshots__/LoadQueryPane.test.tsx.snap
@@ -2,7 +2,7 @@
exports[`Load Query Pane should render Default properly 1`] = `
* {
+ & > :not(.collapsibleSection) {
margin-bottom: @DefaultSpace;
- & > * {
- margin-bottom: @SmallSpace;
+ & > :not(:last-child) {
+ margin-bottom: @DefaultSpace;
}
}
@@ -23,7 +23,6 @@
font-size: @mediumFontSize;
width: @mediumFontSize;
margin: auto 0 auto @SmallSpace;
- color: @InfoIconColor;
cursor: default;
vertical-align: middle;
}
@@ -49,10 +48,6 @@
font-size: @mediumFontSize;
padding: 0 @LargeSpace 0 @SmallSpace;
}
-
- .collapsibleSection {
- margin-bottom: 0;
- }
}
}
@@ -99,7 +94,7 @@
}
.panelFooter {
- padding: 20px 34px;
+ padding: 16px 34px;
border-top: solid 1px #bbbbbb;
& button {
@@ -123,8 +118,8 @@
cursor: pointer;
}
-.panelGroupSpacing > * {
- margin-bottom: @SmallSpace;
+.panelGroupSpacing > :not(:last-child) {
+ margin-bottom: @DefaultSpace;
}
.fileUpload {
display: none !important;
@@ -170,3 +165,6 @@
.column-select-view {
margin: 20px 0px 0px 0px;
}
+.panelSeparator::before {
+ background-color: #edebe9;
+}
diff --git a/src/Explorer/Panes/PublishNotebookPane/PublishNotebookPane.tsx b/src/Explorer/Panes/PublishNotebookPane/PublishNotebookPane.tsx
index 7bbd3eaec..244fcf0d3 100644
--- a/src/Explorer/Panes/PublishNotebookPane/PublishNotebookPane.tsx
+++ b/src/Explorer/Panes/PublishNotebookPane/PublishNotebookPane.tsx
@@ -158,7 +158,6 @@ export const PublishNotebookPane: FunctionComponent =
};
const props: GenericRightPaneProps = {
- container: container,
formError: formError,
formErrorDetail: formErrorDetail,
id: "publishnotebookpane",
@@ -167,6 +166,7 @@ export const PublishNotebookPane: FunctionComponent =
submitButtonText: "Publish",
onSubmit: () => submit(),
onClose: closePanel,
+ expandConsole: () => container.expandConsole(),
isSubmitButtonHidden: !isCodeOfConductAccepted,
};
diff --git a/src/Explorer/Panes/RightPaneForm/RightPaneForm.test.tsx b/src/Explorer/Panes/RightPaneForm/RightPaneForm.test.tsx
index 6e0bfe27e..79bcf43d0 100644
--- a/src/Explorer/Panes/RightPaneForm/RightPaneForm.test.tsx
+++ b/src/Explorer/Panes/RightPaneForm/RightPaneForm.test.tsx
@@ -1,15 +1,15 @@
import { fireEvent, render, screen } from "@testing-library/react";
import { mount, ReactWrapper } from "enzyme";
import React from "react";
-import Explorer from "../../Explorer";
import { RightPaneForm } from "./RightPaneForm";
const onClose = jest.fn();
const onSubmit = jest.fn();
+const expandConsole = jest.fn();
const props = {
closePanel: (): void => undefined,
- container: new Explorer(),
+ expandConsole,
formError: "",
formErrorDetail: "",
id: "loadQueryPane",
diff --git a/src/Explorer/Panes/RightPaneForm/RightPaneForm.tsx b/src/Explorer/Panes/RightPaneForm/RightPaneForm.tsx
index 5e1d0e8f9..ce448eac0 100644
--- a/src/Explorer/Panes/RightPaneForm/RightPaneForm.tsx
+++ b/src/Explorer/Panes/RightPaneForm/RightPaneForm.tsx
@@ -1,13 +1,12 @@
import { IconButton } from "office-ui-fabric-react/lib/Button";
import React, { FunctionComponent, ReactNode } from "react";
import { KeyCodes } from "../../../Common/Constants";
-import Explorer from "../../Explorer";
import { PanelFooterComponent } from "../PanelFooterComponent";
import { PanelInfoErrorComponent, PanelInfoErrorProps } from "../PanelInfoErrorComponent";
import { PanelLoadingScreen } from "../PanelLoadingScreen";
export interface RightPaneFormProps {
- container: Explorer;
+ expandConsole: () => void;
formError: string;
formErrorDetail: string;
id: string;
@@ -21,7 +20,7 @@ export interface RightPaneFormProps {
}
export const RightPaneForm: FunctionComponent = ({
- container,
+ expandConsole,
formError,
formErrorDetail,
id,
@@ -70,16 +69,12 @@ export const RightPaneForm: FunctionComponent = ({
}
};
- const showErrorDetail = (): void => {
- container.expandConsole();
- };
-
const panelInfoErrorProps: PanelInfoErrorProps = {
messageType: "error",
message: formError,
formError: formError !== "",
showErrorDetails: formErrorDetail !== "",
- openNotificationConsole: showErrorDetail,
+ openNotificationConsole: expandConsole,
};
return (
diff --git a/src/Explorer/Panes/RightPaneForm/__snapshots__/RightPaneForm.test.tsx.snap b/src/Explorer/Panes/RightPaneForm/__snapshots__/RightPaneForm.test.tsx.snap
index 1253c1ce8..fa5f6a8df 100644
--- a/src/Explorer/Panes/RightPaneForm/__snapshots__/RightPaneForm.test.tsx.snap
+++ b/src/Explorer/Panes/RightPaneForm/__snapshots__/RightPaneForm.test.tsx.snap
@@ -3,504 +3,7 @@
exports[`Load Query Pane should render Default properly 1`] = `
-
+