Initial pass at removing old spark code (#80)

Co-authored-by: Steve Faulkner <stfaul@microsoft.com>
This commit is contained in:
Steve Faulkner 2020-07-09 10:49:27 -05:00 committed by GitHub
parent 5a1dd42395
commit 326bd4f494
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 1 additions and 503 deletions

View File

@ -147,7 +147,6 @@ src/Explorer/Panes/ExecuteSprocParamsPane.ts
src/Explorer/Panes/GraphStylingPane.ts src/Explorer/Panes/GraphStylingPane.ts
src/Explorer/Panes/LibraryManagePane.ts src/Explorer/Panes/LibraryManagePane.ts
src/Explorer/Panes/LoadQueryPane.ts src/Explorer/Panes/LoadQueryPane.ts
src/Explorer/Panes/ManageSparkClusterPane.ts
src/Explorer/Panes/NewVertexPane.ts src/Explorer/Panes/NewVertexPane.ts
src/Explorer/Panes/PaneComponents.ts src/Explorer/Panes/PaneComponents.ts
src/Explorer/Panes/RenewAdHocAccessPane.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.test.ts
src/Explorer/Panes/SettingsPane.ts src/Explorer/Panes/SettingsPane.ts
src/Explorer/Panes/SetupNotebooksPane.ts src/Explorer/Panes/SetupNotebooksPane.ts
src/Explorer/Panes/SetupSparkClusterPane.ts
src/Explorer/Panes/StringInputPane.ts src/Explorer/Panes/StringInputPane.ts
src/Explorer/Panes/SwitchDirectoryPane.ts src/Explorer/Panes/SwitchDirectoryPane.ts
src/Explorer/Panes/Tables/AddTableEntityPane.ts src/Explorer/Panes/Tables/AddTableEntityPane.ts

View File

@ -148,8 +148,6 @@ export interface Explorer {
uploadFilePane: UploadFilePane; uploadFilePane: UploadFilePane;
stringInputPane: StringInputPane; stringInputPane: StringInputPane;
setupNotebooksPane: SetupNotebooksPane; setupNotebooksPane: SetupNotebooksPane;
setupSparkClusterPane: ContextualPane;
manageSparkClusterPane: ContextualPane;
libraryManagePane: ContextualPane; libraryManagePane: ContextualPane;
clusterLibraryPane: ContextualPane; clusterLibraryPane: ContextualPane;
gitHubReposPane: ContextualPane; gitHubReposPane: ContextualPane;

View File

@ -116,14 +116,6 @@ describe("Component Registerer", () => {
expect(ko.components.isRegistered("setup-notebooks-pane")).toBe(true); 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", () => { it("should register dynamic-list component", () => {
expect(ko.components.isRegistered("dynamic-list")).toBe(true); expect(ko.components.isRegistered("dynamic-list")).toBe(true);
}); });

View File

@ -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("upload-file-pane", new PaneComponents.UploadFilePaneComponent());
ko.components.register("string-input-pane", new PaneComponents.StringInputPaneComponent()); ko.components.register("string-input-pane", new PaneComponents.StringInputPaneComponent());
ko.components.register("setup-notebooks-pane", new PaneComponents.SetupNotebooksPaneComponent()); 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("library-manage-pane", new PaneComponents.LibraryManagePaneComponent());
ko.components.register("cluster-library-pane", new PaneComponents.ClusterLibraryPaneComponent()); ko.components.register("cluster-library-pane", new PaneComponents.ClusterLibraryPaneComponent());
ko.components.register("github-repos-pane", new PaneComponents.GitHubReposPaneComponent()); ko.components.register("github-repos-pane", new PaneComponents.GitHubReposPaneComponent());

View File

@ -55,7 +55,6 @@ import { IGalleryItem } from "../Juno/JunoClient";
import { LibraryManagePane } from "./Panes/LibraryManagePane"; import { LibraryManagePane } from "./Panes/LibraryManagePane";
import { LoadQueryPane } from "./Panes/LoadQueryPane"; import { LoadQueryPane } from "./Panes/LoadQueryPane";
import * as Logger from "../Common/Logger"; import * as Logger from "../Common/Logger";
import { ManageSparkClusterPane } from "./Panes/ManageSparkClusterPane";
import { MessageHandler } from "../Common/MessageHandler"; import { MessageHandler } from "../Common/MessageHandler";
import { NotebookContentItem, NotebookContentItemType } from "./Notebook/NotebookContentItem"; import { NotebookContentItem, NotebookContentItemType } from "./Notebook/NotebookContentItem";
import { NotebookUtil } from "./Notebook/NotebookUtil"; import { NotebookUtil } from "./Notebook/NotebookUtil";
@ -73,7 +72,6 @@ import { RouteHandler } from "../RouteHandlers/RouteHandler";
import { SaveQueryPane } from "./Panes/SaveQueryPane"; import { SaveQueryPane } from "./Panes/SaveQueryPane";
import { SettingsPane } from "./Panes/SettingsPane"; import { SettingsPane } from "./Panes/SettingsPane";
import { SetupNotebooksPane } from "./Panes/SetupNotebooksPane"; import { SetupNotebooksPane } from "./Panes/SetupNotebooksPane";
import { SetupSparkClusterPane } from "./Panes/SetupSparkClusterPane";
import { SparkClusterManager } from "../SparkClusterManager/SparkClusterManager"; import { SparkClusterManager } from "../SparkClusterManager/SparkClusterManager";
import { SplashScreenComponentAdapter } from "./SplashScreen/SplashScreenComponentApdapter"; import { SplashScreenComponentAdapter } from "./SplashScreen/SplashScreenComponentApdapter";
import { Splitter, SplitterBounds, SplitterDirection } from "../Common/Splitter"; import { Splitter, SplitterBounds, SplitterDirection } from "../Common/Splitter";
@ -192,8 +190,6 @@ export default class Explorer implements ViewModels.Explorer {
public uploadFilePane: UploadFilePane; public uploadFilePane: UploadFilePane;
public stringInputPane: StringInputPane; public stringInputPane: StringInputPane;
public setupNotebooksPane: SetupNotebooksPane; public setupNotebooksPane: SetupNotebooksPane;
public setupSparkClusterPane: ViewModels.ContextualPane;
public manageSparkClusterPane: ViewModels.ContextualPane;
public libraryManagePane: ViewModels.ContextualPane; public libraryManagePane: ViewModels.ContextualPane;
public clusterLibraryPane: ViewModels.ContextualPane; public clusterLibraryPane: ViewModels.ContextualPane;
public gitHubReposPane: ViewModels.ContextualPane; public gitHubReposPane: ViewModels.ContextualPane;
@ -759,22 +755,6 @@ export default class Explorer implements ViewModels.Explorer {
container: this container: this
}); });
this.setupSparkClusterPane = new SetupSparkClusterPane({
documentClientUtility: this.documentClientUtility,
id: "setupsparkclusterpane",
visible: ko.observable<boolean>(false),
container: this
});
this.manageSparkClusterPane = new ManageSparkClusterPane({
documentClientUtility: this.documentClientUtility,
id: "managesparkclusterpane",
visible: ko.observable<boolean>(false),
container: this
});
this.libraryManagePane = new LibraryManagePane({ this.libraryManagePane = new LibraryManagePane({
documentClientUtility: this.documentClientUtility, documentClientUtility: this.documentClientUtility,
id: "libraryManagePane", id: "libraryManagePane",
@ -818,9 +798,7 @@ export default class Explorer implements ViewModels.Explorer {
this.browseQueriesPane, this.browseQueriesPane,
this.uploadFilePane, this.uploadFilePane,
this.stringInputPane, this.stringInputPane,
this.setupNotebooksPane, this.setupNotebooksPane
this.setupSparkClusterPane,
this.manageSparkClusterPane
]; ];
this.addDatabaseText.subscribe((addDatabaseText: string) => this.addDatabasePane.title(addDatabaseText)); this.addDatabaseText.subscribe((addDatabaseText: string) => this.addDatabasePane.title(addDatabaseText));
this.rebindDocumentClientUtility.bind(this); this.rebindDocumentClientUtility.bind(this);

View File

@ -4,14 +4,11 @@ import { Action, ActionModifiers } from "../../../Shared/Telemetry/TelemetryCons
import { Areas } from "../../../Common/Constants"; import { Areas } from "../../../Common/Constants";
import TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor"; import TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
import ApacheSparkIcon from "../../../../images/notebook/Apache-spark.svg";
import AddDatabaseIcon from "../../../../images/AddDatabase.svg"; import AddDatabaseIcon from "../../../../images/AddDatabase.svg";
import AddCollectionIcon from "../../../../images/AddCollection.svg"; import AddCollectionIcon from "../../../../images/AddCollection.svg";
import AddSqlQueryIcon from "../../../../images/AddSqlQuery_16x16.svg"; import AddSqlQueryIcon from "../../../../images/AddSqlQuery_16x16.svg";
import BrowseQueriesIcon from "../../../../images/BrowseQuery.svg"; import BrowseQueriesIcon from "../../../../images/BrowseQuery.svg";
import * as Constants from "../../../Common/Constants"; 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 OpenInTabIcon from "../../../../images/open-in-tab.svg";
import OpenQueryFromDiskIcon from "../../../../images/OpenQueryFromDisk.svg"; import OpenQueryFromDiskIcon from "../../../../images/OpenQueryFromDisk.svg";
import CosmosTerminalIcon from "../../../../images/Cosmos-Terminal.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 EnableNotebooksIcon from "../../../../images/notebook/Notebook-enable.svg";
import NewNotebookIcon from "../../../../images/notebook/Notebook-new.svg"; import NewNotebookIcon from "../../../../images/notebook/Notebook-new.svg";
import ResetWorkspaceIcon from "../../../../images/notebook/Notebook-reset-workspace.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 GitHubIcon from "../../../../images/github.svg";
import SynapseIcon from "../../../../images/synapse-link.svg"; import SynapseIcon from "../../../../images/synapse-link.svg";
import { config, Platform } from "../../../Config"; import { config, Platform } from "../../../Config";
@ -88,25 +84,6 @@ export class CommandBarComponentButtonFactory {
buttons.push(CommandBarComponentButtonFactory.createNotebookWorkspaceResetButton(container)); 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.isDatabaseNodeOrNoneSelected()) {
if (container.isNotebookEnabled()) { if (container.isNotebookEnabled()) {
buttons.push(CommandBarComponentButtonFactory.createDivider()); 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 { private static createOpenTerminalButton(container: ViewModels.Explorer): ViewModels.NavbarButtonConfig {
const label = "Open Terminal"; const label = "Open Terminal";
return { 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( private static createStaticCommandBarButtonsForResourceToken(
container: ViewModels.Explorer container: ViewModels.Explorer
): ViewModels.NavbarButtonConfig[] { ): ViewModels.NavbarButtonConfig[] {

View File

@ -94,8 +94,6 @@ export class ExplorerStub implements ViewModels.Explorer {
public uploadFilePane: UploadFilePane; public uploadFilePane: UploadFilePane;
public stringInputPane: StringInputPane; public stringInputPane: StringInputPane;
public setupNotebooksPane: SetupNotebooksPane; public setupNotebooksPane: SetupNotebooksPane;
public setupSparkClusterPane: ViewModels.ContextualPane;
public manageSparkClusterPane: ViewModels.ContextualPane;
public isGalleryPublishEnabled: ko.Computed<boolean>; public isGalleryPublishEnabled: ko.Computed<boolean>;
public isGitHubPaneEnabled: ko.Observable<boolean>; public isGitHubPaneEnabled: ko.Observable<boolean>;
public isPublishNotebookPaneEnabled: ko.Observable<boolean>; public isPublishNotebookPaneEnabled: ko.Observable<boolean>;

View File

@ -1,37 +0,0 @@
<div data-bind="visible: visible, event: { keydown: onPaneKeyDown }">
<div class="contextual-pane-out" data-bind="click: cancel, clickBubble: false"></div>
<div class="contextual-pane" id="managesparkclusterpane">
<!-- Setup spark form -- Start -->
<div class="contextual-pane-in">
<div class="paneContentContainer">
<form class="paneContentContainer" data-bind="submit: submit">
<!-- Setup spark header - Start -->
<div class="firstdivbg headerline">
<span data-bind="text: title"></span>
<div
class="closeImg"
role="button"
aria-label="Close pane"
tabindex="0"
data-bind="click: cancel, event: { keypress: onCloseKeyPress }"
>
<img src="../../../images/close-black.svg" title="Close" alt="Close" />
</div>
</div>
<!-- Setup spark header - End -->
<div class="paneMainContent"><div data-bind="react: clusterSettingsComponentAdapter"></div></div>
<div class="paneFooter">
<div class="leftpanel-okbut"><input type="submit" value="Save" class="btncreatecoll1" /></div>
</div>
</form>
</div>
</div>
<!-- Setup spark form - Start -->
<!-- Loader - Start -->
<div class="dataExplorerLoaderContainer dataExplorerPaneLoaderContainer" data-bind="visible: isExecuting">
<img class="dataExplorerLoader" alt="loading indicator image" src="/LoadingIndicator_3Squares.gif" />
</div>
<!-- Loader - End -->
</div>
</div>

View File

@ -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<number>;
public clusterSettingsComponentAdapter: ClusterSettingsComponentAdapter;
private _settingsComponentAdapterProps: ko.Observable<ClusterSettingsComponentProps>;
private _defaultCluster: ko.Observable<DataModels.SparkCluster>;
constructor(options: ViewModels.PaneOptions) {
super(options);
this.title("Manage spark cluster");
this.workerCount = ko.observable<number>();
this._defaultCluster = ko.observable<DataModels.SparkCluster>({
id: undefined,
name: undefined,
type: undefined,
properties: {
kind: undefined,
creationTime: undefined,
driverSize: undefined,
status: undefined,
workerInstanceCount: undefined,
workerSize: undefined
}
});
this._settingsComponentAdapterProps = ko.observable<ClusterSettingsComponentProps>({
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();
}
}

View File

@ -19,8 +19,6 @@ import BrowseQueriesPaneTemplate from "./BrowseQueriesPane.html";
import UploadFilePaneTemplate from "./UploadFilePane.html"; import UploadFilePaneTemplate from "./UploadFilePane.html";
import StringInputPaneTemplate from "./StringInputPane.html"; import StringInputPaneTemplate from "./StringInputPane.html";
import SetupNotebooksPaneTemplate from "./SetupNotebooksPane.html"; import SetupNotebooksPaneTemplate from "./SetupNotebooksPane.html";
import SetupSparkClusterPaneTemplate from "./SetupSparkClusterPane.html";
import ManageSparkClusterPaneTemplate from "./ManageSparkClusterPane.html";
import LibraryManagePaneTemplate from "./LibraryManagePane.html"; import LibraryManagePaneTemplate from "./LibraryManagePane.html";
import ClusterLibraryPaneTemplate from "./ClusterLibraryPane.html"; import ClusterLibraryPaneTemplate from "./ClusterLibraryPane.html";
import GitHubReposPaneTemplate from "./GitHubReposPane.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 { export class LibraryManagePaneComponent {
constructor() { constructor() {
return { return {

View File

@ -1,52 +0,0 @@
<div data-bind="visible: visible, event: { keydown: onPaneKeyDown }">
<div class="contextual-pane-out" data-bind="click: cancel, clickBubble: false"></div>
<div class="contextual-pane" id="setupsparkclusterpane">
<!-- Setup spark form -- Start -->
<div class="contextual-pane-in">
<form class="paneContentContainer" data-bind="submit: submit">
<div class="paneContentContainer">
<!-- Setup spark header - Start -->
<div class="firstdivbg headerline">
<span data-bind="text: title"></span>
<div
class="closeImg"
role="button"
aria-label="Close pane"
tabindex="0"
data-bind="click: cancel, event: { keypress: onCloseKeyPress }"
>
<img src="../../../images/close-black.svg" title="Close" alt="Close" />
</div>
</div>
<!-- Setup spark header - End -->
<div class="paneMainContent">
<div class="pkPadding">
<div data-bind="text: setupSparkClusterText"></div>
<div class="seconddivpadding">
<div>Worker Count</div>
<input
class="sparkWorkerCountInput"
type="number"
min="1"
aria-label="worker count input"
required
data-bind="textInput: workerCount, attr: { max: maxWorkerNodes }"
/>
</div>
</div>
</div>
<div class="paneFooter">
<div class="leftpanel-okbut"><input type="submit" value="Complete Setup" class="btncreatecoll1" /></div>
</div>
</div>
</form>
</div>
<!-- Setup spark form - Start -->
<!-- Loader - Start -->
<div class="dataExplorerLoaderContainer dataExplorerPaneLoaderContainer" data-bind="visible: isExecuting">
<img class="dataExplorerLoader" alt="loading indicator image" src="/LoadingIndicator_3Squares.gif" />
</div>
<!-- Loader - End -->
</div>
</div>

View File

@ -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<number>;
constructor(options: ViewModels.PaneOptions) {
super(options);
this.title("Enable spark");
this.workerCount = ko.observable<number>(1);
this.resetData();
}
public async submit() {
await this.setupSparkCluster();
}
public async setupSparkCluster(): Promise<void> {
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);
}
}
}

View File

@ -441,8 +441,6 @@
<upload-file-pane params="{data: uploadFilePane}"></upload-file-pane> <upload-file-pane params="{data: uploadFilePane}"></upload-file-pane>
<string-input-pane params="{data: stringInputPane}"></string-input-pane> <string-input-pane params="{data: stringInputPane}"></string-input-pane>
<setup-notebooks-pane params="{data: setupNotebooksPane}"></setup-notebooks-pane> <setup-notebooks-pane params="{data: setupNotebooksPane}"></setup-notebooks-pane>
<setup-spark-cluster-pane params="{data: setupSparkClusterPane}"></setup-spark-cluster-pane>
<manage-spark-cluster-pane params="{data: manageSparkClusterPane}"></manage-spark-cluster-pane>
<library-manage-pane params="{data: libraryManagePane}"></library-manage-pane> <library-manage-pane params="{data: libraryManagePane}"></library-manage-pane>
<cluster-library-pane params="{data: clusterLibraryPane}"></cluster-library-pane> <cluster-library-pane params="{data: clusterLibraryPane}"></cluster-library-pane>