Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
nodenogg-duplicate
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Adam Procter
nodenogg-duplicate
Commits
02cd91b2
Commit
02cd91b2
authored
4 years ago
by
Adam Procter
Browse files
Options
Downloads
Patches
Plain Diff
added textarea to capture path
parent
56782d2d
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/src/components/IpfsInfo.vue
+29
-29
29 additions, 29 deletions
app/src/components/IpfsInfo.vue
app/src/experimental/ModeToolbar.vue
+6
-0
6 additions, 0 deletions
app/src/experimental/ModeToolbar.vue
app/src/experimental/icons/Icon.vue
+6
-6
6 additions, 6 deletions
app/src/experimental/icons/Icon.vue
with
41 additions
and
35 deletions
app/src/components/IpfsInfo.vue
+
29
−
29
View file @
02cd91b2
...
...
@@ -24,8 +24,10 @@
<!--
<button
@
click=
"this.refs.selectedFile.click()"
>
Choose File
</button>
-->
<button
type=
"button"
@
click=
"saveIPFS"
>
Upload
</button>
<button
type=
"button"
@
click=
"getIPFS"
>
Get IPFS
</button>
<!--
<textarea>
https://ipfs.io/ipfs/
{{
path
}}
</textarea>
-->
<textarea
v-model=
"copytext"
></textarea>
</form>
</div>
</
template
>
...
...
@@ -36,6 +38,7 @@ const ipfs = VueIpfs.create()
var
node
var
output
var
path
=
'
ready
'
var
copytext
=
''
//const fileContents = []
// The below code should create an IPFS node to add files to
...
...
@@ -50,6 +53,7 @@ export default {
fileContents
:
this
.
fileContents
,
output
:
output
,
path
:
path
,
copytext
:
copytext
,
}
},
mounted
:
function
()
{
...
...
@@ -57,22 +61,29 @@ export default {
this
.
getIpfsNodeInfo
()
},
methods
:
{
async
getIpfsNodeInfo
()
{
try
{
// Await for ipfs node instance.
node
=
await
ipfs
//console.log(ipfs)
// Call ipfs `id` method.
// Returns the identity of the Peer.
const
{
agentVersion
,
id
}
=
await
node
.
id
()
this
.
agentVersion
=
agentVersion
this
.
id
=
id
// Set successful status text.
this
.
status
=
'
Connected to IPFS 😊
'
}
catch
(
err
)
{
// Set error status text.
this
.
status
=
`Error:
${
err
}
`
}
},
onFileSelected
(
event
)
{
this
.
selectedFile
=
event
.
target
.
files
[
0
]
// this.saveIPFS()
},
copyClipBoard
()
{
/* Get the text field */
var
copyText
=
'
https://ipfs.io/ipfs/
'
+
this
.
path
/* Copy the text inside the text field */
document
.
execCommand
(
'
copy
'
)
console
.
log
(
copyText
)
/* Alert the copied text */
// alert('Copied the text: ' + copyText)
},
async
saveIPFS
()
{
for
await
(
const
result
of
node
.
add
(
this
.
selectedFile
))
{
//console.log(result.cid.string)
...
...
@@ -87,26 +98,15 @@ export default {
for
await
(
const
newfile
of
node
.
get
(
this
.
fileContents
.
path
))
{
// console.log(newfile.path)
this
.
path
=
newfile
.
path
this
.
copyClipBoard
()
this
.
copyClipBoard
(
this
.
path
)
}
},
async
getIpfsNodeInfo
()
{
try
{
// Await for ipfs node instance.
node
=
await
ipfs
//console.log(ipfs)
// Call ipfs `id` method.
// Returns the identity of the Peer.
const
{
agentVersion
,
id
}
=
await
node
.
id
()
this
.
agentVersion
=
agentVersion
this
.
id
=
id
// Set successful status text.
this
.
status
=
'
Connected to IPFS 😊
'
}
catch
(
err
)
{
// Set error status text.
this
.
status
=
`Error:
${
err
}
`
}
copyClipBoard
(
e
)
{
this
.
copytext
=
'
https://ipfs.io/ipfs/
'
+
e
// copyText.select()
// document.execCommand('copy')
console
.
log
(
copytext
)
},
},
}
...
...
This diff is collapsed.
Click to expand it.
app/src/experimental/ModeToolbar.vue
+
6
−
0
View file @
02cd91b2
...
...
@@ -42,7 +42,13 @@ export default {
if
(
mode
==
'
addNode
'
)
{
this
.
$store
.
dispatch
(
'
addNode
'
)
}
if
(
mode
==
'
upload
'
)
{
// onFileSelected(event) {
// this.selectedFile = event.target.files[0]
// }
}
},
isActive
(
mode
)
{
return
this
.
mode
===
mode
.
name
},
...
...
This diff is collapsed.
Click to expand it.
app/src/experimental/icons/Icon.vue
+
6
−
6
View file @
02cd91b2
...
...
@@ -19,20 +19,20 @@ export default {
props
:
{
size
:
{
type
:
Number
,
default
:
40
default
:
40
,
},
theme
:
{
type
:
String
,
default
:
'
light
'
default
:
'
light
'
,
},
type
:
String
type
:
String
,
},
computed
:
{
style
()
{
return
{
width
:
`
${
this
.
size
}
px`
,
height
:
`
${
this
.
size
}
px`
height
:
`
${
this
.
size
}
px`
,
}
},
hasComponent
()
{
...
...
@@ -40,8 +40,8 @@ export default {
},
iconComponent
()
{
return
iconLibrary
[
this
.
type
]
}
}
}
,
}
,
}
</
script
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment