Skip to content
This repository has been archived by the owner on Jan 6, 2022. It is now read-only.

add/download screen #516

Merged
merged 41 commits into from
Oct 12, 2018
Merged

add/download screen #516

merged 41 commits into from
Oct 12, 2018

Conversation

aks-
Copy link
Collaborator

@aks- aks- commented Feb 13, 2018

No description provided.

Copy link
Collaborator

@martinheidegger martinheidegger left a comment

Choose a reason for hiding this comment

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

Looks good @aks- , tested it out and everything works. The code is okay as well, except for the copy & paste job with the sparse data which is too much common code. Please extract that into a separate logic.

for (const con of dat.network.connections) {
con.removeAllListeners()
}
dat.stats.removeAllListeners()
Copy link
Collaborator

Choose a reason for hiding this comment

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

While it seems necessary that we do this, I kinda thought that dat.close() should do that 🤔


dispatch(updateState(dat))

if (!paused) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Paused is always false!

Copy link
Collaborator

Choose a reason for hiding this comment

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

+1

dispatch({ type: 'DAT_METADATA', key, metadata })
})

const walk = () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems (unnecessarily) copy & pasted from addDat. Please extract into common code.

Copy link
Collaborator

Choose a reason for hiding this comment

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

+1

dispatch({ type: 'DAT_METADATA', key, metadata })
})

const walk = () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

+1


dispatch(updateState(dat))

if (!paused) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

+1

<div className='flex ml2'>
<GreenButton
onClick={() => {
addDat({ key: dat.key, path: dat.path, paused: false })
Copy link
Collaborator

Choose a reason for hiding this comment

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

we should default paused to false

@juliangruber
Copy link
Collaborator

this still needs some work, I understand it's not an easy case

@aks-
Copy link
Collaborator Author

aks- commented Feb 22, 2018

@juliangruber oh, you'd done it, i was just getting to it 🙌

@@ -134,8 +128,6 @@ export const downloadSparseDat = ({ key }) => dispatch => {
dispatch(updateState(dat))
joinNetwork(dat)(dispatch)
updateConnections(dat)(dispatch)

dats[key] = { dat, path, opts }
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@juliangruber how do you remove this dat and close it when you click cancel download if you don't keep reference to it somewhere?

Copy link
Collaborator

Choose a reason for hiding this comment

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

you're right, I misread the code

Copy link
Collaborator

Choose a reason for hiding this comment

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

will fix!

@juliangruber
Copy link
Collaborator

ok, sorry about that, unbroke it now

@@ -33,6 +33,106 @@ export const createDat = () => dispatch => {
addDat({ path })(dispatch)
}

export const showDownloadScreen = key => ({
Copy link
Collaborator

Choose a reason for hiding this comment

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

what do you think about merging this action with downloadSparseDat?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@juliangruber you mean merge the logic of showDownloadScreen into downloadSparseDat? I kept it separate because they do two different things? one opens up the screen and second one initiates the download of dat info.

@martinheidegger martinheidegger force-pushed the add/download branch 2 times, most recently from 3a44f4a to af328a1 Compare April 16, 2018 05:52
@aks-
Copy link
Collaborator Author

aks- commented Apr 17, 2018

@martinheidegger i checked it out... you mentioned there issues mentioned below

  1. The preview will download data into a folder - so its not actually a preview.
  2. The Download folder is static (it needs to be dynamic for another PR
  3. Dats can never be downloaded twice because "dat" is our unique, why would we download dats more than once? Versions!
  1. it does not download data into the folder, it only downloads metadata to show on download screen.
  2. i'm not quite sure if i fully understand this one.
  3. i agree, but we don't have a way to tell users as of now that they are trying to download an existing dat even in our master. this pr behaves similar to what is there on master. (cc: @Kriesse)

@okdistribute
Copy link
Collaborator

@aks- on point 3, I guess you could iterate through existing dats and see if one still exists with that id.

@aks-
Copy link
Collaborator Author

aks- commented Apr 17, 2018

@Karissa right, but what action do we take once we find out that one we are trying to download already exist. don't we have to notify user of that?

@aks-
Copy link
Collaborator Author

aks- commented Apr 19, 2018

@martinheidegger can you please take a look at this one again? i think we can merge it

@martinheidegger
Copy link
Collaborator

@aks- My review is contained in #529 and #530 respectively.

@martinheidegger
Copy link
Collaborator

Now this PR contains problems if the same dat is downloaded twice. I think that is the last issue before we should merge it to react?!

@aks-
Copy link
Collaborator Author

aks- commented Apr 21, 2018

@martinheidegger that sounds right, tomorrow i'm travelling, i can work on it day after tomorrow 👍

@martinheidegger martinheidegger dismissed stale reviews from juliangruber and themself April 23, 2018 01:58

That review is based on a old version.

@martinheidegger martinheidegger force-pushed the add/download branch 4 times, most recently from 2f81ef0 to 38a5b8e Compare June 13, 2018 13:39
@martinheidegger martinheidegger changed the title [wip] add/download screen add/download screen Jun 29, 2018
@martinheidegger
Copy link
Collaborator

So: I gave this another shot. @soyuka It would be nice if you could review this once more. I would love to do a rebase after merging #541 :)

…load

# Conflicts:
#	app/actions/index.js
#	app/components/table-row.js
#	app/reducers/index.js
@martinheidegger
Copy link
Collaborator

@soyuka Thank you for reviewing #541, I merged it in this branch. Can you give this branch another look?

@martinheidegger
Copy link
Collaborator

@AtuyL thank you for the fixes, would you mind to review this PR officially ;)

soyuka
soyuka previously approved these changes Oct 9, 2018
Copy link
Collaborator

@soyuka soyuka left a comment

Choose a reason for hiding this comment

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

Code looks good to me.

tests/utils/waitForMatch.js Show resolved Hide resolved
tests/utils/waitForMatch.js Show resolved Hide resolved
app/components/button.js Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
@AtuyL AtuyL merged commit 7f40bc6 into react Oct 12, 2018
@dkastl dkastl deleted the add/download branch October 13, 2018 01:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants