Skip to content
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

Have a check for update button #8189

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
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
40 changes: 32 additions & 8 deletions pkg/rancher-desktop/components/UpdateStatus.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@
<div>
<div class="version">
<version />
<rd-checkbox
v-if="updatePossible"
v-model="updatesEnabled"
class="updatesEnabled"
label="Check for updates automatically"
:is-locked="autoUpdateLocked"
/>
<div v-if="updatePossible" class="check-updates">
<rd-checkbox
v-model="updatesEnabled"
class="updatesEnabled"
label="Check for updates automatically"
:is-locked="autoUpdateLocked"
/>
<button
class="btn btn-xs role-secondary"
@click="checkUpdateNow"
>
Check Now
</button>
</div>
</div>
<card
v-if="hasUpdate"
Expand Down Expand Up @@ -200,6 +207,10 @@ class UpdateStatus extends UpdateStatusProps {
this.$emit('apply');
}

checkUpdateNow() {
this.$emit('check-update-now');
}

get autoUpdateLocked() {
return this.isAutoUpdateLocked;
}
Expand All @@ -211,7 +222,8 @@ export default UpdateStatus;
<style lang="scss" scoped>
.version {
display: flex;
justify-content: space-between
justify-content: space-between;
align-items: center;
}
.update-notification {
font-weight: 900;
Expand All @@ -223,6 +235,18 @@ export default UpdateStatus;
margin-left: 2em;
margin-right: 1em;
}

.check-updates {
display: flex;
gap: 10px;
align-items: center;
}

.btn-xs {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looked too generic, but that's what all the other buttons with limited height do, so I guess that's okay‽

min-height: 2.25rem;
max-height: 2.25rem;
line-height: 0.25rem;
}
</style>

<style lang="scss">
Expand Down
4 changes: 4 additions & 0 deletions pkg/rancher-desktop/main/update/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ Electron.ipcMain.on('update-apply', () => {
autoUpdater.quitAndInstall();
});

Electron.ipcMain.on('update-check-now', () => {
triggerUpdateCheck();
});

function isLonghornUpdateInfo(info: UpdateInfo | LonghornUpdateInfo): info is LonghornUpdateInfo {
return (info as LonghornUpdateInfo).nextUpdateTime !== undefined;
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/rancher-desktop/pages/General.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
:is-auto-update-locked="autoUpdateLocked"
@enabled="onUpdateEnabled"
@apply="onUpdateApply"
@check-update-now="onCheckUpdateNow"
/>
<hr>
<telemetry-opt-in
Expand Down Expand Up @@ -100,6 +101,9 @@ export default {
onUpdateState(event, state) {
this.$data.updateState = state;
},
onCheckUpdateNow() {
ipcRenderer.send('update-check-now');
},
updateTelemetry(value) {
ipcRenderer.invoke('settings-write', { application: { telemetry: { enabled: value } } });
},
Expand Down
1 change: 1 addition & 0 deletions pkg/rancher-desktop/typings/electron-ipc.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export interface IpcMainEvents {
'update-state': () => void;
// Quit and apply the update.
'update-apply': () => void;
'update-check-now': () => void;
// #endregion

// #region main/containerEvents
Expand Down
Loading