Skip to content
This repository was archived by the owner on Jun 23, 2023. It is now read-only.

Commit b5df3ed

Browse files
Show backup status in settings (#202)
1 parent 8dc9d55 commit b5df3ed

File tree

2 files changed

+38
-4
lines changed

2 files changed

+38
-4
lines changed

src/store/modules/system.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ const state = () => ({
1313
progress: 0, //progress of update installation
1414
description: ""
1515
},
16+
backupStatus: {
17+
status: "", //success, failed
18+
timestamp: null
19+
},
1620
showUpdateConfirmationModal: false,
1721
loading: true,
1822
rebooting: false,
@@ -67,7 +71,10 @@ const mutations = {
6771
state.availableUpdate = update;
6872
},
6973
setUpdateStatus(state, status) {
70-
state.updateStatus = status
74+
state.updateStatus = status;
75+
},
76+
setBackupStatus(state, status) {
77+
state.backupStatus = status;
7178
},
7279
setShowUpdateConfirmationModal(state, show) {
7380
state.showUpdateConfirmationModal = show;
@@ -135,6 +142,12 @@ const actions = {
135142
commit("setUpdateStatus", status);
136143
}
137144
},
145+
async getBackupStatus({ commit }) {
146+
const status = await API.get(`${process.env.VUE_APP_MANAGER_API_URL}/v1/system/backup-status`);
147+
if (status && status.timestamp) {
148+
commit("setBackupStatus", status);
149+
}
150+
},
138151
async shutdown({ commit }) {
139152

140153
// Reset any cached hasShutdown value from previous shutdown

src/views/Settings.vue

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@
169169
<b-col col cols="12" md="6" xl="4">
170170
<card-widget header="System" :loading="isCheckingForUpdate || isUpdating">
171171
<div class="pt-2">
172-
<div class="d-flex w-100 justify-content-between px-3 px-lg-4 mb-4">
172+
<div class="d-flex w-100 justify-content-between px-3 px-lg-4 mb-1">
173173
<div class="w-75">
174174
<span class="d-block">Backup</span>
175175
<small class="d-block">
@@ -187,6 +187,20 @@
187187
tooltip="Sorry, backup cannot be disabled for now"
188188
></toggle-switch>
189189
</div>
190+
<div class="px-3 px-lg-4 mb-4" v-if="backupStatus.status">
191+
<b-icon
192+
icon="x-circle-fill"
193+
variant="danger"
194+
class="mr-1"
195+
v-if="backupStatus.status === 'failed'"
196+
></b-icon>
197+
<small style="opacity: 0.4">
198+
Last backup
199+
<span v-if="backupStatus.status === 'failed'">failed</span>
200+
at {{ getReadableTime(backupStatus.timestamp) }}
201+
</small>
202+
</div>
203+
<div class="mb-4" v-else></div>
190204
</div>
191205
<div class="pt-0">
192206
<div class="d-flex w-100 justify-content-between px-3 px-lg-4 mb-4">
@@ -230,7 +244,7 @@
230244
</div>
231245
</div>
232246
<div class="px-4 pb-4">
233-
<div class="w-100 d-flex justify-content-between mb-2">
247+
<div class="w-100 d-flex justify-content-between mb-1">
234248
<span class="align-self-end">Umbrel Version</span>
235249
<span class="font-weight-normal mb-0">{{ version }}</span>
236250
</div>
@@ -274,6 +288,8 @@
274288

275289
<script>
276290
import { mapState } from "vuex";
291+
import moment from "moment";
292+
277293
import API from "@/helpers/api";
278294
279295
import CardWidget from "@/components/CardWidget";
@@ -299,7 +315,8 @@ export default {
299315
version: state => state.system.version,
300316
onionAddress: state => state.system.onionAddress,
301317
availableUpdate: state => state.system.availableUpdate,
302-
updateStatus: state => state.system.updateStatus
318+
updateStatus: state => state.system.updateStatus,
319+
backupStatus: state => state.system.backupStatus
303320
}),
304321
isAllowedToChangePassword() {
305322
if (!this.currentPassword) {
@@ -320,8 +337,12 @@ export default {
320337
created() {
321338
this.$store.dispatch("system/getOnionAddress");
322339
this.$store.dispatch("system/getVersion");
340+
this.$store.dispatch("system/getBackupStatus");
323341
},
324342
methods: {
343+
getReadableTime(timestamp) {
344+
return moment(timestamp).format("MMM D, h:mm:ss a");
345+
},
325346
async changePassword() {
326347
// disable on testnet
327348
if (window.location.hostname === "testnet.getumbrel.com") {

0 commit comments

Comments
 (0)