Commit eaa48a73 authored by jackie / Andrea Ida Malkah Klaura's avatar jackie / Andrea Ida Malkah Klaura
Browse files

FEAT: display show owners, if superuser

parent b1e00e78
......@@ -274,6 +274,7 @@
<hr>
<h2>Allgemeine Einstellungen zur Sendereihe:</h2>
<b-row>
<b-col lg="6">
<p>
......@@ -399,6 +400,56 @@
</b-col>
</b-row>
<hr v-if="$parent.user.steeringUser.is_superuser">
<b-row v-if="$parent.user.steeringUser.is_superuser">
<b-col lg="2">
<b-badge
variant="info"
style="width:80%;"
>
Owners:
</b-badge> <img
src="../assets/16x16/emblem-system.png"
alt="edit"
@click="$refs.appModalSuperuser.showModalOwners()"
>
</b-col>
<b-col lg="10">
<div v-if="loaded.owners">
<p v-if="shows[currentShow].owners.length === 0">
<small><i>(none set)</i></small>
</p>
<p v-else>
<!-- TODO: make link on name; when user clicks, open modal to edit host -->
<ul>
<li
v-for="owner in current.owners"
:key="owner.id"
>
{{ owner.first_name }} {{ owner.last_name }}
<b-badge variant="light">
username:
</b-badge> <small>{{ owner.username }}</small>
<span v-if="owner.email.length > 0">
<b-badge variant="light">
email:
</b-badge> <small>{{ owner.email }}</small>
</span>
</li>
</ul>
</p>
</div>
<div v-else>
<img
src="../assets/radio.gif"
height="24px"
alt="loading data"
><br>
</div>
</b-col>
</b-row>
<hr v-if="$parent.user.steeringUser.is_superuser">
<b-row>
<b-col lg="2">
<b-badge style="width:80%;">
......@@ -671,7 +722,8 @@ export default {
topics: false,
musicfocus: false,
fundingcategory: false,
type: false
type: false,
owners: false,
},
// the current object is used to hold all the necessary data to describe
......@@ -695,7 +747,8 @@ export default {
note: {},
notes: [],
image: '',
logo: ''
logo: '',
owners: [],
},
// this is used to configure the table with all the filtered timeslots
......@@ -812,6 +865,7 @@ export default {
this.loaded.languages = false
this.loaded.musicfocus = false
this.loaded.fundingcategory = false
this.loaded.owners = false
// set the current show and its ID to whatever we want to switch to now
this.currentShow = index
this.currentShowID = this.shows[this.currentShow].id
......@@ -829,6 +883,9 @@ export default {
this.getMusicfocus()
this.getFundingCategory()
this.getType()
if (this.$parent.user.steeringUser.is_superuser) {
this.getOwners()
}
// now fetch the timeslots (including notes) for a given show from PV backend
this.getTimeslots(this.dateStart, this.dateEnd, this.numSlots)
},
......@@ -1124,6 +1181,29 @@ export default {
if (!loadingError) { this.loaded.type = true }
},
getOwners: function () {
this.current.owners = []
let loadingError = false
if (this.shows[this.currentShow].owners.length === 0) {
this.loaded.owners = true
} else {
for (let i in this.shows[this.currentShow].owners) {
axios.get(process.env.VUE_APP_API_STEERING + 'users/' + this.shows[this.currentShow].owners[i] + '/', {
withCredentials: true,
headers: { 'Authorization': 'Bearer ' + this.$parent.user.access_token }
}).then(response => {
this.current.owners.push(response.data)
}).catch(error => {
loadingError = true
this.$log.error(error.response.status + ' ' + error.response.statusText)
this.$log.error(error.response)
alert('Error: could not load owner data. See console for details.')
})
}
if (!loadingError) { this.loaded.owners = true }
}
},
// Just a placeholder function we can use in the UI, to signal if something
// is not yet implemented
notYetImplemented: function () {
......
......@@ -248,6 +248,10 @@ export default {
this.$refs.modalDeleteShow.show()
},
showModalOwners () {
alert('coming soon')
},
// fetch all available (that is: active) show type from steering
loadTypes () {
this.loaded.types = false
......
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