diff --git a/static/css/directives/components/pages/repo-page/body.scss b/static/css/directives/components/pages/repo-page/body.scss index 27eaadbf9..9724ab7df 100644 --- a/static/css/directives/components/pages/repo-page/body.scss +++ b/static/css/directives/components/pages/repo-page/body.scss @@ -41,3 +41,6 @@ } } +.rp-tagSpan { + margin: 0 2px; +} diff --git a/static/js/directives/components/pages/repo-page/body.tsx b/static/js/directives/components/pages/repo-page/body.tsx index 29db9f3a3..cb4c8add2 100644 --- a/static/js/directives/components/pages/repo-page/body.tsx +++ b/static/js/directives/components/pages/repo-page/body.tsx @@ -1,19 +1,64 @@ import * as React from "react"; +import Build from "./build"; interface IBody { - description: string, - api: Object + description: string; + api: Object; + repository: Object; +} + +interface IBodyState { + currentBuild: any; } /** * The Component for the main body of the repo page * @param {string} description - The description of the repository * @param {object} api - The ApiService injected from Angular + * @param {object} repository - The list of properties for the repository */ -class body extends React.Component { +class body extends React.Component { static propTypes = { description: React.PropTypes.string.isRequired, - api: React.PropTypes.object.isRequired + api: React.PropTypes.object.isRequired, + repository: React.PropTypes.object.isRequired, + } + constructor(props){ + super(props) + this.state = { + currentBuild: [] + }; + } + componentDidMount() { + setInterval(() => this.getBuilds(), 1000); + } + getBuilds() { + let api: any = this.props.api; + let repository: any = this.props.repository; + let params: Object = { + 'repository': repository.namespace + '/' + repository.name, + 'limit': 8 + }; + + api.getRepoBuildsAsResource(params, true).get((data) => { + let builds: Array = []; + data.builds.forEach((element, i) => { + builds.push({ + user: element.manual_user, + id: element.id, + display_name: element.display_name, + started: element.started, + tags: element.tags, + phase: element.phase, + trigger: element.trigger, + trigger_metadata: element.trigger_metadata + }); + }); + + this.setState({ + currentBuild: builds + }); + }); } render () { let description: string = this.props.description; @@ -37,6 +82,9 @@ class body extends React.Component {

Repository Builds

+
+ +
diff --git a/static/js/directives/components/pages/repo-page/build.tsx b/static/js/directives/components/pages/repo-page/build.tsx new file mode 100644 index 000000000..7a21454bc --- /dev/null +++ b/static/js/directives/components/pages/repo-page/build.tsx @@ -0,0 +1,52 @@ +import * as React from 'react'; +import * as moment from "moment"; + +export default class Build extends React.Component { + render () { + let builds: any = this.props.data; + let buildsTable: any = []; + if (Object.keys(builds).length === 0) { + buildsTable.push('Loading') + } + else { + builds.forEach((element, i) => { + let tags: Array = [] + element.tags.forEach(tag => { + tags.push( + + + {tag} + + + ); + }); + let buildId: string = element.id.split('-')[0]; + buildsTable.push( + + {element.phase} + {buildId} + {element.trigger_metadata.commit_info.message} + {moment(element.started).format('l')} + {tags} + + ) + }); + } + return( + + + + + + + + + + + + {buildsTable} + +
BUILD IDTRIGGERED BYDATE STARTEDTAGS
+ ); + } +} \ No newline at end of file diff --git a/static/js/directives/components/pages/repo-page/header.tsx b/static/js/directives/components/pages/repo-page/header.tsx index 3e52b264a..a5e159540 100644 --- a/static/js/directives/components/pages/repo-page/header.tsx +++ b/static/js/directives/components/pages/repo-page/header.tsx @@ -1,8 +1,8 @@ import * as React from "react"; interface IHeader { - name: string, - namespace: string + name: string; + namespace: string; } /** diff --git a/static/js/directives/components/pages/repo-page/sidebar.tsx b/static/js/directives/components/pages/repo-page/sidebar.tsx index 48883e126..385e94868 100644 --- a/static/js/directives/components/pages/repo-page/sidebar.tsx +++ b/static/js/directives/components/pages/repo-page/sidebar.tsx @@ -9,8 +9,8 @@ interface tag { } interface ISidebar { - isPublic: string, - tags: Array, + isPublic: string; + tags: Array; repository: Object } diff --git a/static/partials/repo-view.html b/static/partials/repo-view.html index c7427a82f..e618e2b97 100644 --- a/static/partials/repo-view.html +++ b/static/partials/repo-view.html @@ -12,7 +12,7 @@
- +