Skip to content

Commit

Permalink
fix: sources not being removed from pipeline (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
Saelmala authored Nov 6, 2024
1 parent b27d2ac commit 92e1109
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/app/production/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ export default function ProductionConfiguration({ params }: PageProps) {
}
};

const handleRemoveSource = async () => {
const handleRemoveSource = async (ingestSource?: SourceWithId) => {
if (productionSetup && productionSetup.isActive && selectedSourceRef) {
const multiviews =
productionSetup.production_settings.pipelines[0].multiviews;
Expand Down Expand Up @@ -945,7 +945,19 @@ export default function ProductionConfiguration({ params }: PageProps) {
}
}

const updatedSetup = removeSetupItem(selectedSourceRef, productionSetup);
const ingestSourceId =
ingestSource !== undefined
? await getIngestSourceId(
ingestSource.ingest_name,
ingestSource.ingest_source_name
)
: undefined;

const updatedSetup = removeSetupItem(
selectedSourceRef,
productionSetup,
ingestSourceId
);

if (!updatedSetup) return;
updateSourceInputSlotOnMultiviewLayouts(updatedSetup).then((result) => {
Expand All @@ -954,6 +966,7 @@ export default function ProductionConfiguration({ params }: PageProps) {
updateMultiview(selectedSourceRef, result);
setRemoveSourceModal(false);
setSelectedSourceRef(undefined);
setSelectedSource(undefined);
});
}
};
Expand Down Expand Up @@ -1096,6 +1109,7 @@ export default function ProductionConfiguration({ params }: PageProps) {
ingestSource?: ISource
) => {
if (productionSetup && productionSetup.isActive) {
setSelectedSource(ingestSource);
setSelectedSourceRef(source);
setRemoveSourceModal(true);
} else if (productionSetup) {
Expand Down Expand Up @@ -1133,7 +1147,7 @@ export default function ProductionConfiguration({ params }: PageProps) {
name={selectedSourceRef.label}
open={removeSourceModal}
onAbort={handleAbortRemoveSource}
onConfirm={handleRemoveSource}
onConfirm={() => handleRemoveSource(selectedSource)}
status={deleteSourceStatus}
loading={
loadingDeleteStream ||
Expand Down

0 comments on commit 92e1109

Please sign in to comment.