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

form.steps fix, add todos

This commit is contained in:
Matthias Kretschmann 2019-02-28 14:24:04 -03:00
parent 3494e6195b
commit 9069947ca1
Signed by: m
GPG Key ID: 606EEEF3C479A91F

View File

@ -7,7 +7,7 @@ import { User } from '../../context/User'
import Step from './Step' import Step from './Step'
import Progress from './Progress' import Progress from './Progress'
import form from '../../data/form-publish.json' import { steps } from '../../data/form-publish.json'
type AssetType = 'dataset' | 'algorithm' | 'container' | 'workflow' | 'other' type AssetType = 'dataset' | 'algorithm' | 'container' | 'workflow' | 'other'
@ -82,7 +82,7 @@ class Publish extends Component<{}, PublishState> {
private next = () => { private next = () => {
let { currentStep } = this.state let { currentStep } = this.state
const totalSteps = form.steps.length const totalSteps = steps.length
currentStep = currentStep =
currentStep >= totalSteps - 1 ? totalSteps : currentStep + 1 currentStep >= totalSteps - 1 ? totalSteps : currentStep + 1
@ -147,7 +147,8 @@ class Publish extends Component<{}, PublishState> {
// //
// Step 1 // Step 1
// //
// TODO: also validate files with validationStatus[1].files here // TODO: also validate files with validationStatus[1].files here,
// change event for hidden file input is not working
// //
if (validationStatus[1].name) { if (validationStatus[1].name) {
this.setState(prevState => ({ this.setState(prevState => ({
@ -166,6 +167,9 @@ class Publish extends Component<{}, PublishState> {
// //
// Step 2 // Step 2
// //
// TODO: validationStatus[2].categories is not working,
// select change event is not firing
//
if (validationStatus[2].description && validationStatus[2].categories) { if (validationStatus[2].description && validationStatus[2].categories) {
this.setState(prevState => ({ this.setState(prevState => ({
validationStatus: { validationStatus: {
@ -183,6 +187,9 @@ class Publish extends Component<{}, PublishState> {
// //
// Step 3 // Step 3
// //
// TODO: validationStatus[3].license is not working,
// select change event is not firing
//
if ( if (
validationStatus[3].author && validationStatus[3].author &&
validationStatus[3].copyrightHolder && validationStatus[3].copyrightHolder &&
@ -262,13 +269,10 @@ class Publish extends Component<{}, PublishState> {
title="Publish" title="Publish"
description="Publish a new data set into the Ocean Protocol Network." description="Publish a new data set into the Ocean Protocol Network."
> >
<Progress <Progress steps={steps} currentStep={this.state.currentStep} />
steps={form.steps}
currentStep={this.state.currentStep}
/>
<Form onSubmit={this.registerAsset}> <Form onSubmit={this.registerAsset}>
{form.steps.map((step: any, index: number) => ( {steps.map((step: any, index: number) => (
<Step <Step
key={index} key={index}
index={index} index={index}
@ -281,7 +285,7 @@ class Publish extends Component<{}, PublishState> {
state={this.state} state={this.state}
next={this.next} next={this.next}
prev={this.prev} prev={this.prev}
totalSteps={form.steps.length} totalSteps={steps.length}
tryAgain={this.tryAgain} tryAgain={this.tryAgain}
toStart={this.toStart} toStart={this.toStart}
content={step.content} content={step.content}