Skip to content

Commit 46f730e

Browse files
committed
feat(ui): Add support for jobConfigs.analyzer.repositoryConfigPath
Resolves #985. Signed-off-by: Jyrki Keisala <[email protected]>
1 parent 5852faf commit 46f730e

File tree

3 files changed

+37
-3
lines changed

3 files changed

+37
-3
lines changed

ui/src/routes/_layout/organizations/$orgId/products/$productId/repositories/$repoId/-components/analyzer-fields.tsx

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ import {
3131
FormField,
3232
FormItem,
3333
FormLabel,
34+
FormMessage,
3435
} from '@/components/ui/form';
36+
import { Input } from '@/components/ui/input';
3537
import { Switch } from '@/components/ui/switch';
3638
import { packageManagers } from '@/routes/_layout/organizations/$orgId/products/$productId/repositories/$repoId/-types';
3739
import { CreateRunFormValues } from '@/routes/_layout/organizations/$orgId/products/$productId/repositories/$repoId/create-run';
@@ -59,12 +61,30 @@ export const AnalyzerFields = ({ form }: AnalyzerFieldsProps) => {
5961
/>
6062
<AccordionItem value='analyzer' className='flex-1'>
6163
<AccordionTrigger>Analyzer</AccordionTrigger>
62-
<AccordionContent>
64+
<AccordionContent className='flex flex-col gap-6'>
65+
<FormField
66+
control={form.control}
67+
name='jobConfigs.analyzer.repositoryConfigPath'
68+
render={({ field }) => (
69+
<FormItem>
70+
<FormLabel>Repository configuration path</FormLabel>
71+
<FormControl>
72+
<Input {...field} placeholder='(optional)' />
73+
</FormControl>
74+
<FormDescription>
75+
The optional path to a repository configuration file. If this
76+
is not defined, the repository configuration is read from the
77+
root of the analyzed project repository, ie. "./.ort.yml".
78+
</FormDescription>
79+
<FormMessage />
80+
</FormItem>
81+
)}
82+
/>
6383
<FormField
6484
control={form.control}
6585
name='jobConfigs.analyzer.allowDynamicVersions'
6686
render={({ field }) => (
67-
<FormItem className='mb-4 flex flex-row items-center justify-between rounded-lg border p-4'>
87+
<FormItem className='flex flex-row items-center justify-between rounded-lg border p-4'>
6888
<div className='space-y-0.5'>
6989
<FormLabel>Allow dynamic versions</FormLabel>
7090
<FormDescription>
@@ -85,7 +105,7 @@ export const AnalyzerFields = ({ form }: AnalyzerFieldsProps) => {
85105
control={form.control}
86106
name='jobConfigs.analyzer.skipExcluded'
87107
render={({ field }) => (
88-
<FormItem className='mb-4 flex flex-row items-center justify-between rounded-lg border p-4'>
108+
<FormItem className='flex flex-row items-center justify-between rounded-lg border p-4'>
89109
<div className='space-y-0.5'>
90110
<FormLabel>Skip excluded</FormLabel>
91111
<FormDescription>

ui/src/routes/_layout/organizations/$orgId/products/$productId/repositories/$repoId/_layout/runs/$runIndex/config/-components/analyzer-job-details.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ export const AnalyzerJobDetails = ({ run }: AnalyzerJobDetailsProps) => {
5656
Resolved job configuration:
5757
</Label>
5858
<div className='ml-2 space-y-2'>
59+
{jobConfigs?.repositoryConfigPath && (
60+
<div>
61+
<Label className='font-semibold'>
62+
Repository configuration path:
63+
</Label>{' '}
64+
{jobConfigs.repositoryConfigPath}
65+
</div>
66+
)}
5967
{jobConfigs?.allowDynamicVersions && (
6068
<div>
6169
<Label className='font-semibold'>

ui/src/routes/_layout/organizations/$orgId/products/$productId/repositories/$repoId/create-run.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ const formSchema = z.object({
6565
jobConfigs: z.object({
6666
analyzer: z.object({
6767
enabled: z.boolean(),
68+
repositoryConfigPath: z.string().optional(),
6869
allowDynamicVersions: z.boolean(),
6970
skipExcluded: z.boolean(),
7071
enabledPackageManagers: z.array(z.string()),
@@ -159,6 +160,7 @@ const CreateRunPage = () => {
159160
jobConfigs: {
160161
analyzer: {
161162
enabled: true,
163+
repositoryConfigPath: '',
162164
allowDynamicVersions: true,
163165
skipExcluded: true,
164166
enabledPackageManagers: [
@@ -225,6 +227,9 @@ const CreateRunPage = () => {
225227
jobConfigs: {
226228
analyzer: {
227229
enabled: baseDefaults.jobConfigs.analyzer.enabled,
230+
repositoryConfigPath:
231+
ortRun.jobConfigs.analyzer?.repositoryConfigPath ||
232+
baseDefaults.jobConfigs.analyzer.repositoryConfigPath,
228233
allowDynamicVersions:
229234
ortRun.jobConfigs.analyzer?.allowDynamicVersions ||
230235
baseDefaults.jobConfigs.analyzer.allowDynamicVersions,
@@ -404,6 +409,7 @@ const CreateRunPage = () => {
404409
// it empty, and thus disabling the job.
405410
const analyzerConfig = {
406411
allowDynamicVersions: values.jobConfigs.analyzer.allowDynamicVersions,
412+
repositoryConfigPath: values.jobConfigs.analyzer.repositoryConfigPath,
407413
skipExcluded: values.jobConfigs.analyzer.skipExcluded,
408414
enabledPackageManagers: values.jobConfigs.analyzer.enabledPackageManagers,
409415
};

0 commit comments

Comments
 (0)