Skip to content

Commit c45aac2

Browse files
committed
wip
1 parent df24bf0 commit c45aac2

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

packages/meteor-lib/src/triggers/actionFactory.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ interface PlainStudioContext {
6464
showStyleBase: DBShowStyleBase
6565
}
6666

67-
type PlainActionContext = XOR<PlainPlaylistContext, PlainStudioContext>
67+
export type PlainActionContext = XOR<PlainPlaylistContext, PlainStudioContext>
6868

6969
export type ActionContext = XOR<ReactivePlaylistActionContext, PlainActionContext>
7070

@@ -89,10 +89,7 @@ export interface ExecutableAction {
8989
* @extends {ExecutableAction}
9090
*/
9191
interface PreviewableAction extends ExecutableAction {
92-
preview: (
93-
ctx: ReactivePlaylistActionContext,
94-
computation: TriggerTrackerComputation | null
95-
) => Promise<IWrappedAdLib[]>
92+
preview: (ctx: ActionContext, computation: TriggerTrackerComputation | null) => Promise<IWrappedAdLib[]>
9693
}
9794

9895
interface ExecutableAdLibAction extends PreviewableAction {
@@ -156,6 +153,7 @@ function createAdLibAction(
156153
return {
157154
action: PlayoutActions.adlib,
158155
preview: async (ctx, computation) => {
156+
console.log('vv', ctx)
159157
const innerCtx = await createRundownPlaylistContext(computation, triggersContext, ctx, filterChain)
160158

161159
if (innerCtx) {

packages/webui/src/client/ui/Settings/components/triggeredActions/TriggeredActionEntry.tsx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ import { useTracker, useTrackerAsyncTest } from '../../../../lib/ReactMeteorData
1414
import { ActionEditor } from './actionEditors/ActionEditor'
1515
import { OutputLayers, SourceLayers } from '@sofie-automation/corelib/dist/dataModel/ShowStyleBase'
1616
import { flatten, getRandomString } from '../../../../lib/tempLib'
17-
import { createAction, isPreviewableAction } from '@sofie-automation/meteor-lib/dist/triggers/actionFactory'
17+
import {
18+
createAction,
19+
isPreviewableAction,
20+
PlainActionContext,
21+
} from '@sofie-automation/meteor-lib/dist/triggers/actionFactory'
1822
import { PreviewContext } from './TriggeredActionsEditor'
1923
import { IWrappedAdLib } from '@sofie-automation/meteor-lib/dist/triggers/actionFilterChainCompilers'
2024
import { RundownUtils } from '../../../../lib/rundown'
@@ -193,12 +197,16 @@ export const TriggeredActionEntry: React.FC<IProps> = React.memo(function Trigge
193197
const ctx = previewContext
194198
if (!ctx || !ctx.rundownPlaylist) return []
195199

200+
const actionCtx = ctx as PlainActionContext
201+
202+
console.log('aa,', computation, ctx, executableActions)
203+
196204
return flatten(
197205
await Promise.all(
198-
executableActions.map(
199-
async (action): Promise<IWrappedAdLib[]> =>
200-
isPreviewableAction(action) ? action.preview(ctx as any, triggerComputation) : []
201-
)
206+
executableActions.map(async (action): Promise<IWrappedAdLib[]> => {
207+
console.log('check', action, isPreviewableAction(action))
208+
return isPreviewableAction(action) ? action.preview(actionCtx, triggerComputation) : []
209+
})
202210
)
203211
)
204212
} catch (e) {

0 commit comments

Comments
 (0)