mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
wizard for deploying bdc (#7183)
* wip * wip2 * wip eod 820 * wip 822 * text component improvements and misc changes * aria-label * targetClusterPage wip * target cluster page * target cluster page * wip 827 * wip deployment profile page * profile page * service settings page * wip 0903 * 0909 wip * 0910 * 0911 * sql instance and working directory * notebooks * docker version on windows * EULA env var * 917 updates * address comments * use async file access * fix the summary page display issue for ad auth * add save json file buttons * use promise for private methds * review feedbacks * refactor * pass json to notebooks * fix no tool scenario * bypass tool check if installed * update hint text * update notebooks * workaround azdata first time use * comments * accept eula and some text update * fix the error in package.json * promise instead of thenable * comments * fix typo
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
import * as path from 'path';
|
||||
@@ -14,7 +13,7 @@ import { NotebookInfo } from '../interfaces';
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
export interface INotebookService {
|
||||
launchNotebook(notebook: string | NotebookInfo): void;
|
||||
launchNotebook(notebook: string | NotebookInfo): Thenable<azdata.nb.NotebookEditor>;
|
||||
}
|
||||
|
||||
export class NotebookService implements INotebookService {
|
||||
@@ -25,18 +24,22 @@ export class NotebookService implements INotebookService {
|
||||
* Copy the notebook to the user's home directory and launch the notebook from there.
|
||||
* @param notebook the path of the notebook
|
||||
*/
|
||||
launchNotebook(notebook: string | NotebookInfo): void {
|
||||
launchNotebook(notebook: string | NotebookInfo): Thenable<azdata.nb.NotebookEditor> {
|
||||
const notebookPath = this.getNotebook(notebook);
|
||||
const notebookFullPath = path.join(this.extensionPath, notebookPath);
|
||||
if (notebookPath && this.platformService.fileExists(notebookPath)) {
|
||||
this.showNotebookAsUntitled(notebookPath);
|
||||
}
|
||||
else if (notebookPath && this.platformService.fileExists(notebookFullPath)) {
|
||||
this.showNotebookAsUntitled(notebookFullPath);
|
||||
}
|
||||
else {
|
||||
this.platformService.showErrorMessage(localize('resourceDeployment.notebookNotFound', "The notebook {0} does not exist", notebookPath));
|
||||
}
|
||||
return this.platformService.fileExists(notebookPath).then((notebookPathExists) => {
|
||||
if (notebookPathExists) {
|
||||
return this.showNotebookAsUntitled(notebookPath);
|
||||
} else {
|
||||
return this.platformService.fileExists(notebookFullPath).then(notebookFullPathExists => {
|
||||
if (notebookFullPathExists) {
|
||||
return this.showNotebookAsUntitled(notebookFullPath);
|
||||
} else {
|
||||
throw localize('resourceDeployment.notebookNotFound', "The notebook {0} does not exist", notebookPath);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -74,12 +77,12 @@ export class NotebookService implements INotebookService {
|
||||
return title;
|
||||
}
|
||||
|
||||
showNotebookAsUntitled(notebookPath: string): void {
|
||||
showNotebookAsUntitled(notebookPath: string): Thenable<azdata.nb.NotebookEditor> {
|
||||
let targetFileName: string = this.findNextUntitledEditorName(notebookPath);
|
||||
const untitledFileName: vscode.Uri = vscode.Uri.parse(`untitled:${targetFileName}`);
|
||||
vscode.workspace.openTextDocument(notebookPath).then((document) => {
|
||||
return vscode.workspace.openTextDocument(notebookPath).then((document) => {
|
||||
let initialContent = document.getText();
|
||||
azdata.nb.showNotebookDocument(untitledFileName, {
|
||||
return azdata.nb.showNotebookDocument(untitledFileName, {
|
||||
connectionProfile: undefined,
|
||||
preview: false,
|
||||
initialContent: initialContent,
|
||||
|
||||
Reference in New Issue
Block a user