mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Add dont show prompt to azdata toasts (#12037)
* Add dont show prompt to azdata toasts * Undo version change * undo
This commit is contained in:
@@ -12,7 +12,7 @@ import { HttpClient } from './common/httpClient';
|
|||||||
import Logger from './common/logger';
|
import Logger from './common/logger';
|
||||||
import { getErrorMessage, searchForCmd } from './common/utils';
|
import { getErrorMessage, searchForCmd } from './common/utils';
|
||||||
import * as loc from './localizedConstants';
|
import * as loc from './localizedConstants';
|
||||||
import { azdataConfigSection, debugConfigKey, requiredVersion as requiredVersion, installationReadmeUrl } from './constants';
|
import { azdataConfigSection, debugConfigKey, requiredVersion as requiredVersion, installationReadmeUrl, doNotPromptInstallMemento, doNotPromptUpdateMemento } from './constants';
|
||||||
|
|
||||||
export const azdataHostname = 'https://aka.ms';
|
export const azdataHostname = 'https://aka.ms';
|
||||||
export const azdataUri = 'azdata-msi';
|
export const azdataUri = 'azdata-msi';
|
||||||
@@ -256,17 +256,33 @@ export async function checkAndUpgradeAzdata(currentAzdata: IAzdataTool | undefin
|
|||||||
* to install the correct version using opened documentation
|
* to install the correct version using opened documentation
|
||||||
* @param currentAzdata The current version of azdata to check.
|
* @param currentAzdata The current version of azdata to check.
|
||||||
*/
|
*/
|
||||||
export async function manuallyInstallOrUpgradeAzdata(currentAzdata: IAzdataTool | undefined): Promise<void> {
|
export async function manuallyInstallOrUpgradeAzdata(context: vscode.ExtensionContext, currentAzdata: IAzdataTool | undefined): Promise<void> {
|
||||||
|
// Note - not localizing since this is temporary behavior
|
||||||
|
const dontShow = 'Don\'t Show Again';
|
||||||
if (currentAzdata === undefined) {
|
if (currentAzdata === undefined) {
|
||||||
vscode.window.showInformationMessage(loc.installManually(requiredVersion, installationReadmeUrl), 'Ok');
|
const doNotPromptInstall = context.globalState.get(doNotPromptInstallMemento);
|
||||||
|
if (doNotPromptInstall) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const response = await vscode.window.showInformationMessage(loc.installManually(requiredVersion, installationReadmeUrl), 'OK', dontShow);
|
||||||
|
if (response === dontShow) {
|
||||||
|
context.globalState.update(doNotPromptInstallMemento, true);
|
||||||
|
}
|
||||||
Logger.show();
|
Logger.show();
|
||||||
Logger.log(loc.installManually(requiredVersion, installationReadmeUrl));
|
Logger.log(loc.installManually(requiredVersion, installationReadmeUrl));
|
||||||
} else {
|
} else {
|
||||||
|
const doNotPromptUpgrade = context.globalState.get(doNotPromptUpdateMemento);
|
||||||
|
if (doNotPromptUpgrade) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const requiredSemVersion = new SemVer(requiredVersion);
|
const requiredSemVersion = new SemVer(requiredVersion);
|
||||||
if (requiredSemVersion.compare(currentAzdata.cachedVersion) === 0) {
|
if (requiredSemVersion.compare(currentAzdata.cachedVersion) === 0) {
|
||||||
return; // if we have the required version then nothing more needs to be eon.
|
return; // if we have the required version then nothing more needs to be eon.
|
||||||
}
|
}
|
||||||
vscode.window.showInformationMessage(loc.installCorrectVersionManually(currentAzdata.cachedVersion.raw, requiredVersion, installationReadmeUrl), 'Ok');
|
const response = await vscode.window.showInformationMessage(loc.installCorrectVersionManually(currentAzdata.cachedVersion.raw, requiredVersion, installationReadmeUrl), 'OK', dontShow);
|
||||||
|
if (response === dontShow) {
|
||||||
|
context.globalState.update(doNotPromptUpdateMemento, true);
|
||||||
|
}
|
||||||
Logger.show();
|
Logger.show();
|
||||||
Logger.log(loc.installCorrectVersionManually(currentAzdata.cachedVersion.raw, requiredVersion, installationReadmeUrl));
|
Logger.log(loc.installCorrectVersionManually(currentAzdata.cachedVersion.raw, requiredVersion, installationReadmeUrl));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,4 +6,6 @@
|
|||||||
export const azdataConfigSection = 'azdata';
|
export const azdataConfigSection = 'azdata';
|
||||||
export const debugConfigKey = 'logDebugInfo';
|
export const debugConfigKey = 'logDebugInfo';
|
||||||
export const requiredVersion = '20.1.1';
|
export const requiredVersion = '20.1.1';
|
||||||
|
export const doNotPromptInstallMemento = 'azdata.doNotPromptInstall';
|
||||||
|
export const doNotPromptUpdateMemento = 'azdata.doNotPromptUpdate';
|
||||||
export const installationReadmeUrl = 'https://github.com/microsoft/Azure-data-services-on-Azure-Arc/blob/Aug-2020/scenarios-new/001-install-client-tools.md';
|
export const installationReadmeUrl = 'https://github.com/microsoft/Azure-data-services-on-Azure-Arc/blob/Aug-2020/scenarios-new/001-install-client-tools.md';
|
||||||
|
|||||||
@@ -3,16 +3,17 @@
|
|||||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
import * as vscode from 'vscode';
|
||||||
import * as azdataExt from 'azdata-ext';
|
import * as azdataExt from 'azdata-ext';
|
||||||
import { findAzdata, IAzdataTool, manuallyInstallOrUpgradeAzdata } from './azdata';
|
import { findAzdata, IAzdataTool, manuallyInstallOrUpgradeAzdata } from './azdata';
|
||||||
import * as loc from './localizedConstants';
|
import * as loc from './localizedConstants';
|
||||||
|
|
||||||
let localAzdata: IAzdataTool | undefined = undefined;
|
let localAzdata: IAzdataTool | undefined = undefined;
|
||||||
|
|
||||||
export async function activate(): Promise<azdataExt.IExtension> {
|
export async function activate(context: vscode.ExtensionContext): Promise<azdataExt.IExtension> {
|
||||||
localAzdata = await checkForAzdata();
|
localAzdata = await checkForAzdata();
|
||||||
// Don't block on this since we want the extension to finish activating without user actions
|
// Don't block on this since we want the extension to finish activating without user actions
|
||||||
manuallyInstallOrUpgradeAzdata(localAzdata)
|
manuallyInstallOrUpgradeAzdata(context, localAzdata)
|
||||||
.catch(err => console.log(err));
|
.catch(err => console.log(err));
|
||||||
return {
|
return {
|
||||||
azdata: {
|
azdata: {
|
||||||
|
|||||||
Reference in New Issue
Block a user