Skip to content

Commit e153aa6

Browse files
committed
have a manual update button
Signed-off-by: Vikalp Rusia <[email protected]>
1 parent 4848b35 commit e153aa6

File tree

4 files changed

+37
-8
lines changed

4 files changed

+37
-8
lines changed

pkg/rancher-desktop/components/UpdateStatus.vue

Lines changed: 26 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 role-secondary"
14+
@click="manuallyCheckUpdate"
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+
manuallyCheckUpdate() {
211+
this.$emit('check-for-updates');
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,12 @@ 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+
}
226244
</style>
227245

228246
<style lang="scss">

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

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

75+
Electron.ipcMain.on('check-for-updates', () => {
76+
console.error('working');
77+
triggerUpdateCheck();
78+
});
79+
7580
function isLonghornUpdateInfo(info: UpdateInfo | LonghornUpdateInfo): info is LonghornUpdateInfo {
7681
return (info as LonghornUpdateInfo).nextUpdateTime !== undefined;
7782
}

pkg/rancher-desktop/pages/General.vue

Lines changed: 5 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-for-updates="onUpdateCheck"
2324
/>
2425
<hr>
2526
<telemetry-opt-in
@@ -100,6 +101,10 @@ export default {
100101
onUpdateState(event, state) {
101102
this.$data.updateState = state;
102103
},
104+
onUpdateCheck() {
105+
console.log('till here');
106+
ipcRenderer.send('check-for-updates');
107+
},
103108
updateTelemetry(value) {
104109
ipcRenderer.invoke('settings-write', { application: { telemetry: { enabled: value } } });
105110
},

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+
'check-for-updates': () => void;
3536
// #endregion
3637

3738
// #region main/containerEvents

0 commit comments

Comments
 (0)