diff --git a/commands/push-image.ts b/commands/push-image.ts index 2ad67542fc..d8c5fd28bc 100644 --- a/commands/push-image.ts +++ b/commands/push-image.ts @@ -10,7 +10,7 @@ import { ImageNode } from '../explorer/models/imageNode'; import { RootNode } from '../explorer/models/rootNode'; import { ext } from '../extensionVariables'; import { reporter } from '../telemetry/telemetry'; -import { askToSavePrefix } from './registrySettings'; +import { askToSaveRegistryPath } from './registrySettings'; import { addImageTaggingTelemetry, getOrAskForImageAndTag, IHasImageDescriptorAndLabel, tagImage } from './tag-image'; const teleCmdId: string = 'vscode-docker.image.push'; const teleAzureId: string = 'vscode-docker.image.push.azureContainerRegistry'; @@ -23,7 +23,7 @@ export async function pushImage(actionContext: IActionContext, context: ImageNod let [imageToPush, imageName] = await getOrAskForImageAndTag(actionContext, context instanceof RootNode ? undefined : context); if (imageName.includes('/')) { - await askToSavePrefix(imageName); + await askToSaveRegistryPath(imageName); } else { //let addPrefixImagePush = "addPrefixImagePush"; let askToPushPrefix: boolean = true; // ext.context.workspaceState.get(addPrefixImagePush, true); diff --git a/commands/registrySettings.ts b/commands/registrySettings.ts index 8d222b45a3..710dbe8fee 100644 --- a/commands/registrySettings.ts +++ b/commands/registrySettings.ts @@ -40,19 +40,19 @@ export async function consolidateDefaultRegistrySettings(): Promise { } } -export async function askToSavePrefix(imagePath: string, promptForSave?: boolean): Promise { +export async function askToSaveRegistryPath(imagePath: string, promptForSave?: boolean): Promise { + let askToSaveKey: string = 'docker.askToSaveRegistryPath'; + let askToSavePath: boolean = promptForSave || ext.context.globalState.get(askToSaveKey, true); const configOptions: vscode.WorkspaceConfiguration = vscode.workspace.getConfiguration('docker'); - let askToSaveRegistryPath: boolean = promptForSave || configOptions.get('askToSaveRegistryPath', true); let prefix = ""; if (imagePath.includes('/')) { prefix = imagePath.substring(0, imagePath.lastIndexOf('/')); } - if (prefix && askToSaveRegistryPath !== false) { + if (prefix && askToSavePath) { let userPrefixPreference: vscode.MessageItem = await ext.ui.showWarningMessage(`Would you like to save '${prefix}' as your default registry path?`, DialogResponses.yes, DialogResponses.no, DialogResponses.skipForNow); if (userPrefixPreference === DialogResponses.yes || userPrefixPreference === DialogResponses.no) { - askToSaveRegistryPath = false; - await configOptions.update('askToSaveRegistryPath', false, vscode.ConfigurationTarget.Workspace); + await ext.context.globalState.update(askToSaveKey, false); } if (userPrefixPreference === DialogResponses.yes) { await configOptions.update(configurationKeys.defaultRegistryPath, prefix, vscode.ConfigurationTarget.Workspace); diff --git a/package.json b/package.json index 40665ce127..5a4dfabdfe 100644 --- a/package.json +++ b/package.json @@ -284,11 +284,6 @@ "default": "", "description": "Default registry and path when tagging an image" }, - "docker.askToSaveRegistryPath": { - "type": "boolean", - "default": true, - "description": "Ask the user whether to store the path prefix in defaultRegsitryPath on first push" - }, "docker.showExplorer": { "type": "boolean", "default": true,