mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-10 10:12:34 -05:00
Adding tools and Eula page to Resource Deployment (#13182)
* SQL VM wizard migration to ResourceType Wizard * Revert "SQL VM wizard migration to ResourceType Wizard" This reverts commit e58cd47707a7e2812be20d915f1fe638b96b035f. * migrated notebook wizard * SQL VM wizard migration to ResourceType Wizard * Fixed some imports on SQL VM wizard * migrated sqldb wizard to generic ResourceTypeWizard * Added missing import Solving errors from the merge * Moved some common functionality into ResourceTypeWizard * Changed logic of start deployment * fixed some import after changing files. * added pagelss model and tools and Eula Page * Hacky solution to fix wizard update bugs * Removed tools and Eula components from resourceTypePickerDialog * Removing changes in ext host * reverting every change in ext host dialog * Fixed setting the first provider for resourceTypeWizard. * Some PR related changes -Fixed typo in localized constants -made some code logic concise -Removed unnecessary check in tools&Eula * Added some fixes for compilation error * some refactoring for PRs * moved comment * cleaning up some code to make it more readable * fixed comment typo * Some additional cleaning up of code. * Adding a public getter for model * -Adding error message for failed EULA validation -Removed unnecessary check for selected resource. * Added comment to explain model variable behavior * Added additional comments * Fixed a comment to make it accurate * Better phrasing for a comment
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { DeploymentProvider, instanceOfCommandDeploymentProvider, instanceOfDialogDeploymentProvider, instanceOfDownloadDeploymentProvider, instanceOfNotebookDeploymentProvider, instanceOfWebPageDeploymentProvider } from '../interfaces';
|
||||
import { DeploymentInputDialog } from './deploymentInputDialog';
|
||||
import { ResourceTypeModel } from './resourceTypeModel';
|
||||
import * as azdata from 'azdata';
|
||||
import * as vscode from 'vscode';
|
||||
import * as nls from 'vscode-nls';
|
||||
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
|
||||
export class PageLessDeploymentModel extends ResourceTypeModel {
|
||||
|
||||
initialize(): void {
|
||||
this.wizard.setPages([]);
|
||||
}
|
||||
|
||||
async onOk(): Promise<void> {
|
||||
let provider: DeploymentProvider = this.wizard.provider;
|
||||
if (instanceOfDialogDeploymentProvider(provider)) {
|
||||
const dialog = new DeploymentInputDialog(this.wizard.notebookService, this.wizard.platformService, this.wizard.toolsService, provider.dialog);
|
||||
dialog.open();
|
||||
} else if (instanceOfNotebookDeploymentProvider(provider)) {
|
||||
this.wizard.notebookService.openNotebook(provider.notebook);
|
||||
} else if (instanceOfDownloadDeploymentProvider(provider)) {
|
||||
const downloadUrl = provider.downloadUrl;
|
||||
const taskName = localize('resourceDeployment.DownloadAndLaunchTaskName', "Download and launch installer, URL: {0}", downloadUrl);
|
||||
azdata.tasks.startBackgroundOperation({
|
||||
displayName: taskName,
|
||||
description: taskName,
|
||||
isCancelable: false,
|
||||
operation: op => {
|
||||
op.updateStatus(azdata.TaskStatus.InProgress, localize('resourceDeployment.DownloadingText', "Downloading from: {0}", downloadUrl));
|
||||
this.wizard.resourceTypeService.download(downloadUrl).then(async (downloadedFile) => {
|
||||
op.updateStatus(azdata.TaskStatus.InProgress, localize('resourceDeployment.DownloadCompleteText', "Successfully downloaded: {0}", downloadedFile));
|
||||
op.updateStatus(azdata.TaskStatus.InProgress, localize('resourceDeployment.LaunchingProgramText', "Launching: {0}", downloadedFile));
|
||||
await this.wizard.platformService.runCommand(downloadedFile, { sudo: true });
|
||||
op.updateStatus(azdata.TaskStatus.Succeeded, localize('resourceDeployment.ProgramLaunchedText', "Successfully launched: {0}", downloadedFile));
|
||||
}, (error) => {
|
||||
op.updateStatus(azdata.TaskStatus.Failed, error);
|
||||
});
|
||||
}
|
||||
});
|
||||
} else if (instanceOfWebPageDeploymentProvider(provider)) {
|
||||
vscode.commands.executeCommand('vscode.open', vscode.Uri.parse(provider.webPageUrl));
|
||||
} else if (instanceOfCommandDeploymentProvider(provider)) {
|
||||
vscode.commands.executeCommand(provider.command);
|
||||
}
|
||||
}
|
||||
|
||||
onCancel(): void {
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user