From d50f7569f7421d6502d6a10c9c8fd11e51c141e9 Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Mon, 21 Aug 2023 16:47:24 -0500 Subject: [PATCH] feat: show update message if one exists --- src/remote.ts | 28 ++++++++++++++++++++++------ yarn.lock | 2 +- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/remote.ts b/src/remote.ts index 13856841..0e04c5b5 100644 --- a/src/remote.ts +++ b/src/remote.ts @@ -7,6 +7,7 @@ import { getWorkspaceByOwnerAndName, startWorkspace, getDeploymentSSHConfig, + getTemplateVersion, } from "coder/site/src/api/api" import { ProvisionerJobLog, Workspace, WorkspaceAgent } from "coder/site/src/api/typesGenerated" import EventSource from "eventsource" @@ -303,12 +304,20 @@ export class Remote { if (newWorkspace.outdated) { if (!this.storage.workspace?.outdated || !hasShownOutdatedNotification) { hasShownOutdatedNotification = true - vscode.window - .showInformationMessage("A new version of your workspace is available.", "Update") - .then((action) => { - if (action === "Update") { - vscode.commands.executeCommand("coder.workspace.update", newWorkspace) + getTemplate(newWorkspace.template_id) + .then((template) => { + return getTemplateVersion(template.active_version_id) + }) + .then((version) => { + let infoMessage = `A new version of your workspace is available.` + if (version.message) { + infoMessage = `A new version of your workspace is available: ${version.message}` } + vscode.window.showInformationMessage(infoMessage, "Update").then((action) => { + if (action === "Update") { + vscode.commands.executeCommand("coder.workspace.update", newWorkspace) + } + }) }) } } @@ -507,7 +516,14 @@ export class Remote { if (this.mode === vscode.ExtensionMode.Production) { binaryPath = await this.storage.fetchBinary() } else { - binaryPath = path.join(os.tmpdir(), "coder") + try { + // In development, try to use `/tmp/coder` as the binary path. + // This is useful for debugging with a custom bin! + binaryPath = path.join(os.tmpdir(), "coder") + await fs.stat(binaryPath) + } catch (ex) { + binaryPath = await this.storage.fetchBinary() + } } if (!binaryPath) { throw new Error("Failed to fetch the Coder binary!") diff --git a/yarn.lock b/yarn.lock index 60eb3593..0c4184ee 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1444,7 +1444,7 @@ co@3.1.0: "coder@https://github.com/coder/coder#main": version "0.0.0" - resolved "https://github.com/coder/coder#140683813d794081a0c0dbab70ec7eee16c5f5c4" + resolved "https://github.com/coder/coder#07188b123a6bf925064c3972f581ac7098476839" collapse-white-space@^1.0.2: version "1.0.6" pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy