mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2024-11-22 02:17:26 +00:00
fix control panel when no backup has been made yet
This commit is contained in:
parent
df5df18820
commit
86a5394f07
@ -38,6 +38,7 @@ def backup_status(env):
|
|||||||
backups = { }
|
backups = { }
|
||||||
basedir = os.path.join(env['STORAGE_ROOT'], 'backup/duplicity/')
|
basedir = os.path.join(env['STORAGE_ROOT'], 'backup/duplicity/')
|
||||||
encdir = os.path.join(env['STORAGE_ROOT'], 'backup/encrypted/')
|
encdir = os.path.join(env['STORAGE_ROOT'], 'backup/encrypted/')
|
||||||
|
os.makedirs(basedir, exist_ok=True) # os.listdir fails if directory does not exist
|
||||||
for fn in os.listdir(basedir):
|
for fn in os.listdir(basedir):
|
||||||
m = re.match(r"duplicity-(full|full-signatures|(inc|new-signatures)\.(?P<incbase>\d+T\d+Z)\.to)\.(?P<date>\d+T\d+Z)\.", fn)
|
m = re.match(r"duplicity-(full|full-signatures|(inc|new-signatures)\.(?P<incbase>\d+T\d+Z)\.to)\.(?P<date>\d+T\d+Z)\.", fn)
|
||||||
if not m: raise ValueError(fn)
|
if not m: raise ValueError(fn)
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<p><small>The size column in the table indicates the size of the encrpyted backup, but the total size on disk shown above includes storage for unencrpyted intermediate files.</small></p>
|
<p style="margin-top: 2em"><small>The size column in the table indicates the size of the encrpyted backup, but the total size on disk shown above includes storage for unencrpyted intermediate files.</small></p>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function nice_size(bytes) {
|
function nice_size(bytes) {
|
||||||
@ -59,6 +59,12 @@ function show_system_backup() {
|
|||||||
|
|
||||||
$('#backup-status tbody').html("");
|
$('#backup-status tbody').html("");
|
||||||
var total_disk_size = 0;
|
var total_disk_size = 0;
|
||||||
|
|
||||||
|
if (r.backups.length == 0) {
|
||||||
|
var tr = $('<tr><td colspan="3">No backups have been made yet.</td></tr>');
|
||||||
|
$('#backup-status tbody').append(tr);
|
||||||
|
}
|
||||||
|
|
||||||
for (var i = 0; i < r.backups.length; i++) {
|
for (var i = 0; i < r.backups.length; i++) {
|
||||||
var b = r.backups[i];
|
var b = r.backups[i];
|
||||||
var tr = $('<tr/>');
|
var tr = $('<tr/>');
|
||||||
|
Loading…
Reference in New Issue
Block a user