diff --git a/src/app/api/manager/pipelines/[id]/rendering-engine/html/[input_slot]/route.ts b/src/app/api/manager/pipelines/[id]/rendering-engine/html/[input_slot]/[ld_pipeline_id]/route.ts similarity index 81% rename from src/app/api/manager/pipelines/[id]/rendering-engine/html/[input_slot]/route.ts rename to src/app/api/manager/pipelines/[id]/rendering-engine/html/[input_slot]/[ld_pipeline_id]/route.ts index 8e97c1ff..c9ad48d7 100644 --- a/src/app/api/manager/pipelines/[id]/rendering-engine/html/[input_slot]/route.ts +++ b/src/app/api/manager/pipelines/[id]/rendering-engine/html/[input_slot]/[ld_pipeline_id]/route.ts @@ -1,15 +1,16 @@ import { NextRequest, NextResponse } from 'next/server'; -import { isAuthenticated } from '../../../../../../../../api/manager/auth'; -import { deleteHtmlFromPipeline } from '../../../../../../../../api/ateliereLive/pipelines/renderingengine/renderingengine'; -import { MultiviewSettings } from '../../../../../../../../interfaces/multiview'; -import { updateMultiviewForPipeline } from '../../../../../../../../api/ateliereLive/pipelines/multiviews/multiviews'; -import { DeleteRenderingEngineSourceStep } from '../../../../../../../../interfaces/Source'; -import { Result } from '../../../../../../../../interfaces/result'; -import { Log } from '../../../../../../../../api/logger'; +import { isAuthenticated } from '../../../../../../../../../api/manager/auth'; +import { deleteHtmlFromPipeline } from '../../../../../../../../../api/ateliereLive/pipelines/renderingengine/renderingengine'; +import { MultiviewSettings } from '../../../../../../../../../interfaces/multiview'; +import { updateMultiviewForPipeline } from '../../../../../../../../../api/ateliereLive/pipelines/multiviews/multiviews'; +import { DeleteRenderingEngineSourceStep } from '../../../../../../../../../interfaces/Source'; +import { Result } from '../../../../../../../../../interfaces/result'; +import { Log } from '../../../../../../../../../api/logger'; type Params = { id: string; input_slot: number; + ld_pipeline_id: string; }; export async function DELETE( @@ -79,13 +80,15 @@ export async function DELETE( if (!singleMultiview.multiview_id) { throw `The provided multiview settings did not contain any multiview id`; } - return updateMultiviewForPipeline( - params.id, - singleMultiview.multiview_id, - singleMultiview.layout.views - ).catch((e) => { - throw `Error when updating multiview: ${e.message}`; - }); + if (params.id === params.ld_pipeline_id) { + return updateMultiviewForPipeline( + params.id, + singleMultiview.multiview_id, + singleMultiview.layout.views + ).catch((e) => { + throw `Error when updating multiview: ${e.message}`; + }); + } }); await Promise.all(multiviewUpdates); diff --git a/src/app/api/manager/pipelines/[id]/rendering-engine/media/[input_slot]/route.ts b/src/app/api/manager/pipelines/[id]/rendering-engine/media/[input_slot]/[ld_pipeline_id]/route.ts similarity index 76% rename from src/app/api/manager/pipelines/[id]/rendering-engine/media/[input_slot]/route.ts rename to src/app/api/manager/pipelines/[id]/rendering-engine/media/[input_slot]/[ld_pipeline_id]/route.ts index 01e595c3..7ce5b1ef 100644 --- a/src/app/api/manager/pipelines/[id]/rendering-engine/media/[input_slot]/route.ts +++ b/src/app/api/manager/pipelines/[id]/rendering-engine/media/[input_slot]/[ld_pipeline_id]/route.ts @@ -1,15 +1,16 @@ import { NextRequest, NextResponse } from 'next/server'; -import { isAuthenticated } from '../../../../../../../../api/manager/auth'; -import { deleteMediaFromPipeline } from '../../../../../../../../api/ateliereLive/pipelines/renderingengine/renderingengine'; -import { MultiviewSettings } from '../../../../../../../../interfaces/multiview'; -import { updateMultiviewForPipeline } from '../../../../../../../../api/ateliereLive/pipelines/multiviews/multiviews'; -import { DeleteRenderingEngineSourceStep } from '../../../../../../../../interfaces/Source'; -import { Result } from '../../../../../../../../interfaces/result'; -import { Log } from '../../../../../../../../api/logger'; +import { isAuthenticated } from '../../../../../../../../../api/manager/auth'; +import { deleteMediaFromPipeline } from '../../../../../../../../../api/ateliereLive/pipelines/renderingengine/renderingengine'; +import { MultiviewSettings } from '../../../../../../../../../interfaces/multiview'; +import { updateMultiviewForPipeline } from '../../../../../../../../../api/ateliereLive/pipelines/multiviews/multiviews'; +import { DeleteRenderingEngineSourceStep } from '../../../../../../../../../interfaces/Source'; +import { Result } from '../../../../../../../../../interfaces/result'; +import { Log } from '../../../../../../../../../api/logger'; type Params = { id: string; input_slot: number; + ld_pipeline_id: string; }; export async function DELETE( @@ -63,13 +64,15 @@ export async function DELETE( if (!singleMultiview.multiview_id) { throw `The provided multiview settings did not contain any multiview id`; } - return updateMultiviewForPipeline( - params.id, - singleMultiview.multiview_id, - singleMultiview.layout.views - ).catch((e) => { - throw `Error when updating multiview: ${e.message}`; - }); + if (params.id === params.ld_pipeline_id) { + return updateMultiviewForPipeline( + params.id, + singleMultiview.multiview_id, + singleMultiview.layout.views + ).catch((e) => { + throw `Error when updating multiview: ${e.message}`; + }); + } }); await Promise.all(multiviewUpdates); diff --git a/src/hooks/renderingEngine/useDeleteHtmlSource.tsx b/src/hooks/renderingEngine/useDeleteHtmlSource.tsx index fdf29bfc..adf61ffc 100644 --- a/src/hooks/renderingEngine/useDeleteHtmlSource.tsx +++ b/src/hooks/renderingEngine/useDeleteHtmlSource.tsx @@ -30,9 +30,12 @@ export function useDeleteHtmlSource(): CallbackHook< (v) => v.input_slot === inputSlot ); + const ldPipelineId = + production.production_settings.pipelines[0].pipeline_id; + if (!multiviewsToUpdate || multiviewsToUpdate.length === 0) { return fetch( - `/api/manager/pipelines/${pipelineUuid}/rendering-engine/html/${inputSlot}`, + `/api/manager/pipelines/${pipelineUuid}/rendering-engine/html/${inputSlot}/${ldPipelineId}`, { method: 'DELETE', headers: [['x-api-key', `Bearer ${API_SECRET_KEY}`]] @@ -98,7 +101,7 @@ export function useDeleteHtmlSource(): CallbackHook< ); return fetch( - `/api/manager/pipelines/${pipelineUuid}/rendering-engine/html/${inputSlot}`, + `/api/manager/pipelines/${pipelineUuid}/rendering-engine/html/${inputSlot}/${ldPipelineId}`, { method: 'DELETE', headers: [['x-api-key', `Bearer ${API_SECRET_KEY}`]], diff --git a/src/hooks/renderingEngine/useDeleteMediaSource.tsx b/src/hooks/renderingEngine/useDeleteMediaSource.tsx index 5b303f1d..d4e3d286 100644 --- a/src/hooks/renderingEngine/useDeleteMediaSource.tsx +++ b/src/hooks/renderingEngine/useDeleteMediaSource.tsx @@ -30,9 +30,12 @@ export function useDeleteMediaSource(): CallbackHook< (v) => v.input_slot === inputSlot ); + const ldPipelineId = + production.production_settings.pipelines[0].pipeline_id; + if (!multiviewsToUpdate || multiviewsToUpdate.length === 0) { return fetch( - `/api/manager/pipelines/${pipelineUuid}/rendering-engine/media/${inputSlot}`, + `/api/manager/pipelines/${pipelineUuid}/rendering-engine/media/${inputSlot}/${ldPipelineId}`, { method: 'DELETE', headers: [['x-api-key', `Bearer ${API_SECRET_KEY}`]] @@ -98,7 +101,7 @@ export function useDeleteMediaSource(): CallbackHook< ); return fetch( - `/api/manager/pipelines/${pipelineUuid}/rendering-engine/media/${inputSlot}`, + `/api/manager/pipelines/${pipelineUuid}/rendering-engine/media/${inputSlot}/${ldPipelineId}`, { method: 'DELETE', headers: [['x-api-key', `Bearer ${API_SECRET_KEY}`]],