mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-13 19:48:37 -05:00
Replaced db project readme file with opening a doc in browser after project is created (#19543)
This commit is contained in:
@@ -56,6 +56,7 @@ 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 Default = localize('dataworkspace.default', "Default");
|
||||
export const SelectTargetPlatform = localize('dataworkspace.selectTargetPlatform', "Select Target Platform");
|
||||
export const LocalDevInfo = (target: string) => localize('LocalDevInfo', "Click \"Learn more\" button for more information about local development experience to {0}", target);
|
||||
|
||||
//Open Existing Dialog
|
||||
export const OpenExistingDialogTitle = localize('dataworkspace.openExistingDialogTitle', "Open Existing Project");
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
|
||||
import * as fs from 'fs';
|
||||
import type * as azdataType from 'azdata';
|
||||
import * as vscode from 'vscode';
|
||||
import * as constants from './constants';
|
||||
|
||||
export async function directoryExist(directoryPath: string): Promise<boolean> {
|
||||
const stats = await getFileStatus(directoryPath);
|
||||
@@ -69,3 +71,15 @@ try {
|
||||
export function getAzdataApi(): typeof azdataType | undefined {
|
||||
return azdataApi;
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows a message with a "Learn More" button
|
||||
* @param message Info message
|
||||
* @param link Link to open when "Learn Button" is clicked
|
||||
*/
|
||||
export async function showInfoMessageWithLearnMoreLink(message: string, link: string): Promise<void> {
|
||||
const result = await vscode.window.showInformationMessage(message, constants.LearnMore);
|
||||
if (result === constants.LearnMore) {
|
||||
void vscode.env.openExternal(vscode.Uri.parse(link));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,6 +145,11 @@ declare module 'dataworkspace' {
|
||||
* Location where clicking on the Learn More next to SDK style checkbox will go. sdkStyleOption needs to be set to true to use this
|
||||
*/
|
||||
readonly sdkStyleLearnMoreUrl?: string
|
||||
|
||||
/**
|
||||
* Location where clicking on the Learn More to know more about project type will go
|
||||
*/
|
||||
readonly learnMoreUrl?: string
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import * as vscode from 'vscode';
|
||||
import * as path from 'path';
|
||||
import * as constants from '../common/constants';
|
||||
import { directoryExist } from '../common/utils';
|
||||
import { directoryExist, showInfoMessageWithLearnMoreLink } from '../common/utils';
|
||||
import { defaultProjectSaveLocation } from '../common/projectLocationHelper';
|
||||
import { WorkspaceService } from '../services/workspaceService';
|
||||
|
||||
@@ -23,8 +23,9 @@ export async function createNewProjectWithQuickpick(workspaceService: WorkspaceS
|
||||
targetPlatforms: projType.targetPlatforms,
|
||||
defaultTargetPlatform: projType.defaultTargetPlatform,
|
||||
sdkOption: projType.sdkStyleOption,
|
||||
sdkLearnMoreUrl: projType.sdkStyleLearnMoreUrl
|
||||
} as vscode.QuickPickItem & { id: string, sdkOption?: boolean, targetPlatforms?: string[], defaultTargetPlatform?: string, sdkLearnMoreUrl?: string };
|
||||
sdkLearnMoreUrl: projType.sdkStyleLearnMoreUrl,
|
||||
learnMoreUrl: projType.learnMoreUrl
|
||||
} as vscode.QuickPickItem & { id: string, sdkOption?: boolean, targetPlatforms?: string[], defaultTargetPlatform?: string, sdkLearnMoreUrl?: string, learnMoreUrl?: string };
|
||||
});
|
||||
|
||||
// 1. Prompt for project type
|
||||
@@ -166,4 +167,10 @@ export async function createNewProjectWithQuickpick(workspaceService: WorkspaceS
|
||||
}
|
||||
|
||||
await workspaceService.createProject(projectName, vscode.Uri.file(projectLocation), projectType.id, targetPlatform, sdkStyle);
|
||||
|
||||
// Add info message with 'learn more' button if project type has a link
|
||||
// for user to learn more about the project type
|
||||
if (projectType.learnMoreUrl && projectType.defaultTargetPlatform) {
|
||||
void showInfoMessageWithLearnMoreLink(constants.LocalDevInfo(projectType.defaultTargetPlatform), projectType.learnMoreUrl);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user