Skip to content

Commit

Permalink
fix: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
permobergedge committed Dec 27, 2024
1 parent 532c885 commit aacb7de
Show file tree
Hide file tree
Showing 8 changed files with 4,718 additions and 2,929 deletions.
7,605 changes: 4,691 additions & 2,914 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions src/app/api/manager/multiviews/[id]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ export async function GET(
status: 403
});
}
const { id } = await params;
try {
return NextResponse.json(await getMultiviewPreset(params.id));
return NextResponse.json(await getMultiviewPreset(id));
} catch (e) {
return new NextResponse(JSON.stringify(e), {
status: 500
Expand All @@ -35,12 +36,13 @@ export async function PUT(
status: 403
});
}
const { id } = await params;
try {
const data = (await request.json()) as PutMultiviewRequest;
return NextResponse.json(
await updateMultiviewForPipeline(
data.pipelineId,
params.id,
id,
data.multiviews
)
);
Expand Down
3 changes: 2 additions & 1 deletion src/app/api/manager/pipelines/[id]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ export async function GET(
status: 403
});
}
const pipeline = await getPipeline(params.id);
const { id } = await params;
const pipeline = await getPipeline(id);
if (!pipeline) {
console.log('Pipeline not found');
}
Expand Down
7 changes: 5 additions & 2 deletions src/app/api/manager/presets/[id]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ export async function GET(
status: 403
});
}
const { id } = await params;

try {
return NextResponse.json(await getPresetByid(params.id));
return NextResponse.json(await getPresetByid(id));
} catch (e) {
return new NextResponse(JSON.stringify(e), {
status: 500
Expand All @@ -34,9 +35,11 @@ export async function PUT(
status: 403
});
}
const { id } = await params;

try {
const body = (await request.json()) as PresetWithId;
const prod = await putPreset(params.id, body);
const prod = await putPreset(id, body);
return new NextResponse(JSON.stringify(prod), { status: 200 });
} catch (error) {
Log().warn('Could not update preset', error);
Expand Down
9 changes: 5 additions & 4 deletions src/app/api/manager/streams/[id]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ export async function DELETE(
}
const body = await request.json();
const multiview = body.multiview as MultiviewSettings[];
const { id } = await params;
try {
await deleteStream(params.id).catch((e) => {
Log().error(`Failed to delete stream: ${params.id}: ${e.message}`);
throw `Failed to delete stream: ${params.id}: ${e.message}`;
await deleteStream(id).catch((e) => {
Log().error(`Failed to delete stream: ${id}: ${e.message}`);
throw `Failed to delete stream: ${id}: ${e.message}`;
});
if (!multiview || multiview.length === 0) {
return new NextResponse(
Expand Down Expand Up @@ -60,7 +61,7 @@ export async function DELETE(
{
step: 'delete_stream',
success: false,
message: `Failed to delete stream: ${params.id}: ${e}`
message: `Failed to delete stream: ${id}: ${e}`
}
],
error: 'Failed to remove stream properly'
Expand Down
10 changes: 7 additions & 3 deletions src/components/modal/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,22 @@ import { Modal as BaseModal } from '@mui/base';

type BaseModalProps = {
open: boolean;
forwardRef?: LegacyRef<HTMLDivElement> | null;
//forwardRef?: LegacyRef<HTMLDivElement> | null;
outsideClick: () => void;
};

export type ModalProps = BaseModalProps & PropsWithChildren;

export function Modal({ open, children, outsideClick }: ModalProps) {
const element = useRef<HTMLDivElement | null>(null);
//const childrenRef = useRef(children);
const openRef = useRef(open);
//const outsideClickRef = useRef(outsideClick);

useEffect(() => {
const handleClickOutside = (event: MouseEvent) => {
if (element.current && !element.current.contains(event.target as Node)) {
outsideClick();
outsideClick;
}
};

Expand All @@ -32,7 +36,7 @@ export function Modal({ open, children, outsideClick }: ModalProps) {
open={open}
>
<div
ref={element}
ref={element.current}
className="bg-container text-p p-4 shadow-xl rounded m-2"
>
{children}
Expand Down
4 changes: 3 additions & 1 deletion src/components/modal/StopModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Modal } from './Modal';
import { Loader } from '../loader/Loader';
import { StopProductionStatus } from '../../interfaces/production';
import StopProductionFeed from '../startProduction/StopProductionFeed';
import { useRef } from 'react';

type DeleteModalProps = {
name: string;
Expand All @@ -24,8 +25,9 @@ export function StopModal({
stopStatus
}: DeleteModalProps) {
const t = useTranslate();
const cancel = useRef(onCancel);
return (
<Modal open={open} outsideClick={onCancel}>
<Modal open={open} outsideClick={cancel}>
<div className="text-center">
<h1 className="text-xl mb-2">
{stopStatus && stopStatus.success
Expand Down
3 changes: 1 addition & 2 deletions src/components/productionsList/ProductionsListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ export function ProductionsListItem({ production }: ProductionListItemProps) {
useState<StartProductionStatus>();
const [stopProductionStatus, setStopProductionStatus] =
useState<StopProductionStatus>();
const [deleteMonitoring] = useDeleteMonitoring();
const [stopModalOpen, setStopModalOpen] = useState(false);
const [startErrorModalOpen, setStartErrorModalOpen] = useState(false);
const putProduction = usePutProduction();
Expand Down Expand Up @@ -91,7 +90,7 @@ export function ProductionsListItem({ production }: ProductionListItemProps) {
}
}
})
.catch((error) => {
.catch(() => {
setStartProductionStatus({
success: false,
steps: [{ step: 'start', success: false }]
Expand Down

0 comments on commit aacb7de

Please sign in to comment.