From 3a81d9d33c81a428a29bc689fae10ab8bc09ca2f Mon Sep 17 00:00:00 2001 From: Ayush Kumar Sinha Date: Sun, 21 Jul 2019 14:37:47 +0530 Subject: [PATCH] printing buildData in commitsCard.js --- client/src/components/BuildDetails.js | 47 +++++++ client/src/components/Commits.js | 174 ++++++++++++++------------ client/src/components/CommitsCard.js | 167 ++++++++++++------------ client/src/redux/api/index.js | 12 +- 4 files changed, 233 insertions(+), 167 deletions(-) create mode 100644 client/src/components/BuildDetails.js diff --git a/client/src/components/BuildDetails.js b/client/src/components/BuildDetails.js new file mode 100644 index 0000000..deef822 --- /dev/null +++ b/client/src/components/BuildDetails.js @@ -0,0 +1,47 @@ +import React from 'react'; +class BuildDetails extends React.Component { + renderBuild = build => { + return ( + +
+ + {this.props.builders[build.builderid - 1].name} + +
+
+ {build.state_string} + {build.state_string === 'build successful' ? ( + + ) : ( + + )} +
+
started_at:{build.started_at}
+
complete_at:{build.complete_at}
+
+ ); + }; + render() { + return this.props.build ? ( + + {this.props.build.length > 0 ? ( +
{this.props.build.map(this.renderBuild)}
+ ) : ( +

+ No data Exists +

+ )} +
+ ) : ( +
No data Exists
+ ); + } +} + +export default BuildDetails; diff --git a/client/src/components/Commits.js b/client/src/components/Commits.js index b0dac16..9a32520 100644 --- a/client/src/components/Commits.js +++ b/client/src/components/Commits.js @@ -5,98 +5,108 @@ import Branches from './Branches'; import './styles/Commit.css'; import CommitsCard from './CommitsCard'; import Loading from './Loading'; - class Commits extends React.Component { - componentDidMount() { - this.props.loadCommits(); - this.props.loadBuildSets(); - } - renderCommits = commit => { - return ( -
- -
- ); - }; + componentDidMount() { + this.props.loadCommits(); + this.props.loadBuildSets(); + } - render() { - return ( -
- -
Current Branch:{this.props.branch}
-

Latest Commits

- {this.props.isLoading.load ? ( - - ) : ( -
-
{this.props.commits.map(this.renderCommits)}
- {this.props.error ? ( -
- Unexpected Error occured. Kindly Reload the page -
- Err:{this.props.error} -
- ) : ( -
-