Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/make sure source id is correct #86

Merged
merged 2 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ export async function GET(
}

try {
const ingestUuid = await getUuidFromIngestName(params.ingest_name);
const ingestUuid = await getUuidFromIngestName(params.ingest_name, false);
const sourceId = ingestUuid
? await getSourceIdFromSourceName(ingestUuid, params.ingest_source_name)
? await getSourceIdFromSourceName(
ingestUuid,
params.ingest_source_name,
false
)
: 0;
return new NextResponse(JSON.stringify(sourceId), { status: 200 });
} catch (error) {
Expand Down
15 changes: 13 additions & 2 deletions src/components/modal/ConfigureAlignmentLatencyModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Button } from '../button/Button';
import { Loader } from '../loader/Loader';
import { ISource } from '../../hooks/useDragableItems';
import { useState, useEffect, useRef } from 'react';
import { useIngestStreams } from '../../hooks/ingests';
import { useIngestStreams, useIngestSourceId } from '../../hooks/ingests';
import { useGetProductionSourceAlignmentAndLatency } from '../../hooks/productions';
import {
ResourcesCompactPipelineResponse,
Expand Down Expand Up @@ -77,6 +77,7 @@ export function ConfigureAlignmentLatencyModal({
const getProductionSourceAlignmentAndLatency =
useGetProductionSourceAlignmentAndLatency();
const [pipelines] = GetPipelines();
const [getIngestSourceId] = useIngestSourceId();

useEffect(() => {
setAvailablePipelines(pipelines);
Expand All @@ -97,6 +98,17 @@ export function ConfigureAlignmentLatencyModal({
}
}, [pipelinesAreSelected, latencies, alignments]);

useEffect(() => {
const fetchSourceId = async () => {
const id = await getIngestSourceId(
source.ingest_name,
source.ingest_source_name
);
setSourceId(id);
};
fetchSourceId();
}, [source]);

useEffect(() => {
const fetchStreams = async () => {
try {
Expand Down Expand Up @@ -130,7 +142,6 @@ export function ConfigureAlignmentLatencyModal({
newAlignments[stream.pipeline_uuid] = 0;
newLatencies[stream.pipeline_uuid] = 0;
}
setSourceId(stream.source_id);
}
} else if (availablePipelines) {
for (const pipeline of availablePipelines) {
Expand Down
3 changes: 2 additions & 1 deletion src/components/sourceCard/SourceCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ export default function SourceCard({

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

const updateText = (event: ChangeEvent<HTMLInputElement>) => {
Expand Down
Loading