Skip to content

Commit

Permalink
feat: merge dashboard improvements from #173
Browse files Browse the repository at this point in the history
  • Loading branch information
jstarpl committed May 29, 2020
1 parent adc8d13 commit 3e6445e
Show file tree
Hide file tree
Showing 3 changed files with 204 additions and 45 deletions.
193 changes: 172 additions & 21 deletions meteor/client/ui/Settings/RundownLayoutEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ export default translateWithTracker<IProps, IState, ITrackedProps>((props: IProp
modifiedClassName='bghl'
attribute={`filters.${index}.hide`}
obj={item}
type='float'
type='int'
collection={RundownLayouts}
className='input text-input input-l' />
</label>
Expand Down Expand Up @@ -778,9 +778,9 @@ export default translateWithTracker<IProps, IState, ITrackedProps>((props: IProp
modifiedClassName='bghl'
attribute={`filters.${index}.includeClearInRundownBaseline`}
obj={item}
type='checkbox'
type='int'
collection={RundownLayouts}
className='mod mas' />
className='input text-input input-l' />
</label>
</div>
</React.Fragment>
Expand Down Expand Up @@ -908,6 +908,173 @@ export default translateWithTracker<IProps, IState, ITrackedProps>((props: IProp
className='mod mas' />
</label>
</div>
</React.Fragment>
}
<div className='mod mvs mhs'>
<label className='field'>
{t('Display Rank')}
<EditAttribute
modifiedClassName='bghl'
attribute={`filters.${index}.rank`}
obj={item}
type='float'
collection={RundownLayouts}
className='input text-input input-l' />
</label>
</div>
<div className='mod mvs mhs'>
<label className='field'>
{t('Enable search toolbar')}
<EditAttribute
modifiedClassName='bghl'
attribute={`filters.${index}.enableSearch`}
obj={item}
type='checkbox'
collection={RundownLayouts}
className='mod mas' />
</label>
</div>
<div className='mod mvs mhs'>
<label className='field'>
{t('Only Display AdLibs from Current Segment')}
<EditAttribute
modifiedClassName='bghl'
attribute={`filters.${index}.currentSegment`}
obj={item}
type='checkbox'
collection={RundownLayouts}
className='mod mas' />
</label>
</div>
<div className='mod mvs mhs'>
<label className='field'>
{t('Include Global AdLibs')}
</label>
<EditAttribute
modifiedClassName='bghl'
attribute={`filters.${index}.rundownBaseline`}
obj={item}
options={rundownBaselineOptions}
type='dropdown'
label={t('Filter Disabled')}
collection={RundownLayouts}
className='input text-input input-l dropdown' />
</div>
{isDashboardLayout &&
<React.Fragment>
<div className='mod mvs mhs'>
<label className='field'>
{t('Include Clear Source Layer in Ad-Libs')}
<EditAttribute
modifiedClassName='bghl'
attribute={`filters.${index}.includeClearInRundownBaseline`}
obj={item}
type='checkbox'
collection={RundownLayouts}
className='mod mas' />
</label>
</div>
</React.Fragment>
}
<div className='mod mvs mhs'>
<label className='field'>
{t('Source Layers')}
</label>
<EditAttribute
modifiedClassName='bghl'
attribute={`filters.${index}.sourceLayerIds`}
obj={item}
type='checkbox'
collection={RundownLayouts}
className='mod mas'
mutateDisplayValue={(v) => (v === undefined || v.length === 0) ? false : true}
mutateUpdateValue={(v) => undefined} />
<EditAttribute
modifiedClassName='bghl'
attribute={`filters.${index}.sourceLayerIds`}
obj={item}
options={this.props.showStyleBase.sourceLayers.map(l => { return { name: l.name, value: l._id } })}
type='multiselect'
label={t('Filter Disabled')}
collection={RundownLayouts}
className='input text-input input-l dropdown'
mutateUpdateValue={v => v && v.length > 0 ? v : undefined} />
</div>
<div className='mod mvs mhs'>
<label className='field'>
{t('Source Layer Types')}
</label>
<EditAttribute
modifiedClassName='bghl'
attribute={`filters.${index}.sourceLayerTypes`}
obj={item}
type='checkbox'
collection={RundownLayouts}
className='mod mas'
mutateDisplayValue={(v) => (v === undefined || v.length === 0) ? false : true}
mutateUpdateValue={(v) => undefined} />
<EditAttribute
modifiedClassName='bghl'
attribute={`filters.${index}.sourceLayerTypes`}
obj={item}
options={SourceLayerType}
type='multiselect'
optionsAreNumbers={true}
label={t('Filter disabled')}
collection={RundownLayouts}
className='input text-input input-l dropdown'
mutateUpdateValue={(v: string[] | undefined) => v && v.length > 0 ? v.map(a => parseInt(a, 10)) : undefined} />
</div>
<div className='mod mvs mhs'>
<label className='field'>
{t('Output Channels')}
</label>
<EditAttribute
modifiedClassName='bghl'
attribute={`filters.${index}.outputLayerIds`}
obj={item}
type='checkbox'
collection={RundownLayouts}
className='mod mas'
mutateDisplayValue={(v) => (v === undefined || v.length === 0) ? false : true}
mutateUpdateValue={(v) => undefined} />
<EditAttribute
modifiedClassName='bghl'
attribute={`filters.${index}.outputLayerIds`}
obj={item}
options={this.props.showStyleBase.outputLayers.map(l => { return { name: l.name, value: l._id } })}
type='multiselect'
label={t('Filter Disabled')}
collection={RundownLayouts}
className='input text-input input-l dropdown'
mutateUpdateValue={v => v && v.length > 0 ? v : undefined} />
</div>
<div className='mod mvs mhs'>
<label className='field'>
{t('Label contains')}
<EditAttribute
modifiedClassName='bghl'
attribute={`filters.${index}.label`}
obj={item}
type='checkbox'
collection={RundownLayouts}
className='mod mas'
mutateDisplayValue={(v) => (v === undefined || v.length === 0) ? false : true}
mutateUpdateValue={(v) => undefined} />
<EditAttribute
modifiedClassName='bghl'
attribute={`filters.${index}.label`}
obj={item}
type='text'
collection={RundownLayouts}
className='input text-input input-l'
label={t('Filter Disabled')}
mutateDisplayValue={(v) => (v === undefined || v.length === 0) ? undefined : v.join(', ')}
mutateUpdateValue={(v) => (v === undefined || v.length === 0) ? undefined : v.split(',').map(i => i.trim())} />
</label>
</div>
{isDashboardLayout &&
<React.Fragment>
<div className='mod mvs mhs'>
<label className='field'>
{t('Queue all adlibs')}
Expand Down Expand Up @@ -1043,7 +1210,7 @@ export default translateWithTracker<IProps, IState, ITrackedProps>((props: IProp
</React.Fragment>
}

renderAdLibRegion (item: RundownLayoutBase, tab: RundownLayoutAdLibRegion, index: number, isRundownLayout: boolean, isDashboardLayout: boolean) {
renderAdLibRegion(item: RundownLayoutBase, tab: RundownLayoutAdLibRegion, index: number, isRundownLayout: boolean, isDashboardLayout: boolean) {
const { t } = this.props
return <React.Fragment>
<div className='mod mvs mhs'>
Expand Down Expand Up @@ -1085,7 +1252,7 @@ export default translateWithTracker<IProps, IState, ITrackedProps>((props: IProp
</div>
<div className='mod mvs mhs'>
<label className='field'>
{t('Tags must contain')}
{t('Tags must contain')}
<EditAttribute
modifiedClassName='bghl'
attribute={`filters.${index}.tags`}
Expand Down Expand Up @@ -1169,22 +1336,6 @@ export default translateWithTracker<IProps, IState, ITrackedProps>((props: IProp
className='input text-input input-l' />
</label>
</div>
{isDashboardLayout &&
<React.Fragment>
<div className='mod mvs mhs'>
<label className='field'>
{t('Register Shortcuts for this Panel')}
<EditAttribute
modifiedClassName='bghl'
attribute={`filters.${index}.assignHotKeys`}
obj={item}
type='checkbox'
collection={RundownLayouts}
className='mod mas' />
</label>
</div>
</React.Fragment>
}
</React.Fragment>
}
</React.Fragment>
Expand Down
2 changes: 1 addition & 1 deletion meteor/client/ui/Shelf/DashboardPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ export class DashboardPanelInner extends MeteorReactComponent<Translated<IAdLibP
return false
}

isAdLibNext (adLib: AdLibPieceUi) {
isAdLibNext(adLib: AdLibPieceUi) {
if (this.props.nextPieces[unprotectString(adLib._id)] && this.props.nextPieces[unprotectString(adLib._id)].length > 0) {
return true
}
Expand Down
54 changes: 31 additions & 23 deletions meteor/server/api/playout/infinites.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { CacheForRundownPlaylist } from '../../DatabaseCaches'
/** When we crop a piece, set the piece as "it has definitely ended" this far into the future. */
const DEFINITELY_ENDED_FUTURE_DURATION = 10 * 1000

export function updateSourceLayerInfinitesAfterPart (cache: CacheForRundownPlaylist, rundown: Rundown, previousPart?: Part, runUntilEnd?: boolean): void {
export function updateSourceLayerInfinitesAfterPart(cache: CacheForRundownPlaylist, rundown: Rundown, previousPart?: Part, runUntilEnd?: boolean): void {
let activeInfinitePieces: { [layer: string]: Piece } = {}
let activeInfiniteItemsSegmentId: { [layer: string]: SegmentId } = {}

Expand Down Expand Up @@ -63,8 +63,8 @@ export function updateSourceLayerInfinitesAfterPart (cache: CacheForRundownPlayl
'piece._id': piece._id,
reset: { $ne: true }
}, {
$set: { 'piece.infiniteId': piece.infiniteId }
})
$set: { 'piece.infiniteId': piece.infiniteId }
})
}
if (piece.infiniteMode !== PieceLifespan.OutOnNextPart) {
activeInfinitePieces[piece.sourceLayerId] = piece
Expand Down Expand Up @@ -215,8 +215,8 @@ export function updateSourceLayerInfinitesAfterPart (cache: CacheForRundownPlayl
'piece._id': pieceToInsert._id,
reset: { $ne: true }
}, {
$set: { piece: pieceToInsert }
})
$set: { piece: pieceToInsert }
})
// logger.debug(`updateSourceLayerInfinitesAfterPart: updated infinite continuation "${pieceToInsert._id}"`)
} else {
if (existingPiece) {
Expand Down Expand Up @@ -259,11 +259,15 @@ export function updateSourceLayerInfinitesAfterPart (cache: CacheForRundownPlayl
cache.PieceInstances.update({
'piece._id': piece._id,
reset: { $ne: true }
}, { $set: {
'piece.infiniteId': piece.infiniteId }
})
cache.Pieces.update(piece._id, { $set: {
infiniteId: piece.infiniteId }
}, {
$set: {
'piece.infiniteId': piece.infiniteId
}
})
cache.Pieces.update(piece._id, {
$set: {
infiniteId: piece.infiniteId
}
})
// logger.debug(`updateSourceLayerInfinitesAfterPart: marked "${piece._id}" as start of infinite`)
}
Expand All @@ -275,7 +279,7 @@ export function updateSourceLayerInfinitesAfterPart (cache: CacheForRundownPlayl
}
}

export function cropInfinitesOnLayer (cache: CacheForRundownPlaylist, rundown: Rundown, partInstance: PartInstance, newPieceInstance: PieceInstance) {
export function cropInfinitesOnLayer(cache: CacheForRundownPlaylist, rundown: Rundown, partInstance: PartInstance, newPieceInstance: PieceInstance) {
const showStyleBase = rundown.getShowStyleBase()
const exclusiveGroup = _.find(showStyleBase.sourceLayers, sl => sl._id === newPieceInstance.piece.sourceLayerId)
const newItemExclusivityGroup = exclusiveGroup ? exclusiveGroup.exclusiveGroup : undefined
Expand All @@ -288,20 +292,24 @@ export function cropInfinitesOnLayer (cache: CacheForRundownPlaylist, rundown: R

for (const instance of pieceInstances) {
if (!instance.piece.userDuration || (!instance.piece.userDuration.duration && !instance.piece.userDuration.end)) {
cache.PieceInstances.update(instance._id, { $set: {
'piece.userDuration': { end: `#${getPieceGroupId(unprotectObject(newPieceInstance.piece))}.start + ${newPieceInstance.piece.adlibPreroll || 0}` },
definitelyEnded: getCurrentTime() + DEFINITELY_ENDED_FUTURE_DURATION + (newPieceInstance.piece.adlibPreroll || 0),
'piece.infiniteMode': PieceLifespan.Normal,
'piece.originalInfiniteMode': instance.piece.originalInfiniteMode !== undefined ? instance.piece.originalInfiniteMode : instance.piece.infiniteMode
}})
cache.PieceInstances.update(instance._id, {
$set: {
'piece.userDuration': { end: `#${getPieceGroupId(unprotectObject(newPieceInstance.piece))}.start + ${newPieceInstance.piece.adlibPreroll || 0}` },
definitelyEnded: getCurrentTime() + DEFINITELY_ENDED_FUTURE_DURATION + (newPieceInstance.piece.adlibPreroll || 0),
'piece.infiniteMode': PieceLifespan.Normal,
'piece.originalInfiniteMode': instance.piece.originalInfiniteMode !== undefined ? instance.piece.originalInfiniteMode : instance.piece.infiniteMode
}
})

// TODO-PartInstance - pending new data flow
cache.Pieces.update(instance.piece._id, { $set: {
userDuration: { end: `#${getPieceGroupId(unprotectObject(newPieceInstance.piece))}.start + ${newPieceInstance.piece.adlibPreroll || 0}` },
definitelyEnded: getCurrentTime() + DEFINITELY_ENDED_FUTURE_DURATION + (newPieceInstance.piece.adlibPreroll || 0),
infiniteMode: PieceLifespan.Normal,
originalInfiniteMode: instance.piece.originalInfiniteMode !== undefined ? instance.piece.originalInfiniteMode : instance.piece.infiniteMode
}})
cache.Pieces.update(instance.piece._id, {
$set: {
userDuration: { end: `#${getPieceGroupId(unprotectObject(newPieceInstance.piece))}.start + ${newPieceInstance.piece.adlibPreroll || 0}` },
definitelyEnded: getCurrentTime() + DEFINITELY_ENDED_FUTURE_DURATION + (newPieceInstance.piece.adlibPreroll || 0),
infiniteMode: PieceLifespan.Normal,
originalInfiniteMode: instance.piece.originalInfiniteMode !== undefined ? instance.piece.originalInfiniteMode : instance.piece.infiniteMode
}
})
}
}
}
Expand Down

0 comments on commit 3e6445e

Please sign in to comment.