Skip to content

Commit 0b91c64

Browse files
VikalpRusiajandubois
authored andcommitted
add manual update button
Changes - add new button - add new event Signed-off-by: Vikalp Rusia <[email protected]>
1 parent 0216266 commit 0b91c64

File tree

4 files changed

+41
-8
lines changed

4 files changed

+41
-8
lines changed

pkg/rancher-desktop/components/UpdateStatus.vue

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,20 @@
22
<div>
33
<div class="version">
44
<version />
5-
<rd-checkbox
6-
v-if="updatePossible"
7-
v-model="updatesEnabled"
8-
class="updatesEnabled"
9-
label="Check for updates automatically"
10-
:is-locked="autoUpdateLocked"
11-
/>
5+
<div v-if="updatePossible" class="check-updates">
6+
<rd-checkbox
7+
v-model="updatesEnabled"
8+
class="updatesEnabled"
9+
label="Check for updates automatically"
10+
:is-locked="autoUpdateLocked"
11+
/>
12+
<button
13+
class="btn btn-xs role-secondary"
14+
@click="checkUpdateNow"
15+
>
16+
Check Now
17+
</button>
18+
</div>
1219
</div>
1320
<card
1421
v-if="hasUpdate"
@@ -200,6 +207,10 @@ class UpdateStatus extends UpdateStatusProps {
200207
this.$emit('apply');
201208
}
202209
210+
checkUpdateNow() {
211+
this.$emit('check-update-now');
212+
}
213+
203214
get autoUpdateLocked() {
204215
return this.isAutoUpdateLocked;
205216
}
@@ -211,7 +222,8 @@ export default UpdateStatus;
211222
<style lang="scss" scoped>
212223
.version {
213224
display: flex;
214-
justify-content: space-between
225+
justify-content: space-between;
226+
align-items: center;
215227
}
216228
.update-notification {
217229
font-weight: 900;
@@ -223,6 +235,18 @@ export default UpdateStatus;
223235
margin-left: 2em;
224236
margin-right: 1em;
225237
}
238+
239+
.check-updates {
240+
display: flex;
241+
gap: 10px;
242+
align-items: center;
243+
}
244+
245+
.btn-xs {
246+
min-height: 2.25rem;
247+
max-height: 2.25rem;
248+
line-height: 0.25rem;
249+
}
226250
</style>
227251

228252
<style lang="scss">

pkg/rancher-desktop/main/update/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ Electron.ipcMain.on('update-apply', () => {
7272
autoUpdater.quitAndInstall();
7373
});
7474

75+
Electron.ipcMain.on('update-check-now', () => {
76+
triggerUpdateCheck();
77+
});
78+
7579
function isLonghornUpdateInfo(info: UpdateInfo | LonghornUpdateInfo): info is LonghornUpdateInfo {
7680
return (info as LonghornUpdateInfo).nextUpdateTime !== undefined;
7781
}

pkg/rancher-desktop/pages/General.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
:is-auto-update-locked="autoUpdateLocked"
2121
@enabled="onUpdateEnabled"
2222
@apply="onUpdateApply"
23+
@check-update-now="onCheckUpdateNow"
2324
/>
2425
<hr>
2526
<telemetry-opt-in
@@ -100,6 +101,9 @@ export default {
100101
onUpdateState(event, state) {
101102
this.$data.updateState = state;
102103
},
104+
onCheckUpdateNow() {
105+
ipcRenderer.send('update-check-now');
106+
},
103107
updateTelemetry(value) {
104108
ipcRenderer.invoke('settings-write', { application: { telemetry: { enabled: value } } });
105109
},

pkg/rancher-desktop/typings/electron-ipc.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export interface IpcMainEvents {
3232
'update-state': () => void;
3333
// Quit and apply the update.
3434
'update-apply': () => void;
35+
'update-check-now': () => void;
3536
// #endregion
3637

3738
// #region main/containerEvents

0 commit comments

Comments
 (0)