From 64c01cb39fffed54006088cc623e3734321d6043 Mon Sep 17 00:00:00 2001 From: "Brandon Waterloo [MSFT]" <36966225+bwateratmsft@users.noreply.github.com> Date: Mon, 27 Sep 2021 13:56:39 -0400 Subject: [PATCH 1/4] Remove start page in favor of walkthrough --- package-lock.json | 13 -- package.json | 12 - package.nls.json | 2 - resources/startPage.html.template | 212 ------------------ src/commands/containers/inspectContainer.ts | 2 - src/commands/images/inspectImage.ts | 2 - src/commands/installDocker.ts | 3 - src/commands/registerCommands.ts | 4 +- src/commands/startPage/StartPage.ts | 111 --------- src/commands/startPage/openStartPage.ts | 75 ------- src/extension.ts | 3 - src/scaffolding/scaffold.ts | 2 - src/scaffolding/scaffoldCompose.ts | 2 - src/scaffolding/wizard/OpenStartPageStep.ts | 24 -- src/telemetry/registerListeners.ts | 5 +- .../commands/isHigherMinorVersion.test.ts | 50 ----- src/tree/LocalRootTreeItemBase.ts | 3 - src/tree/help/HelpsTreeItem.ts | 17 -- webpack.config.js | 1 - 19 files changed, 3 insertions(+), 540 deletions(-) delete mode 100644 resources/startPage.html.template delete mode 100644 src/commands/startPage/StartPage.ts delete mode 100644 src/commands/startPage/openStartPage.ts delete mode 100644 src/scaffolding/wizard/OpenStartPageStep.ts delete mode 100644 src/test/commands/isHigherMinorVersion.test.ts diff --git a/package-lock.json b/package-lock.json index 4c661261d8..17a8ac4183 100644 --- a/package-lock.json +++ b/package-lock.json @@ -49,7 +49,6 @@ "@types/xml2js": "^0.4.8", "@typescript-eslint/eslint-plugin": "^4.28.4", "@typescript-eslint/parser": "^4.28.4", - "@vscode/codicons": "^0.0.22", "@vscode/test-electron": "^1.6.1", "copy-webpack-plugin": "^9.0.1", "eslint": "^7.24.0", @@ -982,12 +981,6 @@ "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", "dev": true }, - "node_modules/@vscode/codicons": { - "version": "0.0.22", - "resolved": "https://registry.npmjs.org/@vscode/codicons/-/codicons-0.0.22.tgz", - "integrity": "sha512-Cl3s2vgRhoJJ5nY2qC3JXCF0uoSw4zaMi0ZJIIcyOQTeeQCXIirE522cIRlcIo8cJDspQY9PMgALGvD0afZ5Mg==", - "dev": true - }, "node_modules/@vscode/test-electron": { "version": "1.6.2", "resolved": "https://registry.npmjs.org/@vscode/test-electron/-/test-electron-1.6.2.tgz", @@ -7927,12 +7920,6 @@ "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", "dev": true }, - "@vscode/codicons": { - "version": "0.0.22", - "resolved": "https://registry.npmjs.org/@vscode/codicons/-/codicons-0.0.22.tgz", - "integrity": "sha512-Cl3s2vgRhoJJ5nY2qC3JXCF0uoSw4zaMi0ZJIIcyOQTeeQCXIirE522cIRlcIo8cJDspQY9PMgALGvD0afZ5Mg==", - "dev": true - }, "@vscode/test-electron": { "version": "1.6.2", "resolved": "https://registry.npmjs.org/@vscode/test-electron/-/test-electron-1.6.2.tgz", diff --git a/package.json b/package.json index 0c7547e8c4..5dfb083a71 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,6 @@ "onCommand:vscode-docker.debugging.initializeForDebugging", "onCommand:vscode-docker.help", "onCommand:vscode-docker.help.reportIssue", - "onCommand:vscode-docker.help.openStartPage", "onCommand:vscode-docker.images.build", "onCommand:vscode-docker.images.configureExplorer", "onCommand:vscode-docker.images.inspect", @@ -2299,11 +2298,6 @@ "type": "string", "description": "%vscode-docker.config.docker.scaffolding.templatePath%" }, - "docker.showStartPage": { - "type": "boolean", - "default": true, - "description": "%vscode-docker.config.docker.showStartPage%" - }, "docker.dockerPath": { "type": "string", "default": "docker", @@ -2744,11 +2738,6 @@ "title": "%vscode-docker.commands.help.reportIssue%", "category": "%vscode-docker.commands.category.docker%" }, - { - "command": "vscode-docker.help.openStartPage", - "title": "%vscode-docker.commands.help.openStartPage%", - "category": "%vscode-docker.commands.category.docker%" - }, { "command": "vscode-docker.contexts.use", "title": "%vscode-docker.commands.contexts.use%", @@ -2997,7 +2986,6 @@ "@types/xml2js": "^0.4.8", "@typescript-eslint/eslint-plugin": "^4.28.4", "@typescript-eslint/parser": "^4.28.4", - "@vscode/codicons": "^0.0.22", "@vscode/test-electron": "^1.6.1", "copy-webpack-plugin": "^9.0.1", "eslint": "^7.24.0", diff --git a/package.nls.json b/package.nls.json index 4d8bcef98a..e91c173aba 100644 --- a/package.nls.json +++ b/package.nls.json @@ -192,7 +192,6 @@ "vscode-docker.config.docker.dockerComposeDetached": "Set to true to include --d (detached) option when docker-compose command is invoked", "vscode-docker.config.docker.showRemoteWorkspaceWarning": "Set to true to prompt to switch from \"UI\" extension mode to \"Workspace\" extension mode if an operation is not supported in UI mode.", "vscode-docker.config.docker.scaffolding.templatePath": "The path to use for scaffolding templates.", - "vscode-docker.config.docker.showStartPage": "Show the Docker extension Start Page when a new update is released.", "vscode-docker.config.docker.dockerPath": "Absolute path to Docker client executable ('docker' command). If the path contains whitespace, it needs to be quoted appropriately.", "vscode-docker.config.docker.enableDockerComposeLanguageService": "Whether or not to enable the preview Docker Compose Language Service. Changing requires restart to take effect.", "vscode-docker.config.deprecated": "This setting has been deprecated and will be removed in a future release.", @@ -225,7 +224,6 @@ "vscode-docker.commands.debugging.initializeForDebugging": "Initialize for Docker debugging", "vscode-docker.commands.help": "Docker Help", "vscode-docker.commands.help.reportIssue": "Report Issue", - "vscode-docker.commands.help.openStartPage": "Open Start Page", "vscode-docker.commands.images.build": "Build Image...", "vscode-docker.commands.images.configureExplorer": "Configure Explorer...", "vscode-docker.commands.images.inspect": "Inspect", diff --git a/resources/startPage.html.template b/resources/startPage.html.template deleted file mode 100644 index 82ce235093..0000000000 --- a/resources/startPage.html.template +++ /dev/null @@ -1,212 +0,0 @@ - - - - - - - - - Docker - Get Started - - - - - -
-
-
- Docker logo -
-
-

Docker Extension

- by Microsoft -
-
-
-
-
- -
-
-
-

Get Started with Docker Containers

-
-
- -
-
-
-
-
- -
-
-
-

Build and Run Docker Containers

-
-
- -
-
-
-
-
- - - Use Docker Explorer - - - - - - - - - - - -
-
-
-

Use the Docker Explorer

-
-
- -
-
-
-
-
- -
-
-
-

Publish to the Cloud

-
-
- -
-
-
- {{#if showWhatsNew}} -
-
- -
-
-
-

What's New

-
-
-
    -
  • The Docker Explorer now has advanced tooltips! Hover your mouse over an item to see useful info.
  • -
  • You can now open and download the files in a running container! Expand a container node to get started.
  • -
  • Right-click on a Docker Compose file to try our new Docker: Compose Up - Select Services command!
  • -
-
-
-
- {{/if}} - - -
- - - - - diff --git a/src/commands/containers/inspectContainer.ts b/src/commands/containers/inspectContainer.ts index 8c636eea38..636117af27 100644 --- a/src/commands/containers/inspectContainer.ts +++ b/src/commands/containers/inspectContainer.ts @@ -7,7 +7,6 @@ import { IActionContext, openReadOnlyJson } from "vscode-azureextensionui"; import { ext } from "../../extensionVariables"; import { localize } from '../../localize'; import { ContainerTreeItem } from "../../tree/containers/ContainerTreeItem"; -import { openStartPageAfterExtensionUpdate } from "../startPage/openStartPage"; export async function inspectContainer(context: IActionContext, node?: ContainerTreeItem): Promise { if (!node) { @@ -19,6 +18,5 @@ export async function inspectContainer(context: IActionContext, node?: Container } const inspectInfo = await ext.dockerClient.inspectContainer(context, node.containerId); - await openStartPageAfterExtensionUpdate(); await openReadOnlyJson(node, inspectInfo); } diff --git a/src/commands/images/inspectImage.ts b/src/commands/images/inspectImage.ts index e590b3c2a2..1515a06d21 100644 --- a/src/commands/images/inspectImage.ts +++ b/src/commands/images/inspectImage.ts @@ -7,7 +7,6 @@ import { IActionContext, openReadOnlyJson } from "vscode-azureextensionui"; import { ext } from "../../extensionVariables"; import { localize } from '../../localize'; import { ImageTreeItem } from "../../tree/images/ImageTreeItem"; -import { openStartPageAfterExtensionUpdate } from "../startPage/openStartPage"; export async function inspectImage(context: IActionContext, node?: ImageTreeItem): Promise { if (!node) { @@ -19,6 +18,5 @@ export async function inspectImage(context: IActionContext, node?: ImageTreeItem } const inspectInfo = await ext.dockerClient.inspectImage(context, node.imageId); - await openStartPageAfterExtensionUpdate(); await openReadOnlyJson(node, inspectInfo); } diff --git a/src/commands/installDocker.ts b/src/commands/installDocker.ts index 94e7184d57..ee66cdb7f8 100644 --- a/src/commands/installDocker.ts +++ b/src/commands/installDocker.ts @@ -7,7 +7,6 @@ import * as vscode from 'vscode'; import { IActionContext } from 'vscode-azureextensionui'; import { isMac, isWindows } from '../utils/osUtils'; import { MacDockerInstaller, WindowsDockerInstaller } from './dockerInstaller'; -import { openStartPageAfterExtensionUpdate } from './startPage/openStartPage'; export async function installDocker(context: IActionContext): Promise { if (isWindows()) { @@ -17,6 +16,4 @@ export async function installDocker(context: IActionContext): Promise { } else { await vscode.env.openExternal(vscode.Uri.parse('https://aka.ms/download-docker-linux-vscode')); } - - void openStartPageAfterExtensionUpdate(); } diff --git a/src/commands/registerCommands.ts b/src/commands/registerCommands.ts index 5e2d910b3e..95a3b87e66 100644 --- a/src/commands/registerCommands.ts +++ b/src/commands/registerCommands.ts @@ -74,14 +74,13 @@ import { logOutOfDockerCli } from "./registries/logOutOfDockerCli"; import { pullImageFromRepository, pullRepository } from "./registries/pullImages"; import { reconnectRegistry } from "./registries/reconnectRegistry"; import { registryHelp } from "./registries/registryHelp"; -import { openStartPage } from "./startPage/openStartPage"; import { configureVolumesExplorer } from "./volumes/configureVolumesExplorer"; import { inspectVolume } from "./volumes/inspectVolume"; import { pruneVolumes } from "./volumes/pruneVolumes"; import { removeVolume } from "./volumes/removeVolume"; interface CommandReasonArgument { - commandReason: 'tree' | 'palette' | 'startPage' | 'install'; + commandReason: 'tree' | 'palette' | 'install'; } // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -204,5 +203,4 @@ export function registerCommands(): void { registerLocalCommand('vscode-docker.installDocker', installDocker); registerCommand('vscode-docker.help', help); - registerCommand('vscode-docker.help.openStartPage', openStartPage); } diff --git a/src/commands/startPage/StartPage.ts b/src/commands/startPage/StartPage.ts deleted file mode 100644 index c229abbcb1..0000000000 --- a/src/commands/startPage/StartPage.ts +++ /dev/null @@ -1,111 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See LICENSE.md in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import * as fse from 'fs-extra'; -import * as vscode from 'vscode'; -import { callWithTelemetryAndErrorHandling, IActionContext } from 'vscode-azureextensionui'; -import { ext } from '../../extensionVariables'; -import { localize } from '../../localize'; -import { cryptoUtils } from '../../utils/cryptoUtils'; -import { getHandlebarsWithHelpers } from '../../utils/getHandlebarsWithHelpers'; -import { isMac } from '../../utils/osUtils'; - -type WebviewMessage = { command: string, [key: string]: string }; - -interface StartPageContext { - cspSource: string; - nonce: string; - codiconsFontUri: string; - codiconsStyleUri: string; - dockerIconUri: string; - showStartPageChecked: 'checked' | ''; - isMac: boolean; - showWhatsNew: boolean; -} - -class StartPage { - private activePanel: vscode.WebviewPanel | undefined; - - public async createOrShow(context: IActionContext): Promise { - const resourcesRoot = vscode.Uri.joinPath(ext.context.extensionUri, 'resources'); - - if (!this.activePanel) { - const template = await this.getTemplate(resourcesRoot); - - let showWhatsNew = false; - try { - showWhatsNew = !!(await ext.experimentationService.isLiveFlightEnabled('vscode-docker.whatsNew')); - } catch { - // Best effort - } - - // createOrShow() might have been called multiple times in short timeframe - if (!this.activePanel) { - this.doCreatePanel(resourcesRoot, showWhatsNew, template); - } - } - - this.activePanel.reveal(); - } - - private doCreatePanel(resourcesRoot: vscode.Uri, showWhatsNew: boolean, template: HandlebarsTemplateDelegate) { - // If we're using the bundled version, the codicons root URI is at /dist/node_modules/@vscode/codicons/dist - // If we're not using the bundled version, the codicons root URI is /node_modules/@vscode/codicons/dist - const codiconsRoot = vscode.Uri.joinPath(ext.context.extensionUri, ...ext.ignoreBundle ? ['node_modules'] : ['dist', 'node_modules'], '@vscode', 'codicons', 'dist'); - - this.activePanel = vscode.window.createWebviewPanel( - 'vscode-docker.startPage', - localize('vscode-docker.help.startPage.title', 'Docker - Get Started'), - vscode.ViewColumn.One, - { - enableCommandUris: true, - enableScripts: true, - localResourceRoots: [resourcesRoot, codiconsRoot], - } - ); - - const listener = this.activePanel.webview.onDidReceiveMessage(async (message: WebviewMessage) => this.handleMessage(message)); - - this.activePanel.onDidDispose(() => { - this.activePanel = undefined; - listener.dispose(); - }); - - const webview = this.activePanel.webview; - - const startPageContext: StartPageContext = { - cspSource: webview.cspSource, - nonce: cryptoUtils.getRandomHexString(8), - codiconsFontUri: webview.asWebviewUri(vscode.Uri.joinPath(codiconsRoot, 'codicon.ttf')).toString(), - codiconsStyleUri: webview.asWebviewUri(vscode.Uri.joinPath(codiconsRoot, 'codicon.css')).toString(), - dockerIconUri: webview.asWebviewUri(vscode.Uri.joinPath(resourcesRoot, 'docker_blue.png')).toString(), - showStartPageChecked: vscode.workspace.getConfiguration('docker').get('showStartPage', false) ? 'checked' : '', - isMac: isMac(), - showWhatsNew: showWhatsNew, - }; - - this.activePanel.webview.html = template(startPageContext); - } - - private async handleMessage(message: WebviewMessage): Promise { - switch (message.command) { - case 'showStartPageClicked': - await callWithTelemetryAndErrorHandling('showStartPage.checkboxClicked', async (context: IActionContext) => { - context.telemetry.properties.newValue = message.showStartPage; - await vscode.workspace.getConfiguration('docker').update('showStartPage', Boolean(message.showStartPage), vscode.ConfigurationTarget.Global); - }); - break; - default: - } - } - - private async getTemplate(resourcesRoot: vscode.Uri): Promise> { - const templatePath = vscode.Uri.joinPath(resourcesRoot, 'startPage.html.template'); - const Handlebars = await getHandlebarsWithHelpers(); - return Handlebars.compile(await fse.readFile(templatePath.fsPath, 'utf-8')); - } -} - -export const startPage = new StartPage(); diff --git a/src/commands/startPage/openStartPage.ts b/src/commands/startPage/openStartPage.ts deleted file mode 100644 index 45ddf11cda..0000000000 --- a/src/commands/startPage/openStartPage.ts +++ /dev/null @@ -1,75 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See LICENSE.md in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import * as semver from 'semver'; -import * as vscode from 'vscode'; -import { IActionContext } from 'vscode-azureextensionui'; -import { extensionVersion } from '../../constants'; -import { ext } from '../../extensionVariables'; -import { startPage } from './StartPage'; - -export const lastVersionKey = 'vscode-docker.startPage.lastVersionShown'; - -export async function openStartPage(context: IActionContext): Promise { - context.errorHandling.suppressDisplay = true; - await startPage.createOrShow(context); -} - -export async function openStartPageAfterExtensionUpdate(): Promise { - if (!vscode.workspace.getConfiguration('docker').get('showStartPage', false)) { - // Don't show: disabled by settings - return; - } else if (!/^en(-us)?$/i.test(vscode.env.language)) { - // Don't show: this page is English only - return; - } else { - const lastVersionShown = ext.context.globalState.get(lastVersionKey, '0.0.1'); - if (!isHigherMinorVersion(extensionVersion.value, lastVersionShown)) { - // Don't show: already showed during this major/minor - return; - } - } - - if (await ext.experimentationService.getLiveTreatmentVariable('gettingStarted.overrideCategory.ms-azuretools.vscode-docker.dockerStart.when') === 'true') { - // Update the last version shown to short-circuit this TAS check in the future - await ext.context.globalState.update(lastVersionKey, extensionVersion.value); - - // Don't show, the experiment for the other startup walkthrough is enabled - return; - } - - // Let's show! - await ext.context.globalState.update(lastVersionKey, extensionVersion.value); - await vscode.commands.executeCommand('vscode-docker.help.openStartPage', { commandReason: 'install' }); -} - -// Exported just for unit tests -export function isHigherMinorVersion(a: string | semver.SemVer, b: string | semver.SemVer): boolean { - if (typeof (a) === 'string') { - a = semver.coerce(a); - } - - if (typeof (b) === 'string') { - b = semver.coerce(b); - } - - const diff = semver.diff(a, b); - - // If a is less than or equal to b, it's automatically not a higher minor version - if (semver.lte(a, b)) { - return false; - } - - // Otherwise compare; if different majors or minors then true, else false - switch (diff) { - case 'premajor': - case 'major': - case 'preminor': - case 'minor': - return true; - default: - return false; - } -} diff --git a/src/extension.ts b/src/extension.ts index 018d0f67b3..6f36e969b2 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -11,7 +11,6 @@ import { callWithTelemetryAndErrorHandling, createAzExtOutputChannel, createExpe import { ConfigurationParams, DidChangeConfigurationNotification, DocumentSelector, LanguageClient, LanguageClientOptions, Middleware, ServerOptions, TransportKind } from 'vscode-languageclient/node'; import * as tas from 'vscode-tas-client'; import { registerCommands } from './commands/registerCommands'; -import { lastVersionKey } from './commands/startPage/openStartPage'; import { extensionVersion } from './constants'; import { registerDebugProvider } from './debugging/DebugHelper'; import { DockerContextManager } from './docker/ContextManager'; @@ -52,8 +51,6 @@ function initializeExtensionVariables(ctx: vscode.ExtensionContext): void { export async function activateInternal(ctx: vscode.ExtensionContext, perfStats: { loadStartTime: number, loadEndTime: number | undefined }): Promise { perfStats.loadEndTime = Date.now(); - ctx.globalState.setKeysForSync([lastVersionKey]); - initializeExtensionVariables(ctx); await callWithTelemetryAndErrorHandling('docker.activate', async (activateContext: IActionContext) => { diff --git a/src/scaffolding/scaffold.ts b/src/scaffolding/scaffold.ts index 93a881cb95..7487c2b586 100644 --- a/src/scaffolding/scaffold.ts +++ b/src/scaffolding/scaffold.ts @@ -11,7 +11,6 @@ import { ChooseComposeStep } from './wizard/ChooseComposeStep'; import { ChoosePlatformStep } from './wizard/ChoosePlatformStep'; import { ChooseWorkspaceFolderStep } from './wizard/ChooseWorkspaceFolderStep'; import { OpenDockerfileStep } from './wizard/OpenDockerfileStep'; -import { OpenStartPageStep } from './wizard/OpenStartPageStep'; import { ScaffoldFileStep } from './wizard/ScaffoldFileStep'; import { ScaffoldingWizardContext } from './wizard/ScaffoldingWizardContext'; @@ -32,7 +31,6 @@ export async function scaffold(wizardContext: Partial, const executeSteps: AzureWizardExecuteStep[] = [ new ScaffoldFileStep('.dockerignore', 'ask', 100), new ScaffoldFileStep('Dockerfile', 'ask', 200), - new OpenStartPageStep(1000), new OpenDockerfileStep(), ]; diff --git a/src/scaffolding/scaffoldCompose.ts b/src/scaffolding/scaffoldCompose.ts index c53d7cfffa..a678f824b4 100644 --- a/src/scaffolding/scaffoldCompose.ts +++ b/src/scaffolding/scaffoldCompose.ts @@ -9,7 +9,6 @@ import { localize } from '../localize'; import { copyWizardContext } from './copyWizardContext'; import { ChoosePlatformStep } from './wizard/ChoosePlatformStep'; import { ChooseWorkspaceFolderStep } from './wizard/ChooseWorkspaceFolderStep'; -import { OpenStartPageStep } from './wizard/OpenStartPageStep'; import { ScaffoldFileStep } from './wizard/ScaffoldFileStep'; import { ScaffoldingWizardContext } from './wizard/ScaffoldingWizardContext'; import { VerifyDockerfileStep } from './wizard/VerifyDockerfileStep'; @@ -32,7 +31,6 @@ export async function scaffoldCompose(wizardContext: Partial[] = [ new ScaffoldFileStep('docker-compose.yml', 'ask', 300), new ScaffoldFileStep('docker-compose.debug.yml', 'ask', 400), - new OpenStartPageStep(1000) ]; const wizard = new AzureWizard(wizardContext as ScaffoldingWizardContext, { diff --git a/src/scaffolding/wizard/OpenStartPageStep.ts b/src/scaffolding/wizard/OpenStartPageStep.ts deleted file mode 100644 index 91d18dcbfb..0000000000 --- a/src/scaffolding/wizard/OpenStartPageStep.ts +++ /dev/null @@ -1,24 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See LICENSE.md in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import { AzureWizardExecuteStep } from "vscode-azureextensionui"; -import { openStartPageAfterExtensionUpdate } from "../../commands/startPage/openStartPage"; -import { ScaffoldingWizardContext } from "./ScaffoldingWizardContext"; - -export class OpenStartPageStep extends AzureWizardExecuteStep { - public constructor(public readonly priority: number) { - super(); - } - - public async execute(): Promise { - // Wait for the page to be shown. This helps ensure that, if scaffolded files are to be opened, - // they are opened last and are visible after the wizard is finished. - await openStartPageAfterExtensionUpdate(); - } - - public shouldExecute(): boolean { - return true; - } -} diff --git a/src/telemetry/registerListeners.ts b/src/telemetry/registerListeners.ts index 771629e53b..bce80b63f3 100644 --- a/src/telemetry/registerListeners.ts +++ b/src/telemetry/registerListeners.ts @@ -5,7 +5,6 @@ import * as vscode from 'vscode'; import { IActionContext, registerEvent } from 'vscode-azureextensionui'; -import { openStartPageAfterExtensionUpdate } from '../commands/startPage/openStartPage'; import { ext } from '../extensionVariables'; type docHandler = (context: IActionContext, doc: vscode.TextDocument) => void; @@ -26,11 +25,11 @@ export function registerListeners(): void { } registerEvent('dockerfileopen', vscode.workspace.onDidOpenTextDocument, handleDocEvent('dockerfile', () => { - void openStartPageAfterExtensionUpdate(); + // Do nothing })); registerEvent('composefileopen', vscode.workspace.onDidOpenTextDocument, handleDocEvent('dockercompose', () => { - void openStartPageAfterExtensionUpdate(); + // Do nothing })); } diff --git a/src/test/commands/isHigherMinorVersion.test.ts b/src/test/commands/isHigherMinorVersion.test.ts deleted file mode 100644 index bfd31b6fe2..0000000000 --- a/src/test/commands/isHigherMinorVersion.test.ts +++ /dev/null @@ -1,50 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See LICENSE.md in the project root for license information. - *--------------------------------------------------------------------------------------------*/ - -import { isHigherMinorVersion } from '../../commands/startPage/openStartPage'; -import assert = require('assert'); - -suite("(unit) isHigherMinorVersion", () => { - test("Major is higher", () => { - assert(isHigherMinorVersion('1.2.3', '0.2.3')); - assert(isHigherMinorVersion('1.2.3', '0.9.3')); - - assert(isHigherMinorVersion('2.2.3', '1.2.3-alpha')); - assert(isHigherMinorVersion('2.2.3', '1.9.3')); - }); - - test("Minor is higher", () => { - assert(isHigherMinorVersion('1.3.9', '1.2.3')); - assert(isHigherMinorVersion('0.2.2', '0.1.9')); - }); - - test("Patch is higher", () => { - assert(!isHigherMinorVersion('1.2.4', '1.2.3-alpha')); - assert(!isHigherMinorVersion('0.2.4', '0.2.3')); - }); - - test("Equal", () => { - assert(!isHigherMinorVersion('1.2.3', '1.2.3')); - assert(!isHigherMinorVersion('0.2.3', '0.2.3')); - }); - - test("Major is lower", () => { - assert(!isHigherMinorVersion('1.2.3', '2.2.3')); - assert(!isHigherMinorVersion('0.2.3', '1.2.3')); - - assert(!isHigherMinorVersion('1.9.3', '2.2.3')); - assert(!isHigherMinorVersion('0.9.3', '1.2.3')); - }); - - test("Minor is lower", () => { - assert(!isHigherMinorVersion('1.2.3', '1.3.9')); - assert(!isHigherMinorVersion('0.1.2', '0.1.9')); - }); - - test("Patch is lower", () => { - assert(!isHigherMinorVersion('1.2.3', '1.2.4')); - assert(!isHigherMinorVersion('0.1.2-alpha', '0.1.3')); - }); -}); diff --git a/src/tree/LocalRootTreeItemBase.ts b/src/tree/LocalRootTreeItemBase.ts index 81d567f96d..193ebbb658 100644 --- a/src/tree/LocalRootTreeItemBase.ts +++ b/src/tree/LocalRootTreeItemBase.ts @@ -6,7 +6,6 @@ import { ConfigurationChangeEvent, ConfigurationTarget, ThemeColor, ThemeIcon, TreeView, TreeViewVisibilityChangeEvent, window, workspace, WorkspaceConfiguration } from "vscode"; import { AzExtParentTreeItem, AzExtTreeItem, AzureWizard, GenericTreeItem, IActionContext, IParsedError, parseError, registerEvent } from "vscode-azureextensionui"; import { showDockerInstallNotification } from "../commands/dockerInstaller"; -import { openStartPageAfterExtensionUpdate } from "../commands/startPage/openStartPage"; import { configPrefix } from "../constants"; import { DockerObject } from "../docker/Common"; import { NotSupportedError } from "../docker/NotSupportedError"; @@ -102,8 +101,6 @@ export abstract class LocalRootTreeItemBase Date: Mon, 27 Sep 2021 14:05:26 -0400 Subject: [PATCH 2/4] Unconditionally show walkthrough --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index 5dfb083a71..8675a316e2 100644 --- a/package.json +++ b/package.json @@ -2827,7 +2827,6 @@ { "id": "dockerStart", "title": "%vscode-docker.walkthrough.dockerStart.title%", - "when": "never", "featuredFor": [ "Dockerfile", "docker-compose.yml", From e3d7f9f35f3ddaf8e5d265b7a9f0b0be9d9d35cb Mon Sep 17 00:00:00 2001 From: "Brandon Waterloo [MSFT]" <36966225+bwateratmsft@users.noreply.github.com> Date: Thu, 30 Sep 2021 09:55:38 -0400 Subject: [PATCH 3/4] Slight simplification --- src/telemetry/registerListeners.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/telemetry/registerListeners.ts b/src/telemetry/registerListeners.ts index bce80b63f3..b938f2ffe8 100644 --- a/src/telemetry/registerListeners.ts +++ b/src/telemetry/registerListeners.ts @@ -24,16 +24,12 @@ export function registerListeners(): void { })); } - registerEvent('dockerfileopen', vscode.workspace.onDidOpenTextDocument, handleDocEvent('dockerfile', () => { - // Do nothing - })); + registerEvent('dockerfileopen', vscode.workspace.onDidOpenTextDocument, handleDocEvent('dockerfile')); - registerEvent('composefileopen', vscode.workspace.onDidOpenTextDocument, handleDocEvent('dockercompose', () => { - // Do nothing - })); + registerEvent('composefileopen', vscode.workspace.onDidOpenTextDocument, handleDocEvent('dockercompose')); } -function handleDocEvent(languageId: string, handler: docHandler): docHandler { +function handleDocEvent(languageId: string, additionalHandler?: docHandler): docHandler { return (context: IActionContext, doc: vscode.TextDocument) => { // If it is not the document of type we expect, skip if (doc.languageId !== languageId) { @@ -41,6 +37,8 @@ function handleDocEvent(languageId: string, handler: docHandler): docHandler { return; } - handler(context, doc); + if (additionalHandler) { + additionalHandler(context, doc); + } }; } From 9d17a14effd0b8667f178c21ef048e29e2e4607a Mon Sep 17 00:00:00 2001 From: "Brandon Waterloo [MSFT]" <36966225+bwateratmsft@users.noreply.github.com> Date: Thu, 30 Sep 2021 13:23:54 -0400 Subject: [PATCH 4/4] Put back help tree item --- package.json | 10 ++++++++++ package.nls.json | 1 + src/commands/registerCommands.ts | 1 + src/tree/help/HelpsTreeItem.ts | 17 +++++++++++++++++ 4 files changed, 29 insertions(+) diff --git a/package.json b/package.json index 8675a316e2..2a2ad4f8f2 100644 --- a/package.json +++ b/package.json @@ -57,6 +57,7 @@ "onCommand:vscode-docker.debugging.initializeForDebugging", "onCommand:vscode-docker.help", "onCommand:vscode-docker.help.reportIssue", + "onCommand:vscode-docker.help.openWalkthrough", "onCommand:vscode-docker.images.build", "onCommand:vscode-docker.images.configureExplorer", "onCommand:vscode-docker.images.inspect", @@ -224,6 +225,10 @@ { "command": "vscode-docker.registries.azure.runFileAsTask", "when": "isWorkspaceTrusted" + }, + { + "command": "vscode-docker.help.openWalkthrough", + "when": "never" } ], "editor/context": [ @@ -2738,6 +2743,11 @@ "title": "%vscode-docker.commands.help.reportIssue%", "category": "%vscode-docker.commands.category.docker%" }, + { + "command": "vscode-docker.help.openWalkthrough", + "title": "%vscode-docker.commands.help.openWalkthrough%", + "category": "%vscode-docker.commands.category.docker%" + }, { "command": "vscode-docker.contexts.use", "title": "%vscode-docker.commands.contexts.use%", diff --git a/package.nls.json b/package.nls.json index e91c173aba..e3d80d7735 100644 --- a/package.nls.json +++ b/package.nls.json @@ -224,6 +224,7 @@ "vscode-docker.commands.debugging.initializeForDebugging": "Initialize for Docker debugging", "vscode-docker.commands.help": "Docker Help", "vscode-docker.commands.help.reportIssue": "Report Issue", + "vscode-docker.commands.help.openWalkthrough": "Open Docker Extension Walkthrough", "vscode-docker.commands.images.build": "Build Image...", "vscode-docker.commands.images.configureExplorer": "Configure Explorer...", "vscode-docker.commands.images.inspect": "Inspect", diff --git a/src/commands/registerCommands.ts b/src/commands/registerCommands.ts index 95a3b87e66..2a889bde26 100644 --- a/src/commands/registerCommands.ts +++ b/src/commands/registerCommands.ts @@ -203,4 +203,5 @@ export function registerCommands(): void { registerLocalCommand('vscode-docker.installDocker', installDocker); registerCommand('vscode-docker.help', help); + registerCommand('vscode-docker.help.openWalkthrough', () => commands.executeCommand('workbench.action.openWalkthrough', 'ms-azuretools.vscode-docker#dockerStart')); } diff --git a/src/tree/help/HelpsTreeItem.ts b/src/tree/help/HelpsTreeItem.ts index d9c1b46d7b..4243ae4073 100644 --- a/src/tree/help/HelpsTreeItem.ts +++ b/src/tree/help/HelpsTreeItem.ts @@ -19,6 +19,7 @@ export class HelpsTreeItem extends AzExtParentTreeItem { this.readDocumentationTreeItem, this.watchVideosTreeItem, this.getStartedTreeItem, + this.openWalkthroughTreeItem, this.reviewIssuesTreeItem, this.reportIssuesTreeItem, this.installDockerTreeItem, @@ -71,6 +72,22 @@ export class HelpsTreeItem extends AzExtParentTreeItem { return node; } + private get openWalkthroughTreeItem(): AzExtTreeItem { + const node = new GenericTreeItem( + this, + { + label: localize('views.help.openWalkthrough', 'Open Docker Extension Walkthrough'), + contextValue: 'OpenWalkthrough', + commandId: 'vscode-docker.help.openWalkthrough', + iconPath: new ThemeIcon('extensions'), + includeInTreeItemPicker: true, + } + ); + node.id = '30'; + + return node; + } + private get reviewIssuesTreeItem(): AzExtTreeItem { const node = new OpenUrlTreeItem( this,