Add 'no content' toast for slide capture

This commit is contained in:
Daniel Petri Rocha 2023-01-14 18:00:29 +01:00
parent da6f5d996e
commit a72d76a46a
4 changed files with 45 additions and 25 deletions

View File

@ -57,6 +57,16 @@ trait PresentationWithAnnotationsMsgHdlr extends RightsManagementTrait {
BbbCommonEnvCoreMsg(envelope, event) BbbCommonEnvCoreMsg(envelope, event)
} }
def buildBroadcastPresentationConversionUpdateEvtMsg(parentMeetingId: String, status: String, presentationId: String, filename: String, temporaryPresentationId: String): BbbCommonEnvCoreMsg = {
val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, parentMeetingId, "not-used")
val envelope = BbbCoreEnvelope(PresentationPageConvertedEventMsg.NAME, routing)
val header = BbbClientMsgHeader(PresentationConversionUpdateEvtMsg.NAME, parentMeetingId, "not-used")
val body = PresentationConversionUpdateEvtMsgBody("DEFAULT_PRESENTATION_POD", status, "not-used", presentationId, filename, temporaryPresentationId)
val event = PresentationConversionUpdateEvtMsg(header, body)
BbbCommonEnvCoreMsg(envelope, event)
}
def buildBroadcastPresAnnStatusMsg(presAnnStatusMsg: PresAnnStatusMsg, liveMeeting: LiveMeeting): BbbCommonEnvCoreMsg = { def buildBroadcastPresAnnStatusMsg(presAnnStatusMsg: PresAnnStatusMsg, liveMeeting: LiveMeeting): BbbCommonEnvCoreMsg = {
val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, liveMeeting.props.meetingProp.intId, "not-used") val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, liveMeeting.props.meetingProp.intId, "not-used")
val envelope = BbbCoreEnvelope(PresentationPageConvertedEventMsg.NAME, routing) val envelope = BbbCoreEnvelope(PresentationPageConvertedEventMsg.NAME, routing)
@ -193,13 +203,20 @@ trait PresentationWithAnnotationsMsgHdlr extends RightsManagementTrait {
val exportJob: ExportJob = new ExportJob(jobId, JobTypes.CAPTURE_PRESENTATION, filename, presId, presLocation, allPages, pagesRange, parentMeetingId, presentationUploadToken) val exportJob: ExportJob = new ExportJob(jobId, JobTypes.CAPTURE_PRESENTATION, filename, presId, presLocation, allPages, pagesRange, parentMeetingId, presentationUploadToken)
val storeAnnotationPages: List[PresentationPageForExport] = getPresentationPagesForExport(pagesRange, pageCount, presId, currentPres, liveMeeting); val storeAnnotationPages: List[PresentationPageForExport] = getPresentationPagesForExport(pagesRange, pageCount, presId, currentPres, liveMeeting);
// Send Export Job to Redis val annotationCount: Int = storeAnnotationPages.map(_.annotations.size).sum
val job = buildStoreExportJobInRedisSysMsg(exportJob, liveMeeting)
bus.outGW.send(job)
// Send Annotations to Redis if (annotationCount > 0) {
val annotations = new StoredAnnotations(jobId, presId, storeAnnotationPages) // Send Export Job to Redis
bus.outGW.send(buildStoreAnnotationsInRedisSysMsg(annotations, liveMeeting)) val job = buildStoreExportJobInRedisSysMsg(exportJob, liveMeeting)
bus.outGW.send(job)
// Send Annotations to Redis
val annotations = new StoredAnnotations(jobId, presId, storeAnnotationPages)
bus.outGW.send(buildStoreAnnotationsInRedisSysMsg(annotations, liveMeeting))
} else {
// Notify that no content is available
bus.outGW.send(buildBroadcastPresentationConversionUpdateEvtMsg(parentMeetingId, "204", jobId, filename, presentationUploadToken))
}
} }
} }

View File

@ -2,13 +2,12 @@ import Pads, { PadsUpdates } from '/imports/api/pads';
import Breakouts from '/imports/api/breakouts'; import Breakouts from '/imports/api/breakouts';
import RedisPubSub from '/imports/startup/server/redis'; import RedisPubSub from '/imports/startup/server/redis';
import Logger from '/imports/startup/server/logger'; import Logger from '/imports/startup/server/logger';
import Presentations from '/imports/api/presentations';
import _ from 'lodash';
export default function padCapture(breakoutId, parentMeetingId) { export default function padCapture(breakoutId, parentMeetingId) {
const REDIS_CONFIG = Meteor.settings.private.redis; const REDIS_CONFIG = Meteor.settings.private.redis;
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps; const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
const EVENT_NAME = 'PadCapturePubMsg'; const EVENT_NAME = 'PadCapturePubMsg';
const EVENT_NAME_ERROR = 'PresentationConversionUpdateSysPubMsg';
const EXTERNAL_ID = Meteor.settings.public.notes.id; const EXTERNAL_ID = Meteor.settings.public.notes.id;
try { try {
@ -51,21 +50,18 @@ export default function padCapture(breakoutId, parentMeetingId) {
} }
// Notify that no content is available // Notify that no content is available
Presentations.insert({ const temporaryPresentationId = `${breakoutId}-notes`;
id: _.uniqueId(filename), const payload = {
meetingId: parentMeetingId, podId: 'DEFAULT_PRESENTATION_POD',
temporaryPresentationId: `${breakoutId}-notes`, messageKey: '204',
renderedInToast: false, code: 'not-used',
lastModifiedUploader: false, presentationId: temporaryPresentationId,
filename, presName: filename,
conversion: { temporaryPresentationId,
done: false, };
error: true,
status: 204,
},
});
return null; Logger.info(`No notes available for capture in meetingId=${breakoutId} parentMeetingId=${parentMeetingId} padId=${pad.padId}`);
return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME_ERROR, parentMeetingId, 'system', payload);
} catch (err) { } catch (err) {
Logger.error(`Exception while invoking method padCapture ${err.stack}`); Logger.error(`Exception while invoking method padCapture ${err.stack}`);
return null; return null;

View File

@ -14,6 +14,7 @@ const GENERATED_SLIDE_KEY = 'GENERATED_SLIDE';
const FILE_TOO_LARGE_KEY = 'FILE_TOO_LARGE'; const FILE_TOO_LARGE_KEY = 'FILE_TOO_LARGE';
const CONVERSION_TIMEOUT_KEY = "CONVERSION_TIMEOUT"; const CONVERSION_TIMEOUT_KEY = "CONVERSION_TIMEOUT";
const IVALID_MIME_TYPE_KEY = "IVALID_MIME_TYPE"; const IVALID_MIME_TYPE_KEY = "IVALID_MIME_TYPE";
const NO_CONTENT = '204';
// const GENERATING_THUMBNAIL_KEY = 'GENERATING_THUMBNAIL'; // const GENERATING_THUMBNAIL_KEY = 'GENERATING_THUMBNAIL';
// const GENERATED_THUMBNAIL_KEY = 'GENERATED_THUMBNAIL'; // const GENERATED_THUMBNAIL_KEY = 'GENERATED_THUMBNAIL';
// const GENERATING_TEXTFILES_KEY = 'GENERATING_TEXTFILES'; // const GENERATING_TEXTFILES_KEY = 'GENERATING_TEXTFILES';
@ -76,6 +77,13 @@ export default function handlePresentationConversionUpdate({ body }, meetingId)
statusModifier['conversion.numPages'] = body.numberOfPages; statusModifier['conversion.numPages'] = body.numberOfPages;
break; break;
case NO_CONTENT:
statusModifier['conversion.done'] = false;
statusModifier['conversion.error'] = true;
statusModifier.id = presentationId;
statusModifier.name = presentationName;
break;
default: default:
break; break;
} }

View File

@ -7,7 +7,6 @@ import UserListService from '/imports/ui/components/user-list/service';
import fp from 'lodash/fp'; import fp from 'lodash/fp';
import UsersPersistentData from '/imports/api/users-persistent-data'; import UsersPersistentData from '/imports/api/users-persistent-data';
import { UploadingPresentations } from '/imports/api/presentations'; import { UploadingPresentations } from '/imports/api/presentations';
import _ from 'lodash';
const ROLE_MODERATOR = Meteor.settings.public.user.role_moderator; const ROLE_MODERATOR = Meteor.settings.public.user.role_moderator;
@ -43,7 +42,7 @@ const upsertCapturedContent = (filename, temporaryPresentationId) => {
temporaryPresentationId, temporaryPresentationId,
}, { }, {
$set: { $set: {
id: _.uniqueId(filename), id: temporaryPresentationId,
temporaryPresentationId, temporaryPresentationId,
progress: 0, progress: 0,
filename, filename,
@ -60,7 +59,7 @@ const upsertCapturedContent = (filename, temporaryPresentationId) => {
const setCapturedContentUploading = () => { const setCapturedContentUploading = () => {
const breakoutRooms = findBreakouts(); const breakoutRooms = findBreakouts();
breakoutRooms.forEach((breakout) => { breakoutRooms.forEach((breakout) => {
const filename = breakout.shortName; // breakout.name const filename = breakout.shortName;
const temporaryPresentationId = breakout.breakoutId; const temporaryPresentationId = breakout.breakoutId;
if (breakout.captureNotes) { if (breakout.captureNotes) {