Skip to content

Commit

Permalink
Merge branch 'release50' into release51
Browse files Browse the repository at this point in the history
  • Loading branch information
jstarpl committed Oct 10, 2023
2 parents 895d144 + 6f7eefd commit ac19173
Show file tree
Hide file tree
Showing 38 changed files with 549 additions and 183 deletions.
2 changes: 1 addition & 1 deletion meteor/client/lib/__tests__/rundown.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ describe('client/lib/rundown', () => {
partInstanceId: mockCurrentPartInstance._id,
rundownId: mockCurrentPartInstance.rundownId,
manuallySelected: false,
consumesNextSegmentId: false,
consumesQueuedSegmentId: false,
},
},
})
Expand Down
24 changes: 12 additions & 12 deletions meteor/client/lib/__tests__/rundownTiming.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1452,13 +1452,13 @@ describe('rundown Timing Calculator', () => {
partInstanceId: currentPartInstanceId,
rundownId: protectString<RundownId>(rundownId1),
manuallySelected: false,
consumesNextSegmentId: false,
consumesQueuedSegmentId: false,
}
playlist.nextPartInfo = {
partInstanceId: nextPartInstanceId,
rundownId: protectString<RundownId>(rundownId1),
manuallySelected: false,
consumesNextSegmentId: false,
consumesQueuedSegmentId: false,
}
const rundown = makeMockRundown(rundownId1, playlist)
const rundowns = [rundown]
Expand Down Expand Up @@ -1602,13 +1602,13 @@ describe('rundown Timing Calculator', () => {
partInstanceId: currentPartInstanceId,
rundownId: protectString<RundownId>(rundownId1),
manuallySelected: false,
consumesNextSegmentId: false,
consumesQueuedSegmentId: false,
}
playlist.nextPartInfo = {
partInstanceId: nextPartInstanceId,
rundownId: protectString<RundownId>(rundownId1),
manuallySelected: false,
consumesNextSegmentId: false,
consumesQueuedSegmentId: false,
}
const rundown = makeMockRundown(rundownId1, playlist)
const rundowns = [rundown]
Expand Down Expand Up @@ -1758,13 +1758,13 @@ describe('rundown Timing Calculator', () => {
partInstanceId: currentPartInstanceId,
rundownId: protectString<RundownId>(rundownId1),
manuallySelected: false,
consumesNextSegmentId: false,
consumesQueuedSegmentId: false,
}
playlist.nextPartInfo = {
partInstanceId: nextPartInstanceId,
rundownId: protectString<RundownId>(rundownId1),
manuallySelected: false,
consumesNextSegmentId: false,
consumesQueuedSegmentId: false,
}
const rundown = makeMockRundown(rundownId1, playlist)
const rundowns = [rundown]
Expand Down Expand Up @@ -1908,13 +1908,13 @@ describe('rundown Timing Calculator', () => {
partInstanceId: currentPartInstanceId,
rundownId: protectString<RundownId>(rundownId1),
manuallySelected: false,
consumesNextSegmentId: false,
consumesQueuedSegmentId: false,
}
playlist.nextPartInfo = {
partInstanceId: nextPartInstanceId,
rundownId: protectString<RundownId>(rundownId1),
manuallySelected: false,
consumesNextSegmentId: false,
consumesQueuedSegmentId: false,
}
const rundown = makeMockRundown(rundownId1, playlist)
const rundowns = [rundown]
Expand Down Expand Up @@ -2058,13 +2058,13 @@ describe('rundown Timing Calculator', () => {
partInstanceId: currentPartInstanceId,
rundownId: protectString<RundownId>(rundownId1),
manuallySelected: false,
consumesNextSegmentId: false,
consumesQueuedSegmentId: false,
}
playlist.nextPartInfo = {
partInstanceId: nextPartInstanceId,
rundownId: protectString<RundownId>(rundownId1),
manuallySelected: false,
consumesNextSegmentId: false,
consumesQueuedSegmentId: false,
}
const rundown = makeMockRundown(rundownId1, playlist)
const rundowns = [rundown]
Expand Down Expand Up @@ -2214,13 +2214,13 @@ describe('rundown Timing Calculator', () => {
partInstanceId: currentPartInstanceId,
rundownId: protectString<RundownId>(rundownId1),
manuallySelected: false,
consumesNextSegmentId: false,
consumesQueuedSegmentId: false,
}
playlist.nextPartInfo = {
partInstanceId: nextPartInstanceId,
rundownId: protectString<RundownId>(rundownId1),
manuallySelected: false,
consumesNextSegmentId: false,
consumesQueuedSegmentId: false,
}
const rundown = makeMockRundown(rundownId1, playlist)
const rundowns = [rundown]
Expand Down
23 changes: 22 additions & 1 deletion meteor/client/ui/RundownView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2083,7 +2083,8 @@ export const RundownView = translateWithTracker<IProps, IState, ITrackedProps>((
)
}
}
onSetNextSegment = (segmentId: SegmentId | null, e: any) => {

onSetNextSegment = (segmentId: SegmentId, e: any) => {
const { t } = this.props
if (this.state.studioMode && (segmentId || segmentId === null) && this.props.playlist) {
const playlistId = this.props.playlist._id
Expand All @@ -2102,6 +2103,25 @@ export const RundownView = translateWithTracker<IProps, IState, ITrackedProps>((
}
}

onQueueNextSegment = (segmentId: SegmentId | null, e: any) => {
const { t } = this.props
if (this.state.studioMode && (segmentId || segmentId === null) && this.props.playlist) {
const playlistId = this.props.playlist._id
doUserAction(
t,
e,
UserAction.QUEUE_NEXT_SEGMENT,
(e, ts) => MeteorCall.userAction.queueNextSegment(e, ts, playlistId, segmentId),
(err) => {
if (err) logger.error(err)
this.setState({
manualSetAsNext: true,
})
}
)
}
}

onPieceDoubleClick = (item: PieceUi, e: React.MouseEvent<HTMLDivElement>) => {
const { t } = this.props
if (
Expand Down Expand Up @@ -3012,6 +3032,7 @@ export const RundownView = translateWithTracker<IProps, IState, ITrackedProps>((
playlist={playlist}
onSetNext={this.onSetNext}
onSetNextSegment={this.onSetNextSegment}
onQueueNextSegment={this.onQueueNextSegment}
studioMode={this.state.studioMode}
enablePlayFromAnywhere={!!studio.settings.enablePlayFromAnywhere}
/>
Expand Down
6 changes: 3 additions & 3 deletions meteor/client/ui/SegmentContainer/withResolvedSegment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,9 @@ export function withResolvedSegment<T extends IProps, IState = {}>(
// Check rundown changes that are important to the segment
if (
typeof props.playlist !== typeof nextProps.playlist ||
(props.playlist.nextSegmentId !== nextProps.playlist.nextSegmentId &&
(props.playlist.nextSegmentId === props.segmentId ||
nextProps.playlist.nextSegmentId === props.segmentId)) ||
(props.playlist.queuedSegmentId !== nextProps.playlist.queuedSegmentId &&
(props.playlist.queuedSegmentId === props.segmentId ||
nextProps.playlist.queuedSegmentId === props.segmentId)) ||
((props.playlist.currentPartInfo?.partInstanceId !==
nextProps.playlist.currentPartInfo?.partInstanceId ||
props.playlist.nextPartInfo?.partInstanceId !== nextProps.playlist.nextPartInfo?.partInstanceId) &&
Expand Down
2 changes: 1 addition & 1 deletion meteor/client/ui/SegmentList/SegmentListContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ export const SegmentListContainer = withResolvedSegment<IProps>(function Segment
segmentNoteCounts={props.segmentNoteCounts}
isLiveSegment={isLiveSegment}
isNextSegment={isNextSegment}
isQueuedSegment={props.playlist.nextSegmentId === props.segmentui._id}
isQueuedSegment={props.playlist.queuedSegmentId === props.segmentui._id}
showCountdownToSegment={props.showCountdownToSegment}
fixedSegmentDuration={props.fixedSegmentDuration ?? false}
hasAlreadyPlayed={props.hasAlreadyPlayed}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ export const SegmentStoryboardContainer = withResolvedSegment<IProps>(function S
playlist={props.playlist}
isLiveSegment={isLiveSegment}
isNextSegment={isNextSegment}
isQueuedSegment={props.playlist.nextSegmentId === props.segmentui._id}
isQueuedSegment={props.playlist.queuedSegmentId === props.segmentui._id}
hasRemoteItems={props.hasRemoteItems}
hasGuestItems={props.hasGuestItems}
currentPartWillAutoNext={currentPartWillAutoNext}
Expand Down
9 changes: 5 additions & 4 deletions meteor/client/ui/SegmentTimeline/SegmentContextMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { SegmentOrphanedReason } from '@sofie-automation/corelib/dist/dataModel/
interface IProps {
onSetNext: (part: DBPart | undefined, e: any, offset?: number, take?: boolean) => void
onSetNextSegment: (segmentId: SegmentId | null, e: any) => void
onQueueNextSegment: (segmentId: SegmentId | null, e: any) => void
playlist?: DBRundownPlaylist
studioMode: boolean
contextMenuContext: IContextMenuContext | null
Expand Down Expand Up @@ -50,20 +51,20 @@ export const SegmentContextMenu = withTranslation()(
{part && timecode === null && (
<>
<MenuItem
onClick={(e) => this.props.onSetNext(part.instance.part, e)}
onClick={(e) => this.props.onSetNextSegment(part.instance.segmentId, e)}
disabled={isCurrentPart || !canSetAsNext}
>
<span dangerouslySetInnerHTML={{ __html: t('Set segment as <strong>Next</strong>') }}></span>
</MenuItem>
{part.instance.segmentId !== this.props.playlist.nextSegmentId ? (
{part.instance.segmentId !== this.props.playlist.queuedSegmentId ? (
<MenuItem
onClick={(e) => this.props.onSetNextSegment(part.instance.segmentId, e)}
onClick={(e) => this.props.onQueueNextSegment(part.instance.segmentId, e)}
disabled={!canSetAsNext}
>
<span>{t('Queue segment')}</span>
</MenuItem>
) : (
<MenuItem onClick={(e) => this.props.onSetNextSegment(null, e)} disabled={!canSetAsNext}>
<MenuItem onClick={(e) => this.props.onQueueNextSegment(null, e)} disabled={!canSetAsNext}>
<span>{t('Clear queued segment')}</span>
</MenuItem>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ export const SegmentTimelineContainer = withResolvedSegment(
followLiveSegments={this.props.followLiveSegments}
isLiveSegment={this.state.isLiveSegment}
isNextSegment={this.state.isNextSegment}
isQueuedSegment={this.props.playlist.nextSegmentId === this.props.segmentId}
isQueuedSegment={this.props.playlist.queuedSegmentId === this.props.segmentId}
hasRemoteItems={this.props.hasRemoteItems}
hasGuestItems={this.props.hasGuestItems}
autoNextPart={this.state.autoNextPart}
Expand Down
20 changes: 19 additions & 1 deletion meteor/lib/api/rest/v1/playlists.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
RundownPlaylistId,
SegmentId,
} from '@sofie-automation/corelib/dist/dataModel/Ids'
import { QueueNextSegmentResult } from '@sofie-automation/corelib/dist/worker/studio'
import { Meteor } from 'meteor/meteor'

/* *************************************************************************
Expand Down Expand Up @@ -168,7 +169,24 @@ export interface PlaylistsRestAPI {
event: string,
rundownPlaylistId: RundownPlaylistId,
segmentId: SegmentId
): Promise<ClientAPI.ClientResponse<void>>
): Promise<ClientAPI.ClientResponse<PartId | null>>
/**
* Queues the Segment to a given SegmentId.
*
* Throws if the target Playlist is not currently active.
* Throws if the specified Segment does not exist.
* Throws if the specified Segment does not contain any playable parts.
* @param connection Connection data including client and header details
* @param event User event string
* @param rundownPlaylistId Target Playlist.
* @param segmentId Segment to set as next.
*/
queueNextSegment(
connection: Meteor.Connection,
event: string,
rundownPlaylistId: RundownPlaylistId,
segmentId: SegmentId
): Promise<ClientAPI.ClientResponse<QueueNextSegmentResult>>
/**
* Performs a take in the given Playlist.
*
Expand Down
11 changes: 9 additions & 2 deletions meteor/lib/api/userActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { BucketAdLib } from '@sofie-automation/corelib/dist/dataModel/BucketAdLi
import { AdLibActionCommon } from '@sofie-automation/corelib/dist/dataModel/AdlibAction'
import { BucketAdLibAction } from '@sofie-automation/corelib/dist/dataModel/BucketAdLibAction'
import { getHash, Time } from '../lib'
import { ExecuteActionResult } from '@sofie-automation/corelib/dist/worker/studio'
import { ExecuteActionResult, QueueNextSegmentResult } from '@sofie-automation/corelib/dist/worker/studio'
import {
AdLibActionId,
BucketId,
Expand Down Expand Up @@ -41,11 +41,17 @@ export interface NewUserActionAPI extends MethodContext {
timeOffset?: number
): Promise<ClientAPI.ClientResponse<void>>
setNextSegment(
userEvent: string,
eventTime: Time,
rundownPlaylistId: RundownPlaylistId,
segmentId: SegmentId
): Promise<ClientAPI.ClientResponse<PartId>>
queueNextSegment(
userEvent: string,
eventTime: Time,
rundownPlaylistId: RundownPlaylistId,
segmentId: SegmentId | null
): Promise<ClientAPI.ClientResponse<void>>
): Promise<ClientAPI.ClientResponse<QueueNextSegmentResult>>
moveNext(
userEvent: string,
eventTime: Time,
Expand Down Expand Up @@ -327,6 +333,7 @@ export enum UserActionAPIMethods {
'take' = 'userAction.take',
'setNext' = 'userAction.setNext',
'setNextSegment' = 'userAction.setNextSegment',
'queueNextSegment' = 'userAction.queueNextSegment',
'moveNext' = 'userAction.moveNext',

'prepareForBroadcast' = 'userAction.prepareForBroadcast',
Expand Down
2 changes: 2 additions & 0 deletions meteor/lib/clientUserAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ function userActionToLabel(userAction: UserAction, t: i18next.TFunction) {
return t('Setting Next')
case UserAction.SET_NEXT_SEGMENT:
return t('Setting Next Segment')
case UserAction.QUEUE_NEXT_SEGMENT:
return t('Queueing next Segment')
case UserAction.TAKE_PIECE:
return t('Taking Piece')
case UserAction.UNSYNC_RUNDOWN:
Expand Down
1 change: 1 addition & 0 deletions meteor/lib/userAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,5 @@ export enum UserAction {
RUNDOWN_ORDER_RESET,
PERIPHERAL_DEVICE_REFRESH_DEBUG_STATES,
ACTIVATE_SCRATCHPAD,
QUEUE_NEXT_SEGMENT,
}
4 changes: 2 additions & 2 deletions meteor/server/api/__tests__/externalMessageQueue.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ describe('Test external message queue static methods', () => {
partInstanceId: protectString('part_now'),
rundownId: protectString('rundown_1'),
manuallySelected: false,
consumesNextSegmentId: false,
consumesQueuedSegmentId: false,
},
nextPartInfo: {
partInstanceId: protectString('partNext'),
rundownId: protectString('rundown_1'),
manuallySelected: false,
consumesNextSegmentId: false,
consumesQueuedSegmentId: false,
},
previousPartInfo: null,
activationId: protectString('active'),
Expand Down
Loading

0 comments on commit ac19173

Please sign in to comment.