Skip to content

Commit 9b78783

Browse files
authored
[ViPPET] Pipeline editor variants (open-edge-platform#1811)
1 parent 5967d1a commit 9b78783

File tree

16 files changed

+1594
-609
lines changed

16 files changed

+1594
-609
lines changed

tools/visual-pipeline-and-platform-evaluation-tool/ui/src/api/api.generated.ts

Lines changed: 90 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -259,14 +259,36 @@ const injectedRtkApi = api
259259
}),
260260
invalidatesTags: ["pipelines"],
261261
}),
262+
convertAdvancedToSimple: build.mutation<
263+
ConvertAdvancedToSimpleApiResponse,
264+
ConvertAdvancedToSimpleApiArg
265+
>({
266+
query: (queryArg) => ({
267+
url: `/pipelines/${queryArg.pipelineId}/variants/${queryArg.variantId}/convert-to-simple`,
268+
method: "POST",
269+
body: queryArg.pipelineGraph,
270+
}),
271+
invalidatesTags: ["pipelines"],
272+
}),
273+
convertSimpleToAdvanced: build.mutation<
274+
ConvertSimpleToAdvancedApiResponse,
275+
ConvertSimpleToAdvancedApiArg
276+
>({
277+
query: (queryArg) => ({
278+
url: `/pipelines/${queryArg.pipelineId}/variants/${queryArg.variantId}/convert-to-advanced`,
279+
method: "POST",
280+
body: queryArg.pipelineGraph,
281+
}),
282+
invalidatesTags: ["pipelines"],
283+
}),
262284
runPerformanceTest: build.mutation<
263285
RunPerformanceTestApiResponse,
264286
RunPerformanceTestApiArg
265287
>({
266288
query: (queryArg) => ({
267289
url: `/tests/performance`,
268290
method: "POST",
269-
body: queryArg.performanceTestSpecInput,
291+
body: queryArg.performanceTestSpec,
270292
}),
271293
invalidatesTags: ["tests"],
272294
}),
@@ -277,7 +299,7 @@ const injectedRtkApi = api
277299
query: (queryArg) => ({
278300
url: `/tests/density`,
279301
method: "POST",
280-
body: queryArg.densityTestSpecInput,
302+
body: queryArg.densityTestSpec,
281303
}),
282304
invalidatesTags: ["tests"],
283305
}),
@@ -401,8 +423,7 @@ export type CreatePipelineApiArg = {
401423
pipelineDefinition: PipelineDefinition;
402424
};
403425
export type ValidatePipelineApiResponse =
404-
/** status 200 Successful Response */
405-
any | /** status 202 Pipeline validation started */ ValidationJobResponse;
426+
/** status 202 Pipeline validation started */ ValidationJobResponse;
406427
export type ValidatePipelineApiArg = {
407428
pipelineValidationInput: PipelineValidation2;
408429
};
@@ -423,8 +444,7 @@ export type DeletePipelineApiArg = {
423444
pipelineId: string;
424445
};
425446
export type OptimizeVariantApiResponse =
426-
/** status 200 Successful Response */
427-
any | /** status 202 Variant optimization started */ OptimizationJobResponse;
447+
/** status 202 Variant optimization started */ OptimizationJobResponse;
428448
export type OptimizeVariantApiArg = {
429449
pipelineId: string;
430450
variantId: string;
@@ -449,15 +469,29 @@ export type UpdateVariantApiArg = {
449469
variantId: string;
450470
variantUpdate: VariantUpdate;
451471
};
472+
export type ConvertAdvancedToSimpleApiResponse =
473+
/** status 200 Converted simple graph */ PipelineGraph;
474+
export type ConvertAdvancedToSimpleApiArg = {
475+
pipelineId: string;
476+
variantId: string;
477+
pipelineGraph: PipelineGraph;
478+
};
479+
export type ConvertSimpleToAdvancedApiResponse =
480+
/** status 200 Converted advanced graph */ PipelineGraph;
481+
export type ConvertSimpleToAdvancedApiArg = {
482+
pipelineId: string;
483+
variantId: string;
484+
pipelineGraph: PipelineGraph;
485+
};
452486
export type RunPerformanceTestApiResponse =
453487
/** status 202 Performance test job created */ TestJobResponse;
454488
export type RunPerformanceTestApiArg = {
455-
performanceTestSpecInput: PerformanceTestSpec2;
489+
performanceTestSpec: PerformanceTestSpec;
456490
};
457491
export type RunDensityTestApiResponse =
458492
/** status 202 Density test job created */ TestJobResponse;
459493
export type RunDensityTestApiArg = {
460-
densityTestSpecInput: DensityTestSpec2;
494+
densityTestSpec: DensityTestSpec;
461495
};
462496
export type GetVideosApiResponse =
463497
/** status 200 Successful Response */ Video[];
@@ -517,6 +551,8 @@ export type ValidationError = {
517551
loc: (string | number)[];
518552
msg: string;
519553
type: string;
554+
input?: any;
555+
ctx?: object;
520556
};
521557
export type HttpValidationError = {
522558
detail?: ValidationError[];
@@ -558,46 +594,11 @@ export type PerformanceJobStatus = {
558594
[key: string]: string;
559595
} | null;
560596
};
561-
export type GraphInline = {
562-
source?: "graph";
563-
/** Inline pipeline graph to use for the test. */
564-
pipeline_graph: PipelineGraph;
565-
};
566-
export type VariantReference = {
567-
source?: "variant";
568-
/** ID of the pipeline containing the variant. */
569-
pipeline_id: string;
570-
/** ID of the variant within the pipeline. */
571-
variant_id: string;
572-
};
573-
export type PipelinePerformanceSpec = {
574-
/** Graph source - either a reference to existing variant or inline graph. */
575-
pipeline:
576-
| ({
577-
source: "graph";
578-
} & GraphInline)
579-
| ({
580-
source: "variant";
581-
} & VariantReference);
582-
/** Number of parallel streams for this pipeline. */
583-
streams?: number;
584-
};
585-
export type OutputMode = "disabled" | "file" | "live_stream";
586-
export type ExecutionConfig = {
587-
/** Mode for pipeline output generation. */
588-
output_mode?: OutputMode;
589-
/** Maximum runtime in seconds (0 = run until EOS, >0 = time limit with looping for live_stream/disabled). */
590-
max_runtime?: number;
591-
};
592-
export type PerformanceTestSpec = {
593-
/** List of pipelines with number of streams for each. */
594-
pipeline_performance_specs: PipelinePerformanceSpec[];
595-
/** Execution configuration for output and runtime. */
596-
execution_config?: ExecutionConfig;
597-
};
598597
export type PerformanceJobSummary = {
599598
id: string;
600-
request: PerformanceTestSpec;
599+
request: {
600+
[key: string]: any;
601+
};
601602
};
602603
export type DensityJobStatus = {
603604
id: string;
@@ -613,29 +614,11 @@ export type DensityJobStatus = {
613614
} | null;
614615
error_message: string | null;
615616
};
616-
export type PipelineDensitySpec = {
617-
/** Graph source - either a reference to existing variant or inline graph. */
618-
pipeline:
619-
| ({
620-
source: "graph";
621-
} & GraphInline)
622-
| ({
623-
source: "variant";
624-
} & VariantReference);
625-
/** Relative share of total streams for this pipeline (percentage). */
626-
stream_rate?: number;
627-
};
628-
export type DensityTestSpec = {
629-
/** Minimum acceptable FPS per stream. */
630-
fps_floor: number;
631-
/** List of pipelines with relative stream_rate percentages that must sum to 100. */
632-
pipeline_density_specs: PipelineDensitySpec[];
633-
/** Execution configuration for output and runtime. */
634-
execution_config?: ExecutionConfig;
635-
};
636617
export type DensityJobSummary = {
637618
id: string;
638-
request: DensityTestSpec;
619+
request: {
620+
[key: string]: any;
621+
};
639622
};
640623
export type OptimizationType = "preprocess" | "optimize";
641624
export type OptimizationJobState =
@@ -780,46 +763,75 @@ export type TestJobResponse = {
780763
/** Identifier of the created test job. */
781764
job_id: string;
782765
};
783-
export type GraphInline2 = {
766+
export type PipelineDescriptionSource = {
767+
source?: "description";
768+
/** GStreamer pipeline string with elements separated by '!'. */
769+
pipeline_description: string;
770+
/** Optional custom identifier for pipeline description. Must be URL-safe. */
771+
description_id?: string | null;
772+
};
773+
export type GraphInline = {
784774
source?: "graph";
775+
/** Optional custom identifier for inline graph. Must be URL-safe. */
776+
graph_id?: string | null;
785777
/** Inline pipeline graph to use for the test. */
786778
pipeline_graph: PipelineGraph;
787779
};
788-
export type PipelinePerformanceSpec2 = {
780+
export type VariantReference = {
781+
source?: "variant";
782+
/** ID of the pipeline containing the variant. */
783+
pipeline_id: string;
784+
/** ID of the variant within the pipeline. */
785+
variant_id: string;
786+
};
787+
export type PipelinePerformanceSpec = {
789788
/** Graph source - either a reference to existing variant or inline graph. */
790789
pipeline:
790+
| ({
791+
source: "description";
792+
} & PipelineDescriptionSource)
791793
| ({
792794
source: "graph";
793-
} & GraphInline2)
795+
} & GraphInline)
794796
| ({
795797
source: "variant";
796798
} & VariantReference);
797799
/** Number of parallel streams for this pipeline. */
798800
streams?: number;
799801
};
800-
export type PerformanceTestSpec2 = {
802+
export type OutputMode = "disabled" | "file" | "live_stream";
803+
export type ExecutionConfig = {
804+
/** Mode for pipeline output generation. */
805+
output_mode?: OutputMode;
806+
/** Maximum runtime in seconds (0 = run until EOS, >0 = time limit with looping for live_stream/disabled). */
807+
max_runtime?: number;
808+
};
809+
export type PerformanceTestSpec = {
801810
/** List of pipelines with number of streams for each. */
802-
pipeline_performance_specs: PipelinePerformanceSpec2[];
811+
pipeline_performance_specs: PipelinePerformanceSpec[];
803812
/** Execution configuration for output and runtime. */
804813
execution_config?: ExecutionConfig;
805814
};
806-
export type PipelineDensitySpec2 = {
815+
export type PipelineDensitySpec = {
807816
/** Graph source - either a reference to existing variant or inline graph. */
808817
pipeline:
818+
| ({
819+
source: "description";
820+
} & PipelineDescriptionSource)
809821
| ({
810822
source: "graph";
811-
} & GraphInline2)
823+
} & GraphInline)
812824
| ({
813825
source: "variant";
814826
} & VariantReference);
815827
/** Relative share of total streams for this pipeline (percentage). */
816828
stream_rate?: number;
817829
};
818-
export type DensityTestSpec2 = {
830+
export type DensityTestSpec = {
819831
/** Minimum acceptable FPS per stream. */
820832
fps_floor: number;
821833
/** List of pipelines with relative stream_rate percentages that must sum to 100. */
822-
pipeline_density_specs: PipelineDensitySpec2[];
834+
pipeline_density_specs: PipelineDensitySpec[];
823835
/** Execution configuration for output and runtime. */
824836
execution_config?: ExecutionConfig;
825837
};
@@ -913,6 +925,8 @@ export const {
913925
useCreateVariantMutation,
914926
useDeleteVariantMutation,
915927
useUpdateVariantMutation,
928+
useConvertAdvancedToSimpleMutation,
929+
useConvertSimpleToAdvancedMutation,
916930
useRunPerformanceTestMutation,
917931
useRunDensityTestMutation,
918932
useGetVideosQuery,

tools/visual-pipeline-and-platform-evaluation-tool/ui/src/components/PageTitle.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { useLocation, useParams } from "react-router";
1+
import { useLocation } from "react-router";
22
import { menuItems } from "@/config/navigation.ts";
3-
import { PipelineNameEdit } from "@/features/pipelines/PipelineNameEdit.tsx";
43

54
const getPageTitle = (pathname: string): string => {
65
const exactMatch = menuItems.find((item) => item.url === pathname);
@@ -17,11 +16,6 @@ const getPageTitle = (pathname: string): string => {
1716

1817
export const PageTitle = () => {
1918
const location = useLocation();
20-
const params = useParams();
21-
22-
if (location.pathname.startsWith("/pipelines/") && params.id) {
23-
return <PipelineNameEdit pipelineId={params.id} />;
24-
}
2519

2620
const pageTitle = getPageTitle(location.pathname);
2721
return <>{pageTitle}</>;
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import {
2+
AlertDialog,
3+
AlertDialogAction,
4+
AlertDialogCancel,
5+
AlertDialogContent,
6+
AlertDialogDescription,
7+
AlertDialogFooter,
8+
AlertDialogHeader,
9+
AlertDialogTitle,
10+
} from "@/components/ui/alert-dialog";
11+
12+
interface UnsavedChangesDialogProps {
13+
open: boolean;
14+
onOpenChange: (open: boolean) => void;
15+
onDiscard: () => void;
16+
title?: string;
17+
description?: string;
18+
}
19+
20+
export const UnsavedChangesDialog = ({
21+
open,
22+
onOpenChange,
23+
onDiscard,
24+
title = "Unsaved Changes",
25+
description = "You have unsaved changes to this pipeline. Do you want to discard them?",
26+
}: UnsavedChangesDialogProps) => {
27+
return (
28+
<AlertDialog open={open} onOpenChange={onOpenChange}>
29+
<AlertDialogContent className="top-[20%] translate-y-0">
30+
<AlertDialogHeader>
31+
<AlertDialogTitle>{title}</AlertDialogTitle>
32+
<AlertDialogDescription>{description}</AlertDialogDescription>
33+
</AlertDialogHeader>
34+
<AlertDialogFooter>
35+
<AlertDialogCancel>Cancel</AlertDialogCancel>
36+
<AlertDialogAction onClick={onDiscard} variant="destructive">
37+
Discard Changes
38+
</AlertDialogAction>
39+
</AlertDialogFooter>
40+
</AlertDialogContent>
41+
</AlertDialog>
42+
);
43+
};

tools/visual-pipeline-and-platform-evaluation-tool/ui/src/config/navigation.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ export type NavigationItem = {
3030

3131
export const menuItems: Array<NavigationItem> = [
3232
{ url: "/", title: "Dashboard", icon: Home },
33+
{
34+
url: "/pipelines/",
35+
title: "Pipeline Editor",
36+
hidden: true,
37+
},
3338
{ url: "/pipelines", title: "Pipelines", icon: GitFork },
3439
{ url: "/models", title: "Models", icon: Cpu },
3540
{ url: "/videos", title: "Videos", icon: Film },
@@ -40,11 +45,6 @@ export const menuItems: Array<NavigationItem> = [
4045
},
4146
{ url: "/tests/density", title: "Density", icon: Grid3x3 },
4247
{ url: "/jobs", title: "Jobs", icon: ListTodo },
43-
{
44-
url: "/pipelines/",
45-
title: "Pipeline Editor",
46-
hidden: true,
47-
},
4848
];
4949

5050
export const routeConfig: Array<RouteObject> = [

0 commit comments

Comments
 (0)