Skip to content
This repository has been archived by the owner on Jul 7, 2024. It is now read-only.
/ Orion Public archive

Allow to wrap multiple uploads under the same directory #95

Merged
merged 4 commits into from
May 5, 2018

Conversation

kernelwhisperer
Copy link
Contributor

@kernelwhisperer kernelwhisperer commented May 4, 2018

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

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.
* ```
Copy link
Member

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) {
Copy link
Member

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

app/api.js Outdated
path: '',
size: res.size
const promises = []
if (Array.isArray(filePath)) {
Copy link
Member

@koalalorenzo koalalorenzo May 5, 2018

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 () {
Copy link
Member

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!

@koalalorenzo
Copy link
Member

Manually tested it Looks good to me, I would like just to change the type used for the params of addFileOrFilesFromFSPath to be sure that is always the same type (array).

Maybe in the future typescript will help us :)

@kernelwhisperer kernelwhisperer merged commit 80f2405 into master May 5, 2018
@koalalorenzo koalalorenzo deleted the bugfix/96-open-properties-after-file-upload branch May 5, 2018 11:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants