mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Add select target platform to new project quickpick (#18731)
* add step to choose target platform in new project quickpick * add comment * only splice if the default target platform index isn't -1 * change 3 to 5 in comment
This commit is contained in:
@@ -54,6 +54,8 @@ export const LearnMore = localize('dataworkspace.learnMore', "Learn More");
|
|||||||
export const YesRecommended = localize('dataworkspace.yesRecommended', "Yes (Recommended)");
|
export const YesRecommended = localize('dataworkspace.yesRecommended', "Yes (Recommended)");
|
||||||
export const No = localize('dataworkspace.no', "No");
|
export const No = localize('dataworkspace.no', "No");
|
||||||
export const SdkLearnMorePlaceholder = localize('dataworkspace.sdkLearnMorePlaceholder', "Click \"Learn More\" button for more information about SDK-style projects");
|
export const SdkLearnMorePlaceholder = localize('dataworkspace.sdkLearnMorePlaceholder', "Click \"Learn More\" button for more information about SDK-style projects");
|
||||||
|
export const Default = localize('dataworkspace.default', "Default");
|
||||||
|
export const SelectTargetPlatform = localize('dataworkspace.selectTargetPlatform', "Select Target Platform");
|
||||||
|
|
||||||
//Open Existing Dialog
|
//Open Existing Dialog
|
||||||
export const OpenExistingDialogTitle = localize('dataworkspace.openExistingDialogTitle', "Open Existing Project");
|
export const OpenExistingDialogTitle = localize('dataworkspace.openExistingDialogTitle', "Open Existing Project");
|
||||||
|
|||||||
@@ -20,9 +20,11 @@ export async function createNewProjectWithQuickpick(workspaceService: WorkspaceS
|
|||||||
label: projType.displayName,
|
label: projType.displayName,
|
||||||
description: projType.description,
|
description: projType.description,
|
||||||
id: projType.id,
|
id: projType.id,
|
||||||
|
targetPlatforms: projType.targetPlatforms,
|
||||||
|
defaultTargetPlatform: projType.defaultTargetPlatform,
|
||||||
sdkOption: projType.sdkStyleOption,
|
sdkOption: projType.sdkStyleOption,
|
||||||
sdkLearnMoreUrl: projType.sdkStyleLearnMoreUrl
|
sdkLearnMoreUrl: projType.sdkStyleLearnMoreUrl
|
||||||
} as vscode.QuickPickItem & { id: string, sdkOption?: boolean, sdkLearnMoreUrl?: string };
|
} as vscode.QuickPickItem & { id: string, sdkOption?: boolean, targetPlatforms?: string[], defaultTargetPlatform?: string, sdkLearnMoreUrl?: string };
|
||||||
});
|
});
|
||||||
|
|
||||||
// 1. Prompt for project type
|
// 1. Prompt for project type
|
||||||
@@ -89,9 +91,34 @@ export async function createNewProjectWithQuickpick(workspaceService: WorkspaceS
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let targetPlatform;
|
||||||
|
if (projectType.targetPlatforms) {
|
||||||
|
// 4. Target platform of the project
|
||||||
|
let targetPlatforms: vscode.QuickPickItem[] = projectType.targetPlatforms.map(targetPlatform => { return { label: targetPlatform }; });
|
||||||
|
|
||||||
|
if (projectType.defaultTargetPlatform) {
|
||||||
|
// move the default target platform to be the first one in the list
|
||||||
|
const defaultIndex = targetPlatforms.findIndex(i => i.label === projectType.defaultTargetPlatform);
|
||||||
|
if (defaultIndex > -1) {
|
||||||
|
targetPlatforms.splice(defaultIndex, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// add default next to the default target platform
|
||||||
|
targetPlatforms.unshift({ label: projectType.defaultTargetPlatform, description: constants.Default });
|
||||||
|
}
|
||||||
|
|
||||||
|
const selectedTargetPlatform = await vscode.window.showQuickPick(targetPlatforms, { title: constants.SelectTargetPlatform, ignoreFocusOut: true });
|
||||||
|
if (!selectedTargetPlatform) {
|
||||||
|
// User cancelled
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
targetPlatform = selectedTargetPlatform.label;
|
||||||
|
}
|
||||||
|
|
||||||
let sdkStyle;
|
let sdkStyle;
|
||||||
if (projectType.sdkOption) {
|
if (projectType.sdkOption) {
|
||||||
// 4. SDK-style project or not
|
// 5. SDK-style project or not
|
||||||
const sdkLearnMoreButton: vscode.QuickInputButton = {
|
const sdkLearnMoreButton: vscode.QuickInputButton = {
|
||||||
iconPath: new vscode.ThemeIcon('link-external'),
|
iconPath: new vscode.ThemeIcon('link-external'),
|
||||||
tooltip: constants.LearnMore
|
tooltip: constants.LearnMore
|
||||||
@@ -138,5 +165,5 @@ export async function createNewProjectWithQuickpick(workspaceService: WorkspaceS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await workspaceService.createProject(projectName, vscode.Uri.file(projectLocation), projectType.id, undefined, sdkStyle);
|
await workspaceService.createProject(projectName, vscode.Uri.file(projectLocation), projectType.id, targetPlatform, sdkStyle);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user