Skip to content

Commit

Permalink
Merge branch 'main' into fix/srt-metadata-update-on-active
Browse files Browse the repository at this point in the history
  • Loading branch information
malmen237 authored Nov 4, 2024
2 parents e3052b5 + 60bf6fe commit d45bd26
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 12 deletions.
26 changes: 24 additions & 2 deletions src/api/ateliereLive/pipelines/renderingengine/renderingengine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -529,11 +529,33 @@ export async function getPipelineRenderingEngine(
method: 'GET',
headers: {
authorization: getAuthorizationHeader()
},
next: {
revalidate: 0
}
}
);

if (response.ok) {
return await response.json();
try {
return await response.json();
} catch (error) {
console.error('Failed to parse successful JSON response:', error);
throw new Error('Parsing error in successful response.');
}
}

const contentType = response.headers.get('content-type');
const responseText = await response.text();

if (contentType && contentType.includes('application/json')) {
try {
throw JSON.parse(responseText);
} catch (error) {
console.error('Failed to parse JSON error response:', error);
throw new Error(`Failed to parse JSON error response: ${responseText}`);
}
} else {
throw new Error(`Unexpected non-JSON response: ${responseText}`);
}
throw await response.json();
}
16 changes: 9 additions & 7 deletions src/api/manager/workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -378,10 +378,12 @@ export async function stopProduction(
}

for (const source of production.sources) {
for (const stream_uuid of source.stream_uuids || []) {
await deleteStreamByUuid(stream_uuid).catch((error) => {
Log().error('Failed to delete stream! \nError: ', error);
});
if (source.type === 'ingest_source') {
for (const stream_uuid of source.stream_uuids || []) {
await deleteStreamByUuid(stream_uuid).catch((error) => {
Log().error('Failed to delete stream! \nError: ', error);
});
}
}
}

Expand Down Expand Up @@ -441,7 +443,7 @@ export async function stopProduction(
value: {
step: 'remove_pipeline_streams',
success: false,
message: 'Unexpected error occured'
message: `Error occurred when removing streams from pipeline: ${e}`
}
};
} else {
Expand All @@ -464,7 +466,7 @@ export async function stopProduction(
value: {
step: 'remove_pipeline_multiviews',
success: false,
message: 'Unexpected error occured'
message: `Error occurred when removing multiviews from pipeline: ${e}`
}
};
} else {
Expand Down Expand Up @@ -638,7 +640,7 @@ export async function startProduction(
return {
ok: false,
value: [{ step: 'streams', success: false }],
error: 'Could not setup streams: Unexpected error occured'
error: `Could not setup streams: Unexpected error occured: ${e}`
};
}
return {
Expand Down
10 changes: 9 additions & 1 deletion src/app/production/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,16 @@ export default function ProductionConfiguration({ params }: PageProps) {

const memoizedProduction = useMemo(() => productionSetup, [productionSetup]);

const pipelinesAreSelected = productionSetup?.production_settings
? productionSetup?.production_settings.pipelines.some(
(pipeline) => pipeline.pipeline_id === undefined
) === false
: false;

const isAddButtonDisabled =
(selectedValue !== 'HTML' && selectedValue !== 'Media Player') || locked;
(selectedValue !== 'HTML' && selectedValue !== 'Media Player') ||
locked ||
!pipelinesAreSelected;

useEffect(() => {
refreshPipelines();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ export function CreateHtmlModal({
const handleCreate = () => {
let hasError = false;

if (!height || height < 20) {
if (!height || height < 20 || height > 8192) {
setHeightError(true);
hasError = true;
}

if (!width || width < 20) {
if (!width || width < 20 || width > 8192) {
setWidthError(true);
hasError = true;
}
Expand Down

0 comments on commit d45bd26

Please sign in to comment.