mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-15 10:58:31 -05:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user