Skip to content

Commit 956152c

Browse files
author
Mint de Wit
committed
chore: add mock pieceContentStatus as option
1 parent 9e55968 commit 956152c

File tree

8 files changed

+185
-0
lines changed

8 files changed

+185
-0
lines changed

meteor/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ COPY meteor /opt/core/meteor
3030
COPY scripts /opt/core/scripts
3131
WORKDIR /opt/core/meteor
3232

33+
# remove the dev only assets from the webui output
34+
RUN rm -Rf /opt/core/packages/webui/dist/dev
3335
# move the webui to the correct place
3436
RUN rm -Rf /opt/core/meteor/public
3537
RUN cp -R /opt/core/packages/webui/dist /opt/core/meteor/public

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@ export function studioSettingsFrom(apiStudioSettings: APIStudioSettings): Comple
372372
allowPieceDirectPlay: apiStudioSettings.allowPieceDirectPlay ?? true, // Backwards compatible
373373
enableBuckets: apiStudioSettings.enableBuckets ?? true, // Backwards compatible
374374
enableEvaluationForm: apiStudioSettings.enableEvaluationForm ?? true, // Backwards compatible
375+
mockPieceContentStatus: apiStudioSettings.mockPieceContentStatus,
375376
}
376377
}
377378

@@ -396,6 +397,7 @@ export function APIStudioSettingsFrom(settings: IStudioSettings): Complete<APISt
396397
allowPieceDirectPlay: settings.allowPieceDirectPlay,
397398
enableBuckets: settings.enableBuckets,
398399
enableEvaluationForm: settings.enableEvaluationForm,
400+
mockPieceContentStatus: settings.mockPieceContentStatus,
399401
}
400402
}
401403

meteor/server/publications/pieceContentStatusUI/checkPieceContentStatus.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,27 @@ export async function checkPieceContentStatusAndDependencies(
211211
packageContainerPackageStatuses: [],
212212
}
213213

214+
if (studio.settings.mockPieceContentStatus) {
215+
return [
216+
{
217+
status: PieceStatusCode.OK,
218+
messages: [],
219+
progress: undefined,
220+
221+
freezes: [],
222+
blacks: [],
223+
scenes: [],
224+
225+
thumbnailUrl: undefined,
226+
previewUrl: '/dev/fakePreview.mp4',
227+
228+
packageName: null,
229+
contentDuration: 30 * 1000,
230+
},
231+
pieceDependencies,
232+
]
233+
}
234+
214235
const ignoreMediaStatus = piece.content && piece.content.ignoreMediaObjectStatus
215236
if (!ignoreMediaStatus) {
216237
if (piece.expectedPackages) {

packages/shared-lib/src/core/model/StudioSettings.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,9 @@ export interface IStudioSettings {
8686
* Enable evaluation form - the default behavior is to have evaluation forms.
8787
*/
8888
enableEvaluationForm: boolean
89+
90+
/**
91+
* Override the piece content statuses with fake info - used for developing the UI
92+
*/
93+
mockPieceContentStatus?: boolean
8994
}
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
<!--
2+
This page emulates a MOS plugin (typically) provided by the MAM system that can provide
3+
MOS-items to the UI to be imported into the Blueprints either as Bucket items or in conjunction
4+
with the user-editing features (i.e. drag on top of a part)
5+
-->
6+
7+
<html>
8+
<head>
9+
<style>
10+
:root {
11+
color: white;
12+
}
13+
</style>
14+
</head>
15+
<body>
16+
<h1>Drag&Drop Test page</h1>
17+
18+
<button id="btn" draggable="true">Media Item #1</button>
19+
20+
<script>
21+
const btn = document.getElementById('btn')
22+
btn.addEventListener('dragstart', ({ dataTransfer }) => {
23+
const ncsItem = createNcsItem()
24+
25+
dataTransfer.setData('text', new XMLSerializer().serializeToString(ncsItem))
26+
})
27+
28+
function createNcsItem() {
29+
return objectToXml(
30+
{
31+
ncsItem: {
32+
item: {
33+
itemID: 'OM_2.18516582,10.8570667.23',
34+
itemSlug: 'TEST/SOFIE PKG 1/1519/23/9',
35+
objID: '105.20913908',
36+
objSlug: 'TEST/SOFIE PKG 1/1519/23/9',
37+
objDur: 1315,
38+
objTB: 25,
39+
mosID: 'BIGTED.NBH.BBC.MOS',
40+
mosPlugInID: 'BIGTED.NBH.BBC.MOS',
41+
itemEdDur: 1325,
42+
mosExternalMetadata: {
43+
mosScope: 'PLAYLIST',
44+
mosSchema: '',
45+
mosPayload: {
46+
ModTime: '2024-09-23T14:21:08.905Z',
47+
ModBy: 'ActiveXWeb',
48+
Creator: 'ActiveXWeb',
49+
},
50+
},
51+
},
52+
},
53+
},
54+
'mos'
55+
)
56+
}
57+
58+
function objectToXml(obj, rootName) {
59+
const doc = new Document()
60+
const root = doc.createElement(rootName)
61+
62+
addNodes(obj, root)
63+
64+
doc.appendChild(root)
65+
return doc
66+
}
67+
68+
function addNodes(obj, rootNode) {
69+
const doc = rootNode.ownerDocument
70+
71+
for (const name of Object.keys(obj)) {
72+
const value = obj[name]
73+
74+
if (Array.isArray(value)) {
75+
value.forEach((element) => {
76+
rootNode.appendChild(createNode(name, element, doc))
77+
})
78+
} else if (name.startsWith('@')) {
79+
rootNode.setAttribute(name.substring(1), String(value))
80+
} else {
81+
rootNode.appendChild(createNode(name, value, doc))
82+
}
83+
}
84+
}
85+
86+
function createNode(name, value, doc) {
87+
if (name === '#textContent') {
88+
return doc.createTextNode(String(value))
89+
}
90+
91+
const node = doc.createElement(name)
92+
93+
if (typeof value === 'object' && value !== null) {
94+
addNodes(value, node)
95+
} else {
96+
node.textContent = value
97+
}
98+
99+
return node
100+
}
101+
</script>
102+
</body>
103+
</html>
259 KB
Binary file not shown.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<!--
2+
This page emulates an HTML preview coming from the graphics system to
3+
be rendered inside the Sofie UI as a hover preview.
4+
-->
5+
6+
<html>
7+
<head>
8+
<style>
9+
body {
10+
width: 1920;
11+
height: 1080;
12+
overflow: hidden;
13+
}
14+
15+
#test {
16+
position: absolute;
17+
width: 500px;
18+
height: 80px;
19+
font-size: 2.5em;
20+
background: #fff;
21+
bottom: 120px;
22+
left: 80px;
23+
}
24+
</style>
25+
</head>
26+
<body>
27+
<div id="test">Test Box</div>
28+
29+
<script>
30+
const el = document.getElementById('test')
31+
32+
window.addEventListener('message', (ev) => {
33+
console.log('recv', ev.data)
34+
if (ev.data.event === 'sofie-update') {
35+
el.innerText = ev.data.payload
36+
}
37+
})
38+
</script>
39+
</body>
40+
</html>

packages/webui/src/client/ui/Settings/Studio/Generic.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,18 @@ function StudioSettings({ studio }: { studio: DBStudio }): JSX.Element {
451451
>
452452
{(value, handleUpdate) => <CheckboxControl value={!!value} handleUpdate={handleUpdate} />}
453453
</LabelAndOverridesForCheckbox>
454+
455+
<LabelAndOverridesForCheckbox
456+
label={t('Mock Piece Content Status')}
457+
item={wrappedItem}
458+
itemKey={'mockPieceContentStatus'}
459+
overrideHelper={overrideHelper}
460+
hint={t(
461+
'When enabled, this will override the piece content statuses to have no errors or warnings and display a mock preview. This should only be used for development!'
462+
)}
463+
>
464+
{(value, handleUpdate) => <CheckboxControl value={!!value} handleUpdate={handleUpdate} />}
465+
</LabelAndOverridesForCheckbox>
454466
</>
455467
)
456468
}

0 commit comments

Comments
 (0)