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

Merge branch 'master' into feature/assets-styling

This commit is contained in:
Matthias Kretschmann 2019-04-01 12:41:39 +02:00 committed by GitHub
commit 1e02037a18
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 953 additions and 648 deletions

View File

@ -2,13 +2,11 @@ language: node_js
node_js: node
script:
- ./scripts/install.sh
# - ./scripts/install.sh # runs automatically with npm ci
- ./scripts/test.sh
- ./scripts/build.sh
notifications:
email: false
cache:
directories:
- node_modules
cache: npm

505
client/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -11,22 +11,22 @@
},
"dependencies": {
"@oceanprotocol/art": "^2.2.0",
"@oceanprotocol/squid": "^0.4.0",
"@oceanprotocol/squid": "^0.4.1",
"@oceanprotocol/typographies": "^0.1.0",
"classnames": "^2.2.6",
"filesize": "^4.1.2",
"is-url": "^1.2.4",
"moment": "^2.24.0",
"query-string": "^6.4.0",
"react": "^16.8.5",
"react-dom": "^16.8.5",
"query-string": "^6.4.2",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-helmet": "^5.2.0",
"react-moment": "^0.8.4",
"react-popper": "^1.3.3",
"react-router-dom": "^5.0.0",
"react-transition-group": "^2.7.0",
"react-transition-group": "^2.7.1",
"slugify": "^1.3.4",
"web3": "^1.0.0-beta.50"
"web3": "^1.0.0-beta.51"
},
"devDependencies": {
"@types/classnames": "^2.2.7",
@ -34,7 +34,7 @@
"@types/is-url": "^1.2.28",
"@types/jest": "^24.0.11",
"@types/query-string": "^6.3.0",
"@types/react": "^16.8.8",
"@types/react": "^16.8.10",
"@types/react-dom": "^16.8.3",
"@types/react-helmet": "^5.0.8",
"@types/react-router-dom": "^4.3.1",
@ -42,7 +42,7 @@
"@types/web3": "^1.0.18",
"node-sass": "^4.11.0",
"react-scripts": "^2.1.8",
"typescript": "^3.3.4000"
"typescript": "^3.4.1"
},
"repository": {
"type": "git",

View File

@ -8,14 +8,10 @@ const AssetModel = {
name: null,
description: null,
dateCreated: null,
size: null,
author: null,
type: '',
license: null,
copyrightHolder: null,
encoding: null,
compression: null,
contentType: null,
workExample: null,
files: [],
categories: [],

View File

@ -8,8 +8,19 @@ import styles from './index.module.scss'
import { serviceHost, servicePort, serviceScheme } from '../../../config'
interface File {
url: string
checksum?: string
checksumType?: string
contentLength?: string
contentType?: string
resourceId?: string
encoding?: string
compression?: string
}
interface FilesProps {
files: any[]
files: File[]
placeholder: string
help?: string
name: string
@ -20,6 +31,32 @@ interface FilesStates {
isFormShown: boolean
}
const getFileCompression = async (contentType: string) => {
// TODO: add all the possible archive & compression MIME types
if (
contentType === 'application/zip' ||
contentType === 'application/gzip' ||
contentType === 'application/x-lzma' ||
contentType === 'application/x-xz' ||
contentType === 'application/x-tar' ||
contentType === 'application/x-gtar' ||
contentType === 'application/x-bzip2' ||
contentType === 'application/x-7z-compressed' ||
contentType === 'application/x-rar-compressed' ||
contentType === 'application/x-apple-diskimage'
) {
const contentTypeSplit = contentType.split('/')
if (contentTypeSplit[1].includes('x-')) {
return contentTypeSplit[1].replace('x-', '')
}
return contentTypeSplit[1]
} else {
return 'none'
}
}
export default class Files extends PureComponent<FilesProps, FilesStates> {
public state: FilesStates = {
isFormShown: false
@ -46,8 +83,9 @@ export default class Files extends PureComponent<FilesProps, FilesStates> {
}
)
res = await response.json()
file.size = res.result.contentLength
file.type = res.result.contentType
file.contentLength = res.result.contentLength
file.contentType = res.result.contentType
file.compression = await getFileCompression(file.contentType)
file.found = res.result.found
} catch (error) {
// error

View File

@ -258,10 +258,6 @@ class Publish extends Component<{}, PublishState> {
price: this.state.price,
type: this.state.type,
categories: [this.state.categories],
size: '',
encoding: '',
compression: undefined,
contentType: '',
workExample: undefined,
inLanguage: undefined,
tags: ''

18
package-lock.json generated
View File

@ -1267,9 +1267,9 @@
},
"dependencies": {
"semver": {
"version": "5.6.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz",
"integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==",
"version": "5.7.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz",
"integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==",
"dev": true
}
}
@ -3735,9 +3735,9 @@
}
},
"parent-module": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.0.tgz",
"integrity": "sha512-8Mf5juOMmiE4FcmzYc4IaiS9L3+9paz2KOiXzkRviCP6aDmN49Hz6EMWz0lGNp9pX80GvvAuLADtyGfW/Em3TA==",
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
"integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==",
"dev": true,
"requires": {
"callsites": "^3.0.0"
@ -6498,9 +6498,9 @@
}
},
"typescript": {
"version": "3.3.4000",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.3.4000.tgz",
"integrity": "sha512-jjOcCZvpkl2+z7JFn0yBOoLQyLoIkNZAs/fYJkUG6VKy6zLPHJGfQJYFHzibB6GJaF/8QrcECtlQ5cpvRHSMEA==",
"version": "3.4.1",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.4.1.tgz",
"integrity": "sha512-3NSMb2VzDQm8oBTLH6Nj55VVtUEpe/rgkIzMir0qVoLyjDZlnMBva0U6vDiV3IH+sl/Yu6oP5QwsAQtHPmDd2Q==",
"dev": true
},
"unherit": {

View File

@ -32,7 +32,7 @@
"stylelint-config-bigchaindb": "^1.2.1",
"stylelint-config-css-modules": "^1.3.0",
"stylelint-config-standard": "^18.2.0",
"typescript": "^3.3.4000"
"typescript": "^3.4.1"
},
"repository": {
"type": "git",

980
server/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -15,7 +15,7 @@
"dependencies": {
"body-parser": "^1.18.3",
"color-js": "^1.0.5",
"compression": "^1.7.3",
"compression": "^1.7.4",
"debug": "^4.1.1",
"express": "^4.16.4",
"express-validator": "^5.3.1",
@ -28,22 +28,22 @@
"devDependencies": {
"@types/body-parser": "^1.17.0",
"@types/compression": "0.0.36",
"@types/debug": "^4.1.1",
"@types/dotenv": "^6.1.0",
"@types/debug": "^4.1.3",
"@types/dotenv": "^6.1.1",
"@types/express": "^4.16.1",
"@types/jasmine": "^3.3.9",
"@types/jest": "^24.0.5",
"@types/jasmine": "^3.3.12",
"@types/jest": "^24.0.11",
"@types/morgan": "^1.7.35",
"@types/node": "^11.9.4",
"@types/node": "^11.12.2",
"@types/request": "^2.48.1",
"chai": "^4.2.0",
"jest": "^24.1.0",
"jest": "^24.5.0",
"mocha": "^6.0.2",
"nodemon": "^1.18.10",
"supertest": "^3.4.2",
"ts-jest": "^24.0.0",
"ts-node": "^8.0.2",
"typescript": "^3.3.4000"
"supertest": "^4.0.2",
"ts-jest": "^24.0.1",
"ts-node": "^8.0.3",
"typescript": "^3.4.1"
},
"repository": {
"type": "git",