Added in auto-install prompt for Azure CLI and arcdata extension, "Don't Ask Again" logic, removed waiting on azcli extension activate (#16646)

* Added back Don't Ask Again logic

* If no Azure CLI found, throw error instead of returning undefined.

* Deleted 'restart ADS' text for arcdata extension prompts

* Added error catch for parse version and parsed out the * in az --version

* Added back findAz()

* Added arcdata version to AzTool. Parse --version using regex.

* Return undefined if no az found.

* Added userRequested param for findAz

* No longer await on extension activate. Re-added some functions for az install.

* Install works for windows

* Changed auto install for az on Linux and MacOS.

* Added comment for findSpecificAzAndArc and uncommented some localizedConstants

* Added comment for getSemVersionArc and took out the path for some tests.

* Made findSpecificAzAndArc return an object instead of a list

* Removed azToolService test

* Removed azToolService tests and renamed suite to azcli Extension Tests

* Got rid of new Regexp for regex in parseVersions

* Added back azToolService.ts

* Added logic to enable prompt user to install arcdata extension and auto-install capability. No update capability yet.

Co-authored-by: Candice Ye <canye@microsoft.com>
This commit is contained in:
Candice Ye
2021-08-10 15:39:31 -07:00
committed by GitHub
parent dfc91cc0ff
commit faffdb0a9a
13 changed files with 593 additions and 104 deletions

View File

@@ -7,16 +7,26 @@ import * as azExt from 'az-ext';
import * as rd from 'resource-deployment';
import * as vscode from 'vscode';
import { getExtensionApi } from './api';
import { findAz } from './az';
import { checkAndInstallAz } from './az';
import { ArcControllerConfigProfilesOptionsSource } from './providers/arcControllerConfigProfilesOptionsSource';
import { AzToolService } from './services/azToolService';
export async function activate(context: vscode.ExtensionContext): Promise<azExt.IExtension> {
const azToolService = new AzToolService();
vscode.commands.registerCommand('az.install', async () => {
azToolService.localAz = await checkAndInstallAz(true /* userRequested */);
});
azToolService.localAz = await findAz();
// Don't block on this since we want the extension to finish activating without needing user input
const localAzDiscovered = checkAndInstallAz() // install if not installed and user wants it.
.then(async azTool => {
if (azTool !== undefined) {
azToolService.localAz = azTool;
}
return azTool;
});
const azApi = getExtensionApi(azToolService);
const azApi = getExtensionApi(azToolService, localAzDiscovered);
// register option source(s)
const rdApi = <rd.IExtension>vscode.extensions.getExtension(rd.extension.name)?.exports;