From c559678dca65e1b9f879473f1313e9c92ab3abef Mon Sep 17 00:00:00 2001 From: Axolotle Date: Fri, 25 Sep 2020 13:41:09 +0200 Subject: [PATCH] add BackupList view/route + size filter --- app/src/filters/size.js | 6 +++ app/src/router/routes.js | 12 +++++ app/src/views/backup/Backup.vue | 2 +- app/src/views/backup/BackupList.vue | 76 +++++++++++++++++++++++++++++ 4 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 app/src/filters/size.js create mode 100644 app/src/views/backup/BackupList.vue diff --git a/app/src/filters/size.js b/app/src/filters/size.js new file mode 100644 index 00000000..050f70ba --- /dev/null +++ b/app/src/filters/size.js @@ -0,0 +1,6 @@ +export function humanSize (bytes) { + const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'] + if (bytes === 0) return 'n/a' + const i = parseInt(Math.floor(Math.log(bytes) / Math.log(1024))) + return Math.round(bytes / Math.pow(1024, i), 2) + ' ' + sizes[i] +} diff --git a/app/src/router/routes.js b/app/src/router/routes.js index 855bde46..526142fd 100644 --- a/app/src/router/routes.js +++ b/app/src/router/routes.js @@ -291,6 +291,18 @@ const routes = [ { name: 'backup', trad: 'backup' } ] } + }, + { + name: 'backup-list', + path: '/backup/:id', + component: () => import(/* webpackChunkName: "views/backup" */ '@/views/backup/BackupList'), + props: true, + meta: { + breadcrumb: [ + { name: 'backup', trad: 'backup' }, + { name: 'backup-list', param: 'id' } + ] + } } ] diff --git a/app/src/views/backup/Backup.vue b/app/src/views/backup/Backup.vue index 00cd122b..0e354f96 100644 --- a/app/src/views/backup/Backup.vue +++ b/app/src/views/backup/Backup.vue @@ -3,7 +3,7 @@
diff --git a/app/src/views/backup/BackupList.vue b/app/src/views/backup/BackupList.vue new file mode 100644 index 00000000..07823f2d --- /dev/null +++ b/app/src/views/backup/BackupList.vue @@ -0,0 +1,76 @@ + + +