Skip to content

Commit 6caf488

Browse files
authored
Merge pull request #1736 from bbc/justandras/feat/minishelf-buttons
feat: improved shelf buttons
2 parents e2201a3 + 1dee6a5 commit 6caf488

54 files changed

Lines changed: 2073 additions & 950 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

meteor/__mocks__/defaultCollectionObjects.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { DBRundown } from '@sofie-automation/corelib/dist/dataModel/Rundown'
66
import { DBSegment } from '@sofie-automation/corelib/dist/dataModel/Segment'
77
import { DBPart } from '@sofie-automation/corelib/dist/dataModel/Part'
88
import { IBlueprintPieceType, PieceLifespan } from '@sofie-automation/blueprints-integration'
9+
import { ShelfButtonSize } from '@sofie-automation/shared-lib/dist/core/model/StudioSettings'
910
import { Piece, EmptyPieceTimelineObjectsBlob } from '@sofie-automation/corelib/dist/dataModel/Piece'
1011
import { AdLibPiece } from '@sofie-automation/corelib/dist/dataModel/AdLibPiece'
1112
import { getRundownId } from '../server/api/ingest/lib'
@@ -116,6 +117,7 @@ export function defaultStudio(_id: StudioId): DBStudio {
116117
allowPieceDirectPlay: false,
117118
enableBuckets: false,
118119
enableEvaluationForm: true,
120+
shelfAdlibButtonSize: ShelfButtonSize.LARGE,
119121
}),
120122
_rundownVersionHash: '',
121123
routeSetsWithOverrides: wrapDefaultObject({}),

meteor/server/__tests__/cronjobs.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
StatusCode,
1313
TSR,
1414
} from '@sofie-automation/blueprints-integration'
15+
import { ShelfButtonSize } from '@sofie-automation/shared-lib/dist/core/model/StudioSettings'
1516
import {
1617
PeripheralDeviceType,
1718
PeripheralDeviceCategory,
@@ -590,6 +591,7 @@ describe('cronjobs', () => {
590591
frameRate: 25,
591592
mediaPreviewsUrl: '',
592593
minimumTakeSpan: 1000,
594+
shelfAdlibButtonSize: ShelfButtonSize.LARGE,
593595
}),
594596
routeSetsWithOverrides: newObjectWithOverrides({}),
595597
routeSetExclusivityGroupsWithOverrides: newObjectWithOverrides({}),

meteor/server/api/rest/v1/typeConversion.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ import {
5555
DEFAULT_FALLBACK_PART_DURATION,
5656
} from '@sofie-automation/shared-lib/dist/core/constants'
5757
import { Bucket } from '@sofie-automation/corelib/dist/dataModel/Bucket'
58-
import { ForceQuickLoopAutoNext } from '@sofie-automation/shared-lib/dist/core/model/StudioSettings'
58+
import { ForceQuickLoopAutoNext, ShelfButtonSize } from '@sofie-automation/shared-lib/dist/core/model/StudioSettings'
5959
import { PlaylistSnapshotOptions, SystemSnapshotOptions } from '@sofie-automation/meteor-lib/dist/api/shapshot'
6060

6161
/*
@@ -424,6 +424,7 @@ export function studioSettingsFrom(apiStudioSettings: APIStudioSettings): Comple
424424
allowPieceDirectPlay: apiStudioSettings.allowPieceDirectPlay ?? true, // Backwards compatible
425425
enableBuckets: apiStudioSettings.enableBuckets ?? true, // Backwards compatible
426426
enableEvaluationForm: apiStudioSettings.enableEvaluationForm ?? true, // Backwards compatible
427+
shelfAdlibButtonSize: apiStudioSettings.shelfAdlibButtonSize ?? ShelfButtonSize.LARGE,
427428
mockPieceContentStatus: apiStudioSettings.mockPieceContentStatus,
428429
rundownGlobalPiecesPrepareTime: apiStudioSettings.rundownGlobalPiecesPrepareTime,
429430
}
@@ -452,6 +453,7 @@ export function APIStudioSettingsFrom(settings: IStudioSettings): Complete<APISt
452453
allowPieceDirectPlay: settings.allowPieceDirectPlay,
453454
enableBuckets: settings.enableBuckets,
454455
enableEvaluationForm: settings.enableEvaluationForm,
456+
shelfAdlibButtonSize: settings.shelfAdlibButtonSize,
455457
mockPieceContentStatus: settings.mockPieceContentStatus,
456458
rundownGlobalPiecesPrepareTime: settings.rundownGlobalPiecesPrepareTime,
457459
}

meteor/server/api/studio/api.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import { logger } from '../../logging'
2828
import { DEFAULT_MINIMUM_TAKE_SPAN } from '@sofie-automation/shared-lib/dist/core/constants'
2929
import { UserPermissions } from '@sofie-automation/meteor-lib/dist/userPermissions'
3030
import { assertConnectionHasOneOfPermissions } from '../../security/auth'
31+
import { ShelfButtonSize } from '@sofie-automation/shared-lib/dist/core/model/StudioSettings'
3132

3233
const PERMISSIONS_FOR_MANAGE_STUDIOS: Array<keyof UserPermissions> = ['configure']
3334

@@ -64,6 +65,7 @@ export async function insertStudioInner(newId?: StudioId): Promise<StudioId> {
6465
allowPieceDirectPlay: false,
6566
enableBuckets: true,
6667
enableEvaluationForm: true,
68+
shelfAdlibButtonSize: ShelfButtonSize.LARGE,
6769
}),
6870
_rundownVersionHash: '',
6971
routeSetsWithOverrides: wrapDefaultObject({}),

meteor/server/lib/rest/v1/studios.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { ClientAPI } from '@sofie-automation/meteor-lib/dist/api/client'
22
import { PeripheralDeviceId, StudioId } from '@sofie-automation/corelib/dist/dataModel/Ids'
33
import { Meteor } from 'meteor/meteor'
4+
import { ShelfButtonSize } from '@sofie-automation/shared-lib/dist/core/model/StudioSettings'
45

56
/* *************************************************************************
67
This file contains types and interfaces that are used by the REST API.
@@ -223,6 +224,8 @@ export interface APIStudioSettings {
223224
allowPieceDirectPlay?: boolean
224225
enableBuckets?: boolean
225226
enableEvaluationForm?: boolean
227+
/** Default size of AdLib buttons in the mini shelf */
228+
shelfAdlibButtonSize?: Exclude<ShelfButtonSize, ShelfButtonSize.INHERIT>
226229
mockPieceContentStatus?: boolean
227230
rundownGlobalPiecesPrepareTime?: number
228231
}

meteor/server/migration/0_1_0.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { wrapDefaultObject } from '@sofie-automation/corelib/dist/settings/objec
66
import { ShowStyleVariantId } from '@sofie-automation/corelib/dist/dataModel/Ids'
77
import { ShowStyleBases, ShowStyleVariants, Studios } from '../collections'
88
import { DEFAULT_MINIMUM_TAKE_SPAN } from '@sofie-automation/shared-lib/dist/core/constants'
9+
import { ShelfButtonSize } from '@sofie-automation/shared-lib/dist/core/model/StudioSettings'
910

1011
/**
1112
* This file contains system specific migration steps.
@@ -37,6 +38,7 @@ export const addSteps = addMigrationSteps('0.1.0', [
3738
allowPieceDirectPlay: false,
3839
enableBuckets: true,
3940
enableEvaluationForm: true,
41+
shelfAdlibButtonSize: ShelfButtonSize.LARGE,
4042
}),
4143
mappingsWithOverrides: wrapDefaultObject({}),
4244
blueprintConfigWithOverrides: wrapDefaultObject({}),

meteor/server/migration/X_X_X.ts

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { addMigrationSteps } from './databaseMigration'
22
import { CURRENT_SYSTEM_VERSION } from './currentSystemVersion'
3-
import { RundownPlaylists } from '../collections'
3+
import { RundownPlaylists, Segments, Studios } from '../collections'
44
import { ContainerIdsToObjectWithOverridesMigrationStep } from './steps/X_X_X/ContainerIdsToObjectWithOverridesMigrationStep'
5+
import { ShelfButtonSize } from '@sofie-automation/shared-lib/dist/core/model/StudioSettings'
56

67
/*
78
* **************************************************************************************
@@ -83,5 +84,69 @@ export const addSteps = addMigrationSteps(CURRENT_SYSTEM_VERSION, [
8384
)
8485
},
8586
},
87+
{
88+
id: `studios settings create default shelfAdlibButtonSize=large`,
89+
canBeRunAutomatically: true,
90+
validate: async () => {
91+
const studios = await Studios.findFetchAsync({
92+
'settingsWithOverrides.defaults.shelfAdlibButtonSize': { $exists: false },
93+
})
94+
95+
if (studios.length > 0) return `Some studios are missing settings default shelfAdlibButtonSize`
96+
return false
97+
},
98+
migrate: async () => {
99+
const studios = await Studios.findFetchAsync({
100+
'settingsWithOverrides.defaults.shelfAdlibButtonSize': { $exists: false },
101+
})
102+
103+
for (const studio of studios) {
104+
await Studios.updateAsync(studio._id, {
105+
$set: {
106+
'settingsWithOverrides.defaults.shelfAdlibButtonSize': ShelfButtonSize.LARGE,
107+
},
108+
})
109+
}
110+
},
111+
},
112+
{
113+
id: `segments migrate showShelf to displayMinishelf`,
114+
canBeRunAutomatically: true,
115+
validate: async () => {
116+
const count = await Segments.countDocuments({
117+
showShelf: { $exists: true },
118+
})
119+
if (count > 0) return `There are ${count} Segments with legacy showShelf`
120+
return false
121+
},
122+
migrate: async () => {
123+
// showShelf: true => displayMinishelf: inherit (if missing)
124+
await Segments.mutableCollection.updateAsync(
125+
{
126+
showShelf: true,
127+
displayMinishelf: { $exists: false },
128+
},
129+
{
130+
$set: {
131+
displayMinishelf: ShelfButtonSize.INHERIT,
132+
},
133+
},
134+
{ multi: true }
135+
)
136+
137+
// Always remove legacy field
138+
await Segments.mutableCollection.updateAsync(
139+
{
140+
showShelf: { $exists: true },
141+
},
142+
{
143+
$unset: {
144+
showShelf: 1,
145+
},
146+
},
147+
{ multi: true }
148+
)
149+
},
150+
},
86151
// Add your migration here
87152
])

meteor/server/publications/pieceContentStatusUI/__tests__/checkPieceContentStatus.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
PieceLifespan,
1717
VTContent,
1818
} from '@sofie-automation/blueprints-integration'
19+
import { ShelfButtonSize } from '@sofie-automation/shared-lib/dist/core/model/StudioSettings'
1920
import { Complete, literal } from '@sofie-automation/corelib/dist/lib'
2021
import { MongoMock } from '../../../../__mocks__/mongo'
2122
import {
@@ -556,6 +557,7 @@ describe('lib/mediaObjects', () => {
556557
allowPieceDirectPlay: false,
557558
enableBuckets: false,
558559
enableEvaluationForm: false,
560+
shelfAdlibButtonSize: ShelfButtonSize.LARGE,
559561
}
560562

561563
const mockDefaultStudio = defaultStudio(protectString('studio0'))

packages/blueprints-integration/src/documents/segment.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { UserEditingDefinition, UserEditingProperties } from '../userEditing.js'
2+
import { ShelfButtonSize } from '@sofie-automation/shared-lib/dist/core/model/StudioSettings'
23

34
export enum SegmentDisplayMode {
45
Timeline = 'timeline',
@@ -40,7 +41,19 @@ export interface IBlueprintSegment<TPrivateData = unknown, TPublicData = unknown
4041
/** User-facing identifier that can be used by the User to identify the contents of a segment in the Rundown source system */
4142
identifier?: string
4243

43-
/** Show the minishelf of the segment */
44+
/**
45+
* Control display of the segment minishelf.
46+
* - unset: minishelf is not shown
47+
* - inherit: show minishelf, use studio default size
48+
* - large/compact: show minishelf, force that size
49+
*/
50+
displayMinishelf?: ShelfButtonSize
51+
52+
/**
53+
* @deprecated Use `displayMinishelf` instead.
54+
* - `true`: show minishelf, using studio default size (equivalent to `displayMinishelf: 'inherit'`)
55+
* - `false`: hide minishelf (equivalent to `displayMinishelf: undefined`)
56+
*/
4457
showShelf?: boolean
4558
/** Segment display mode. Default mode is *SegmentDisplayMode.Timeline* */
4659
displayAs?: SegmentDisplayMode

packages/corelib/src/dataModel/Segment.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { SegmentDisplayMode, SegmentTimingInfo } from '@sofie-automation/blueprints-integration'
2+
import { ShelfButtonSize } from '@sofie-automation/shared-lib/dist/core/model/StudioSettings'
23
import { SegmentId, RundownId } from './Ids.js'
34
import { SegmentNote } from './Notes.js'
45
import { CoreUserEditingDefinition, CoreUserEditingProperties } from './UserEditingDefinitions.js'
@@ -34,8 +35,8 @@ export interface DBSegment {
3435
/** User-facing identifier that can be used by the User to identify the contents of a segment in the Rundown source system */
3536
identifier?: string
3637

37-
/** Show the minishelf of the segment */
38-
showShelf?: boolean
38+
/** Control display of the segment minishelf. Unset means hidden. */
39+
displayMinishelf?: ShelfButtonSize
3940
/** Segment display mode. Default mode is *SegmentDisplayMode.Timeline* */
4041
displayAs?: SegmentDisplayMode
4142

0 commit comments

Comments
 (0)