Browse Source

Attachment size, changed calculation to npm filesize (Attachment Move)

Martin Filser 3 years ago
parent
commit
464bc2f87b

+ 2 - 2
client/components/settings/attachments.jade

@@ -52,7 +52,7 @@ template(name="moveBoardAttachments")
         th {{_ 'name'}}
         th {{_ 'path'}}
         th {{_ 'version-name'}}
-        th {{_ 'size'}} (B)
+        th {{_ 'size'}}
         th GridFsFileId
         th {{_ 'storage'}}
         th {{_ 'action'}}
@@ -68,7 +68,7 @@ template(name="moveAttachment")
       td {{ name }}
       td {{ version.path }}
       td {{ version.versionName }}
-      td {{ version.size }}
+      td {{ fileSize version.size }}
       td {{ version.meta.gridFsFileId }}
       td {{ version.storageName }}
       td

+ 5 - 0
client/components/settings/attachments.js

@@ -1,4 +1,5 @@
 import Attachments, { fileStoreStrategyFactory } from '/models/attachments';
+const filesize = require('filesize');
 
 BlazeComponent.extendComponent({
   subscription: null,
@@ -108,6 +109,10 @@ BlazeComponent.extendComponent({
 }).register('moveBoardAttachments');
 
 BlazeComponent.extendComponent({
+  fileSize(size) {
+    const ret = filesize(size);
+    return ret;
+  },
   events() {
     return [
       {