Skip to content

Commit

Permalink
Merge pull request #24 from KPMP/KPMP-1919_DisplayValidationResults
Browse files Browse the repository at this point in the history
Kpmp 1919 display validation results
  • Loading branch information
zwright authored Jul 2, 2020
2 parents feae706 + 041ba46 commit b9157d3
Show file tree
Hide file tree
Showing 6 changed files with 287 additions and 224 deletions.
28 changes: 11 additions & 17 deletions src/components/Validation/FilenameValidationPage.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React, { Component } from 'react';
import { Container, Row, Col, Button } from 'reactstrap';
import ValidationSuccess from './ValidationSuccess';
import ValidationFailure from './ValidationFailure';
import ValidationResult from './ValidationResult';

class FilenameValidationPage extends Component {

Expand Down Expand Up @@ -35,21 +34,16 @@ class FilenameValidationPage extends Component {
if (Object.keys(this.props.validationResult).length !== 0 && this.props.validationResult.constructor === Object) {
let filesNotInGlobus = this.props.validationResult.metadataFilesNotFoundInGlobus;
let filesNotInMetadata = this.props.validationResult.globusFilesNotFoundInMetadata;
if (!filesNotInGlobus && !filesNotInMetadata) {
return (
<ValidationSuccess
result={this.props.validationResult}
clearValidationResult={this.props.clearValidationResult}
/>
);
} else {
return (
<ValidationFailure
result={this.props.validationResult}
clearValidationResult={this.props.clearValidationResult}
/>
);
}
let isSuccess = !filesNotInGlobus && !filesNotInMetadata;

return (
<ValidationResult
result={this.props.validationResult}
clearValidationResult={this.props.clearValidationResult}
isSuccess={isSuccess}
/>
);

} else {
return (
<Container>
Expand Down
112 changes: 0 additions & 112 deletions src/components/Validation/ValidationFailure.js

This file was deleted.

68 changes: 68 additions & 0 deletions src/components/Validation/ValidationResult.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import React, { Component } from 'react';
import { Container, Row, Col, Button } from 'reactstrap';
import { Link } from 'react-router-dom';
import { generateTableRows } from './validationResultHelper';

class ValidationFailure extends Component {


render() {

let rows = generateTableRows(this.props.result);
let message = 'Validation Failed!';
let imgSrc = 'img/fail-kidneys.jpg';
let altText = 'Filname mismatch';
if (this.props.isSuccess) {
message = 'Validation Success!';
imgSrc = 'img/happy-kidneys.jpg';
altText = 'Filename match';
}

return (
<Container>
<Row className='mt-3'>
<Col sm={3} >
<img
src={imgSrc}
alt={altText}
className='validationImage'
/>
</Col>
<Col sm={9}>
<h3 className='validationMessage'>{message}</h3>
</Col>
</Row>
<Row className='mt-3'>
<Col sm={12}>
<span className='heavierText'>Package Id:</span> {this.props.result.packageId}
</Col>
</Row>

<Row className='mt-3'>
<Col sm={6} className='resultHeader'>
Files Provided
</Col>
<Col sm={6} className='resultHeader'>
Files Found
</Col>
</Row>
{rows}

<Row className='mt-4'>
<Col sm={6}>
<Link to='/filenameValidation'>
<Button color="primary" onClick={this.props.clearValidationResult}>Let's do it again!</Button>
</Link>
</Col>
<Col sm={6}>
<Link to='/'>
<Button color="primary">Done for now</Button>
</Link>
</Col>
</Row>
</Container>
);
}
}

export default ValidationFailure;
95 changes: 0 additions & 95 deletions src/components/Validation/ValidationSuccess.js

This file was deleted.

Loading

0 comments on commit b9157d3

Please sign in to comment.