-
Notifications
You must be signed in to change notification settings - Fork 16
Allow to wrap multiple uploads under the same directory #95
Allow to wrap multiple uploads under the same directory #95
Conversation
app/api.js
Outdated
@@ -52,72 +52,121 @@ export function initIPFSClient () { | |||
} | |||
|
|||
/** | |||
* This function will allow the user to add a file to the IPFS repo. | |||
* ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs, what does this do? Where could this be used?
app/api.js
Outdated
*/ | ||
export function addFileFromFSPath (filePath, _queryGateways = queryGateways) { | ||
export function addFileOrFilesFromFSPath (filePath, _queryGateways = queryGateways) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will simplify a lot if you could switch to always array (you can have an array of 1 element).
This will remove some conditions in the code and simplify the logic, but it will require on the implementation of the function to use arrays.
Don't mix types of variables
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/Siderus/Orion/pull/95/files#diff-45bba5770252947b22079e6d12f321dfR40
Is it returning a promise?
app/api.js
Outdated
path: '', | ||
size: res.size | ||
const promises = [] | ||
if (Array.isArray(filePath)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exactly this :D (see previous comment)
* | ||
* @returns {boolean} | ||
*/ | ||
function askWhetherToWrapAllFiles () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well done :) Having this in a method will be useful!
Manually tested it Looks good to me, I would like just to change the type used for the params of Maybe in the future typescript will help us :) |
What changed?
If the user upload one file: just open the Property Window (Details)
If the user uploads multiple files (greater than 1) ask him/she if he/she wants to wrap the files, and then show just one property window for the wrapper. Otherwise fall back on the previous behavior (show the wrappers in an alert and allow to
Open in browser
)This solves Redmine issue 96 and Github issue #87