diff --git a/src/Explorer/Explorer.tsx b/src/Explorer/Explorer.tsx
index 08e9e8c98..6fc0d5f80 100644
--- a/src/Explorer/Explorer.tsx
+++ b/src/Explorer/Explorer.tsx
@@ -33,11 +33,7 @@ import * as TelemetryProcessor from "../Shared/Telemetry/TelemetryProcessor";
import { userContext } from "../UserContext";
import { getCollectionName, getUploadName } from "../Utils/APITypeUtils";
import { update } from "../Utils/arm/generatedClients/cosmos/databaseAccounts";
-import {
- get as getWorkspace,
- listByDatabaseAccount,
- start,
-} from "../Utils/arm/generatedClients/cosmosNotebooks/notebookWorkspaces";
+import { listByDatabaseAccount } from "../Utils/arm/generatedClients/cosmosNotebooks/notebookWorkspaces";
import { stringToBlob } from "../Utils/BlobUtils";
import { isCapabilityEnabled } from "../Utils/CapabilityUtils";
import { fromContentUri, toRawContentUri } from "../Utils/GitHubUtils";
@@ -57,7 +53,6 @@ import { useNotebook } from "./Notebook/useNotebook";
import { AddCollectionPanel } from "./Panes/AddCollectionPanel";
import { CassandraAddCollectionPane } from "./Panes/CassandraAddCollectionPane/CassandraAddCollectionPane";
import { ExecuteSprocParamsPane } from "./Panes/ExecuteSprocParamsPane/ExecuteSprocParamsPane";
-import { SetupNoteBooksPanel } from "./Panes/SetupNotebooksPanel/SetupNotebooksPanel";
import { StringInputPane } from "./Panes/StringInputPane/StringInputPane";
import { UploadFilePane } from "./Panes/UploadFilePane/UploadFilePane";
import { UploadItemsPane } from "./Panes/UploadItemsPane/UploadItemsPane";
@@ -467,35 +462,6 @@ export default class Explorer {
}
}
- private async ensureNotebookWorkspaceRunning() {
- if (!userContext.databaseAccount) {
- return;
- }
-
- let clearMessage;
- try {
- const notebookWorkspace = await getWorkspace(
- userContext.subscriptionId,
- userContext.resourceGroup,
- userContext.databaseAccount.name,
- "default"
- );
- if (
- notebookWorkspace &&
- notebookWorkspace.properties &&
- notebookWorkspace.properties.status &&
- notebookWorkspace.properties.status.toLowerCase() === "stopped"
- ) {
- clearMessage = NotificationConsoleUtils.logConsoleProgress("Initializing notebook workspace");
- await start(userContext.subscriptionId, userContext.resourceGroup, userContext.databaseAccount.name, "default");
- }
- } catch (error) {
- handleError(error, "Explorer/ensureNotebookWorkspaceRunning", "Failed to initialize notebook workspace");
- } finally {
- clearMessage && clearMessage();
- }
- }
-
private _resetNotebookWorkspace = async () => {
useDialog.getState().closeDialog();
const clearInProgressMessage = logConsoleProgress("Resetting notebook workspace");
@@ -1182,20 +1148,12 @@ export default class Explorer {
}
}
- private _openSetupNotebooksPaneForQuickstart(): void {
- 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.";
- useSidePanel
- .getState()
- .openSidePanel(title, );
- }
-
public async handleOpenFileAction(path: string): Promise {
+ if (useNotebook.getState().isPhoenixNotebooks === undefined) {
+ await useNotebook.getState().getPhoenixStatus();
+ }
if (useNotebook.getState().isPhoenixNotebooks) {
await this.allocateContainer();
- } else if (!(await this._containsDefaultNotebookWorkspace(userContext.databaseAccount))) {
- this._openSetupNotebooksPaneForQuickstart();
}
// We still use github urls like https://github.com/Azure-Samples/cosmos-notebooks/blob/master/CSharp_quickstarts/GettingStarted_CSharp.ipynb
diff --git a/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.tsx b/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.tsx
index 0780f9e61..c4fa1b79c 100644
--- a/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.tsx
+++ b/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.tsx
@@ -10,7 +10,6 @@ import CosmosTerminalIcon from "../../../../images/Cosmos-Terminal.svg";
import FeedbackIcon from "../../../../images/Feedback-Command.svg";
import GitHubIcon from "../../../../images/github.svg";
import HostedTerminalIcon from "../../../../images/Hosted-Terminal.svg";
-import EnableNotebooksIcon from "../../../../images/notebook/Notebook-enable.svg";
import NewNotebookIcon from "../../../../images/notebook/Notebook-new.svg";
import ResetWorkspaceIcon from "../../../../images/notebook/Notebook-reset-workspace.svg";
import OpenInTabIcon from "../../../../images/open-in-tab.svg";
@@ -35,7 +34,6 @@ import { BrowseQueriesPane } from "../../Panes/BrowseQueriesPane/BrowseQueriesPa
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";
@@ -111,11 +109,6 @@ export function createStaticCommandBarButtons(
}
buttons.push(btn);
});
- } else {
- if (!isRunningOnNationalCloud() && useNotebook.getState().isPhoenixNotebooks) {
- buttons.push(createDivider());
- buttons.push(createEnableNotebooksButton(container));
- }
}
if (!selectedNodeState.isDatabaseNodeOrNoneSelected()) {
@@ -466,33 +459,6 @@ function createOpenQueryFromDiskButton(): CommandButtonComponentProps {
};
}
-function createEnableNotebooksButton(container: Explorer): CommandButtonComponentProps {
- if (configContext.platform === Platform.Emulator) {
- return undefined;
- }
- const label = "Enable Notebooks (Preview)";
- const tooltip =
- "Notebooks are not yet available in your account's region. View supported regions here: https://aka.ms/cosmos-enable-notebooks.";
- const description =
- "Looks like 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.";
- return {
- iconSrc: EnableNotebooksIcon,
- iconAlt: label,
- onCommandClick: () =>
- useSidePanel
- .getState()
- .openSidePanel(
- label,
-
- ),
- commandButtonLabel: label,
- hasPopup: false,
- disabled: !useNotebook.getState().isNotebooksEnabledForAccount,
- ariaLabel: label,
- tooltipText: useNotebook.getState().isNotebooksEnabledForAccount ? "" : tooltip,
- };
-}
-
function createOpenTerminalButton(container: Explorer): CommandButtonComponentProps {
const label = "Open Terminal";
return {
@@ -510,9 +476,6 @@ function createOpenMongoTerminalButton(container: Explorer): CommandButtonCompon
const label = "Open Mongo Shell";
const tooltip =
"This feature is not yet available in your account's region. View supported regions here: https://aka.ms/cosmos-enable-notebooks.";
- const title = "Set up workspace";
- const description =
- "Looks like you have not created a workspace for this account. To proceed and start using features including mongo shell and notebook, we will need to create a default workspace in this account.";
const disableButton =
!useNotebook.getState().isNotebooksEnabledForAccount && !useNotebook.getState().isNotebookEnabled;
return {
@@ -521,13 +484,6 @@ function createOpenMongoTerminalButton(container: Explorer): CommandButtonCompon
onCommandClick: () => {
if (useNotebook.getState().isNotebookEnabled) {
container.openNotebookTerminal(ViewModels.TerminalKind.Mongo);
- } else {
- useSidePanel
- .getState()
- .openSidePanel(
- title,
-
- );
}
},
commandButtonLabel: label,
@@ -542,9 +498,6 @@ function createOpenCassandraTerminalButton(container: Explorer): CommandButtonCo
const label = "Open Cassandra Shell";
const tooltip =
"This feature is not yet available in your account's region. View supported regions here: https://aka.ms/cosmos-enable-notebooks.";
- const title = "Set up workspace";
- const description =
- "Looks like you have not created a workspace for this account. To proceed and start using features including cassandra shell and notebook, we will need to create a default workspace in this account.";
const disableButton =
!useNotebook.getState().isNotebooksEnabledForAccount && !useNotebook.getState().isNotebookEnabled;
return {
@@ -553,13 +506,6 @@ function createOpenCassandraTerminalButton(container: Explorer): CommandButtonCo
onCommandClick: () => {
if (useNotebook.getState().isNotebookEnabled) {
container.openNotebookTerminal(ViewModels.TerminalKind.Cassandra);
- } else {
- useSidePanel
- .getState()
- .openSidePanel(
- title,
-
- );
}
},
commandButtonLabel: label,
diff --git a/src/Explorer/Panes/SetupNotebooksPanel/SetupNotebooksPanel.test.tsx b/src/Explorer/Panes/SetupNotebooksPanel/SetupNotebooksPanel.test.tsx
deleted file mode 100644
index bee2b9e6d..000000000
--- a/src/Explorer/Panes/SetupNotebooksPanel/SetupNotebooksPanel.test.tsx
+++ /dev/null
@@ -1,50 +0,0 @@
-import { PrimaryButton } from "@fluentui/react";
-import { mount } from "enzyme";
-import React from "react";
-import Explorer from "../../Explorer";
-import { SetupNoteBooksPanel } from "./SetupNotebooksPanel";
-
-describe("Setup Notebooks Panel", () => {
- it("should render Default properly", () => {
- const fakeExplorer = {} as Explorer;
- const props = {
- explorer: fakeExplorer,
- closePanel: (): void => undefined,
- openNotificationConsole: (): void => undefined,
- panelTitle: "",
- panelDescription: "",
- };
- const wrapper = mount();
- expect(wrapper).toMatchSnapshot();
- });
-
- it("should render button", () => {
- const fakeExplorer = {} as Explorer;
- const props = {
- explorer: fakeExplorer,
- closePanel: (): void => undefined,
- openNotificationConsole: (): void => undefined,
- panelTitle: "",
- panelDescription: "",
- };
- const wrapper = mount();
- const button = wrapper.find("PrimaryButton").first();
- expect(button).toBeDefined();
- });
-
- it("Button onClick should call onCompleteSetup", () => {
- const onCompleteSetupClick = jest.fn();
- const wrapper = mount();
- wrapper.find("button").simulate("click");
-
- expect(onCompleteSetupClick).toHaveBeenCalled();
- });
-
- it("Button onKeyPress should call onCompleteSetupKeyPress", () => {
- const onCompleteSetupKeyPress = jest.fn();
- const wrapper = mount();
- wrapper.find("button").simulate("keypress");
-
- expect(onCompleteSetupKeyPress).toHaveBeenCalled();
- });
-});
diff --git a/src/Explorer/Panes/SetupNotebooksPanel/SetupNotebooksPanel.tsx b/src/Explorer/Panes/SetupNotebooksPanel/SetupNotebooksPanel.tsx
deleted file mode 100644
index a7d943749..000000000
--- a/src/Explorer/Panes/SetupNotebooksPanel/SetupNotebooksPanel.tsx
+++ /dev/null
@@ -1,121 +0,0 @@
-import { PrimaryButton } from "@fluentui/react";
-import { useBoolean } from "@fluentui/react-hooks";
-import React, { FunctionComponent, KeyboardEvent, useState } from "react";
-import { Areas, NormalizedEventKey } from "../../../Common/Constants";
-import { getErrorMessage, getErrorStack } from "../../../Common/ErrorHandlingUtils";
-import { useSidePanel } from "../../../hooks/useSidePanel";
-import { Action } from "../../../Shared/Telemetry/TelemetryConstants";
-import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
-import { userContext } from "../../../UserContext";
-import { createOrUpdate } from "../../../Utils/arm/generatedClients/cosmosNotebooks/notebookWorkspaces";
-import * as NotificationConsoleUtils from "../../../Utils/NotificationConsoleUtils";
-import Explorer from "../../Explorer";
-import { PanelInfoErrorComponent } from "../PanelInfoErrorComponent";
-import { PanelLoadingScreen } from "../PanelLoadingScreen";
-interface SetupNoteBooksPanelProps {
- explorer: Explorer;
- panelTitle: string;
- panelDescription: string;
-}
-
-export const SetupNoteBooksPanel: FunctionComponent = ({
- explorer,
- panelTitle,
- panelDescription,
-}: SetupNoteBooksPanelProps): JSX.Element => {
- const closeSidePanel = useSidePanel((state) => state.closeSidePanel);
-
- const description = panelDescription;
- const [isLoading, { setTrue: setLoadingTrue, setFalse: setLoadingFalse }] = useBoolean(false);
- const [errorMessage, setErrorMessage] = useState("");
- const [showErrorDetails, setShowErrorDetails] = useState(false);
-
- const onCompleteSetupClick = async () => {
- await setupNotebookWorkspace();
- };
-
- const onCompleteSetupKeyPress = async (event: KeyboardEvent) => {
- if (event.key === " " || event.key === NormalizedEventKey.Enter) {
- await setupNotebookWorkspace();
- event.stopPropagation();
- return false;
- }
- return true;
- };
-
- const setupNotebookWorkspace = async (): Promise => {
- if (!explorer) {
- return;
- }
-
- const startKey: number = TelemetryProcessor.traceStart(Action.CreateNotebookWorkspace, {
- dataExplorerArea: Areas.ContextualPane,
- paneTitle: panelTitle,
- });
-
- const clear = NotificationConsoleUtils.logConsoleProgress("Creating a new default notebook workspace");
-
- try {
- setLoadingTrue();
- await createOrUpdate(
- userContext.subscriptionId,
- userContext.resourceGroup,
- userContext.databaseAccount.name,
- "default"
- );
- explorer.refreshExplorer();
-
- closeSidePanel();
-
- TelemetryProcessor.traceSuccess(
- Action.CreateNotebookWorkspace,
- {
- dataExplorerArea: Areas.ContextualPane,
- paneTitle: panelTitle,
- },
- startKey
- );
- NotificationConsoleUtils.logConsoleInfo("Successfully created a default notebook workspace for the account");
- } catch (error) {
- const errorMessage = getErrorMessage(error);
- TelemetryProcessor.traceFailure(
- Action.CreateNotebookWorkspace,
- {
- dataExplorerArea: Areas.ContextualPane,
- paneTitle: panelTitle,
- error: errorMessage,
- errorStack: getErrorStack(error),
- },
- startKey
- );
- setErrorMessage(`Failed to setup a default notebook workspace: ${errorMessage}`);
- setShowErrorDetails(true);
- NotificationConsoleUtils.logConsoleError(`Failed to create a default notebook workspace: ${errorMessage}`);
- } finally {
- setLoadingFalse();
- clear();
- }
- };
-
- return (
-
- );
-};
diff --git a/src/Explorer/Panes/SetupNotebooksPanel/__snapshots__/SetupNotebooksPanel.test.tsx.snap b/src/Explorer/Panes/SetupNotebooksPanel/__snapshots__/SetupNotebooksPanel.test.tsx.snap
deleted file mode 100644
index 25914ed75..000000000
--- a/src/Explorer/Panes/SetupNotebooksPanel/__snapshots__/SetupNotebooksPanel.test.tsx.snap
+++ /dev/null
@@ -1,1773 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Setup Notebooks Panel should render Default properly 1`] = `
-
-
-
-`;