mirror of
https://github.com/Sebclem/hassio-nextcloud-backup.git
synced 2024-11-22 17:22:58 +01:00
Update last backup when upload is finish
This commit is contained in:
parent
a962827599
commit
b32d51847e
@ -80,14 +80,17 @@ router.get('/nextcloud-settings', function(req, res, next) {
|
|||||||
router.post('/manual-backup', function(req, res, next) {
|
router.post('/manual-backup', function(req, res, next) {
|
||||||
let id = req.query.id;
|
let id = req.query.id;
|
||||||
let name = req.query.name;
|
let name = req.query.name;
|
||||||
// hassioApiTools.downloadSnapshot(id)
|
hassioApiTools.downloadSnapshot(id)
|
||||||
// .then(() => {
|
.then(() => {
|
||||||
webdav.uploadFile('8afb4728', '/Hassio Backup/Manual/' + '8afb4728' + '.tar');
|
webdav.uploadFile(id, '/Hassio Backup/Manual/' + name + '.tar');
|
||||||
res.send(200);
|
res.send(200);
|
||||||
// })
|
})
|
||||||
// .catch(() => {
|
.catch(() => {
|
||||||
// res.send(500);
|
res.send(500);
|
||||||
// })
|
})
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
const { createClient } = require("webdav");
|
const { createClient } = require("webdav");
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
|
const moment = require('moment');
|
||||||
|
|
||||||
const statusTools = require('./status');
|
const statusTools = require('./status');
|
||||||
const endpoint = "/remote.php/webdav"
|
const endpoint = "/remote.php/webdav"
|
||||||
@ -148,6 +149,8 @@ class WebdavTools {
|
|||||||
status.status = "idle";
|
status.status = "idle";
|
||||||
status.message = null;
|
status.message = null;
|
||||||
status.error_code = null;
|
status.error_code = null;
|
||||||
|
status.last_backup = moment().format("lll")
|
||||||
|
|
||||||
statusTools.setStatus(status);
|
statusTools.setStatus(status);
|
||||||
resolve();
|
resolve();
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
|
@ -112,7 +112,7 @@
|
|||||||
<div class="card-content">
|
<div class="card-content">
|
||||||
<span class="card-title white-text" style="font-weight: bold;">Last Backup</span>
|
<span class="card-title white-text" style="font-weight: bold;">Last Backup</span>
|
||||||
<div class="divider"></div>
|
<div class="divider"></div>
|
||||||
<h5 id="last_back_status"></h5>
|
<h6 class="white-text" id="last_back_status"></h6>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -333,6 +333,10 @@
|
|||||||
case "upload":
|
case "upload":
|
||||||
printStatusWithBar('Uploading Snapshot', data.progress);
|
printStatusWithBar('Uploading Snapshot', data.progress);
|
||||||
}
|
}
|
||||||
|
if (data.last_backup != null) {
|
||||||
|
if ($('#last_back_status').html() != data.last_backup)
|
||||||
|
$('#last_back_status').html(data.last_backup);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user