Skip to content

Commit 9a80434

Browse files
authored
feat: show update message if one exists (#127)
1 parent 128e4b2 commit 9a80434

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

src/remote.ts

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
getWorkspaceByOwnerAndName,
88
startWorkspace,
99
getDeploymentSSHConfig,
10+
getTemplateVersion,
1011
} from "coder/site/src/api/api"
1112
import { ProvisionerJobLog, Workspace, WorkspaceAgent } from "coder/site/src/api/typesGenerated"
1213
import EventSource from "eventsource"
@@ -303,12 +304,20 @@ export class Remote {
303304
if (newWorkspace.outdated) {
304305
if (!this.storage.workspace?.outdated || !hasShownOutdatedNotification) {
305306
hasShownOutdatedNotification = true
306-
vscode.window
307-
.showInformationMessage("A new version of your workspace is available.", "Update")
308-
.then((action) => {
309-
if (action === "Update") {
310-
vscode.commands.executeCommand("coder.workspace.update", newWorkspace)
307+
getTemplate(newWorkspace.template_id)
308+
.then((template) => {
309+
return getTemplateVersion(template.active_version_id)
310+
})
311+
.then((version) => {
312+
let infoMessage = `A new version of your workspace is available.`
313+
if (version.message) {
314+
infoMessage = `A new version of your workspace is available: ${version.message}`
311315
}
316+
vscode.window.showInformationMessage(infoMessage, "Update").then((action) => {
317+
if (action === "Update") {
318+
vscode.commands.executeCommand("coder.workspace.update", newWorkspace)
319+
}
320+
})
312321
})
313322
}
314323
}
@@ -507,7 +516,14 @@ export class Remote {
507516
if (this.mode === vscode.ExtensionMode.Production) {
508517
binaryPath = await this.storage.fetchBinary()
509518
} else {
510-
binaryPath = path.join(os.tmpdir(), "coder")
519+
try {
520+
// In development, try to use `/tmp/coder` as the binary path.
521+
// This is useful for debugging with a custom bin!
522+
binaryPath = path.join(os.tmpdir(), "coder")
523+
await fs.stat(binaryPath)
524+
} catch (ex) {
525+
binaryPath = await this.storage.fetchBinary()
526+
}
511527
}
512528
if (!binaryPath) {
513529
throw new Error("Failed to fetch the Coder binary!")

yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1444,7 +1444,7 @@ co@3.1.0:
14441444

14451445
"coder@https://github.com/coder/coder#main":
14461446
version "0.0.0"
1447-
resolved "https://github.com/coder/coder#140683813d794081a0c0dbab70ec7eee16c5f5c4"
1447+
resolved "https://github.com/coder/coder#07188b123a6bf925064c3972f581ac7098476839"
14481448

14491449
collapse-white-space@^1.0.2:
14501450
version "1.0.6"

0 commit comments

Comments
 (0)
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