Ver Fonte

More S3 code.

Thanks to xet7 !

Related #142
Lauri Ojansivu há 2 anos atrás
pai
commit
fb6f618917

+ 6 - 0
client/components/cards/attachments.jade

@@ -102,6 +102,12 @@ template(name="attachmentActionsPopup")
               i.fa.fa-arrow-right
               i.fa.fa-arrow-right
               | {{_ 'attachment-move-storage-gridfs'}}
               | {{_ 'attachment-move-storage-gridfs'}}
 
 
+        if $neq versions.original.storage "s3"
+          if versions.original.storage
+            a.js-move-storage-s3
+              i.fa.fa-arrow-right
+              | {{_ 'attachment-move-storage-s3'}}
+
 template(name="attachmentRenamePopup")
 template(name="attachmentRenamePopup")
   input.js-edit-attachment-name(type='text' autofocus value="{{getNameWithoutExtension}}" dir="auto")
   input.js-edit-attachment-name(type='text' autofocus value="{{getNameWithoutExtension}}" dir="auto")
   .edit-controls.clearfix
   .edit-controls.clearfix

+ 4 - 0
client/components/cards/attachments.js

@@ -191,6 +191,10 @@ BlazeComponent.extendComponent({
           Meteor.call('moveAttachmentToStorage', this.data()._id, "gridfs");
           Meteor.call('moveAttachmentToStorage', this.data()._id, "gridfs");
           Popup.back();
           Popup.back();
         },
         },
+        'click .js-move-storage-s3'() {
+          Meteor.call('moveAttachmentToStorage', this.data()._id, "s3");
+          Popup.back();
+        },
       }
       }
     ]
     ]
   }
   }

+ 11 - 0
client/components/settings/attachments.jade

@@ -23,6 +23,8 @@ template(name="moveAttachments")
       button.js-move-all-attachments-to-fs {{_ 'move-all-attachments-to-fs'}}
       button.js-move-all-attachments-to-fs {{_ 'move-all-attachments-to-fs'}}
     .js-move-attachment
     .js-move-attachment
       button.js-move-all-attachments-to-gridfs {{_ 'move-all-attachments-to-gridfs'}}
       button.js-move-all-attachments-to-gridfs {{_ 'move-all-attachments-to-gridfs'}}
+    .js-move-attachment
+      button.js-move-all-attachments-to-s3 {{_ 'move-all-attachments-to-s3'}}
 
 
   each board in getBoardsWithAttachments
   each board in getBoardsWithAttachments
     +moveBoardAttachments board
     +moveBoardAttachments board
@@ -43,6 +45,8 @@ template(name="moveBoardAttachments")
       button.js-move-all-attachments-of-board-to-fs {{_ 'move-all-attachments-of-board-to-fs'}}
       button.js-move-all-attachments-of-board-to-fs {{_ 'move-all-attachments-of-board-to-fs'}}
     .js-move-attachment
     .js-move-attachment
       button.js-move-all-attachments-of-board-to-gridfs {{_ 'move-all-attachments-of-board-to-gridfs'}}
       button.js-move-all-attachments-of-board-to-gridfs {{_ 'move-all-attachments-of-board-to-gridfs'}}
+    .js-move-attachment
+      button.js-move-all-attachments-of-board-to-s3 {{_ 'move-all-attachments-of-board-to-s3'}}
 
 
   .board-attachments
   .board-attachments
     table
     table
@@ -70,6 +74,7 @@ template(name="moveAttachment")
       td {{ version.versionName }}
       td {{ version.versionName }}
       td {{ fileSize version.size }}
       td {{ fileSize version.size }}
       td {{ version.meta.gridFsFileId }}
       td {{ version.meta.gridFsFileId }}
+      td {{ version.meta.s3FileId }}
       td {{ version.storageName }}
       td {{ version.storageName }}
       td
       td
         if $neq version.storageName "fs"
         if $neq version.storageName "fs"
@@ -82,3 +87,9 @@ template(name="moveAttachment")
             button.js-move-storage-gridfs
             button.js-move-storage-gridfs
               i.fa.fa-arrow-right
               i.fa.fa-arrow-right
               | {{_ 'attachment-move-storage-gridfs'}}
               | {{_ 'attachment-move-storage-gridfs'}}
+
+        if $neq version.storageName "s3"
+          if version.storageName
+            button.js-move-storage-s3
+              i.fa.fa-arrow-right
+              | {{_ 'attachment-move-storage-s3'}}

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

@@ -84,6 +84,11 @@ BlazeComponent.extendComponent({
             Meteor.call('moveAttachmentToStorage', _attachment._id, "gridfs");
             Meteor.call('moveAttachmentToStorage', _attachment._id, "gridfs");
           });
           });
         },
         },
+        'click button.js-move-all-attachments-to-s3'(event) {
+          this.attachments.forEach(_attachment => {
+            Meteor.call('moveAttachmentToStorage', _attachment._id, "s3");
+          });
+        },
       }
       }
     ]
     ]
   }
   }
@@ -103,6 +108,11 @@ BlazeComponent.extendComponent({
             Meteor.call('moveAttachmentToStorage', _attachment._id, "gridfs");
             Meteor.call('moveAttachmentToStorage', _attachment._id, "gridfs");
           });
           });
         },
         },
+        'click button.js-move-all-attachments-of-board-to-s3'(event) {
+          this.data().attachments.forEach(_attachment => {
+            Meteor.call('moveAttachmentToStorage', _attachment._id, "s3");
+          });
+        },
       }
       }
     ]
     ]
   },
   },
@@ -122,6 +132,9 @@ BlazeComponent.extendComponent({
         'click button.js-move-storage-gridfs'(event) {
         'click button.js-move-storage-gridfs'(event) {
           Meteor.call('moveAttachmentToStorage', this.data()._id, "gridfs");
           Meteor.call('moveAttachmentToStorage', this.data()._id, "gridfs");
         },
         },
+        'click button.js-move-storage-s3'(event) {
+          Meteor.call('moveAttachmentToStorage', this.data()._id, "s3");
+        },
       }
       }
     ]
     ]
   },
   },

+ 3 - 0
imports/i18n/data/en.i18n.json

@@ -1177,11 +1177,14 @@
   "attachmentActionsPopup-title": "Attachment Actions",
   "attachmentActionsPopup-title": "Attachment Actions",
   "attachment-move-storage-fs": "Move attachment to filesystem",
   "attachment-move-storage-fs": "Move attachment to filesystem",
   "attachment-move-storage-gridfs": "Move attachment to GridFS",
   "attachment-move-storage-gridfs": "Move attachment to GridFS",
+  "attachment-move-storage-s3": "Move attachment to S3",
   "attachment-move": "Move Attachment",
   "attachment-move": "Move Attachment",
   "move-all-attachments-to-fs": "Move all attachments to filesystem",
   "move-all-attachments-to-fs": "Move all attachments to filesystem",
   "move-all-attachments-to-gridfs": "Move all attachments to GridFS",
   "move-all-attachments-to-gridfs": "Move all attachments to GridFS",
+  "move-all-attachments-to-s3": "Move all attachments to S3",
   "move-all-attachments-of-board-to-fs": "Move all attachments of board to filesystem",
   "move-all-attachments-of-board-to-fs": "Move all attachments of board to filesystem",
   "move-all-attachments-of-board-to-gridfs": "Move all attachments of board to GridFS",
   "move-all-attachments-of-board-to-gridfs": "Move all attachments of board to GridFS",
+  "move-all-attachments-of-board-to-s3": "Move all attachments of board to S3",
   "path": "Path",
   "path": "Path",
   "version-name": "Version-Name",
   "version-name": "Version-Name",
   "size": "Size",
   "size": "Size",