-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from KPMP/KPMP-1917_ButtonToValidateFilenames
Kpmp 1917 button to validate filenames
- Loading branch information
Showing
5 changed files
with
135 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,34 @@ | ||
import React, { Component } from 'react'; | ||
import { Container, Row, Col } from 'reactstrap'; | ||
import { Container, Row, Col, Button } from 'reactstrap'; | ||
import { Link } from 'react-router-dom'; | ||
import PackageTable from './PackageTable'; | ||
|
||
class PackageDashboardPage extends Component { | ||
|
||
componentDidMount() { | ||
this.props.getPackages(); | ||
} | ||
componentDidMount() { | ||
this.props.getPackages(); | ||
} | ||
|
||
render() { | ||
return <Container id="package-dashboard-page"> | ||
<Row> | ||
<Col sm={12}> | ||
<PackageTable | ||
packages={this.props.packages} | ||
/> | ||
</Col> | ||
</Row> | ||
</Container>; | ||
} | ||
render() { | ||
return ( | ||
<Container id='package-dashboard-page'> | ||
<Row className='mt-3'> | ||
<Col sm={12}> | ||
<Link className='float-right' to='/filenameValidation'> | ||
<Button color="primary">Validate Filenames</Button> | ||
</Link> | ||
</Col> | ||
</Row> | ||
<Row className='mt-3'> | ||
<Col sm={12}> | ||
<PackageTable | ||
packages={this.props.packages} | ||
/> | ||
</Col> | ||
</Row> | ||
</Container> | ||
); | ||
} | ||
} | ||
|
||
export default PackageDashboardPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import React, { Component } from 'react'; | ||
import { Container, Row, Col, Button } from 'reactstrap'; | ||
|
||
class FilenameValidationPage extends Component { | ||
|
||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
packageId: '', | ||
filenames: '' | ||
}; | ||
this.handleSubmit = this.handleSubmit.bind(this); | ||
} | ||
|
||
handlePackageIdChange = (event) => { | ||
this.setState({ packageId: event.target.value }); | ||
} | ||
|
||
handleFilenamesChange = (event) => { | ||
this.setState({ filenames: event.target.value }); | ||
} | ||
|
||
handleSubmit(e) { | ||
e.preventDefault(); | ||
} | ||
|
||
|
||
render() { | ||
const { packageId, filenames } = this.state; | ||
const isEnabled = packageId.length > 0 && filenames.length > 0; | ||
return ( | ||
<Container> | ||
<form onSubmit={this.handleSubmit}> | ||
<Row className='mt-3'> | ||
<Col sm={3}> | ||
<label>Package Id:</label> | ||
</Col> | ||
<Col sm={9}> | ||
<input type='text' size={40} ref={(input) => this.packageId = input} onChange={this.handlePackageIdChange}/> | ||
</Col> | ||
</Row> | ||
<Row className='mt-3'> | ||
<Col sm={3}> | ||
<label>Files in metadata spreadsheet:</label> | ||
</Col> | ||
<Col sm={9}> | ||
<textarea name='filenames' id='filenames' rows='10' cols='100' onChange={this.handleFilenamesChange} ref={(input) => this.filenames = input}/> | ||
</Col> | ||
</Row> | ||
<Row className='mt-3'> | ||
<Col sm={3} > | ||
</Col> | ||
<Col sm={9}> | ||
<Button color='primary' type="submit" disabled={!isEnabled}>Validate</Button> | ||
</Col> | ||
</Row> | ||
</form> | ||
</Container> | ||
); | ||
} | ||
|
||
} | ||
|
||
export default FilenameValidationPage; |
10 changes: 10 additions & 0 deletions
10
src/components/Validation/FilenameValidationPageContainer.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { connect } from 'react-redux'; | ||
import FilenameValidationPage from './FilenameValidationPage'; | ||
|
||
const mapStateToProps = (state, props) => ({ | ||
}); | ||
|
||
const mapDispatchToProps = (dispatch, props) => ({ | ||
}); | ||
|
||
export default connect(mapStateToProps, mapDispatchToProps)(FilenameValidationPage); |