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 @@ ...@@ -9,13 +9,26 @@
:user="user" :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 <router-view
:modules="modules" :modules="modules"
:user="user" :user="user"
/> />
</div> </div>
<div
v-else
class="tw-flex-1 tw-flex tw-my-8"
>
<home
:modules="modules"
:user="user"
/>
</div>
<app-footer :modules="modules" /> <app-footer :modules="modules" />
</div> </div>
</template> </template>
...@@ -29,10 +42,12 @@ ...@@ -29,10 +42,12 @@
import header from './components/Header.vue' import header from './components/Header.vue'
import footer from './components/Footer.vue' import footer from './components/Footer.vue'
import Home from "./Pages/Home";
export default { export default {
name: 'App', name: 'App',
components: { components: {
Home,
'app-header': header, 'app-header': header,
'app-footer': footer 'app-footer': footer
}, },
...@@ -105,6 +120,7 @@ ...@@ -105,6 +120,7 @@
created() { created() {
this.$store.dispatch('auth/oidcInit') this.$store.dispatch('auth/oidcInit')
}, },
methods: { methods: {
signIn() { signIn() {
this.$store.dispatch('auth/signinRedirect') this.$store.dispatch('auth/signinRedirect')
......
<template> <template>
<b-container> <b-container>
<auth-wall> <template v-if="selectedShow">
<show-selector <auth-wall>
ref="showSelector" <show-selector
:title="$t('navigation.calendar')" ref="showSelector"
:callback="showHasSwitched" :title="$t('navigation.calendar')"
/> :callback="showHasSwitched"
<hr> />
<hr>
<b-alert
variant="danger" <b-alert
:show="conflictMode" variant="danger"
> :show="conflictMode"
<div
v-if="conflictMode"
align="center"
> >
<h4>Conflict Resolution</h4> <div
<p> v-if="conflictMode"
for new schedule align="center"
from <b>{{ resolveData.schedule.dstart }}, {{ resolveData.schedule.tstart }}</b> >
to <b>{{ resolveData.schedule.tend }}</b>. <h4>Conflict Resolution</h4>
</p> <p>
<p v-if="resolveData.schedule.rrule !== 1"> for new schedule
This is a recurring event: <b>{{ rruleRender(resolveData.schedule.rrule) }}</b>, from <b>{{ resolveData.schedule.dstart }}, {{ resolveData.schedule.tstart }}</b>
until: <b>{{ resolveData.schedule.until }}</b>. to <b>{{ resolveData.schedule.tend }}</b>.
</p>
<div v-if="submitting">
<b-row>
<b-col align="center">
<img
src="/assets/radio.gif"
alt="submitting resolve data"
>
</b-col>
</b-row>
</div>
<div v-else>
<p v-if="conflictCount > 0">
Conflicts left to resolve:
<b-badge variant="danger">
{{ conflictCount }}
</b-badge>
&nbsp;
<b-button
variant="danger"
size="sm"
@click="resolveCancel"
>
Cancel
</b-button>
</p> </p>
<p v-else> <p v-if="resolveData.schedule.rrule !== 1">
<b-button This is a recurring event: <b>{{ rruleRender(resolveData.schedule.rrule) }}</b>,
variant="success" until: <b>{{ resolveData.schedule.until }}</b>.
@click="resolveSubmit"
>
0 conflicts left! Submit this solution.
</b-button>
&nbsp;
<b-button
variant="danger"
@click="resolveCancel"
>
Cancel
</b-button>
</p> </p>
<div v-if="submitting">
<b-row>
<b-col align="center">
<img
src="/assets/radio.gif"
alt="submitting resolve data"
>
</b-col>
</b-row>
</div>
<div v-else>
<p v-if="conflictCount > 0">
Conflicts left to resolve:
<b-badge variant="danger">
{{ conflictCount }}
</b-badge>
&nbsp;
<b-button
variant="danger"
size="sm"
@click="resolveCancel"
>
Cancel
</b-button>
</p>
<p v-else>
<b-button
variant="success"
@click="resolveSubmit"
>
0 conflicts left! Submit this solution.
</b-button>
&nbsp;
<b-button
variant="danger"
@click="resolveCancel"
>
Cancel
</b-button>
</p>
</div>
</div> </div>
</div> </b-alert>
</b-alert>
<full-calendar
<full-calendar ref="calendar"
ref="calendar" default-view="agendaWeek"
default-view="agendaWeek" :events="calendarSlots"
:events="calendarSlots" :config="calendarConfig"
:config="calendarConfig" @view-render="renderView"
@view-render="renderView" @event-selected="eventSelected"
@event-selected="eventSelected" @event-drop="eventDrop"
@event-drop="eventDrop" @event-resize="eventResize"
@event-resize="eventResize" @event-created="eventCreated"
@event-created="eventCreated" />
</auth-wall>
<app-modalEmissionManagerCreate
ref="appModalEmissionManagerCreate"
/> />
</auth-wall> <app-modalEmissionManagerResolve
ref="appModalEmissionManagerResolve"
/>
<app-modalEmissionManagerEdit
ref="appModalEmissionManagerEdit"
/>
</template>
<app-modalEmissionManagerCreate <div
ref="appModalEmissionManagerCreate" v-else
/> class="tw-text-center"
<app-modalEmissionManagerResolve v-html="this.$t('no_assigned_shows', { admin_url: adminUrl })"
ref="appModalEmissionManagerResolve"
/>
<app-modalEmissionManagerEdit
ref="appModalEmissionManagerEdit"
/> />
</b-container> </b-container>
</template> </template>
...@@ -184,8 +192,14 @@ ...@@ -184,8 +192,14 @@
created() { created() {
this.$store.dispatch('shows/fetchShows', { this.$store.dispatch('shows/fetchShows', {
callback: () => { callback: () => {
this.showHasSwitched() if (!this.selectedShow) {
this.$refs.showSelector.updateInputSelector() return;
}
this.$nextTick(() => {
this.showHasSwitched()
this.$refs.showSelector.updateInputSelector()
})
} }
}) })
}, },
......
<template> <template>
<b-container> <b-container>
<show-selector <template v-if="selectedShow">
<show-selector
ref="showSelector" ref="showSelector"
title="Files &amp; playlists" title="Files &amp; playlists"
:callback="showHasSwitched" :callback="showHasSwitched"
/>
<hr>
<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/>
</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/>
</div>
</template>
<div
v-else
class="tw-text-center"
v-html="this.$t('no_assigned_shows', { admin_url: adminUrl })"
/> />
<hr>
<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 />
</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 />
</div>
</b-container> </b-container>
</template> </template>
...@@ -65,8 +73,14 @@ ...@@ -65,8 +73,14 @@
created() { created() {
this.$store.dispatch('shows/fetchShows', { this.$store.dispatch('shows/fetchShows', {
callback: () => { callback: () => {
this.showHasSwitched() if (!this.selectedShow) {
this.$refs.showSelector.updateInputSelector() return;
}
this.$nextTick(() => {
this.showHasSwitched()
this.$refs.showSelector.updateInputSelector()
})
} }
}) })
}, },
......
<template> <template>
<b-container class="tw-self-center"> <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"> <div align="center">
<h1>{{ $t('home.welcome') }}</h1> <h1>{{ $t('home.welcome') }}</h1>
<p>Here are some infos for you on how to use this interface...</p> <p>Here are some infos for you on how to use this interface...</p>
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
<div <div
:class="{ :class="{
'tw-mx-auto tw-grid sm:tw-grid-cols-2 tw-gap-8 tw-text-center': true, '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-3 tw-max-w-3xl': user.steeringUser.is_superuser,
'md:tw-grid-cols-2 tw-max-w-lg': !$parent.user.steeringUser.is_superuser 'md:tw-grid-cols-2 tw-max-w-lg': !user.steeringUser.is_superuser
}" }"
> >
<router-link <router-link
...@@ -46,6 +46,11 @@ ...@@ -46,6 +46,11 @@
modules: { modules: {
type: Object, type: Object,
required: true, required: true,
},
user: {
type: Object,
required: true,
} }
} }
} }
......
<template> <template>
<b-container> <b-container>
<show-selector <template v-if="loaded.shows">
ref="showSelector" <template v-if="selectedShow">
title="Radio shows" <show-selector
:callback="showHasSwitched" ref="showSelector"
/> title="Radio shows"
<hr> :callback="showHasSwitched"
/>
<!-- The jumbotron is used to display the name and description of the <hr>
currently selected show -->
<show-jumbotron /> <!-- The jumbotron is used to display the name and description of the
currently selected show -->
<show-jumbotron/>
<show-schedules/>
<!-- include the modals to edit show and timeslot entries from the modal compontents -->
<show-timeslots ref="timeslotsComponent"/>
<hr>
<h2>General settings for the radio show:</h2>
<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 --> <!-- If the shows are not fully loaded yet, we just put the loading sign -->
<div v-if="!loaded.shows"> <div
<b-row> v-else
<b-col align="center"> class="tw-text-center"
<img >
src="/assets/radio.gif" {{ $t('loading') }}
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 />
<!-- include the modals to edit show and timeslot entries from the modal compontents -->
<show-timeslots ref="timeslotsComponent" />
<hr>
<h2>General settings for the radio show:</h2>
<show-metaSimpleTypes />
<show-metaArrays />
<show-metaOwners />
<show-metaImages />
<hr>
</div> </div>
</b-container> </b-container>
</template> </template>
...@@ -69,7 +71,9 @@ ...@@ -69,7 +71,9 @@
}, },
data() { 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 // Some of the info we need in the template are not easily and directly
...@@ -78,6 +82,7 @@ ...@@ -78,6 +82,7 @@
user() { user() {
return this.$store.state.auth.user return this.$store.state.auth.user
}, },
isSuperuser() { isSuperuser() {
return this.$store.state.auth.user.steeringUser.is_superuser return this.$store.state.auth.user.steeringUser.is_superuser
}, },
...@@ -117,8 +122,12 @@ ...@@ -117,8 +122,12 @@
loadShowInfos() { loadShowInfos() {
this.$store.dispatch('shows/fetchShows', { this.$store.dispatch('shows/fetchShows', {
callback: () => { callback: () => {
if (!this.selectedShow) {
return;
}
this.$store.dispatch('playlists/fetch', {slug: this.selectedShow.slug}) 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}) this.$store.dispatch('shows/fetchMetaArray', {property: 'types', onlyActive: true})
......
...@@ -3,31 +3,31 @@ ...@@ -3,31 +3,31 @@
<div> <div>
<b-container> <b-container>
<b-navbar <b-navbar
toggleable="lg" toggleable="lg"
type="dark" type="dark"
class="tw-text-white tw-flex" class="tw-text-white tw-flex"
> >
<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-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> <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 <b-collapse
id="nav_collapse" id="nav_collapse"
is-nav is-nav
class="tw-flex tw-items-center tw-justify-between" class="tw-flex tw-items-center tw-justify-between"
> >
<b-navbar-nav class="tw-flex tw-items-center"> <b-navbar-nav class="tw-flex tw-items-center">
<b-nav-item to="/home"> <b-nav-item to="/home">
<img <img
class="header-logo tw-h-12" class="header-logo tw-h-12"
src="/assets/aura-dashboard-200-nobackground.png" src="/assets/aura-dashboard-200-nobackground.png"
> >
</b-nav-item> </b-nav-item>
<b-nav-item <b-nav-item
v-for="mod in modules.main" v-for="mod in modules.main"
:key="mod.slug" :key="mod.slug"
:active="mod.slug === $route.name" :active="mod.slug === $route.name"
:to="'/' + mod.slug" :to="'/' + mod.slug"
> >
{{ mod.title }} {{ mod.title }}
</b-nav-item> </b-nav-item>
...@@ -35,26 +35,26 @@ ...@@ -35,26 +35,26 @@
<b-navbar-nav class="tw-flex tw-items-center"> <b-navbar-nav class="tw-flex tw-items-center">
<b-nav-item-dropdown <b-nav-item-dropdown
:text="$activeLocale().toUpperCase()" :text="$activeLocale().toUpperCase()"
right right
> >
<b-dropdown-item <b-dropdown-item
:active="$activeLocale() === 'de'" :active="$activeLocale() === 'de'"
@click="$locale('de')" @click="$locale('de')"
> >
DE DE
</b-dropdown-item> </b-dropdown-item>
<b-dropdown-item <b-dropdown-item
:active="$activeLocale() === 'en'" :active="$activeLocale() === 'en'"
@click="$locale('en')" @click="$locale('en')"
> >
EN EN
</b-dropdown-item> </b-dropdown-item>
</b-nav-item-dropdown> </b-nav-item-dropdown>