1
0
mirror of https://github.com/oceanprotocol/commons.git synced 2023-03-15 18:03:00 +01:00

Merge pull request #17 from oceanprotocol/fix/metadata

metadata fixes
This commit is contained in:
Matthias Kretschmann 2019-02-18 15:08:03 +01:00 committed by GitHub
commit 7abb3741fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 88 additions and 71 deletions

25
library.json Normal file
View File

@ -0,0 +1,25 @@
{
"name": "commons-marketplace",
"repository": {
"type": "git",
"url": "https://github.com/oceanprotocol/commons-marketplace.git"
},
"dependencies": [
{
"name": "keeper-contracts",
"version": "~0.6.12"
},
{
"name": "brizo",
"version": "~0.2.0"
},
{
"name": "aquarius",
"version": "~0.1.8"
},
{
"name": "squid-js",
"version": "~0.3.0"
}
]
}

28
package-lock.json generated
View File

@ -1022,9 +1022,9 @@
"integrity": "sha512-p2n505t2K0zD1ZvGPhI6EsSviEVLCB7BYowhf/ONmVaWED138PaG4Z9nY6YuHU383uOoIWT+Lq3dLkFzDzstXw==" "integrity": "sha512-p2n505t2K0zD1ZvGPhI6EsSviEVLCB7BYowhf/ONmVaWED138PaG4Z9nY6YuHU383uOoIWT+Lq3dLkFzDzstXw=="
}, },
"@oceanprotocol/keeper-contracts": { "@oceanprotocol/keeper-contracts": {
"version": "0.5.3", "version": "0.6.12",
"resolved": "https://registry.npmjs.org/@oceanprotocol/keeper-contracts/-/keeper-contracts-0.5.3.tgz", "resolved": "https://registry.npmjs.org/@oceanprotocol/keeper-contracts/-/keeper-contracts-0.6.12.tgz",
"integrity": "sha512-Fm1iV76d38VxKXPWdGInH5Qt/yEsiWYAeyfxVLArAalxoI5QsvNrfgiFcDcKUxX/+OY6ptnEtbowr62gdCtt4g==" "integrity": "sha512-vWs4jVAvFHZobHB64444MuQDxsNIWttt6u93wa0/NA6xMxjjoqa5V4Fv8LXDi5TW2WH3Z+2YzHoqKARe0gQBmw=="
}, },
"@oceanprotocol/secret-store-client": { "@oceanprotocol/secret-store-client": {
"version": "0.0.14", "version": "0.0.14",
@ -1035,11 +1035,11 @@
} }
}, },
"@oceanprotocol/squid": { "@oceanprotocol/squid": {
"version": "0.2.8", "version": "0.3.0",
"resolved": "https://registry.npmjs.org/@oceanprotocol/squid/-/squid-0.2.8.tgz", "resolved": "https://registry.npmjs.org/@oceanprotocol/squid/-/squid-0.3.0.tgz",
"integrity": "sha512-AgV+V81nba+v9Q8hyG7LnF+jtzkbFkPqousx5+QeDj9yscIhTHSwkRGW6nhqSbwDn7IC8ajkGKsD/l4lLJtu6Q==", "integrity": "sha512-j0qC2VcUHNoqjdD01VYoifJlRQBAuMmDAufsZ4fQo59wN5aI+/ftwYLVlaoeIg1YWhhNx07X92Dv1PjWtWg4UA==",
"requires": { "requires": {
"@oceanprotocol/keeper-contracts": "^0.5.3", "@oceanprotocol/keeper-contracts": "^0.6.12",
"@oceanprotocol/secret-store-client": "~0.0.14", "@oceanprotocol/secret-store-client": "~0.0.14",
"@types/node-fetch": "^2.1.4", "@types/node-fetch": "^2.1.4",
"bignumber.js": "^8.0.1", "bignumber.js": "^8.0.1",
@ -1181,9 +1181,9 @@
"integrity": "sha512-CBgLNk4o3XMnqMc0rhb6lc77IwShMEglz05deDcn2lQxyXEZivfwgYJu7SMha9V5XcrP6qZuevTHV/QrN2vjKQ==" "integrity": "sha512-CBgLNk4o3XMnqMc0rhb6lc77IwShMEglz05deDcn2lQxyXEZivfwgYJu7SMha9V5XcrP6qZuevTHV/QrN2vjKQ=="
}, },
"@types/node-fetch": { "@types/node-fetch": {
"version": "2.1.4", "version": "2.1.6",
"resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.1.4.tgz", "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.1.6.tgz",
"integrity": "sha512-tR1ekaXUGpmzOcDXWU9BW73YfA2/VW1DF1FH+wlJ82BbCSnWTbdX+JkqWQXWKIGsFPnPsYadbXfNgz28g+ccWg==", "integrity": "sha512-Hv1jgh3pfpUEl2F2mqUd1AfLSk1YbUCeBJFaP36t7esAO617dErqdxWb5cdG2NfJGOofkmBW36fdx0dVewxDRg==",
"requires": { "requires": {
"@types/node": "*" "@types/node": "*"
} }
@ -6314,13 +6314,13 @@
} }
}, },
"ethereumjs-util": { "ethereumjs-util": {
"version": "6.0.0", "version": "6.1.0",
"resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-6.0.0.tgz", "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-6.1.0.tgz",
"integrity": "sha512-E3yKUyl0Fs95nvTFQZe/ZSNcofhDzUsDlA5y2uoRmf1+Ec7gpGhNCsgKkZBRh7Br5op8mJcYF/jFbmjj909+nQ==", "integrity": "sha512-URESKMFbDeJxnAxPppnk2fN6Y3BIatn9fwn76Lm8bQlt+s52TpG8dN9M66MLPuRAiAOIqL3dfwqWJf0sd0fL0Q==",
"requires": { "requires": {
"bn.js": "^4.11.0", "bn.js": "^4.11.0",
"create-hash": "^1.1.2", "create-hash": "^1.1.2",
"ethjs-util": "^0.1.6", "ethjs-util": "0.1.6",
"keccak": "^1.0.2", "keccak": "^1.0.2",
"rlp": "^2.0.0", "rlp": "^2.0.0",
"safe-buffer": "^5.1.1", "safe-buffer": "^5.1.1",

View File

@ -16,7 +16,7 @@
}, },
"dependencies": { "dependencies": {
"@oceanprotocol/art": "^2.2.0", "@oceanprotocol/art": "^2.2.0",
"@oceanprotocol/squid": "^0.2.8", "@oceanprotocol/squid": "^0.3.0",
"@types/is-url": "^1.2.28", "@types/is-url": "^1.2.28",
"@types/react-helmet": "^5.0.8", "@types/react-helmet": "^5.0.8",
"@types/react-transition-group": "^2.0.15", "@types/react-transition-group": "^2.0.15",

View File

@ -49,7 +49,7 @@ export default class Input extends PureComponent<InputProps, InputState> {
} }
public InputComponent = () => { public InputComponent = () => {
const { type, options, group, name, required } = this.props const { type, options, group, name, required, onChange } = this.props
const wrapClass = this.inputWrapClasses() const wrapClass = this.inputWrapClasses()
@ -63,8 +63,9 @@ export default class Input extends PureComponent<InputProps, InputState> {
required={required} required={required}
onFocus={this.toggleFocus} onFocus={this.toggleFocus}
onBlur={this.toggleFocus} onBlur={this.toggleFocus}
onChange={onChange}
> >
<option value="none">---</option> <option value="">---</option>
{options && {options &&
options.map((option: string, index: number) => ( options.map((option: string, index: number) => (
<option <option

View File

@ -6,7 +6,7 @@ export const aquariusScheme = 'http'
export const aquariusHost = 'localhost' export const aquariusHost = 'localhost'
export const aquariusPort = 5000 export const aquariusPort = 5000
export const brizoScheme = 'https' export const brizoScheme = 'http'
export const brizoHost = 'localhost' export const brizoHost = 'localhost'
export const brizoPort = 8030 export const brizoPort = 8030

View File

@ -23,37 +23,6 @@
"required": true, "required": true,
"rows": 5 "rows": 5
}, },
"type": {
"label": "Type",
"type": "select",
"options": ["Data set", "Algorithm", "Container", "Workflow", "Other"]
},
"author": {
"label": "Author",
"placeholder": "i.e. Jelly McJellyfish",
"type": "text",
"required": true
},
"license": {
"label": "License",
"type": "select",
"required": true,
"options": [
"Public Domain",
"CC BY: Attribution",
"CC BY-SA: Attribution ShareAlike",
"CC BY-ND: Attribution-NoDerivs",
"CC BY-NC: Attribution-NonCommercial",
"CC BY-NC-SA: Attribution-NonCommercial-ShareAlike",
"CC BY-NC-ND: Attribution-NonCommercial-NoDerivs"
]
},
"copyrightHolder": {
"label": "Copyright Holder",
"placeholder": "i.e. fwhfiw",
"type": "text",
"required": true
},
"categories": { "categories": {
"label": "Categories", "label": "Categories",
"type": "select", "type": "select",
@ -90,6 +59,32 @@
"Communication & Journalism", "Communication & Journalism",
"Other" "Other"
] ]
},
"copyrightHolder": {
"label": "Copyright Holder",
"placeholder": "i.e. fwhfiw",
"type": "text",
"required": true
},
"author": {
"label": "Author",
"placeholder": "i.e. Jelly McJellyfish",
"type": "text",
"required": true
},
"license": {
"label": "License",
"type": "select",
"required": true,
"options": [
"Public Domain",
"CC BY: Attribution",
"CC BY-SA: Attribution ShareAlike",
"CC BY-ND: Attribution-NoDerivs",
"CC BY-NC: Attribution-NonCommercial",
"CC BY-NC-SA: Attribution-NonCommercial-ShareAlike",
"CC BY-NC-ND: Attribution-NonCommercial-NoDerivs"
]
} }
} }
} }

View File

@ -17,14 +17,9 @@ const AssetModel = {
compression: null, compression: null,
contentType: null, contentType: null,
workExample: null, workExample: null,
contentUrls: [], files: [],
links: [ categories: [],
{ links: [],
name: null,
type: null,
url: null
}
],
inLanguage: null, inLanguage: null,
tags: [], tags: [],
price: null price: null

View File

@ -1,4 +1,4 @@
import { Ocean } from '@oceanprotocol/squid/dist/node/squid' import { Ocean } from '@oceanprotocol/squid'
import { import {
address, address,

View File

@ -32,7 +32,7 @@ export default class Details extends Component<DetailsProps, DetailsState> {
try { try {
const account = await this.context.ocean.getAccounts() const account = await this.context.ocean.getAccounts()
const service = ddo.findServiceByType('Access') const service = ddo.findServiceByType('Access')
const serviceAgreementSignatureResult: any = await this.context.ocean.signServiceAgreement( const serviceAgreementSignatureResult = await this.context.ocean.signServiceAgreement(
ddo.id, ddo.id,
service.serviceDefinitionId, service.serviceDefinitionId,
account[0] account[0]
@ -40,9 +40,10 @@ export default class Details extends Component<DetailsProps, DetailsState> {
await this.context.ocean.initializeServiceAgreement( await this.context.ocean.initializeServiceAgreement(
ddo.id, ddo.id,
service.serviceDefinitionId, service.serviceDefinitionId,
serviceAgreementSignatureResult.serviceAgreementId, serviceAgreementSignatureResult.agreementId,
serviceAgreementSignatureResult.serviceAgreementSignature, serviceAgreementSignatureResult.signature,
(files: any) => { (files: any) => {
Logger.log('downloading files', files)
files.forEach((file: any) => { files.forEach((file: any) => {
const parsedUrl: any = queryString.parseUrl(file) const parsedUrl: any = queryString.parseUrl(file)
setTimeout(() => { setTimeout(() => {

View File

@ -1,9 +1,9 @@
import React from 'react' import React from 'react'
import styles from './Item.module.scss' import styles from './Item.module.scss'
const Item = ({ item, removeItem }: { item: string; removeItem: any }) => ( const Item = ({ item, removeItem }: { item: any; removeItem: any }) => (
<li> <li>
<a href={item}>{item}</a> <a href={item.url}>{item.url}</a>
<button <button
type="button" type="button"
className={styles.remove} className={styles.remove}

View File

@ -7,7 +7,7 @@ import Item from './Item'
import styles from './index.module.scss' import styles from './index.module.scss'
interface FilesProps { interface FilesProps {
files: string[] files: any[]
placeholder: string placeholder: string
help?: string help?: string
name: string name: string
@ -31,7 +31,7 @@ export default class Files extends PureComponent<FilesProps, FilesStates> {
} }
public addItem = (value: string) => { public addItem = (value: string) => {
this.props.files.push(value) this.props.files.push({ url: value })
// this.props.resetForm() // this.props.resetForm()
this.setState({ isFormShown: !this.state.isFormShown }) this.setState({ isFormShown: !this.state.isFormShown })
} }
@ -62,7 +62,7 @@ export default class Files extends PureComponent<FilesProps, FilesStates> {
component="ul" component="ul"
className={styles.itemsList} className={styles.itemsList}
> >
{files.map((item: string, index: number) => ( {files.map((item: any, index: number) => (
<CSSTransition <CSSTransition
key={index} key={index}
timeout={400} timeout={400}

View File

@ -19,7 +19,7 @@ interface PublishState {
name?: string name?: string
dateCreated?: Date dateCreated?: Date
description?: string description?: string
files?: string[] files?: any[]
price?: number price?: number
author?: string author?: string
type?: AssetType type?: AssetType
@ -118,13 +118,13 @@ class Publish extends Component<{}, PublishState> {
name: '', name: '',
dateCreated: new Date(), dateCreated: new Date(),
description: '', description: '',
files: [''], files: [],
price: 0, price: 0,
author: '', author: '',
type: 'dataset' as AssetType, type: 'dataset' as AssetType,
license: '', license: '',
copyrightHolder: '', copyrightHolder: '',
categories: [''], categories: [],
isPublishing: false, isPublishing: false,
isPublished: false isPublished: false
}) })
@ -147,9 +147,10 @@ class Publish extends Component<{}, PublishState> {
author: this.state.author, author: this.state.author,
license: this.state.license, license: this.state.license,
copyrightHolder: this.state.copyrightHolder, copyrightHolder: this.state.copyrightHolder,
contentUrls: [this.state.files], files: this.state.files,
price: this.state.price, price: this.state.price,
type: this.state.type, type: this.state.type,
categories: [this.state.categories],
size: '', size: '',
encoding: '', encoding: '',
compression: undefined, compression: undefined,
@ -169,7 +170,6 @@ class Publish extends Component<{}, PublishState> {
newAsset, newAsset,
account[0] account[0]
) )
Logger.log('asset:', asset)
this.setState({ this.setState({
publishedDid: asset.id, publishedDid: asset.id,
isPublished: true isPublished: true