-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(vscode): Introduce onboarding experience (#3581)
* feat(vscode): externalize connection parameterization (#2830) connection parameterization * feat(vscode): Azurite Start & Default Location (#3031) Cherry Pick Autostart Azurite * feat(vscode): Start Design time on project launch (#3037) * Add first workspace changes * Add validation for workspace and project * +DesignTime settings * +telemetry * +PromptStartDesignTimeOption * +Telemetry * PR Feedback * fix missing --------- Co-authored-by: ccastrotrejo <[email protected]> * feat(vscode): Binary Dependency Installation (Cherry Pick) (#3319) * Cherry Picked: binaryInstallation * overwrite existing tasks.json * Change wording --------- Co-authored-by: Alan Kai (from Dev Box) <[email protected]> * fix(Designer): Fixes for single click installation bugs (#3505) * async Timeout for Dependencies * fix timeout, fix async/await, add csharp setting * Rename to timeOutErrorOperation --------- Co-authored-by: Alan Kai (from Dev Box) <[email protected]> * feat(vscode): Opt-in/opt-out for installation of binaries (#3546) * Add prompt to opt-in and opt-out for binaries installation * Separate onboarding to different file * Update onboarding ids * Add default to binaries and update onboarding for binaries * Add back functionality * Separate functions according to binaries opt-in/out * Add default value when get global setting * Update dotnet command when there is no use of dotnet dependencies * fix(vscode): Set default path when opt-out (#3564) * Add prompt to opt-in and opt-out for binaries installation * Separate onboarding to different file * Update onboarding ids * Add default to binaries and update onboarding for binaries * Add back functionality * Separate functions according to binaries opt-in/out * Add default value when get global setting * Update dotnet command when there is no use of dotnet dependencies * Update to default path when opt out * Update strings to be able to review * Update strings * Add final point * fix(vscode): Update function core tools option when optout (#3570) * Update tasks.json according to binaries * Add warning message for install binaries command * Revert "feat(vscode): externalize connection parameterization (#2830)" This reverts commit b8e6e7c. * Update imports * Update binaries prompt to prompt always * Remove esModuleInterop from tsconfig * Update imports and command preview * Add validation for auto start azurite * Update setting name * Update settings and remove warning message * Update settings * Add log and update settings * Update azurite and look for project path * Make azurite auto location * Update to get logic app project * Update string --------- Co-authored-by: Yerko <[email protected]> Co-authored-by: Alan Kai <[email protected]> Co-authored-by: Alan Kai (from Dev Box) <[email protected]>
- Loading branch information
1 parent
0689a6d
commit f28c4fa
Showing
55 changed files
with
2,268 additions
and
220 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
apps/vs-code-designer/src/app/azuriteExtension/executeOnAzuriteExt.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
import { azuriteExtensionId } from '../../constants'; | ||
import { localize } from '../../localize'; | ||
import type { IActionContext } from '@microsoft/vscode-azext-utils'; | ||
import { extensions } from 'vscode'; | ||
import * as vscode from 'vscode'; | ||
|
||
export async function executeOnAzurite(context: IActionContext, command: string, ...args: any[]): Promise<void> { | ||
const azuriteExtension = extensions.getExtension(azuriteExtensionId); | ||
|
||
if (azuriteExtension?.isActive) { | ||
vscode.commands.executeCommand(command, { | ||
...args, | ||
}); | ||
} else { | ||
const message: string = localize('deactivatedAzuriteExt', 'Azurite extension is deactivated, make sure to activate it'); | ||
await context.ui.showWarningMessage(message); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
apps/vs-code-designer/src/app/commands/dotnet/installDotNet.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/*------------------p--------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
import { autoRuntimeDependenciesPathSettingKey, dotnetDependencyName } from '../../../constants'; | ||
import { ext } from '../../../extensionVariables'; | ||
import { downloadAndExtractBinaries, getDotNetBinariesReleaseUrl } from '../../utils/binaries'; | ||
import { getGlobalSetting } from '../../utils/vsCodeConfig/settings'; | ||
import type { IActionContext } from '@microsoft/vscode-azext-utils'; | ||
|
||
export async function installDotNet(context: IActionContext, majorVersion?: string): Promise<void> { | ||
ext.outputChannel.show(); | ||
context.telemetry.properties.majorVersion = majorVersion; | ||
const targetDirectory = getGlobalSetting<string>(autoRuntimeDependenciesPathSettingKey); | ||
|
||
context.telemetry.properties.lastStep = 'getDotNetBinariesReleaseUrl'; | ||
const scriptUrl = getDotNetBinariesReleaseUrl(); | ||
|
||
context.telemetry.properties.lastStep = 'downloadAndExtractBinaries'; | ||
await downloadAndExtractBinaries(scriptUrl, targetDirectory, dotnetDependencyName, majorVersion); | ||
} |
75 changes: 75 additions & 0 deletions
75
apps/vs-code-designer/src/app/commands/dotnet/validateDotNetInstalled.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
import { validateDotNetSDKSetting } from '../../../constants'; | ||
import { localize } from '../../../localize'; | ||
import { getDotNetCommand } from '../../utils/dotnet/dotnet'; | ||
import { executeCommand } from '../../utils/funcCoreTools/cpUtils'; | ||
import { getWorkspaceSetting } from '../../utils/vsCodeConfig/settings'; | ||
import { installDotNet } from './installDotNet'; | ||
import { callWithTelemetryAndErrorHandling, DialogResponses, openUrl } from '@microsoft/vscode-azext-utils'; | ||
import type { IActionContext } from '@microsoft/vscode-azext-utils'; | ||
import type { MessageItem } from 'vscode'; | ||
|
||
/** | ||
* Checks if dotnet 6 is installed, and installs it if needed. | ||
* @param {IActionContext} context - Workflow file path. | ||
* @param {string} message - Message for warning. | ||
* @param {string} fsPath - Workspace file system path. | ||
* @returns {Promise<boolean>} Returns true if it is installed or was sucessfully installed, otherwise returns false. | ||
*/ | ||
export async function validateDotNetIsInstalled(context: IActionContext, message: string, fsPath: string): Promise<boolean> { | ||
let input: MessageItem | undefined; | ||
let installed = false; | ||
const install: MessageItem = { title: localize('install', 'Install') }; | ||
|
||
await callWithTelemetryAndErrorHandling('azureLogicAppsStandard.validateDotNetIsInstalled', async (innerContext: IActionContext) => { | ||
innerContext.errorHandling.suppressDisplay = true; | ||
|
||
if (!getWorkspaceSetting<boolean>(validateDotNetSDKSetting, fsPath)) { | ||
innerContext.telemetry.properties.validateDotNet = 'false'; | ||
installed = true; | ||
} else if (await isDotNetInstalled()) { | ||
installed = true; | ||
} else { | ||
const items: MessageItem[] = [install, DialogResponses.learnMore]; | ||
input = await innerContext.ui.showWarningMessage(message, { modal: true }, ...items); | ||
innerContext.telemetry.properties.dialogResult = input.title; | ||
|
||
if (input === install) { | ||
await installDotNet(innerContext); | ||
installed = true; | ||
} else if (input === DialogResponses.learnMore) { | ||
await openUrl('https://dotnet.microsoft.com/download/dotnet/6.0'); | ||
} | ||
} | ||
}); | ||
|
||
// validate that DotNet was installed only if user confirmed | ||
if (input === install && !installed) { | ||
if ( | ||
(await context.ui.showWarningMessage( | ||
localize('failedInstallDotNet', 'The .NET SDK installation failed. Please manually install instead.'), | ||
DialogResponses.learnMore | ||
)) === DialogResponses.learnMore | ||
) { | ||
await openUrl('https://dotnet.microsoft.com/download/dotnet/6.0'); | ||
} | ||
} | ||
|
||
return installed; | ||
} | ||
|
||
/** | ||
* Check is dotnet is installed. | ||
* @returns {Promise<boolean>} Returns true if installed, otherwise returns false. | ||
*/ | ||
export async function isDotNetInstalled(): Promise<boolean> { | ||
try { | ||
await executeCommand(undefined, undefined, getDotNetCommand(), '--version'); | ||
return true; | ||
} catch (error) { | ||
return false; | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
apps/vs-code-designer/src/app/commands/dotnet/validateDotNetIsLatest.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
import { dotnetDependencyName } from '../../../constants'; | ||
import { localize } from '../../../localize'; | ||
import { binariesExist, getLatestDotNetVersion } from '../../utils/binaries'; | ||
import { getDotNetCommand, getLocalDotNetVersionFromBinaries } from '../../utils/dotnet/dotnet'; | ||
import { getWorkspaceSetting, updateGlobalSetting } from '../../utils/vsCodeConfig/settings'; | ||
import { installDotNet } from './installDotNet'; | ||
import { callWithTelemetryAndErrorHandling, DialogResponses, openUrl } from '@microsoft/vscode-azext-utils'; | ||
import type { IActionContext } from '@microsoft/vscode-azext-utils'; | ||
import * as semver from 'semver'; | ||
import type { MessageItem } from 'vscode'; | ||
|
||
export async function validateDotNetIsLatest(majorVersion?: string): Promise<void> { | ||
await callWithTelemetryAndErrorHandling('azureLogicAppsStandard.validateDotNetIsLatest', async (context: IActionContext) => { | ||
context.errorHandling.suppressDisplay = true; | ||
context.telemetry.properties.isActivationEvent = 'true'; | ||
|
||
const showDotNetWarningKey = 'showDotNetWarning'; | ||
const showDotNetWarning = !!getWorkspaceSetting<boolean>(showDotNetWarningKey); | ||
const binaries = binariesExist(dotnetDependencyName); | ||
context.telemetry.properties.binariesExist = `${binaries}`; | ||
|
||
if (!binaries) { | ||
await installDotNet(context, majorVersion); | ||
context.telemetry.properties.binaryCommand = `${getDotNetCommand()}`; | ||
} else if (showDotNetWarning) { | ||
context.telemetry.properties.binaryCommand = `${getDotNetCommand()}`; | ||
const localVersion: string | null = await getLocalDotNetVersionFromBinaries(); | ||
context.telemetry.properties.localVersion = localVersion; | ||
const newestVersion: string | undefined = await getLatestDotNetVersion(context, majorVersion); | ||
if (semver.major(newestVersion) === semver.major(localVersion) && semver.gt(newestVersion, localVersion)) { | ||
context.telemetry.properties.outOfDateDotNet = 'true'; | ||
const message: string = localize( | ||
'outdatedDotNetRuntime', | ||
'Update your local .NET SDK version ({0}) to the latest version ({1}) for the best experience.', | ||
localVersion, | ||
newestVersion | ||
); | ||
const update: MessageItem = { title: 'Update' }; | ||
let result: MessageItem; | ||
do { | ||
result = | ||
newestVersion !== undefined | ||
? await context.ui.showWarningMessage(message, update, DialogResponses.learnMore, DialogResponses.dontWarnAgain) | ||
: await context.ui.showWarningMessage(message, DialogResponses.learnMore, DialogResponses.dontWarnAgain); | ||
if (result === DialogResponses.learnMore) { | ||
await openUrl('https://dotnet.microsoft.com/en-us/download/dotnet/6.0'); | ||
} else if (result === update) { | ||
await installDotNet(context, majorVersion); | ||
} else if (result === DialogResponses.dontWarnAgain) { | ||
await updateGlobalSetting(showDotNetWarningKey, false); | ||
} | ||
} while (result === DialogResponses.learnMore); | ||
} | ||
} | ||
}); | ||
} |
Oops, something went wrong.