diff --git a/src/components/TopBar/TopBarMenu.vue b/src/components/TopBar/TopBarMenu.vue index 18791370182..96c929fa1a8 100644 --- a/src/components/TopBar/TopBarMenu.vue +++ b/src/components/TopBar/TopBarMenu.vue @@ -139,6 +139,15 @@ {{ t('spreed', 'Conversation settings') }} + + + + {{ t('spreed', ' Download attendance list') }} + @@ -147,6 +156,7 @@ import Cog from 'vue-material-design-icons/Cog.vue' import DotsCircle from 'vue-material-design-icons/DotsCircle.vue' import DotsHorizontal from 'vue-material-design-icons/DotsHorizontal.vue' +import IconDownload from 'vue-material-design-icons/Download.vue' import File from 'vue-material-design-icons/File.vue' import Fullscreen from 'vue-material-design-icons/Fullscreen.vue' import FullscreenExit from 'vue-material-design-icons/FullscreenExit.vue' @@ -158,7 +168,7 @@ import VideoIcon from 'vue-material-design-icons/Video.vue' import PromotedView from 'vue-material-design-icons/ViewGallery.vue' import GridView from 'vue-material-design-icons/ViewGrid.vue' -import { showWarning } from '@nextcloud/dialogs' +import { showError, showWarning } from '@nextcloud/dialogs' import { emit } from '@nextcloud/event-bus' import { t } from '@nextcloud/l10n' @@ -179,6 +189,7 @@ import { } from '../../composables/useDocumentFullscreen.ts' import { useIsInCall } from '../../composables/useIsInCall.js' import { CALL, CONVERSATION, PARTICIPANT } from '../../constants.js' +import { callDownloadParticipants } from '../../services/callsService.js' import { getTalkConfig } from '../../services/CapabilitiesManager.ts' import { useBreakoutRoomsStore } from '../../stores/breakoutRooms.ts' import { useCallViewStore } from '../../stores/callView.js' @@ -208,6 +219,7 @@ export default { FullscreenExit, GridView, HandBackLeft, + IconDownload, MicrophoneOff, PromotedView, RecordCircle, @@ -492,6 +504,24 @@ export default { token: this.token, }) }, + + async downloadAttendanceList() { + try { + const reponse = await callDownloadParticipants(this.token) + // Create a link and click it to download the file + const url = window.URL.createObjectURL(new Blob([reponse.data])) + const link = document.createElement('a') + link.href = url + link.setAttribute('download', 'Attendance list.csv') + document.body.appendChild(link) + link.click() + // Cleanup: remove the link + link.remove() + } catch (error) { + console.error('Error downloading attendance list', error) + showError(t('spreed', 'Error downloading attendance list')) + } + } }, } diff --git a/src/services/callsService.js b/src/services/callsService.js index bd0f72923c5..3385e0e819c 100644 --- a/src/services/callsService.js +++ b/src/services/callsService.js @@ -132,6 +132,10 @@ const callSIPSendCallMessage = async function(sessionId, data) { } } +const callDownloadParticipants = async function(token, options) { + return await axios.get(generateOcsUrl('apps/spreed/api/v4/call/{token}/download', { token }), options) +} + export { joinCall, leaveCall, @@ -142,4 +146,5 @@ export { callSIPUnmutePhone, callSIPHoldPhone, callSIPSendDTMF, + callDownloadParticipants, }