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

FIX #33: show loading symbols for schedule creation and resolution

parent 6782074a
......@@ -66,35 +66,48 @@
This is a recurring event: <b>{{ rruleRender(resolveData.schedule.rrule) }}</b>,
until: <b>{{ resolveData.schedule.until }}</b>.
</p>
<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 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>
</b-alert>
......@@ -159,6 +172,7 @@ export default {
timeslots: false,
calendarSlots: false,
},
submitting: false,
// this flag signifies if we are in conflict resolution mode
conflictMode: false,
......@@ -497,11 +511,13 @@ export default {
this.$log.debug('resolveSubmit: schedule:', resolvedSchedule)
// now generate the URL and POST it to steering
let uri = process.env.VUE_APP_API_STEERING_SHOWS + this.shows[this.currentShow].id + '/schedules/'
this.submitting = true
axios.post(uri, resolvedSchedule, {
withCredentials: true,
headers: { 'Authorization': 'Bearer ' + this.$parent.user.access_token }
}).then(response => {
this.$log.debug('resolveSubmit: response:', response)
this.submitting = false
// if for some reason a new conflict arose, e.g. because in the meantime
// someone else inserted a conflicting schedule, we have to resolve.
if (response.data.projected === undefined) {
......@@ -511,6 +527,7 @@ export default {
this.resolve(response.data)
}
}).catch(error => {
this.submitting = false
this.$log.error(error.response.status + ' ' + error.response.statusText)
this.$log.error(error.response)
alert('Error: could not submit final schedule. See console for details.')
......
......@@ -25,7 +25,7 @@
Try again or change the start date to something in the future.
</b-alert>
<div v-if="loaded">
<div v-if="loaded && !submitting">
<b-row>
<b-col cols="2">
Start:
......@@ -74,6 +74,16 @@
</b-col>
</b-row>
</div>
<div v-else>
<b-row>
<b-col align="center">
<img
src="../assets/radio.gif"
alt="submitting new schedule"
>
</b-col>
</b-row>
</div>
</b-modal>
</div>
</template>
......@@ -90,6 +100,7 @@ export default {
return {
newSchedule: null,
loaded: false,
submitting: false,
pastEventWarning: false,
valuePick: {
dstart: null,
......@@ -126,6 +137,7 @@ export default {
this.newSchedule.schedule.byweekday = this.getWeekdayFromApiDate(this.valuePick.dstart)
// now generate the URL and POST our new schedule
let uri = process.env.VUE_APP_API_STEERING_SHOWS + this.$parent.shows[this.$parent.currentShow].id + '/schedules/'
this.submitting = true
axios.post(uri, this.newSchedule, {
withCredentials: true,
headers: { 'Authorization': 'Bearer ' + this.$parent.$parent.user.access_token }
......@@ -145,10 +157,12 @@ export default {
this.submit()
// otherwise we have to resolve the conflict first.
} else {
this.submitting = false
this.$parent.resolve(response.data)
this.$refs.modalEmissionManagerCreate.hide()
}
}).catch(error => {
this.submitting = false
this.$log.error(error.response.status + ' ' + error.response.statusText)
this.$log.error(error.response)
alert('Error: could not create schedule. See console for details.')
......@@ -162,6 +176,7 @@ export default {
withCredentials: true,
headers: { 'Authorization': 'Bearer ' + this.$parent.$parent.user.access_token }
}).then(response => {
this.submitting = false
// if for some reason a new conflict arose, e.g. because in the meantime
// someone else inserted a conflicting schedule, we have to resolve.
// TODO: based on single event schedule
......@@ -174,6 +189,7 @@ export default {
}
this.$refs.modalEmissionManagerCreate.hide()
}).catch(error => {
this.submitting = false
this.$log.error(error.response.status + ' ' + error.response.statusText)
this.$log.error(error.response)
alert('Error: could not submit final schedule. See console for details.')
......@@ -215,6 +231,7 @@ export default {
}
}
this.loaded = true
this.submitting = false
this.$refs.modalEmissionManagerCreate.show()
},
}
......
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