mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-17 05:41:25 +02:00
Merge pull request #3575 from modoboa/fix/calendars-frontend
Fixed multiple issues in calendar views.
This commit is contained in:
@@ -51,7 +51,9 @@ export default {
|
||||
data
|
||||
)
|
||||
},
|
||||
|
||||
deleteUserEvent(calendarPk, eventId) {
|
||||
return repository.delete(`/user-calendars/${calendarPk}/events/${eventId}/`)
|
||||
},
|
||||
getAttendees() {
|
||||
return repository.get('/attendees/')
|
||||
},
|
||||
|
||||
@@ -109,7 +109,7 @@ async function submit() {
|
||||
props.initialCalendar &&
|
||||
props.initialCalendar.color !== calendar.value.color
|
||||
) {
|
||||
emit('colorChanged', calendar.value)
|
||||
emit('colorChanged', calendar.value.pk)
|
||||
}
|
||||
close()
|
||||
busStore.displayNotification({
|
||||
|
||||
@@ -81,6 +81,14 @@
|
||||
</template>
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-btn
|
||||
v-if="props.event"
|
||||
:loading="working"
|
||||
color="error"
|
||||
@click="deleteEvent"
|
||||
>
|
||||
{{ $gettext('Delete') }}
|
||||
</v-btn>
|
||||
<v-spacer />
|
||||
<v-btn :loading="working" @click="close">{{ $gettext('Close') }}</v-btn>
|
||||
<v-btn color="primary" type="submit" :loading="working">
|
||||
@@ -109,7 +117,7 @@ const props = defineProps({
|
||||
default: null,
|
||||
},
|
||||
})
|
||||
const emit = defineEmits(['close'])
|
||||
const emit = defineEmits(['close', 'refreshCalendar'])
|
||||
|
||||
const { $gettext } = useGettext()
|
||||
const busStore = useBusStore()
|
||||
@@ -170,16 +178,26 @@ async function saveEvent() {
|
||||
try {
|
||||
var data = JSON.parse(JSON.stringify(form.value))
|
||||
if (!props.event) {
|
||||
api.createUserEvent(form.value.calendar, data).then(() => {
|
||||
busStore.displayNotification({ msg: $gettext('Event added') })
|
||||
close()
|
||||
})
|
||||
await api.createUserEvent(form.value.calendar, data)
|
||||
busStore.displayNotification({ msg: $gettext('Event added') })
|
||||
} else {
|
||||
api.patchUserEvent(form.value.calendar, props.event.id, data).then(() => {
|
||||
busStore.displayNotification({ msg: $gettext('Event updated') })
|
||||
close()
|
||||
})
|
||||
await api.patchUserEvent(form.value.calendar, props.event.id, data)
|
||||
busStore.displayNotification({ msg: $gettext('Event updated') })
|
||||
}
|
||||
emit('refreshCalendar', data.calendar)
|
||||
close()
|
||||
} finally {
|
||||
working.value = false
|
||||
}
|
||||
}
|
||||
|
||||
async function deleteEvent() {
|
||||
working.value = true
|
||||
try {
|
||||
await api.deleteUserEvent(form.value.calendar, props.event.id)
|
||||
busStore.displayNotification({ msg: $gettext('Event deleted') })
|
||||
emit('refreshCalendar', form.value.calendar)
|
||||
close()
|
||||
} finally {
|
||||
working.value = false
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ async function sendFile() {
|
||||
response.data.counter
|
||||
)
|
||||
busStore.displayNotification({ msg })
|
||||
emit('eventsImported', props.calendar)
|
||||
emit('eventsImported', props.calendar.pk)
|
||||
} catch (err) {
|
||||
onSendError(err.response)
|
||||
} finally {
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
<EventForm
|
||||
:info="selectInfo"
|
||||
:event="selectedEvent"
|
||||
@refresh-calendar="refreshCalendarEvents"
|
||||
@close="closeEventForm"
|
||||
/>
|
||||
</v-dialog>
|
||||
@@ -183,9 +184,9 @@ function fetchUserCalendars() {
|
||||
})
|
||||
}
|
||||
|
||||
function refreshCalendarEvents(calendar) {
|
||||
function refreshCalendarEvents(calendarPk) {
|
||||
const fullc = calendarRef.value.getApi()
|
||||
const evtSource = fullc.getEventSourceById(`user-${calendar.pk}`)
|
||||
const evtSource = fullc.getEventSourceById(`user-${calendarPk}`)
|
||||
evtSource.refetch()
|
||||
}
|
||||
|
||||
|
||||
@@ -198,7 +198,7 @@ MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
||||
OAUTH2_PROVIDER = {
|
||||
'OIDC_ENABLED': True,
|
||||
'OIDC_RP_INITIATED_LOGOUT_ENABLED': True,
|
||||
'OIDC_RP_INITIATED_LOGOUT_ALWAYS_PROMPT': True,
|
||||
'OIDC_RP_INITIATED_LOGOUT_ALWAYS_PROMPT': False,
|
||||
'OIDC_RSA_PRIVATE_KEY': env.str('OIDC_RSA_PRIVATE_KEY', multiline=True),
|
||||
'SCOPES': {
|
||||
'openid': 'OpenID Connect scope',
|
||||
|
||||
@@ -215,7 +215,7 @@ dTnvCVtA59ne4LEVie/PMH/odQWY0SxVm/76uBZv/1vY
|
||||
OAUTH2_PROVIDER = {
|
||||
"OIDC_ENABLED": True,
|
||||
"OIDC_RP_INITIATED_LOGOUT_ENABLED": True,
|
||||
"OIDC_RP_INITIATED_LOGOUT_ALWAYS_PROMPT": True,
|
||||
"OIDC_RP_INITIATED_LOGOUT_ALWAYS_PROMPT": False,
|
||||
"OIDC_RSA_PRIVATE_KEY": OIDC_RSA_PRIVATE_KEY, # PROD : os.environ.get("OIDC_RSA_PRIVATE_KEY"),
|
||||
"SCOPES": {
|
||||
"openid": "OpenID Connect scope",
|
||||
|
||||
Reference in New Issue
Block a user