Skip to content

Commit

Permalink
fix: errors with getting alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
Saelmala committed Nov 14, 2024
1 parent f3361d6 commit d3177e4
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 21 deletions.
4 changes: 2 additions & 2 deletions src/api/manager/productions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ function deleteMonitoring(db: Db, productionId: string) {
export async function getProductionPipelineSourceAlignment(
productionId: string,
pipelineId: string,
ingestName: string,
ingestSourceName: string
ingestSourceName: string,
ingestName: string
) {
const production = await getProduction(productionId);

Expand Down
7 changes: 6 additions & 1 deletion src/app/production/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ export default function ProductionConfiguration({ params }: PageProps) {

const [updateStream, loading] = useUpdateStream();

const [getIngestSourceId] = useIngestSourceId();

const putProductionPipelineSourceAlignmentAndLatency =
usePutProductionPipelineSourceAlignmentAndLatency();

Expand Down Expand Up @@ -351,7 +353,6 @@ export default function ProductionConfiguration({ params }: PageProps) {

const handleSetPipelineSourceSettings = async (
source: ISource,
sourceId: number,
data: {
pipeline_uuid: string;
stream_uuid: string;
Expand Down Expand Up @@ -411,6 +412,10 @@ export default function ProductionConfiguration({ params }: PageProps) {
const sourceToDeleteFrom = productionSetup.sources.find((source) =>
source.stream_uuids?.includes(streamUuids[0])
);
const sourceId = await getIngestSourceId(
source.ingest_name,
source.ingest_source_name
);
deleteStream(streamUuids, productionSetup, sourceId)
.then(() => {
delete sourceToDeleteFrom?.stream_uuids;
Expand Down
18 changes: 2 additions & 16 deletions src/components/modal/ConfigureAlignmentLatencyModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ type ConfigureAlignmentModalProps = {
onAbort: () => void;
onConfirm: (
source: ISource,
sourceId: number,
data: {
pipeline_uuid: string;
stream_uuid: string;
Expand Down Expand Up @@ -67,7 +66,6 @@ export function ConfigureAlignmentLatencyModal({
const [alignments, setAlignments] = useState<Settings>({});
const [latencies, setLatencies] = useState<Settings>({});
const previousLatenciesRef = useRef<Settings>({});
const [sourceId, setSourceId] = useState<number>(0);
const [showRestartStreamModal, setShowRestartStreamModal] =
useState<boolean>(false);
const [inputErrors, setInputErrors] = useState<Record<string, boolean>>({});
Expand Down Expand Up @@ -98,17 +96,6 @@ 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 @@ -221,14 +208,13 @@ export function ConfigureAlignmentLatencyModal({
if (shouldRestart) {
onConfirm(
source,
sourceId,
alignmentData,
true,
sourceStreams.map((stream) => stream.stream_uuid)
);
handleCloseModal();
} else {
onConfirm(source, sourceId, alignmentData);
onConfirm(source, alignmentData);
if (!latenciesChanged) {
handleCloseModal();
}
Expand All @@ -250,7 +236,7 @@ export function ConfigureAlignmentLatencyModal({
setInputErrors({});
});

onConfirm(source, sourceId, alignmentData);
onConfirm(source, alignmentData);
handleCloseModal();
}
};
Expand Down
1 change: 0 additions & 1 deletion src/components/sourceCard/SourceCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ type SourceCardProps = {
onSelectingText: (bool: boolean) => void;
onConfirm: (
source: ISource,
sourceId: number,
data: {
pipeline_uuid: string;
stream_uuid: string;
Expand Down
1 change: 0 additions & 1 deletion src/components/sourceCards/SourceCards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export default function SourceCards({
onSourceRemoval: (source: SourceReference, ingestSource?: ISource) => void;
onConfirm: (
source: ISource,
sourceId: number,
data: {
pipeline_uuid: string;
stream_uuid: string;
Expand Down

0 comments on commit d3177e4

Please sign in to comment.