Skip to content

feat: show workspace updates in the ui #55

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 6, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Fix showing notification on first connect!
  • Loading branch information
kylecarbs committed Feb 6, 2023
commit 77844293ff10ef3b90cfc3002195c7ec1b49e168
20 changes: 12 additions & 8 deletions src/remote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,17 +268,21 @@ export class Remote {
const workspaceUpdatedStatus = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left, 999)
disposables.push(workspaceUpdatedStatus)

let hasShownOutdatedNotification = false
const refreshWorkspaceUpdatedStatus = (newWorkspace: Workspace) => {
// If the newly gotten workspace was updated, then we show a notification
// to the user that they should update.
if (!this.storage.workspace?.outdated && newWorkspace.outdated) {
vscode.window
.showInformationMessage("A new version of your workspace is available.", "Update")
.then((action) => {
if (action === "Update") {
vscode.commands.executeCommand("coder.workspace.update", newWorkspace)
}
})
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)
}
})
}
}
if (!newWorkspace.outdated) {
vscode.commands.executeCommand("setContext", "coder.workspace.updatable", false)
Expand Down