Add new file UI (#14773)

Adds a notebook or markdown file to a book's top level or a section by right click on Book Tree View
This commit is contained in:
Barbara Valdez
2021-03-30 18:44:52 -07:00
committed by GitHub
parent b774f09b6c
commit 8aa222d1c8
13 changed files with 428 additions and 247 deletions

View File

@@ -12,8 +12,8 @@ import * as azdata from 'azdata';
import * as crypto from 'crypto';
import { notebookLanguages, notebookConfigKey, pinnedBooksConfigKey, AUTHTYPE, INTEGRATED_AUTH, KNOX_ENDPOINT_PORT, KNOX_ENDPOINT_SERVER } from './constants';
import { IPrompter, IQuestion, QuestionTypes } from '../prompts/question';
import * as loc from '../common/localizedConstants';
import { BookTreeItemFormat, BookTreeItemType } from '../book/bookTreeItem';
import * as loc from './localizedConstants';
const localize = nls.loadMessageBundle();
@@ -488,11 +488,30 @@ export interface IBookNotebook {
notebookPath: string;
}
export enum FileExtension {
Markdown = '.md',
Notebook = '.ipynb'
}
//Confirmation message dialog
export async function confirmReplace(prompter: IPrompter): Promise<boolean> {
export async function confirmMessageDialog(prompter: IPrompter, msg: string): Promise<boolean> {
return await prompter.promptSingle<boolean>(<IQuestion>{
type: QuestionTypes.confirm,
message: loc.confirmReplace,
message: msg,
default: false
});
}
export async function selectFolder(): Promise<string | undefined> {
let uris = await vscode.window.showOpenDialog({
canSelectFiles: false,
canSelectMany: false,
canSelectFolders: true,
openLabel: loc.labelSelectFolder
});
if (uris?.length > 0) {
return uris[0].fsPath;
}
return undefined;
}