This commit is contained in:
Alex Eftimie
2021-05-27 07:06:55 +02:00
parent 00045028c0
commit 2139ed8973
2 changed files with 15 additions and 8 deletions

View File

@@ -9,7 +9,7 @@
"lesshint": "lesshint --config .lesshintrc src/", "lesshint": "lesshint --config .lesshintrc src/",
"test": "jest", "test": "jest",
"start": "webpack-dev-server --progress --hot --inline", "start": "webpack-dev-server --progress --hot --inline",
"format": "prettier --use-tabs --trailing-comma all --write {src/*.js,src/**/*.js,src/**/*/*.js,src/*/*/*/*.js,src/*/*/*/*/*.js,src/*/*/*/*/*/*.js,src/*/*/*/*/*/*.js,src/*/*/*/*/*/*/*.js}" "format": "prettier --trailing-comma all --write {src/*.js,src/**/*.js,src/**/*/*.js,src/*/*/*/*.js,src/*/*/*/*/*.js,src/*/*/*/*/*/*.js,src/*/*/*/*/*/*.js,src/*/*/*/*/*/*/*.js}"
}, },
"jest": { "jest": {
"moduleFileExtensions": [ "moduleFileExtensions": [

View File

@@ -28,7 +28,7 @@ export default class Main extends Component {
super(props, context); super(props, context);
this.fetchNextBuildPage = this.fetchNextBuildPage.bind(this); this.fetchNextBuildPage = this.fetchNextBuildPage.bind(this);
this.selectBranch = this.selectBranch.bind(this) this.selectBranch = this.selectBranch.bind(this);
} }
componentWillMount() { componentWillMount() {
@@ -102,7 +102,7 @@ export default class Main extends Component {
const filterBranch = (build) => { const filterBranch = (build) => {
return !branch || build.branch === branch; return !branch || build.branch === branch;
} };
if (error) { if (error) {
return <div>Not Found</div>; return <div>Not Found</div>;
@@ -123,12 +123,19 @@ export default class Main extends Component {
return ( return (
<div className={styles.root}> <div className={styles.root}>
<div className={styles.right}> <div className={styles.right}>
{!branch ? {!branch ? (
<button onClick={() => this.selectBranch(repo.default_branch)}>Show {repo.default_branch} branch only</button> : <button onClick={() => this.selectBranch(repo.default_branch)}>
<button onClick={() => this.selectBranch(undefined)}>Show all branches</button> Show {repo.default_branch} branch only
} </button>
) : (
<button onClick={() => this.selectBranch(undefined)}>
Show all branches
</button>
)}
</div> </div>
<List>{list.sort(compareBuild).filter(filterBranch).map(renderBuild)}</List> <List>
{list.sort(compareBuild).filter(filterBranch).map(renderBuild)}
</List>
{list.length < repo.last_build && ( {list.length < repo.last_build && (
<button <button
onClick={() => this.fetchNextBuildPage(list)} onClick={() => this.fetchNextBuildPage(list)}