Create book UI (#14210)

* Add dialog for creating books

* create empty book

* add localized constants

* add validation to dialog

* reset the create book command to original

* address pr comments

* change error message

* Init book toc manager in bookTreeView
This commit is contained in:
Barbara Valdez
2021-02-22 13:29:09 -08:00
committed by GitHub
parent 551eb76a42
commit 5ece9b968a
8 changed files with 227 additions and 23 deletions

View File

@@ -14,6 +14,7 @@ export class IconPathHelper {
private static extensionContext: vscode.ExtensionContext;
public static delete: IconPath;
public static folder: IconPath;
public static setExtensionContext(extensionContext: vscode.ExtensionContext) {
IconPathHelper.extensionContext = extensionContext;
@@ -21,5 +22,9 @@ export class IconPathHelper {
dark: IconPathHelper.extensionContext.asAbsolutePath('resources/dark/delete_inverse.svg'),
light: IconPathHelper.extensionContext.asAbsolutePath('resources/light/delete.svg')
};
IconPathHelper.folder = {
dark: IconPathHelper.extensionContext.asAbsolutePath('resources/dark/folder_inverse.svg'),
light: IconPathHelper.extensionContext.asAbsolutePath('resources/light/folder.svg')
};
}
}

View File

@@ -81,3 +81,18 @@ export const msgReleaseNotFound = localize('msgReleaseNotFound', "Releases not F
export const msgUndefinedAssetError = localize('msgUndefinedAssetError', "The selected book is not valid");
export function httpRequestError(code: number, message: string): string { return localize('httpRequestError', "Http Request failed with error: {0} {1}", code, message); }
export function msgDownloadLocation(downloadLocation: string): string { return localize('msgDownloadLocation', "Downloading to {0}", downloadLocation); }
// Create Book dialog constants
export const newGroup = localize('newGroup', "New Group");
export const groupDescription = localize('groupDescription', "Groups are used to organize Notebooks.");
export const locationBrowser = localize('locationBrowser', "Browse locations...");
export const selectContentFolder = localize('selectContentFolder', "Select content folder");
export const browse = localize('browse', "Browse");
export const create = localize('create', "Create");
export const name = localize('name', "Name");
export const saveLocation = localize('saveLocation', "Save location");
export const contentFolder = localize('contentFolder', "Content folder (Optional)");
export const msgContentFolderError = localize('msgContentFolderError', "Content folder path does not exist");
export const msgSaveFolderError = localize('msgSaveFolderError', "Save location path does not exist");

View File

@@ -11,6 +11,8 @@ import * as vscode from 'vscode';
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';
const localize = nls.loadMessageBundle();
@@ -390,3 +392,12 @@ export interface IBookNotebook {
bookPath?: string;
notebookPath: string;
}
//Confirmation message dialog
export async function confirmReplace(prompter: IPrompter): Promise<boolean> {
return await prompter.promptSingle<boolean>(<IQuestion>{
type: QuestionTypes.confirm,
message: loc.confirmReplace,
default: false
});
}