mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
add SDK option to create project from db quickpick (#19100)
* Add SDK option to create project from db quickpick * cleanup
This commit is contained in:
@@ -269,6 +269,8 @@ export const WorkspaceFileExtension = '.code-workspace';
|
|||||||
export const browseEllipsisWithIcon = `$(folder) ${localize('browseEllipsis', "Browse...")}`;
|
export const browseEllipsisWithIcon = `$(folder) ${localize('browseEllipsis', "Browse...")}`;
|
||||||
export const selectProjectLocation = localize('selectProjectLocation', "Select project location");
|
export const selectProjectLocation = localize('selectProjectLocation', "Select project location");
|
||||||
export const sdkStyleProject = localize('sdkStyleProject', 'SDK-style project (Preview)');
|
export const sdkStyleProject = localize('sdkStyleProject', 'SDK-style project (Preview)');
|
||||||
|
export const YesRecommended = localize('yesRecommended', "Yes (Recommended)");
|
||||||
|
export const SdkLearnMorePlaceholder = localize('sdkLearnMorePlaceholder', "Click \"Learn More\" button for more information about SDK-style projects");
|
||||||
export const ProjectParentDirectoryNotExistError = (location: string): string => { return localize('dataworkspace.projectParentDirectoryNotExistError', "The selected project location '{0}' does not exist or is not a directory.", location); };
|
export const ProjectParentDirectoryNotExistError = (location: string): string => { return localize('dataworkspace.projectParentDirectoryNotExistError', "The selected project location '{0}' does not exist or is not a directory.", location); };
|
||||||
export const ProjectDirectoryAlreadyExistError = (projectName: string, location: string): string => { return localize('dataworkspace.projectDirectoryAlreadyExistError', "There is already a directory named '{0}' in the selected location: '{1}'.", projectName, location); };
|
export const ProjectDirectoryAlreadyExistError = (projectName: string, location: string): string => { return localize('dataworkspace.projectDirectoryAlreadyExistError', "There is already a directory named '{0}' in the selected location: '{1}'.", projectName, location); };
|
||||||
|
|
||||||
|
|||||||
@@ -133,6 +133,48 @@ export async function createNewProjectFromDatabaseWithQuickpick(connectionInfo?:
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 5. SDK-style project or not
|
||||||
|
let sdkStyle;
|
||||||
|
const sdkLearnMoreButton: vscode.QuickInputButton = {
|
||||||
|
iconPath: new vscode.ThemeIcon('link-external'),
|
||||||
|
tooltip: constants.learnMore
|
||||||
|
};
|
||||||
|
const quickPick = vscode.window.createQuickPick();
|
||||||
|
quickPick.items = [{ label: constants.YesRecommended }, { label: constants.noString }];
|
||||||
|
quickPick.title = constants.sdkStyleProject;
|
||||||
|
quickPick.ignoreFocusOut = true;
|
||||||
|
const disposables: vscode.Disposable[] = [];
|
||||||
|
|
||||||
|
try {
|
||||||
|
quickPick.buttons = [sdkLearnMoreButton];
|
||||||
|
quickPick.placeholder = constants.SdkLearnMorePlaceholder;
|
||||||
|
|
||||||
|
const sdkStylePromise = new Promise<boolean | undefined>((resolve) => {
|
||||||
|
disposables.push(
|
||||||
|
quickPick.onDidHide(() => {
|
||||||
|
resolve(undefined);
|
||||||
|
}),
|
||||||
|
quickPick.onDidChangeSelection((item) => {
|
||||||
|
resolve(item[0].label === constants.YesRecommended);
|
||||||
|
}));
|
||||||
|
|
||||||
|
disposables.push(quickPick.onDidTriggerButton(async () => {
|
||||||
|
await vscode.env.openExternal(vscode.Uri.parse(constants.sdkLearnMoreUrl!));
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
|
||||||
|
quickPick.show();
|
||||||
|
sdkStyle = await sdkStylePromise;
|
||||||
|
quickPick.hide();
|
||||||
|
} finally {
|
||||||
|
disposables.forEach(d => d.dispose());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sdkStyle === undefined) {
|
||||||
|
// User cancelled
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
connectionUri: connectionUri,
|
connectionUri: connectionUri,
|
||||||
database: selectedDatabase,
|
database: selectedDatabase,
|
||||||
@@ -140,6 +182,6 @@ export async function createNewProjectFromDatabaseWithQuickpick(connectionInfo?:
|
|||||||
filePath: projectLocation,
|
filePath: projectLocation,
|
||||||
version: '1.0.0.0',
|
version: '1.0.0.0',
|
||||||
extractTarget: mapExtractTargetEnum(folderStructure),
|
extractTarget: mapExtractTargetEnum(folderStructure),
|
||||||
sdkStyle: false // todo: add sdkstyle option to quickpick
|
sdkStyle: sdkStyle
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user