From 326bd4f49401c777a1dfa0a068abb05ceb1c44f1 Mon Sep 17 00:00:00 2001 From: Steve Faulkner Date: Thu, 9 Jul 2020 10:49:27 -0500 Subject: [PATCH] Initial pass at removing old spark code (#80) Co-authored-by: Steve Faulkner --- .eslintignore | 2 - src/Contracts/ViewModels.ts | 2 - src/Explorer/ComponentRegisterer.test.ts | 8 - src/Explorer/ComponentRegisterer.ts | 2 - src/Explorer/Explorer.ts | 24 +-- .../CommandBarComponentButtonFactory.ts | 101 ------------ src/Explorer/OpenActionsStubs.ts | 2 - .../Panes/ManageSparkClusterPane.html | 37 ----- src/Explorer/Panes/ManageSparkClusterPane.ts | 153 ------------------ src/Explorer/Panes/PaneComponents.ts | 20 --- src/Explorer/Panes/SetupSparkClusterPane.html | 52 ------ src/Explorer/Panes/SetupSparkClusterPane.ts | 99 ------------ src/explorer.html | 2 - 13 files changed, 1 insertion(+), 503 deletions(-) delete mode 100644 src/Explorer/Panes/ManageSparkClusterPane.html delete mode 100644 src/Explorer/Panes/ManageSparkClusterPane.ts delete mode 100644 src/Explorer/Panes/SetupSparkClusterPane.html delete mode 100644 src/Explorer/Panes/SetupSparkClusterPane.ts diff --git a/.eslintignore b/.eslintignore index 44da3e3c9..281a7cb83 100644 --- a/.eslintignore +++ b/.eslintignore @@ -147,7 +147,6 @@ src/Explorer/Panes/ExecuteSprocParamsPane.ts src/Explorer/Panes/GraphStylingPane.ts src/Explorer/Panes/LibraryManagePane.ts src/Explorer/Panes/LoadQueryPane.ts -src/Explorer/Panes/ManageSparkClusterPane.ts src/Explorer/Panes/NewVertexPane.ts src/Explorer/Panes/PaneComponents.ts src/Explorer/Panes/RenewAdHocAccessPane.ts @@ -155,7 +154,6 @@ src/Explorer/Panes/SaveQueryPane.ts src/Explorer/Panes/SettingsPane.test.ts src/Explorer/Panes/SettingsPane.ts src/Explorer/Panes/SetupNotebooksPane.ts -src/Explorer/Panes/SetupSparkClusterPane.ts src/Explorer/Panes/StringInputPane.ts src/Explorer/Panes/SwitchDirectoryPane.ts src/Explorer/Panes/Tables/AddTableEntityPane.ts diff --git a/src/Contracts/ViewModels.ts b/src/Contracts/ViewModels.ts index 6614d8f68..18a19eaa7 100644 --- a/src/Contracts/ViewModels.ts +++ b/src/Contracts/ViewModels.ts @@ -148,8 +148,6 @@ export interface Explorer { uploadFilePane: UploadFilePane; stringInputPane: StringInputPane; setupNotebooksPane: SetupNotebooksPane; - setupSparkClusterPane: ContextualPane; - manageSparkClusterPane: ContextualPane; libraryManagePane: ContextualPane; clusterLibraryPane: ContextualPane; gitHubReposPane: ContextualPane; diff --git a/src/Explorer/ComponentRegisterer.test.ts b/src/Explorer/ComponentRegisterer.test.ts index 878de01cc..f8418597d 100644 --- a/src/Explorer/ComponentRegisterer.test.ts +++ b/src/Explorer/ComponentRegisterer.test.ts @@ -116,14 +116,6 @@ describe("Component Registerer", () => { expect(ko.components.isRegistered("setup-notebooks-pane")).toBe(true); }); - it("should register setup-spark-cluster-pane component", () => { - expect(ko.components.isRegistered("setup-spark-cluster-pane")).toBe(true); - }); - - it("should register manage-spark-cluster-pane component", () => { - expect(ko.components.isRegistered("manage-spark-cluster-pane")).toBe(true); - }); - it("should register dynamic-list component", () => { expect(ko.components.isRegistered("dynamic-list")).toBe(true); }); diff --git a/src/Explorer/ComponentRegisterer.ts b/src/Explorer/ComponentRegisterer.ts index 168757be9..52eaa6425 100644 --- a/src/Explorer/ComponentRegisterer.ts +++ b/src/Explorer/ComponentRegisterer.ts @@ -76,8 +76,6 @@ ko.components.register("browse-queries-pane", new PaneComponents.BrowseQueriesPa ko.components.register("upload-file-pane", new PaneComponents.UploadFilePaneComponent()); ko.components.register("string-input-pane", new PaneComponents.StringInputPaneComponent()); ko.components.register("setup-notebooks-pane", new PaneComponents.SetupNotebooksPaneComponent()); -ko.components.register("setup-spark-cluster-pane", new PaneComponents.SetupSparkClusterPaneComponent()); -ko.components.register("manage-spark-cluster-pane", new PaneComponents.ManageSparkClusterPaneComponent()); ko.components.register("library-manage-pane", new PaneComponents.LibraryManagePaneComponent()); ko.components.register("cluster-library-pane", new PaneComponents.ClusterLibraryPaneComponent()); ko.components.register("github-repos-pane", new PaneComponents.GitHubReposPaneComponent()); diff --git a/src/Explorer/Explorer.ts b/src/Explorer/Explorer.ts index bf677e115..2e3def7b8 100644 --- a/src/Explorer/Explorer.ts +++ b/src/Explorer/Explorer.ts @@ -55,7 +55,6 @@ import { IGalleryItem } from "../Juno/JunoClient"; import { LibraryManagePane } from "./Panes/LibraryManagePane"; import { LoadQueryPane } from "./Panes/LoadQueryPane"; import * as Logger from "../Common/Logger"; -import { ManageSparkClusterPane } from "./Panes/ManageSparkClusterPane"; import { MessageHandler } from "../Common/MessageHandler"; import { NotebookContentItem, NotebookContentItemType } from "./Notebook/NotebookContentItem"; import { NotebookUtil } from "./Notebook/NotebookUtil"; @@ -73,7 +72,6 @@ import { RouteHandler } from "../RouteHandlers/RouteHandler"; import { SaveQueryPane } from "./Panes/SaveQueryPane"; import { SettingsPane } from "./Panes/SettingsPane"; import { SetupNotebooksPane } from "./Panes/SetupNotebooksPane"; -import { SetupSparkClusterPane } from "./Panes/SetupSparkClusterPane"; import { SparkClusterManager } from "../SparkClusterManager/SparkClusterManager"; import { SplashScreenComponentAdapter } from "./SplashScreen/SplashScreenComponentApdapter"; import { Splitter, SplitterBounds, SplitterDirection } from "../Common/Splitter"; @@ -192,8 +190,6 @@ export default class Explorer implements ViewModels.Explorer { public uploadFilePane: UploadFilePane; public stringInputPane: StringInputPane; public setupNotebooksPane: SetupNotebooksPane; - public setupSparkClusterPane: ViewModels.ContextualPane; - public manageSparkClusterPane: ViewModels.ContextualPane; public libraryManagePane: ViewModels.ContextualPane; public clusterLibraryPane: ViewModels.ContextualPane; public gitHubReposPane: ViewModels.ContextualPane; @@ -759,22 +755,6 @@ export default class Explorer implements ViewModels.Explorer { container: this }); - this.setupSparkClusterPane = new SetupSparkClusterPane({ - documentClientUtility: this.documentClientUtility, - id: "setupsparkclusterpane", - visible: ko.observable(false), - - container: this - }); - - this.manageSparkClusterPane = new ManageSparkClusterPane({ - documentClientUtility: this.documentClientUtility, - id: "managesparkclusterpane", - visible: ko.observable(false), - - container: this - }); - this.libraryManagePane = new LibraryManagePane({ documentClientUtility: this.documentClientUtility, id: "libraryManagePane", @@ -818,9 +798,7 @@ export default class Explorer implements ViewModels.Explorer { this.browseQueriesPane, this.uploadFilePane, this.stringInputPane, - this.setupNotebooksPane, - this.setupSparkClusterPane, - this.manageSparkClusterPane + this.setupNotebooksPane ]; this.addDatabaseText.subscribe((addDatabaseText: string) => this.addDatabasePane.title(addDatabaseText)); this.rebindDocumentClientUtility.bind(this); diff --git a/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.ts b/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.ts index d796462ef..202932bfd 100644 --- a/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.ts +++ b/src/Explorer/Menus/CommandBar/CommandBarComponentButtonFactory.ts @@ -4,14 +4,11 @@ import { Action, ActionModifiers } from "../../../Shared/Telemetry/TelemetryCons import { Areas } from "../../../Common/Constants"; import TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor"; -import ApacheSparkIcon from "../../../../images/notebook/Apache-spark.svg"; import AddDatabaseIcon from "../../../../images/AddDatabase.svg"; import AddCollectionIcon from "../../../../images/AddCollection.svg"; import AddSqlQueryIcon from "../../../../images/AddSqlQuery_16x16.svg"; import BrowseQueriesIcon from "../../../../images/BrowseQuery.svg"; import * as Constants from "../../../Common/Constants"; -import DeleteIcon from "../../../../images/delete.svg"; -import EditIcon from "../../../../images/edit.svg"; import OpenInTabIcon from "../../../../images/open-in-tab.svg"; import OpenQueryFromDiskIcon from "../../../../images/OpenQueryFromDisk.svg"; import CosmosTerminalIcon from "../../../../images/Cosmos-Terminal.svg"; @@ -25,7 +22,6 @@ import FeedbackIcon from "../../../../images/Feedback-Command.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 LibraryManageIcon from "../../../../images/notebook/Spark-library-manage.svg"; import GitHubIcon from "../../../../images/github.svg"; import SynapseIcon from "../../../../images/synapse-link.svg"; import { config, Platform } from "../../../Config"; @@ -88,25 +84,6 @@ export class CommandBarComponentButtonFactory { buttons.push(CommandBarComponentButtonFactory.createNotebookWorkspaceResetButton(container)); } - // TODO: Should be replaced with the create arcadia spark pool button - // if (!container.isSparkEnabled() && container.isSparkEnabledForAccount()) { - // const createSparkClusterButton = CommandBarComponentButtonFactory.createSparkClusterButton(container); - // buttons.push(createSparkClusterButton); - // } - - // TODO: Should be replaced with the edit/manage/delete arcadia spark pool button - // if (container.isSparkEnabled()) { - // const manageSparkClusterButton = CommandBarComponentButtonFactory.createMonitorClusterButton(container); - // manageSparkClusterButton.children = [ - // CommandBarComponentButtonFactory.createMonitorClusterButton(container), - // CommandBarComponentButtonFactory.createEditClusterButton(container), - // CommandBarComponentButtonFactory.createDeleteClusterButton(container), - // CommandBarComponentButtonFactory.createLibraryManageButton(container), - // CommandBarComponentButtonFactory.createClusterLibraryButton(container) - // ]; - // buttons.push(manageSparkClusterButton); - // } - if (!container.isDatabaseNodeOrNoneSelected()) { if (container.isNotebookEnabled()) { buttons.push(CommandBarComponentButtonFactory.createDivider()); @@ -505,58 +482,6 @@ export class CommandBarComponentButtonFactory { }; } - private static createSparkClusterButton(container: ViewModels.Explorer): ViewModels.NavbarButtonConfig { - const label = "Enable Spark"; - return { - iconSrc: ApacheSparkIcon, - iconAlt: "Enable spark icon", - onCommandClick: () => container.setupSparkClusterPane.open(), - commandButtonLabel: label, - hasPopup: false, - disabled: false, - ariaLabel: label - }; - } - - private static createEditClusterButton(container: ViewModels.Explorer): ViewModels.NavbarButtonConfig { - const label = "Edit Cluster"; - return { - iconSrc: EditIcon, - iconAlt: "Edit cluster icon", - onCommandClick: () => container.manageSparkClusterPane.open(), - commandButtonLabel: label, - hasPopup: false, - disabled: false, - ariaLabel: label - }; - } - - private static createDeleteClusterButton(container: ViewModels.Explorer): ViewModels.NavbarButtonConfig { - const label = "Delete Cluster"; - return { - iconSrc: DeleteIcon, - iconAlt: "Delete cluster icon", - onCommandClick: () => container.deleteCluster(), - commandButtonLabel: label, - hasPopup: false, - disabled: false, - ariaLabel: label - }; - } - - private static createMonitorClusterButton(container: ViewModels.Explorer): ViewModels.NavbarButtonConfig { - const label = "Monitor Cluster"; - return { - iconSrc: ApacheSparkIcon, - iconAlt: "Monitor cluster icon", - onCommandClick: () => container.openSparkMasterTab(), - commandButtonLabel: label, - hasPopup: false, - disabled: false, - ariaLabel: label - }; - } - private static createOpenTerminalButton(container: ViewModels.Explorer): ViewModels.NavbarButtonConfig { const label = "Open Terminal"; return { @@ -658,32 +583,6 @@ export class CommandBarComponentButtonFactory { }; } - private static createLibraryManageButton(container: ViewModels.Explorer): ViewModels.NavbarButtonConfig { - const label = "Manage Libraries"; - return { - iconSrc: LibraryManageIcon, - iconAlt: label, - onCommandClick: () => container.libraryManagePane.open(), - commandButtonLabel: label, - hasPopup: false, - disabled: false, - ariaLabel: label - }; - } - - private static createClusterLibraryButton(container: ViewModels.Explorer): ViewModels.NavbarButtonConfig { - const label = "Manage Cluster Libraries"; - return { - iconSrc: LibraryManageIcon, - iconAlt: label, - onCommandClick: () => container.clusterLibraryPane.open(), - commandButtonLabel: label, - hasPopup: false, - disabled: false, - ariaLabel: label - }; - } - private static createStaticCommandBarButtonsForResourceToken( container: ViewModels.Explorer ): ViewModels.NavbarButtonConfig[] { diff --git a/src/Explorer/OpenActionsStubs.ts b/src/Explorer/OpenActionsStubs.ts index 46c090f99..42097e185 100644 --- a/src/Explorer/OpenActionsStubs.ts +++ b/src/Explorer/OpenActionsStubs.ts @@ -94,8 +94,6 @@ export class ExplorerStub implements ViewModels.Explorer { public uploadFilePane: UploadFilePane; public stringInputPane: StringInputPane; public setupNotebooksPane: SetupNotebooksPane; - public setupSparkClusterPane: ViewModels.ContextualPane; - public manageSparkClusterPane: ViewModels.ContextualPane; public isGalleryPublishEnabled: ko.Computed; public isGitHubPaneEnabled: ko.Observable; public isPublishNotebookPaneEnabled: ko.Observable; diff --git a/src/Explorer/Panes/ManageSparkClusterPane.html b/src/Explorer/Panes/ManageSparkClusterPane.html deleted file mode 100644 index b4b2e2ddd..000000000 --- a/src/Explorer/Panes/ManageSparkClusterPane.html +++ /dev/null @@ -1,37 +0,0 @@ -
-
-
- -
-
-
- -
- -
- Close -
-
- - -
-
-
-
-
-
-
- - -
- loading indicator image -
- -
-
diff --git a/src/Explorer/Panes/ManageSparkClusterPane.ts b/src/Explorer/Panes/ManageSparkClusterPane.ts deleted file mode 100644 index fb6e6b514..000000000 --- a/src/Explorer/Panes/ManageSparkClusterPane.ts +++ /dev/null @@ -1,153 +0,0 @@ -import * as ko from "knockout"; -import * as ViewModels from "../../Contracts/ViewModels"; -import * as DataModels from "../../Contracts/DataModels"; -import { Action } from "../../Shared/Telemetry/TelemetryConstants"; -import { Areas } from "../../Common/Constants"; -import { ConsoleDataType } from "../Menus/NotificationConsole/NotificationConsoleComponent"; -import { ContextualPaneBase } from "./ContextualPaneBase"; -import { ClusterSettingsComponentAdapter } from "../Controls/Spark/ClusterSettingsComponentAdapter"; -import { ClusterSettingsComponentProps } from "../Controls/Spark/ClusterSettingsComponent"; -import { NotificationConsoleUtils } from "../../Utils/NotificationConsoleUtils"; -import { Spark } from "../../Common/Constants"; -import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor"; - -const MAX_NUM_WORKERS = 10; - -export class ManageSparkClusterPane extends ContextualPaneBase { - public readonly maxWorkerCount = Spark.MaxWorkerCount; - public workerCount: ko.Observable; - public clusterSettingsComponentAdapter: ClusterSettingsComponentAdapter; - - private _settingsComponentAdapterProps: ko.Observable; - private _defaultCluster: ko.Observable; - - constructor(options: ViewModels.PaneOptions) { - super(options); - this.title("Manage spark cluster"); - this.workerCount = ko.observable(); - this._defaultCluster = ko.observable({ - id: undefined, - name: undefined, - type: undefined, - properties: { - kind: undefined, - creationTime: undefined, - driverSize: undefined, - status: undefined, - workerInstanceCount: undefined, - workerSize: undefined - } - }); - this._settingsComponentAdapterProps = ko.observable({ - cluster: this._defaultCluster(), - onClusterSettingsChanged: this.onClusterSettingsChange - }); - this._defaultCluster.subscribe(cluster => { - this._settingsComponentAdapterProps().cluster = cluster; - this._settingsComponentAdapterProps.valueHasMutated(); // trigger component re-render - }); - this.clusterSettingsComponentAdapter = new ClusterSettingsComponentAdapter(); - this.clusterSettingsComponentAdapter.parameters = this._settingsComponentAdapterProps; - this.resetData(); - } - - public async submit() { - if (!this.workerCount() || this.workerCount() > MAX_NUM_WORKERS) { - this.formErrors("Invalid worker count specified"); - this.formErrorsDetails(`The number of workers should be between 0 and ${MAX_NUM_WORKERS}`); - return; - } - - if (!this._defaultCluster()) { - this.formErrors("No default cluster found"); - this.formErrorsDetails("No default cluster found to be associated with this account"); - return; - } - - const startKey = TelemetryProcessor.traceStart(Action.UpdateSparkCluster, { - databaseAccountName: this.container && this.container.databaseAccount().name, - defaultExperience: this.container && this.container.defaultExperience(), - dataExplorerArea: Areas.ContextualPane, - paneTitle: this.title() - }); - const workerCount = this.workerCount(); - const id = NotificationConsoleUtils.logConsoleMessage( - ConsoleDataType.InProgress, - `Updating default cluster worker count to ${workerCount} nodes` - ); - this.isExecuting(true); - try { - const databaseAccount = this.container && this.container.databaseAccount(); - const cluster = this._defaultCluster(); - cluster.properties.workerInstanceCount = workerCount; - const updatedCluster = - this.container && - (await this.container.sparkClusterManager.updateClusterAsync( - databaseAccount && databaseAccount.id, - cluster.name, - cluster - )); - this._defaultCluster(updatedCluster); - NotificationConsoleUtils.logConsoleMessage( - ConsoleDataType.Info, - `Successfully updated default cluster worker count to ${workerCount} nodes` - ); - TelemetryProcessor.traceSuccess( - Action.UpdateSparkCluster, - { - databaseAccountName: this.container && this.container.databaseAccount().name, - defaultExperience: this.container && this.container.defaultExperience(), - dataExplorerArea: Areas.ContextualPane, - paneTitle: this.title() - }, - startKey - ); - } catch (error) { - NotificationConsoleUtils.logConsoleMessage( - ConsoleDataType.Error, - `Failed to update default cluster worker count to ${workerCount} nodes: ${JSON.stringify(error)}` - ); - TelemetryProcessor.traceFailure( - Action.UpdateSparkCluster, - { - databaseAccountName: this.container && this.container.databaseAccount().name, - defaultExperience: this.container && this.container.defaultExperience(), - dataExplorerArea: Areas.ContextualPane, - paneTitle: this.title(), - error: JSON.stringify(error) - }, - startKey - ); - } finally { - this.isExecuting(false); - NotificationConsoleUtils.clearInProgressMessageWithId(id); - } - } - - public onClusterSettingsChange = (cluster: DataModels.SparkCluster) => { - this._defaultCluster(cluster); - this.workerCount( - (cluster && - cluster.properties && - cluster.properties.workerInstanceCount !== undefined && - cluster.properties.workerInstanceCount) || - 0 - ); - }; - - public async open() { - const defaultCluster = await this.container.sparkClusterManager.getClusterAsync( - this.container.databaseAccount().id, - "default" - ); - this._defaultCluster(defaultCluster); - this.workerCount( - (defaultCluster && - defaultCluster.properties && - defaultCluster.properties.workerInstanceCount !== undefined && - defaultCluster.properties.workerInstanceCount) || - 0 - ); - super.open(); - } -} diff --git a/src/Explorer/Panes/PaneComponents.ts b/src/Explorer/Panes/PaneComponents.ts index 08867525f..2796e421b 100644 --- a/src/Explorer/Panes/PaneComponents.ts +++ b/src/Explorer/Panes/PaneComponents.ts @@ -19,8 +19,6 @@ import BrowseQueriesPaneTemplate from "./BrowseQueriesPane.html"; import UploadFilePaneTemplate from "./UploadFilePane.html"; import StringInputPaneTemplate from "./StringInputPane.html"; import SetupNotebooksPaneTemplate from "./SetupNotebooksPane.html"; -import SetupSparkClusterPaneTemplate from "./SetupSparkClusterPane.html"; -import ManageSparkClusterPaneTemplate from "./ManageSparkClusterPane.html"; import LibraryManagePaneTemplate from "./LibraryManagePane.html"; import ClusterLibraryPaneTemplate from "./ClusterLibraryPane.html"; import GitHubReposPaneTemplate from "./GitHubReposPane.html"; @@ -220,24 +218,6 @@ export class SetupNotebooksPaneComponent { } } -export class SetupSparkClusterPaneComponent { - constructor() { - return { - viewModel: PaneComponent, - template: SetupSparkClusterPaneTemplate - }; - } -} - -export class ManageSparkClusterPaneComponent { - constructor() { - return { - viewModel: PaneComponent, - template: ManageSparkClusterPaneTemplate - }; - } -} - export class LibraryManagePaneComponent { constructor() { return { diff --git a/src/Explorer/Panes/SetupSparkClusterPane.html b/src/Explorer/Panes/SetupSparkClusterPane.html deleted file mode 100644 index 35e83ce3d..000000000 --- a/src/Explorer/Panes/SetupSparkClusterPane.html +++ /dev/null @@ -1,52 +0,0 @@ -
-
-
- -
-
-
- -
- -
- Close -
-
- - -
-
-
-
-
Worker Count
- -
-
-
-
-
-
-
-
-
- - -
- loading indicator image -
- -
-
diff --git a/src/Explorer/Panes/SetupSparkClusterPane.ts b/src/Explorer/Panes/SetupSparkClusterPane.ts deleted file mode 100644 index 57d4cf729..000000000 --- a/src/Explorer/Panes/SetupSparkClusterPane.ts +++ /dev/null @@ -1,99 +0,0 @@ -import * as ko from "knockout"; -import * as ViewModels from "../../Contracts/ViewModels"; -import { Action } from "../../Shared/Telemetry/TelemetryConstants"; -import { Areas } from "../../Common/Constants"; -import { ConsoleDataType } from "../Menus/NotificationConsole/NotificationConsoleComponent"; -import { ContextualPaneBase } from "./ContextualPaneBase"; -import { NotificationConsoleUtils } from "../../Utils/NotificationConsoleUtils"; -import { Spark } from "../../Common/Constants"; -import TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor"; - -export class SetupSparkClusterPane extends ContextualPaneBase { - public setupSparkClusterText: string = - "Looks like you have not yet created a default spark cluster for this account. To proceed and start using notebooks with spark, we'll need to create a default spark cluster for this account."; - public readonly maxWorkerNodes: number = Spark.MaxWorkerCount; - public workerCount: ko.Observable; - - constructor(options: ViewModels.PaneOptions) { - super(options); - this.title("Enable spark"); - this.workerCount = ko.observable(1); - this.resetData(); - } - - public async submit() { - await this.setupSparkCluster(); - } - - public async setupSparkCluster(): Promise { - if (!this.container) { - return; - } - - const startKey: number = TelemetryProcessor.traceStart(Action.CreateSparkCluster, { - databaseAccountName: this.container && this.container.databaseAccount().name, - defaultExperience: this.container && this.container.defaultExperience(), - dataExplorerArea: Areas.ContextualPane, - paneTitle: this.title() - }); - const id = NotificationConsoleUtils.logConsoleMessage( - ConsoleDataType.InProgress, - "Creating a new default spark cluster" - ); - try { - this.isExecuting(true); - await this.container.sparkClusterManager.createClusterAsync( - this.container.databaseAccount() && this.container.databaseAccount().id, - { - name: "default", - properties: { - kind: "Spark", - workerInstanceCount: this.workerCount(), - driverSize: "Cosmos.Spark.D4s", - workerSize: "Cosmos.Spark.D4s", - creationTime: undefined, - status: undefined - } - } - ); - this.container.isAccountReady.valueHasMutated(); // refresh internal state - this.close(); - TelemetryProcessor.traceSuccess( - Action.CreateSparkCluster, - { - databaseAccountName: this.container && this.container.databaseAccount().name, - defaultExperience: this.container && this.container.defaultExperience(), - dataExplorerArea: Areas.ContextualPane, - paneTitle: this.title() - }, - startKey - ); - NotificationConsoleUtils.logConsoleMessage( - ConsoleDataType.Info, - "Successfully created a default spark cluster for the account" - ); - } catch (error) { - const errorMessage = typeof error == "string" ? error : JSON.stringify(error); - TelemetryProcessor.traceFailure( - Action.CreateSparkCluster, - { - databaseAccountName: this.container && this.container.databaseAccount().name, - defaultExperience: this.container && this.container.defaultExperience(), - dataExplorerArea: Areas.ContextualPane, - paneTitle: this.title(), - error: errorMessage - }, - startKey - ); - this.formErrors("Failed to setup a default spark cluster"); - this.formErrorsDetails(`Failed to setup a default spark cluster: ${errorMessage}`); - NotificationConsoleUtils.logConsoleMessage( - ConsoleDataType.Error, - `Failed to create a default spark cluster: ${errorMessage}` - ); - } finally { - this.isExecuting(false); - NotificationConsoleUtils.clearInProgressMessageWithId(id); - } - } -} diff --git a/src/explorer.html b/src/explorer.html index 9600c617f..daf77851f 100644 --- a/src/explorer.html +++ b/src/explorer.html @@ -441,8 +441,6 @@ - -