Skip to content

Commit

Permalink
feat(ui): Pass Evaluator job config to the ORT run
Browse files Browse the repository at this point in the history
At this stage, when the Evaluator job is enabled, only pass an empty
job config to see whether the Evaluator runs successfully.

Signed-off-by: Jyrki Keisala <[email protected]>
  • Loading branch information
Etsija authored and mnonnenmacher committed May 22, 2024
1 parent 84447e2 commit aeaa0ba
Showing 1 changed file with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ const formSchema = z.object({
skipConcluded: z.boolean(),
skipExcluded: z.boolean(),
}),
evaluator: z.object({
enabled: z.boolean(),
}),
reporter: z.object({
enabled: z.boolean(),
formats: z.array(z.string()),
Expand Down Expand Up @@ -192,6 +195,9 @@ const CreateRunPage = () => {
skipConcluded: true,
skipExcluded: true,
},
evaluator: {
enabled: true,
},
reporter: {
enabled: true,
formats: ['ortresult', 'WebApp'],
Expand All @@ -201,6 +207,11 @@ const CreateRunPage = () => {
});

async function onSubmit(values: z.infer<typeof formSchema>) {
// In ORT Server, running or not running a job for and ORT Run is decided
// based on the presence or absence of the corresponding job configuration
// in the request body. If a job is disabled in the UI, we pass "undefined"
// as the configuration for that job in the request body, in effect leaving
// it empty, and thus disabling the job.
const analyzerConfig = values.jobConfigs.analyzer.enabled
? {
allowDynamicVersions: values.jobConfigs.analyzer.allowDynamicVersions,
Expand All @@ -216,6 +227,9 @@ const CreateRunPage = () => {
skipExcluded: values.jobConfigs.scanner.skipExcluded,
}
: undefined;
const evaluatorConfig = values.jobConfigs.evaluator.enabled
? {}
: undefined;
const reporterConfig = values.jobConfigs.reporter.enabled
? {
formats: values.jobConfigs.reporter.formats,
Expand All @@ -229,6 +243,7 @@ const CreateRunPage = () => {
jobConfigs: {
analyzer: analyzerConfig,
scanner: scannerConfig,
evaluator: evaluatorConfig,
reporter: reporterConfig,
},
},
Expand Down Expand Up @@ -440,6 +455,29 @@ const CreateRunPage = () => {
</AccordionItem>
</div>

{/* Evaluator job */}
<div className="flex flex-row align-middle">
<FormField
control={form.control}
name="jobConfigs.evaluator.enabled"
render={({ field }) => (
<FormControl>
<Switch
className="data-[state=checked]:bg-green-500 mr-4 my-4"
checked={field.value}
onCheckedChange={field.onChange}
/>
</FormControl>
)}
/>
<AccordionItem value="evaluator" className="flex-1">
<AccordionTrigger>Evaluator</AccordionTrigger>
<AccordionContent>
No job configurations yet implemented for Evaluator.
</AccordionContent>
</AccordionItem>
</div>

{/* Reporter job */}
<div className="flex flex-row align-middle">
<FormField
Expand Down

0 comments on commit aeaa0ba

Please sign in to comment.