-
Notifications
You must be signed in to change notification settings - Fork 864
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove Pinning and add Add By Path #655
Conversation
License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com>
License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com>
License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com>
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.
src/controls/main/pinned-files.js
Outdated
try { | ||
await ipfs().files.stat(PATH) | ||
} catch (_) { | ||
return |
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.
Return silently only if error is Error: file does not exist
.
Everything else should be logged.
src/controls/main/pinned-files.js
Outdated
const sendPinning = () => { send('pinning', pinning > 0) } | ||
const inc = () => { pinning++; sendPinning() } | ||
const dec = () => { pinning--; sendPinning() } | ||
await ipfs().files.mkdir('/pinset_from_old_ipfs') |
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.
+desktop: pinset_from_old_ipfs_desktop
src/controls/main/files.js
Outdated
const { ipfs } = opts | ||
|
||
return async (_, hash, path) => { | ||
if (!hash.startsWith('/ipfs')) { |
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.
People may try to add /ipns/
paths, and that should not be prefixed.
License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com>
License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com>
License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com>
License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com>
License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com>
@lidel I changed the icon to the pinning one just to make it more familiar for now. What do you think? |
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.
Better, but still need those titles :P
src/panes/Files.js
Outdated
|
||
const path = await prompt({ | ||
title: 'Add by IPFS Path', | ||
label: 'How do you want to tag it?', |
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.
Now that we are in Files "How do you want to name it?" is a better label.
src/panes/Files.js
Outdated
|
||
const hash = await prompt({ | ||
title: 'Add by IPFS Path', | ||
label: 'Write the IPFS path to add:', |
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.
"Enter the IPFS path to add:"
src/panes/Files.js
Outdated
@@ -144,6 +177,7 @@ class Files extends Component { | |||
<IconButton active={this.state.sticky} onClick={this.toggleStickWindow} icon='eye' /> | |||
|
|||
<div className='right'> | |||
<IconButton onClick={this.addFromIPFS} icon='pin-alt' /> |
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.
IconButton
should accept title
as one of its props, and use it like this:
<button title="Add by IPFS Path">[icon]</button>
We really need a tooltip that describes what the button does :)
License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com>
Done @lidel 😄 |
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.
Thanks! I feel this should be enough for now, we don't want to spend too much time on this.
When WebUI lands we will get back to Desktop with proper redesign :) 👍
Before merging this, check logging bug below 🙃
src/controls/main/pinned-files.js
Outdated
try { | ||
await ipfs().files.stat(PATH) | ||
} catch (e) { | ||
if (e.toString().indexOf('file does not exist') !== -1) { |
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.
I think you meant ===
here :) Avoid indexOf
, try using String.includes
instead, it is easier to read and harder to make a mistake.
In this particular case, this should be enough:
if (e.message !== 'file does not exist') {
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.
Thanks! Merging now 😄
License: MIT Signed-off-by: Henrique Dias <hacdias@gmail.com>
@hacdias would be good to make a new release with this fix. |
Closes #652