diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4eabde0..d37a5a7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,7 +2,9 @@ stages: - build - deploy -kaniko: +kaniko: + tags: + - docker stage: build image: name: gcr.io/kaniko-project/executor:debug @@ -11,7 +13,9 @@ kaniko: - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:latest --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG -kubernetes: +kubernetes: + tags: + - turniere-deploy stage: deploy only: - master diff --git a/js/api.js b/js/api.js index 6112c0d..0cee469 100644 --- a/js/api.js +++ b/js/api.js @@ -344,6 +344,7 @@ const reducerTournamentStatistics = (state = defaultStateTournamentStatistics, a storeOptionalToken(error.response); } action.parameters.errorCallback(); + return Object.assign({}, state, {loaded: true}); }); return state; case actionTypesTournamentStatistics.INT_REQUEST_TOURNAMENT_STATISTICS: @@ -361,11 +362,12 @@ const reducerTournamentStatistics = (state = defaultStateTournamentStatistics, a storeOptionalToken(error.response); } action.parameters.errorCallback(); + return Object.assign({}, state, {loaded: true}); }); - return Object.assign({}, state, action.parameters.tournamentInfo); + return Object.assign({}, state, action.parameters.tournamentInfo, {loaded: true}); case actionTypesTournamentStatistics.REQUEST_TOURNAMENT_STATISTICS_SUCCESS: action.parameters.successCallback(); - return Object.assign({}, state, action.parameters.tournamentStatistics); + return Object.assign({}, state, action.parameters.tournamentStatistics, {loaded: true}); default: return state; } }; diff --git a/js/components/LoadingPage.js b/js/components/LoadingPage.js new file mode 100644 index 0000000..9fb26f6 --- /dev/null +++ b/js/components/LoadingPage.js @@ -0,0 +1,23 @@ +import Head from 'next/head'; +import {TurniereNavigation} from './Navigation'; +import {Container} from 'reactstrap'; +import {Footer} from './Footer'; +import React from 'react'; + +export function LoadingPage(props) { + return (
+ + {props.title} + + + +
+ +
+
+ {props.text} +
+
+
); +} diff --git a/js/components/TournamentList.js b/js/components/TournamentList.js index 4a28da9..6886f17 100644 --- a/js/components/TournamentList.js +++ b/js/components/TournamentList.js @@ -1,35 +1,51 @@ import React from 'react'; import {requestTournamentList} from '../api'; +import {Spinner} from 'react-bootstrap'; export default class TournamentList extends React.Component { constructor(props) { super(props); this.state = { - tournaments: [] + tournaments: [], + loaded: false }; } componentDidMount() { requestTournamentList(this.props.type, tournaments => { this.setState({ - tournaments: tournaments + tournaments: tournaments, + loaded: true }); - }, () => {}); + }, () => { + this.setState({loaded: true}); + }); } render() { - if (this.state.tournaments.length === 0) { - return

keine - Turniere vorhanden

; - } else { - return this.state.tournaments.map(item => ( - // The code should be item.code but the api just supports it this way by now - - )); + if (!this.state.loaded) { + return ( + + lade Turnier-Liste + ); } + + if (this.state.tournaments.length === 0) { + return keine Turniere vorhanden; + } + return this.state.tournaments.map(item => ( + // The code should be item.code but the api just supports it this way by now + + )); } } +function EmptyList(props) { + return (

+ {props.children} +

); +} + function TournamentListEntry(props) { return ( diff --git a/js/redux/tournamentStatistics.js b/js/redux/tournamentStatistics.js index 4004982..0f4884c 100644 --- a/js/redux/tournamentStatistics.js +++ b/js/redux/tournamentStatistics.js @@ -16,6 +16,7 @@ export const defaultStateTournamentStatistics = { owner_username: '', isPublic: '', + loaded: false, statistics_available: false, most_dominant_team: {}, diff --git a/pages/tournament-edit.js b/pages/tournament-edit.js index d1eaeaf..aa3c1df 100644 --- a/pages/tournament-edit.js +++ b/pages/tournament-edit.js @@ -19,6 +19,7 @@ import 'bootstrap/dist/css/bootstrap.min.css'; import '../static/css/everypage.css'; import '../static/css/index.css'; +import {LoadingPage} from '../js/components/LoadingPage'; class EditTournamentPage extends React.Component { static async getInitialProps({query}) { @@ -29,26 +30,31 @@ class EditTournamentPage extends React.Component { super(props); this.state = { - validCode: false + validCode: false, + loaded: false }; } componentDidMount() { requestTournament(this.props.query.code, () => { - this.setState({validCode: true}); + this.setState({validCode: true, loaded: true}); if (this._edittournamentcontent != null) { this._edittournamentcontent.notifyOfContentUpdate(); } }, () => { - this.setState({validCode: false}); + this.setState({validCode: false, loaded: true}); }); } render() { - const {validCode} = this.state; + const {validCode, loaded} = this.state; const {tournamentname, ownerUsername, isSignedIn, username} = this.props; + if (!loaded) { + return ; + } + return (