diff --git a/.eslintignore b/.eslintignore index 283f2f781..bc1bab872 100644 --- a/.eslintignore +++ b/.eslintignore @@ -71,7 +71,6 @@ src/Explorer/DataSamples/ContainerSampleGenerator.test.ts src/Explorer/DataSamples/ContainerSampleGenerator.ts src/Explorer/DataSamples/DataSamplesUtil.test.ts src/Explorer/DataSamples/DataSamplesUtil.ts -src/Explorer/Explorer.tsx src/Explorer/Graph/GraphExplorerComponent/ArraysByKeyCache.test.ts src/Explorer/Graph/GraphExplorerComponent/ArraysByKeyCache.ts src/Explorer/Graph/GraphExplorerComponent/D3ForceGraph.test.ts @@ -83,8 +82,6 @@ src/Explorer/Graph/GraphExplorerComponent/GremlinClient.test.ts src/Explorer/Graph/GraphExplorerComponent/GremlinClient.ts src/Explorer/Graph/GraphExplorerComponent/GremlinSimpleClient.test.ts src/Explorer/Graph/GraphExplorerComponent/GremlinSimpleClient.ts -src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.test.ts -src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.ts src/Explorer/Menus/ContextMenu.ts src/Explorer/MostRecentActivity/MostRecentActivity.ts src/Explorer/Notebook/NotebookClientV2.ts @@ -206,7 +203,6 @@ src/Explorer/Notebook/NotebookRenderer/decorators/draggable/index.tsx src/Explorer/Notebook/NotebookRenderer/decorators/hijack-scroll/index.tsx src/Explorer/Notebook/NotebookRenderer/decorators/kbd-shortcuts/index.tsx src/Explorer/Notebook/temp/inputs/connected-editors/codemirror.tsx -src/Explorer/SplashScreen/SplashScreen.tsx src/Explorer/Tree/ResourceTreeAdapter.tsx __mocks__/monaco-editor.ts src/Explorer/Tree/ResourceTreeAdapterForResourceToken.test.tsx \ No newline at end of file diff --git a/src/Explorer/Explorer.tsx b/src/Explorer/Explorer.tsx index 008651899..32e2e5828 100644 --- a/src/Explorer/Explorer.tsx +++ b/src/Explorer/Explorer.tsx @@ -17,12 +17,12 @@ import * as ViewModels from "../Contracts/ViewModels"; import { GitHubOAuthService } from "../GitHub/GitHubOAuthService"; import { useSidePanel } from "../hooks/useSidePanel"; import { useTabs } from "../hooks/useTabs"; -import { IGalleryItem, JunoClient } from "../Juno/JunoClient"; +import { IGalleryItem } from "../Juno/JunoClient"; import { ExplorerSettings } from "../Shared/ExplorerSettings"; import { Action, ActionModifiers } from "../Shared/Telemetry/TelemetryConstants"; import * as TelemetryProcessor from "../Shared/Telemetry/TelemetryProcessor"; import { userContext } from "../UserContext"; -import { getCollectionName, getDatabaseName, getUploadName } from "../Utils/APITypeUtils"; +import { getCollectionName, getUploadName } from "../Utils/APITypeUtils"; import { update } from "../Utils/arm/generatedClients/cosmos/databaseAccounts"; import { get as getWorkspace, @@ -35,7 +35,6 @@ import { isCapabilityEnabled } from "../Utils/CapabilityUtils"; import { fromContentUri, toRawContentUri } from "../Utils/GitHubUtils"; import * as NotificationConsoleUtils from "../Utils/NotificationConsoleUtils"; import { logConsoleError, logConsoleInfo, logConsoleProgress } from "../Utils/NotificationConsoleUtils"; -import * as ComponentRegisterer from "./ComponentRegisterer"; import { DialogProps, TextFieldProps, useDialog } from "./Controls/Dialog"; import { GalleryTab as GalleryTabKind } from "./Controls/NotebookGallery/GalleryViewerComponent"; import { useCommandBar } from "./Menus/CommandBar/CommandBarComponentAdapter"; @@ -47,12 +46,8 @@ import type { NotebookPaneContent } from "./Notebook/NotebookManager"; import { NotebookUtil } from "./Notebook/NotebookUtil"; import { useNotebook } from "./Notebook/useNotebook"; import { AddCollectionPanel } from "./Panes/AddCollectionPanel"; -import { AddDatabasePanel } from "./Panes/AddDatabasePanel/AddDatabasePanel"; -import { BrowseQueriesPane } from "./Panes/BrowseQueriesPane/BrowseQueriesPane"; import { CassandraAddCollectionPane } from "./Panes/CassandraAddCollectionPane/CassandraAddCollectionPane"; import { ExecuteSprocParamsPane } from "./Panes/ExecuteSprocParamsPane/ExecuteSprocParamsPane"; -import { GitHubReposPanel } from "./Panes/GitHubReposPanel/GitHubReposPanel"; -import { SaveQueryPane } from "./Panes/SaveQueryPane/SaveQueryPane"; import { SetupNoteBooksPanel } from "./Panes/SetupNotebooksPanel/SetupNotebooksPanel"; import { StringInputPane } from "./Panes/StringInputPane/StringInputPane"; import { UploadFilePane } from "./Panes/UploadFilePane/UploadFilePane"; @@ -70,8 +65,6 @@ import { useDatabases } from "./useDatabases"; import { useSelectedNode } from "./useSelectedNode"; BindingHandlersRegisterer.registerBindingHandlers(); -// Hold a reference to ComponentRegisterer to prevent transpiler to ignore import -var tmp = ComponentRegisterer; export default class Explorer { public isFixedCollectionWithSharedThroughputSupported: ko.Computed; @@ -143,13 +136,13 @@ export default class Explorer { document.addEventListener( "contextmenu", - function (e) { + (e) => { e.preventDefault(); }, false ); - $(function () { + $(() => { $(document.body).click(() => $(".commandDropdownContainer").hide()); }); @@ -160,6 +153,7 @@ export default class Explorer { case "Cassandra": this.tableDataClient = new CassandraAPIDataClient(); break; + default: } this._initSettings(); @@ -330,19 +324,15 @@ export default class Explorer { } } - public onRefreshDatabasesKeyPress = (source: any, event: KeyboardEvent): boolean => { + public onRefreshDatabasesKeyPress = (source: string, event: KeyboardEvent): boolean => { if (event.keyCode === Constants.KeyCodes.Space || event.keyCode === Constants.KeyCodes.Enter) { - this.onRefreshResourcesClick(source, null); + this.onRefreshResourcesClick(); return false; } return true; }; - public onRefreshResourcesClick = (source: any, event: MouseEvent): void => { - const startKey: number = TelemetryProcessor.traceStart(Action.LoadDatabases, { - description: "Refresh button clicked", - dataExplorerArea: Constants.Areas.ResourceTree, - }); + public onRefreshResourcesClick = (): void => { userContext.authType === AuthType.ResourceToken ? this.refreshDatabaseForResourceToken() : this.refreshAllDatabases(); @@ -350,7 +340,7 @@ export default class Explorer { }; // Facade - public provideFeedbackEmail = () => { + public provideFeedbackEmail = (): void => { window.open(Constants.Urls.feedbackEmail, "_blank"); }; @@ -564,7 +554,7 @@ export default class Explorer { const promise = this.notebookManager?.notebookContentClient.uploadFileAsync(name, content, parent); promise .then(() => this.resourceTree.triggerRender()) - .catch((reason: any) => this.showOkModalDialog("Unable to upload file", reason)); + .catch((reason) => this.showOkModalDialog("Unable to upload file", reason)); return promise; } @@ -710,13 +700,13 @@ export default class Explorer { const options: NotebookTabOptions = { account: userContext.databaseAccount, tabKind: ViewModels.CollectionTabKind.NotebookV2, - node: null, + node: undefined, title: notebookContentItem.name, tabPath: notebookContentItem.path, - collection: null, + collection: undefined, masterKey: userContext.masterKey || "", isTabsContentExpanded: ko.observable(true), - onLoadStartKey: null, + onLoadStartKey: undefined, container: this, notebookContentItem, }; @@ -843,7 +833,7 @@ export default class Explorer { clearMessage(); }, - (error: any) => { + (error) => { logConsoleError(`Could not download notebook ${getErrorMessage(error)}`); clearMessage(); } @@ -895,7 +885,7 @@ export default class Explorer { return this.notebookManager?.notebookContentClient.deleteContentItem(item).then( () => logConsoleInfo(`Successfully deleted: ${item.path}`), - (reason: any) => logConsoleError(`Failed to delete "${item.path}": ${JSON.stringify(reason)}`) + (reason) => logConsoleError(`Failed to delete "${item.path}": ${JSON.stringify(reason)}`) ); } @@ -930,7 +920,7 @@ export default class Explorer { return this.openNotebook(newFile); }) .then(() => this.resourceTree.triggerRender()) - .catch((error: any) => { + .catch((error) => { const errorMessage = `Failed to create a new notebook: ${getErrorMessage(error)}`; logConsoleError(errorMessage); TelemetryProcessor.traceFailure( @@ -988,12 +978,12 @@ export default class Explorer { const newTab = new TerminalTab({ account: userContext.databaseAccount, tabKind: ViewModels.CollectionTabKind.Terminal, - node: null, + node: undefined, title: `${title} ${index}`, tabPath: `${title} ${index}`, - collection: null, + collection: undefined, isTabsContentExpanded: ko.observable(true), - onLoadStartKey: null, + onLoadStartKey: undefined, container: this, kind: kind, index: index, @@ -1013,7 +1003,7 @@ export default class Explorer { const galleryTab = useTabs .getState() .getTabs(ViewModels.CollectionTabKind.Gallery) - .find((tab) => tab.tabTitle() == title); + .find((tab) => tab.tabTitle() === title); if (galleryTab instanceof GalleryTab) { useTabs.getState().activateTab(galleryTab); @@ -1024,7 +1014,7 @@ export default class Explorer { tabKind: ViewModels.CollectionTabKind.Gallery, title, tabPath: title, - onLoadStartKey: null, + onLoadStartKey: undefined, isTabsContentExpanded: ko.observable(true), }, { @@ -1070,8 +1060,9 @@ export default class Explorer { const title = "Enable Notebooks (Preview)"; const description = "You have not yet created a notebooks workspace for this account. To proceed and start using notebooks, we'll need to create a default notebooks workspace in this account."; - - this.openSetupNotebooksPanel(title, description); + useSidePanel + .getState() + .openSidePanel(title, ); } public async handleOpenFileAction(path: string): Promise { @@ -1106,18 +1097,6 @@ export default class Explorer { .openSidePanel("Input parameters", ); } - public openAddDatabasePane(): void { - useSidePanel.getState().openSidePanel("New " + getDatabaseName(), ); - } - - public openBrowseQueriesPanel(): void { - useSidePanel.getState().openSidePanel("Open Saved Queries", ); - } - - public openSaveQueryPanel(): void { - useSidePanel.getState().openSidePanel("Save Query", ); - } - public openUploadFilePanel(parent?: NotebookContentItem): void { parent = parent || this.resourceTree.myNotebooksContentRoot; useSidePanel @@ -1128,25 +1107,6 @@ export default class Explorer { ); } - public openGitHubReposPanel(header: string, junoClient?: JunoClient): void { - useSidePanel - .getState() - .openSidePanel( - header, - - ); - } - - public openSetupNotebooksPanel(title: string, description: string): void { - useSidePanel - .getState() - .openSidePanel(title, ); - } - public async refreshExplorer(): Promise { userContext.authType === AuthType.ResourceToken ? this.refreshDatabaseForResourceToken() diff --git a/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.test.ts b/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.test.ts index a8dba6874..e3ad0044f 100644 --- a/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.test.ts +++ b/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.test.ts @@ -256,7 +256,6 @@ describe("CommandBarComponentButtonFactory tests", () => { }, } as DatabaseAccount, }); - console.log(mockExplorer); const buttons = CommandBarComponentButtonFactory.createStaticCommandBarButtons(mockExplorer, selectedNodeState); const openCassandraShellBtn = buttons.find((button) => button.commandButtonLabel === openCassandraShellBtnLabel); expect(openCassandraShellBtn).toBeUndefined(); diff --git a/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.tsx b/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.tsx index 52c70d99b..73e085aac 100644 --- a/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.tsx +++ b/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.tsx @@ -30,8 +30,12 @@ import { CommandButtonComponentProps } from "../../Controls/CommandButton/Comman import Explorer from "../../Explorer"; import { useNotebook } from "../../Notebook/useNotebook"; import { OpenFullScreen } from "../../OpenFullScreen"; +import { AddDatabasePanel } from "../../Panes/AddDatabasePanel/AddDatabasePanel"; +import { BrowseQueriesPane } from "../../Panes/BrowseQueriesPane/BrowseQueriesPane"; +import { GitHubReposPanel } from "../../Panes/GitHubReposPanel/GitHubReposPanel"; import { LoadQueryPane } from "../../Panes/LoadQueryPane/LoadQueryPane"; import { SettingsPane } from "../../Panes/SettingsPane/SettingsPane"; +import { SetupNoteBooksPanel } from "../../Panes/SetupNotebooksPanel/SetupNotebooksPanel"; import { useDatabases } from "../../useDatabases"; import { SelectedNodeState } from "../../useSelectedNode"; @@ -281,9 +285,8 @@ function createNewDatabase(container: Explorer): CommandButtonComponentProps { return { iconSrc: AddDatabaseIcon, iconAlt: label, - onCommandClick: () => { - container.openAddDatabasePane(); - }, + onCommandClick: () => + useSidePanel.getState().openSidePanel("New " + getDatabaseName(), ), commandButtonLabel: label, ariaLabel: label, hasPopup: true, @@ -415,7 +418,8 @@ function createOpenQueryButton(container: Explorer): CommandButtonComponentProps return { iconSrc: BrowseQueriesIcon, iconAlt: label, - onCommandClick: () => container.openBrowseQueriesPanel(), + onCommandClick: () => + useSidePanel.getState().openSidePanel("Open Saved Queries", ), commandButtonLabel: label, ariaLabel: label, hasPopup: true, @@ -448,7 +452,13 @@ function createEnableNotebooksButton(container: Explorer): CommandButtonComponen return { iconSrc: EnableNotebooksIcon, iconAlt: label, - onCommandClick: () => container.openSetupNotebooksPanel(label, description), + onCommandClick: () => + useSidePanel + .getState() + .openSidePanel( + label, + + ), commandButtonLabel: label, hasPopup: false, disabled: !useNotebook.getState().isNotebooksEnabledForAccount, @@ -486,7 +496,12 @@ function createOpenMongoTerminalButton(container: Explorer): CommandButtonCompon if (useNotebook.getState().isNotebookEnabled) { container.openNotebookTerminal(ViewModels.TerminalKind.Mongo); } else { - container.openSetupNotebooksPanel(title, description); + useSidePanel + .getState() + .openSidePanel( + title, + + ); } }, commandButtonLabel: label, @@ -513,7 +528,12 @@ function createOpenCassandraTerminalButton(container: Explorer): CommandButtonCo if (useNotebook.getState().isNotebookEnabled) { container.openNotebookTerminal(ViewModels.TerminalKind.Cassandra); } else { - container.openSetupNotebooksPanel(title, description); + useSidePanel + .getState() + .openSidePanel( + title, + + ); } }, commandButtonLabel: label, @@ -543,7 +563,13 @@ function createManageGitHubAccountButton(container: Explorer): CommandButtonComp return { iconSrc: GitHubIcon, iconAlt: label, - onCommandClick: () => container.openGitHubReposPanel(label), + onCommandClick: () => + useSidePanel + .getState() + .openSidePanel( + label, + + ), commandButtonLabel: label, hasPopup: false, disabled: false, diff --git a/src/Explorer/Notebook/NotebookManager.tsx b/src/Explorer/Notebook/NotebookManager.tsx index 9aca162f1..22e384276 100644 --- a/src/Explorer/Notebook/NotebookManager.tsx +++ b/src/Explorer/Notebook/NotebookManager.tsx @@ -20,6 +20,7 @@ import { userContext } from "../../UserContext"; import { getFullName } from "../../Utils/UserUtils"; import Explorer from "../Explorer"; import { CopyNotebookPane } from "../Panes/CopyNotebookPane/CopyNotebookPane"; +import { GitHubReposPanel } from "../Panes/GitHubReposPanel/GitHubReposPanel"; import { PublishNotebookPane } from "../Panes/PublishNotebookPane/PublishNotebookPane"; import { ResourceTreeAdapter } from "../Tree/ResourceTreeAdapter"; import { InMemoryContentProvider } from "./NotebookComponent/ContentProviders/InMemoryContentProvider"; @@ -88,7 +89,16 @@ export default class NotebookManager { this.gitHubClient.setToken(token?.access_token); if (this?.gitHubOAuthService.isLoggedIn()) { useSidePanel.getState().closeSidePanel(); - this.params.container.openGitHubReposPanel("Manager GitHub settings", this.junoClient); + useSidePanel + .getState() + .openSidePanel( + "Manage GitHub settings", + + ); } this.params.refreshCommandBarButtons(); @@ -161,7 +171,16 @@ export default class NotebookManager { undefined, "Cosmos DB cannot access your Github account anymore. Please connect to GitHub again.", "Connect to GitHub", - () => this.params.container.openGitHubReposPanel("Connect to GitHub"), + () => + useSidePanel + .getState() + .openSidePanel( + "Connect to GitHub", + + ), "Cancel", undefined ); diff --git a/src/Explorer/Panes/GitHubReposPanel/GitHubReposPanel.tsx b/src/Explorer/Panes/GitHubReposPanel/GitHubReposPanel.tsx index 60db777de..d2d3acac7 100644 --- a/src/Explorer/Panes/GitHubReposPanel/GitHubReposPanel.tsx +++ b/src/Explorer/Panes/GitHubReposPanel/GitHubReposPanel.tsx @@ -23,7 +23,7 @@ import { PanelLoadingScreen } from "../PanelLoadingScreen"; interface IGitHubReposPanelProps { explorer: Explorer; gitHubClientProp: GitHubClient; - junoClientProp: JunoClient; + junoClientProp?: JunoClient; } interface IGitHubReposPanelState { diff --git a/src/Explorer/SplashScreen/SplashScreen.tsx b/src/Explorer/SplashScreen/SplashScreen.tsx index d05ea16c2..a84e53e8f 100644 --- a/src/Explorer/SplashScreen/SplashScreen.tsx +++ b/src/Explorer/SplashScreen/SplashScreen.tsx @@ -16,6 +16,7 @@ import CollectionIcon from "../../../images/tree-collection.svg"; import { AuthType } from "../../AuthType"; import * as Constants from "../../Common/Constants"; import * as ViewModels from "../../Contracts/ViewModels"; +import { useSidePanel } from "../../hooks/useSidePanel"; import { userContext } from "../../UserContext"; import { getCollectionName, getDatabaseName } from "../../Utils/APITypeUtils"; import { FeaturePanelLauncher } from "../Controls/FeaturePanel/FeaturePanelLauncher"; @@ -23,6 +24,8 @@ import { DataSamplesUtil } from "../DataSamples/DataSamplesUtil"; import Explorer from "../Explorer"; import * as MostRecentActivity from "../MostRecentActivity/MostRecentActivity"; import { useNotebook } from "../Notebook/useNotebook"; +import { AddDatabasePanel } from "../Panes/AddDatabasePanel/AddDatabasePanel"; +import { BrowseQueriesPane } from "../Panes/BrowseQueriesPane/BrowseQueriesPane"; import { useDatabases } from "../useDatabases"; import { useSelectedNode } from "../useSelectedNode"; @@ -173,7 +176,7 @@ export class SplashScreen extends React.Component { ))}
  • - + {SplashScreen.seeMoreItemTitle}
  • @@ -241,20 +244,20 @@ export class SplashScreen extends React.Component { iconSrc: NewQueryIcon, onClick: () => { const selectedCollection: ViewModels.Collection = useSelectedNode.getState().findSelectedCollection(); - selectedCollection && selectedCollection.onNewQueryClick(selectedCollection, null); + selectedCollection && selectedCollection.onNewQueryClick(selectedCollection, undefined); }, title: "New SQL Query", - description: null, + description: undefined, }); } else if (userContext.apiType === "Mongo") { items.push({ iconSrc: NewQueryIcon, onClick: () => { const selectedCollection: ViewModels.Collection = useSelectedNode.getState().findSelectedCollection(); - selectedCollection && selectedCollection.onNewMongoQueryClick(selectedCollection, null); + selectedCollection && selectedCollection.onNewMongoQueryClick(selectedCollection, undefined); }, title: "New Query", - description: null, + description: undefined, }); } @@ -262,8 +265,11 @@ export class SplashScreen extends React.Component { items.push({ iconSrc: OpenQueryIcon, title: "Open Query", - description: null, - onClick: () => this.container.openBrowseQueriesPanel(), + description: undefined, + onClick: () => + useSidePanel + .getState() + .openSidePanel("Open Saved Queries", ), }); } @@ -271,10 +277,10 @@ export class SplashScreen extends React.Component { items.push({ iconSrc: NewStoredProcedureIcon, title: "New Stored Procedure", - description: null, + description: undefined, onClick: () => { const selectedCollection: ViewModels.Collection = useSelectedNode.getState().findSelectedCollection(); - selectedCollection && selectedCollection.onNewStoredProcedureClick(selectedCollection, null); + selectedCollection && selectedCollection.onNewStoredProcedureClick(selectedCollection, undefined); }, }); } @@ -286,7 +292,7 @@ export class SplashScreen extends React.Component { items.push({ iconSrc: ScaleAndSettingsIcon, title: label, - description: null, + description: undefined, onClick: () => { const selectedCollection: ViewModels.Collection = useSelectedNode.getState().findSelectedCollection(); selectedCollection && selectedCollection.onSettingsClick(); @@ -296,8 +302,11 @@ export class SplashScreen extends React.Component { items.push({ iconSrc: AddDatabaseIcon, title: "New " + getDatabaseName(), - description: null, - onClick: () => this.container.openAddDatabasePane(), + description: undefined, + onClick: () => + useSidePanel + .getState() + .openSidePanel("New " + getDatabaseName(), ), }); } @@ -348,19 +357,19 @@ export class SplashScreen extends React.Component { private createTipsItems(): SplashScreenItem[] { return [ { - iconSrc: null, + iconSrc: undefined, title: "Data Modeling", description: "Learn more about modeling", onClick: () => window.open(SplashScreen.dataModelingUrl), }, { - iconSrc: null, + iconSrc: undefined, title: "Cost & Throughput Calculation", description: "Learn more about cost calculation", onClick: () => window.open(SplashScreen.throughputEstimatorUrl), }, { - iconSrc: null, + iconSrc: undefined, title: "Configure automatic failover", description: "Learn more about Cosmos DB high-availability", onClick: () => window.open(SplashScreen.failoverUrl), diff --git a/src/Explorer/Tabs/QueryTab/QueryTabComponent.tsx b/src/Explorer/Tabs/QueryTab/QueryTabComponent.tsx index e8744441e..4f9a63dcf 100644 --- a/src/Explorer/Tabs/QueryTab/QueryTabComponent.tsx +++ b/src/Explorer/Tabs/QueryTab/QueryTabComponent.tsx @@ -22,12 +22,15 @@ import { InfoTooltip } from "../../../Common/Tooltip/InfoTooltip"; import * as DataModels from "../../../Contracts/DataModels"; import * as ViewModels from "../../../Contracts/ViewModels"; import { useNotificationConsole } from "../../../hooks/useNotificationConsole"; +import { useSidePanel } from "../../../hooks/useSidePanel"; import { userContext } from "../../../UserContext"; import * as QueryUtils from "../../../Utils/QueryUtils"; import { CommandButtonComponentProps } from "../../Controls/CommandButton/CommandButtonComponent"; import { EditorReact } from "../../Controls/Editor/EditorReact"; import Explorer from "../../Explorer"; import { useCommandBar } from "../../Menus/CommandBar/CommandBarComponentAdapter"; +import { BrowseQueriesPane } from "../../Panes/BrowseQueriesPane/BrowseQueriesPane"; +import { SaveQueryPane } from "../../Panes/SaveQueryPane/SaveQueryPane"; import TabsBase from "../TabsBase"; import "./QueryTabComponent.less"; @@ -389,13 +392,13 @@ export default class QueryTabComponent extends React.Component { - this.props.collection && this.props.collection.container && this.props.collection.container.openSaveQueryPanel(); + useSidePanel.getState().openSidePanel("Save Query", ); }; public onSavedQueriesClick = (): void => { - this.props.collection && - this.props.collection.container && - this.props.collection.container.openBrowseQueriesPanel(); + useSidePanel + .getState() + .openSidePanel("Open Saved Queries", ); }; public async onFetchNextPageClick(): Promise { diff --git a/src/Explorer/Tree/ResourceTreeAdapter.tsx b/src/Explorer/Tree/ResourceTreeAdapter.tsx index 936046567..2513a23be 100644 --- a/src/Explorer/Tree/ResourceTreeAdapter.tsx +++ b/src/Explorer/Tree/ResourceTreeAdapter.tsx @@ -16,6 +16,7 @@ import { Areas } from "../../Common/Constants"; import { isPublicInternetAccessAllowed } from "../../Common/DatabaseAccountUtility"; import * as DataModels from "../../Contracts/DataModels"; import * as ViewModels from "../../Contracts/ViewModels"; +import { useSidePanel } from "../../hooks/useSidePanel"; import { useTabs } from "../../hooks/useTabs"; import { IPinnedRepo } from "../../Juno/JunoClient"; import { LocalStorageUtility, StorageKey } from "../../Shared/StorageUtility"; @@ -33,6 +34,7 @@ import { mostRecentActivity } from "../MostRecentActivity/MostRecentActivity"; import { NotebookContentItem, NotebookContentItemType } from "../Notebook/NotebookContentItem"; import { NotebookUtil } from "../Notebook/NotebookUtil"; import { useNotebook } from "../Notebook/useNotebook"; +import { GitHubReposPanel } from "../Panes/GitHubReposPanel/GitHubReposPanel"; import TabsBase from "../Tabs/TabsBase"; import { useDatabases } from "../useDatabases"; import { useSelectedNode } from "../useSelectedNode"; @@ -624,7 +626,16 @@ export class ResourceTreeAdapter implements ReactAdapter { gitHubNotebooksTree.contextMenu = [ { label: "Manage GitHub settings", - onClick: () => this.container.openGitHubReposPanel("Manage GitHub settings"), + onClick: () => + useSidePanel + .getState() + .openSidePanel( + "Manage GitHub settings", + + ), }, { label: "Disconnect from GitHub",