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>
<auth-wall>
<show-selector
ref="showSelector"
:title="$t('navigation.calendar')"
:callback="showHasSwitched"
/>
<hr>
<b-alert
variant="danger"
:show="conflictMode"
>
<div
v-if="conflictMode"
align="center"
<template v-if="selectedShow">
<auth-wall>
<show-selector
ref="showSelector"
:title="$t('navigation.calendar')"
:callback="showHasSwitched"
/>
<hr>
<b-alert
variant="danger"
:show="conflictMode"
>
<h4>Conflict Resolution</h4>
<p>
for new schedule
from <b>{{ resolveData.schedule.dstart }}, {{ resolveData.schedule.tstart }}</b>
to <b>{{ resolveData.schedule.tend }}</b>.
</p>
<p v-if="resolveData.schedule.rrule !== 1">
This is a recurring event: <b>{{ rruleRender(resolveData.schedule.rrule) }}</b>,
until: <b>{{ resolveData.schedule.until }}</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>
<div
v-if="conflictMode"
align="center"
>
<h4>Conflict Resolution</h4>
<p>
for new schedule
from <b>{{ resolveData.schedule.dstart }}, {{ resolveData.schedule.tstart }}</b>
to <b>{{ resolveData.schedule.tend }}</b>.
</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 v-if="resolveData.schedule.rrule !== 1">
This is a recurring event: <b>{{ rruleRender(resolveData.schedule.rrule) }}</b>,
until: <b>{{ resolveData.schedule.until }}</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 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>
</b-alert>
<full-calendar
ref="calendar"
default-view="agendaWeek"
:events="calendarSlots"
:config="calendarConfig"
@view-render="renderView"
@event-selected="eventSelected"
@event-drop="eventDrop"
@event-resize="eventResize"
@event-created="eventCreated"
</b-alert>
<full-calendar
ref="calendar"
default-view="agendaWeek"
:events="calendarSlots"
:config="calendarConfig"
@view-render="renderView"
@event-selected="eventSelected"
@event-drop="eventDrop"
@event-resize="eventResize"
@event-created="eventCreated"
/>
</auth-wall>
<app-modalEmissionManagerCreate
ref="appModalEmissionManagerCreate"
/>
</auth-wall>
<app-modalEmissionManagerResolve
ref="appModalEmissionManagerResolve"
/>
<app-modalEmissionManagerEdit
ref="appModalEmissionManagerEdit"
/>
</template>
<app-modalEmissionManagerCreate
ref="appModalEmissionManagerCreate"
/>
<app-modalEmissionManagerResolve
ref="appModalEmissionManagerResolve"
/>
<app-modalEmissionManagerEdit
ref="appModalEmissionManagerEdit"
<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: () => {
this.showHasSwitched()
this.$refs.showSelector.updateInputSelector()
if (!this.selectedShow) {
return;
}
this.$nextTick(() => {
this.showHasSwitched()
this.$refs.showSelector.updateInputSelector()
})
}
})
},
......
<template>
<b-container>
<show-selector
<template v-if="selectedShow">
<show-selector
ref="showSelector"
title="Files &amp; playlists"
: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>
</template>
......@@ -65,8 +73,14 @@
created() {
this.$store.dispatch('shows/fetchShows', {
callback: () => {
this.showHasSwitched()
this.$refs.showSelector.updateInputSelector()
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>
<show-selector
ref="showSelector"
title="Radio shows"
:callback="showHasSwitched"
/>
<hr>
<!-- The jumbotron is used to display the name and description of the
currently selected show -->
<show-jumbotron />
<template v-if="loaded.shows">
<template v-if="selectedShow">
<show-selector
ref="showSelector"
title="Radio shows"
:callback="showHasSwitched"
/>
<hr>
<!-- 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 -->
<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 />
<!-- 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
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})
......
......@@ -3,31 +3,31 @@
<div>
<b-container>
<b-navbar
toggleable="lg"
type="dark"
class="tw-text-white tw-flex"
toggleable="lg"
type="dark"
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-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
class="tw-flex tw-items-center tw-justify-between"
id="nav_collapse"
is-nav
class="tw-flex tw-items-center tw-justify-between"
>
<b-navbar-nav class="tw-flex tw-items-center">
<b-nav-item to="/home">
<img
class="header-logo tw-h-12"
src="/assets/aura-dashboard-200-nobackground.png"
class="header-logo tw-h-12"
src="/assets/aura-dashboard-200-nobackground.png"
>
</b-nav-item>
<b-nav-item
v-for="mod in modules.main"
:key="mod.slug"
:active="mod.slug === $route.name"
:to="'/' + mod.slug"
v-for="mod in modules.main"
:key="mod.slug"
:active="mod.slug === $route.name"
:to="'/' + mod.slug"
>
{{ mod.title }}
</b-nav-item>
......@@ -35,26 +35,26 @@
<b-navbar-nav class="tw-flex tw-items-center">
<b-nav-item-dropdown
:text="$activeLocale().toUpperCase()"
right
:text="$activeLocale().toUpperCase()"
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>
<b-nav-item-dropdown
v-if="user.logged_in"
right
v-if="user.logged_in"
right
>
<!-- Using button-content slot -->
<template slot="button-content">
......@@ -71,23 +71,23 @@
</b-dropdown-item>
</b-nav-item-dropdown>
<b-nav-item
v-if="! user.logged_in"
to="home"
v-if="! user.logged_in"
to="home"
>
<img
src="/assets/16x16/system-users.png"
alt="log-in symbol"
:title="$t('auth.signIn')"
src="/assets/16x16/system-users.png"
alt="log-in symbol"
:title="$t('auth.signIn')"
>
</b-nav-item>
<div class="help-image-container">
<b-nav-item>
<router-link to="help">
<img
class="help-image"
src="/assets/help-browser-32x32.png"
alt="Help symbol"
title="Go to help pages"
class="help-image"
src="/assets/help-browser-32x32.png"
alt="Help symbol"
title="Go to help pages"
>
</router-link>
</b-nav-item>
......
......@@ -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