Commit 1f03d695 authored by Richard Blechinger's avatar Richard Blechinger
Browse files

Fix bug where user with no assigned shows would be hit with countless errors.

parent d17df0d4
......@@ -9,13 +9,26 @@
:user="user"
/>
<div class="tw-flex-1 tw-flex tw-my-8">
<div
v-if="user.steeringUser !== null"
class="tw-flex-1 tw-flex tw-my-8"
>
<router-view
:modules="modules"
:user="user"
/>
</div>
<div
v-else
class="tw-flex-1 tw-flex tw-my-8"
>
<home
:modules="modules"
:user="user"
/>
</div>
<app-footer :modules="modules" />
</div>
</template>
......@@ -29,10 +42,12 @@
import header from './components/Header.vue'
import footer from './components/Footer.vue'
import Home from "./Pages/Home";
export default {
name: 'App',
components: {
Home,
'app-header': header,
'app-footer': footer
},
......@@ -105,6 +120,7 @@
created() {
this.$store.dispatch('auth/oidcInit')
},
methods: {
signIn() {
this.$store.dispatch('auth/signinRedirect')
......
<template>
<b-container>
<template v-if="selectedShow">
<auth-wall>
<show-selector
ref="showSelector"
......@@ -93,6 +94,13 @@
<app-modalEmissionManagerEdit
ref="appModalEmissionManagerEdit"
/>
</template>
<div
v-else
class="tw-text-center"
v-html="this.$t('no_assigned_shows', { admin_url: adminUrl })"
/>
</b-container>
</template>
......@@ -184,8 +192,14 @@
created() {
this.$store.dispatch('shows/fetchShows', {
callback: () => {
if (!this.selectedShow) {
return;
}
this.$nextTick(() => {
this.showHasSwitched()
this.$refs.showSelector.updateInputSelector()
})
}
})
},
......
<template>
<b-container>
<template v-if="selectedShow">
<show-selector
ref="showSelector"
title="Files &amp; playlists"
......@@ -7,19 +8,26 @@
/>
<hr>
<jumbotron />
<jumbotron/>
<!-- All the UI for uploading and editing files is only shown if the user
choose to edit files in the jumbotron above -->
<div v-if="mode === 'files'">
<files />
<files/>
</div>
<!-- All the UI for creating and editing playlists is only shown if the user
choose to edit playlists in the jumbotron above -->
<div v-if="mode === 'playlists'">
<playlists />
<playlists/>
</div>
</template>
<div
v-else
class="tw-text-center"
v-html="this.$t('no_assigned_shows', { admin_url: adminUrl })"
/>
</b-container>
</template>
......@@ -65,8 +73,14 @@
created() {
this.$store.dispatch('shows/fetchShows', {
callback: () => {
if (!this.selectedShow) {
return;
}
this.$nextTick(() => {
this.showHasSwitched()
this.$refs.showSelector.updateInputSelector()
})
}
})
},
......
<template>
<b-container class="tw-self-center">
<div v-if="$parent.user.logged_in === true">
<div v-if="user.logged_in === true && user.steeringUser">
<div align="center">
<h1>{{ $t('home.welcome') }}</h1>
<p>Here are some infos for you on how to use this interface...</p>
......@@ -10,8 +10,8 @@
<div
:class="{
'tw-mx-auto tw-grid sm:tw-grid-cols-2 tw-gap-8 tw-text-center': true,
'md:tw-grid-cols-3 tw-max-w-3xl': $parent.user.steeringUser.is_superuser,
'md:tw-grid-cols-2 tw-max-w-lg': !$parent.user.steeringUser.is_superuser
'md:tw-grid-cols-3 tw-max-w-3xl': user.steeringUser.is_superuser,
'md:tw-grid-cols-2 tw-max-w-lg': !user.steeringUser.is_superuser
}"
>
<router-link
......@@ -46,6 +46,11 @@
modules: {
type: Object,
required: true,
},
user: {
type: Object,
required: true,
}
}
}
......
<template>
<b-container>
<template v-if="loaded.shows">
<template v-if="selectedShow">
<show-selector
ref="showSelector"
title="Radio shows"
......@@ -9,36 +11,36 @@
<!-- The jumbotron is used to display the name and description of the
currently selected show -->
<show-jumbotron />
<!-- If the shows are not fully loaded yet, we just put the loading sign -->
<div v-if="!loaded.shows">
<b-row>
<b-col align="center">
<img
src="/assets/radio.gif"
alt="loading data"
>
</b-col>
</b-row>
</div>
<!-- When all show data is loaded, here we display all the rest -->
<div v-else>
<show-schedules />
<show-jumbotron/>
<show-schedules/>
<!-- include the modals to edit show and timeslot entries from the modal compontents -->
<show-timeslots ref="timeslotsComponent" />
<show-timeslots ref="timeslotsComponent"/>
<hr>
<h2>General settings for the radio show:</h2>
<show-metaSimpleTypes />
<show-metaArrays />
<show-metaOwners />
<show-metaImages />
<show-metaSimpleTypes/>
<show-metaArrays/>
<show-metaOwners/>
<show-metaImages/>
<hr>
</template>
<div
v-else
class="tw-text-center"
v-html="this.$t('no_assigned_shows', { admin_url: adminUrl })"
/>
</template>
<!-- If the shows are not fully loaded yet, we just put the loading sign -->
<div
v-else
class="tw-text-center"
>
{{ $t('loading') }}
</div>
</b-container>
</template>
......@@ -69,7 +71,9 @@
},
data() {
return {}
return {
adminUrl: `${process.env.VUE_APP_BASEURI_STEERING}/admin`
}
},
// Some of the info we need in the template are not easily and directly
......@@ -78,6 +82,7 @@
user() {
return this.$store.state.auth.user
},
isSuperuser() {
return this.$store.state.auth.user.steeringUser.is_superuser
},
......@@ -117,8 +122,12 @@
loadShowInfos() {
this.$store.dispatch('shows/fetchShows', {
callback: () => {
if (!this.selectedShow) {
return;
}
this.$store.dispatch('playlists/fetch', {slug: this.selectedShow.slug})
this.$refs.showSelector.updateInputSelector()
this.$nextTick(() => this.$refs.showSelector.updateInputSelector())
}
})
this.$store.dispatch('shows/fetchMetaArray', {property: 'types', onlyActive: true})
......
......@@ -9,7 +9,7 @@
>
<span class="d-none d-sm-inline d-lg-none menu-context-info">For more options tap the menu button on the right:</span>
<span class="d-sm-none menu-context-info">Hit menu button for more:</span>
<b-navbar-toggle target="nav_collapse" />
<b-navbar-toggle target="nav_collapse"/>
<b-collapse
id="nav_collapse"
is-nav
......@@ -39,16 +39,16 @@
right
>
<b-dropdown-item
:active="$activeLocale() === 'de'"
@click="$locale('de')"
>
:active="$activeLocale() === 'de'"
@click="$locale('de')"
>
DE
</b-dropdown-item>
<b-dropdown-item
:active="$activeLocale() === 'en'"
@click="$locale('en')"
>
:active="$activeLocale() === 'en'"
@click="$locale('en')"
>
EN
</b-dropdown-item>
</b-nav-item-dropdown>
......
......@@ -8,6 +8,7 @@ export default {
// Layout
'loading': 'Lädt..',
'no_assigned_shows': 'Dir sind noch keine Sendungen zugewiesen.<br>Diese können im <a href="%{admin_url}">Administrationsbereich</a> zugewiesen werden.',
'auth': {
'signOut': 'Abmelden',
......
......@@ -8,8 +8,8 @@ export default {
// Layout
'loading': 'Loading..',
'settings': 'Settings',
'profile': 'Profile',
'no_assigned_shows': 'You have not been assigned any shows yet.<br>They can be assigned in the <a href="%{admin_url}">administration interface</a>.',
'auth': {
'signOut': 'Sign out',
'signIn': 'Sign in',
......
......@@ -195,6 +195,7 @@ const actions = {
}
}).catch(error => {
handleApiError(this, error, 'could not load shows')
console.log(error)
if (data && typeof (data.callbackCancel) === 'function') {
data.callbackCancel()
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment