147 lines
2.7 KiB
Vue
147 lines
2.7 KiB
Vue
<template>
|
|
<div class="app offline" v-if="!online">
|
|
<div class="offline-message">
|
|
<h1>You are offline.</h1>
|
|
<p>Please check your network connection and try again.</p>
|
|
</div>
|
|
</div>
|
|
<template v-else-if="ready">
|
|
<slot/>
|
|
</template>
|
|
<section v-else-if="error !== ''">
|
|
<no-auth-wrapper>
|
|
<card>
|
|
<p v-if="error === errorNoApiUrl">
|
|
{{ $t('ready.noApiUrlConfigured') }}
|
|
</p>
|
|
<div class="notification is-danger" v-else>
|
|
<p>
|
|
{{ $t('ready.errorOccured') }}<br/>
|
|
{{ error }}
|
|
</p>
|
|
<p>
|
|
{{ $t('ready.checkApiUrl') }}
|
|
</p>
|
|
</div>
|
|
<api-config :configure-open="true" @found-api="load"/>
|
|
</card>
|
|
</no-auth-wrapper>
|
|
</section>
|
|
<transition name="fade">
|
|
<section class="vikunja-loading" v-if="showLoading">
|
|
<img alt="Vikunja" :src="logoUrl" width="100" height="100"/>
|
|
<p>
|
|
<span class="loader-container is-loading-small is-loading"></span>
|
|
{{ $t('ready.loading') }}
|
|
</p>
|
|
</section>
|
|
</transition>
|
|
</template>
|
|
|
|
<script>
|
|
import logoUrl from '@/assets/logo.svg'
|
|
import ApiConfig from '@/components/misc/api-config'
|
|
import NoAuthWrapper from '@/components/misc/no-auth-wrapper'
|
|
import {mapState} from 'vuex'
|
|
import {ONLINE} from '@/store/mutation-types'
|
|
|
|
const ERROR_NO_API_URL = 'noApiUrlProvided'
|
|
|
|
export default {
|
|
name: 'ready',
|
|
components: {
|
|
NoAuthWrapper,
|
|
ApiConfig,
|
|
},
|
|
data() {
|
|
return {
|
|
logoUrl,
|
|
error: '',
|
|
errorNoApiUrl: ERROR_NO_API_URL,
|
|
}
|
|
},
|
|
mounted() {
|
|
this.load()
|
|
},
|
|
computed: {
|
|
ready() {
|
|
return this.$store.state.vikunjaReady
|
|
},
|
|
showLoading() {
|
|
return !this.ready && this.error === ''
|
|
},
|
|
...mapState({
|
|
online: ONLINE,
|
|
}),
|
|
},
|
|
methods: {
|
|
load() {
|
|
if (window.API_URL === '') {
|
|
this.error = ERROR_NO_API_URL
|
|
return
|
|
}
|
|
|
|
this.$store.dispatch('loadApp')
|
|
.catch(e => {
|
|
this.error = e
|
|
})
|
|
},
|
|
},
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.vikunja-loading {
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
height: 100vh;
|
|
width: 100vw;
|
|
flex-direction: column;
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
bottom: 0;
|
|
right: 0;
|
|
background: $grey-100;
|
|
z-index: 99;
|
|
|
|
img {
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
.loader-container {
|
|
margin-right: 1rem;
|
|
|
|
&.is-loading:after {
|
|
border-left-color: $grey-400;
|
|
border-bottom-color: $grey-400;
|
|
}
|
|
}
|
|
}
|
|
|
|
.offline {
|
|
background: url('@/assets/llama-nightscape.jpg') no-repeat center;
|
|
background-size: cover;
|
|
height: 100vh;
|
|
|
|
.offline-message {
|
|
text-align: center;
|
|
position: absolute;
|
|
width: 100vw;
|
|
bottom: 5vh;
|
|
color: $white;
|
|
padding: 0 1rem;
|
|
|
|
h1 {
|
|
font-weight: bold;
|
|
font-size: 1.5rem;
|
|
text-align: center;
|
|
color: $white;
|
|
font-weight: 700 !important;
|
|
font-size: 1.5rem;
|
|
}
|
|
}
|
|
}
|
|
</style>
|