1
0
mirror of https://github.com/oceanprotocol/docs.git synced 2024-11-26 19:49:26 +01:00

Merge pull request #182 from oceanprotocol/fix-publish-page-in-react-app-tutorial

Fix the Publish page of the React App Tutorial
This commit is contained in:
Troy McConaghy 2019-03-20 12:53:01 +01:00 committed by GitHub
commit af484e2cf3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,36 +18,67 @@ To do that, we need to add the following code after `window.ethereum.enable()` l
```js ```js
const asset = { const asset = {
base: { base: {
name: 'Office Humidity', name: "10 Monkey Species Small",
description: 'Weather information of UK including temperature and humidity', dateCreated: "2012-02-01T10:55:11Z",
dateCreated: '2012-02-01T10:55:11+00:00', author: "Mario",
author: 'Met Office', license: "CC0: Public Domain",
size: '3.1bg', contentType: "jpg/txt",
license: 'Public Domain', price: 10,
copyrightHolder: 'Met Office', files: [
contentUrls: [
'https://testocnfiles.blob.core.windows.net/testfiles/testzkp.zip'
],
contentType: 'text/csv',
links: [
{ {
name: 'Dataset sample', checksum: "2bf9d229d110d1976cdf85e9f3256c7f",
type: 'sample', checksumType: "MD5",
url: contentLength: 12057507,
'http://data.ceda.ac.uk/badc/ukcp09/data/gridded-land-obs/gridded-land-obs-daily/' url: "https://s3.amazonaws.com/datacommons-seeding-us-east/10_Monkey_Species_Small/assets/training.zip"
},
{
checksum: "354d19c0733c47ef3a6cce5b633116b0",
checksumType: "MD5",
contentLength: 928,
url: "https://s3.amazonaws.com/datacommons-seeding-us-east/10_Monkey_Species_Small/assets/monkey_labels.txt"
},
{
url: "https://s3.amazonaws.com/datacommons-seeding-us-east/10_Monkey_Species_Small/assets/validation.zip"
} }
], ],
tags: 'weather, uk, 2011, temperature, humidity', checksum: "",
price: 5, categories: [
type: 'dataset' "image"
],
tags: [
"image data",
"classification",
"animals"
],
type: "dataset",
description: "EXAMPLE ONLY ",
size: "3.1gb",
copyrightHolder: "Unknown",
encoding: "UTF-8",
compression: "zip",
workExample: "image path, id, label",
links: [
{
name: "example model",
url: "https://drive.google.com/open?id=1uuz50RGiAW8YxRcWeQVgQglZpyAebgSM"
}, },
curation: { {
rating: 0, name: "example code",
numVotes: 0, type: "example code",
schema: 'Binary Voting' url: "https://github.com/slothkong/CNN_classification_10_monkey_species"
}, },
additionalInformation: { {
updateFrequency: 'yearly' url: "https://s3.amazonaws.com/datacommons-seeding-us-east/10_Monkey_Species_Small/links/discovery/n5151.jpg",
name: "n5151.jpg",
type: "discovery"
},
{
url: "https://s3.amazonaws.com/datacommons-seeding-us-east/10_Monkey_Species_Small/links/sample/sample.zip",
name: "sample.zip",
type: "sample"
}
],
inLanguage: "en"
} }
} }
``` ```
@ -60,7 +91,7 @@ Now that we have an asset to submit, we need a function to handle it. Just befor
async submitAsset() { async submitAsset() {
const accounts = await this.ocean.getAccounts() const accounts = await this.ocean.getAccounts()
const ddo = await this.ocean.registerAsset(asset, accounts[0]) const ddo = await this.ocean.registerAsset(asset, accounts[0])
alert('Asset successfully submited: ', JSON.stringify(ddo)) alert('Asset successfully submitted: ', JSON.stringify(ddo))
} }
``` ```
@ -87,36 +118,67 @@ window.ethereum.enable()
const asset = { const asset = {
base: { base: {
name: 'Office Humidity', name: "10 Monkey Species Small",
description: 'Weather information of UK including temperature and humidity', dateCreated: "2012-02-01T10:55:11Z",
dateCreated: '2012-02-01T10:55:11+00:00', author: "Mario",
author: 'Met Office', license: "CC0: Public Domain",
size: '3.1bg', contentType: "jpg/txt",
license: 'Public Domain', price: 10,
copyrightHolder: 'Met Office', files: [
contentUrls: [
'https://testocnfiles.blob.core.windows.net/testfiles/testzkp.zip'
],
contentType: 'text/csv',
links: [
{ {
name: 'Dataset sample', checksum: "2bf9d229d110d1976cdf85e9f3256c7f",
type: 'sample', checksumType: "MD5",
url: contentLength: 12057507,
'http://data.ceda.ac.uk/badc/ukcp09/data/gridded-land-obs/gridded-land-obs-daily/' url: "https://s3.amazonaws.com/datacommons-seeding-us-east/10_Monkey_Species_Small/assets/training.zip"
},
{
checksum: "354d19c0733c47ef3a6cce5b633116b0",
checksumType: "MD5",
contentLength: 928,
url: "https://s3.amazonaws.com/datacommons-seeding-us-east/10_Monkey_Species_Small/assets/monkey_labels.txt"
},
{
url: "https://s3.amazonaws.com/datacommons-seeding-us-east/10_Monkey_Species_Small/assets/validation.zip"
} }
], ],
tags: 'weather, uk, 2011, temperature, humidity', checksum: "",
price: 5, categories: [
type: 'dataset' "image"
],
tags: [
"image data",
"classification",
"animals"
],
type: "dataset",
description: "EXAMPLE ONLY ",
size: "3.1gb",
copyrightHolder: "Unknown",
encoding: "UTF-8",
compression: "zip",
workExample: "image path, id, label",
links: [
{
name: "example model",
url: "https://drive.google.com/open?id=1uuz50RGiAW8YxRcWeQVgQglZpyAebgSM"
}, },
curation: { {
rating: 0, name: "example code",
numVotes: 0, type: "example code",
schema: 'Binary Voting' url: "https://github.com/slothkong/CNN_classification_10_monkey_species"
}, },
additionalInformation: { {
updateFrequency: 'yearly' url: "https://s3.amazonaws.com/datacommons-seeding-us-east/10_Monkey_Species_Small/links/discovery/n5151.jpg",
name: "n5151.jpg",
type: "discovery"
},
{
url: "https://s3.amazonaws.com/datacommons-seeding-us-east/10_Monkey_Species_Small/links/sample/sample.zip",
name: "sample.zip",
type: "sample"
}
],
inLanguage: "en"
} }
} }
@ -139,7 +201,7 @@ class App extends Component {
async submitAsset() { async submitAsset() {
const accounts = await this.ocean.getAccounts() const accounts = await this.ocean.getAccounts()
const ddo = await this.ocean.registerAsset(asset, accounts[0]) const ddo = await this.ocean.registerAsset(asset, accounts[0])
alert('Asset successfully submited: ', JSON.stringify(ddo)) alert('Asset successfully submitted: ', JSON.stringify(ddo))
} }
render() { render() {