From 00045028c0d7ce53e807e19eb9a1efe7c6acd633 Mon Sep 17 00:00:00 2001 From: Alex Eftimie Date: Thu, 27 May 2021 06:49:18 +0200 Subject: [PATCH 1/3] Filter default branch Allow the user to view only builds from main/master. --- web/src/screens/repo/screens/builds/index.js | 23 +++++++++++++++++-- .../screens/repo/screens/builds/index.less | 4 ++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/web/src/screens/repo/screens/builds/index.js b/web/src/screens/repo/screens/builds/index.js index a6ebb867d..303493a40 100644 --- a/web/src/screens/repo/screens/builds/index.js +++ b/web/src/screens/repo/screens/builds/index.js @@ -28,6 +28,7 @@ export default class Main extends Component { super(props, context); this.fetchNextBuildPage = this.fetchNextBuildPage.bind(this); + this.selectBranch = this.selectBranch.bind(this) } componentWillMount() { @@ -40,7 +41,8 @@ export default class Main extends Component { (nextProps.builds !== undefined && this.props.builds !== nextProps.builds) || this.props.error !== nextProps.error || - this.props.loaded !== nextProps.loaded + this.props.loaded !== nextProps.loaded || + this.state.branch !== nextState.branch ); } @@ -79,8 +81,15 @@ export default class Main extends Component { ); } + selectBranch(branch) { + this.setState({ + branch: branch, + }); + } + render() { const { repo, builds, loaded, error } = this.props; + const { branch } = this.state; const list = Object.values(builds || {}); function renderBuild(build) { @@ -91,6 +100,10 @@ export default class Main extends Component { ); } + const filterBranch = (build) => { + return !branch || build.branch === branch; + } + if (error) { return
Not Found
; } @@ -109,7 +122,13 @@ export default class Main extends Component { return (
- {list.sort(compareBuild).map(renderBuild)} +
+ {!branch ? + : + + } +
+ {list.sort(compareBuild).filter(filterBranch).map(renderBuild)} {list.length < repo.last_build && ( : - - } + {!branch ? ( + + ) : ( + + )}
- {list.sort(compareBuild).filter(filterBranch).map(renderBuild)} + + {list.sort(compareBuild).filter(filterBranch).map(renderBuild)} + {list.length < repo.last_build && (