From c47251bcf92553d27ee5d37b87faf77524d319e4 Mon Sep 17 00:00:00 2001 From: Alex Eftimie Date: Fri, 19 Mar 2021 15:44:16 +0100 Subject: [PATCH 1/4] Fix lint https://wp.laszlo.cloud/laszlocph/woodpecker/103/6 --- web/src/screens/repo/screens/build/components/details.js | 1 - 1 file changed, 1 deletion(-) diff --git a/web/src/screens/repo/screens/build/components/details.js b/web/src/screens/repo/screens/build/components/details.js index 3e82f667f6..ff137d1674 100644 --- a/web/src/screens/repo/screens/build/components/details.js +++ b/web/src/screens/repo/screens/build/components/details.js @@ -16,7 +16,6 @@ export class Details extends Component {
{build.message} -
From 00045028c0d7ce53e807e19eb9a1efe7c6acd633 Mon Sep 17 00:00:00 2001 From: Alex Eftimie Date: Thu, 27 May 2021 06:49:18 +0200 Subject: [PATCH 2/4] 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 a6ebb867dd..303493a404 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 && (