@backstage/plugin-scaffolder 1.8.0 → 1.9.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,6 +9,8 @@ import FormControl from '@material-ui/core/FormControl';
9
9
  import Autocomplete from '@material-ui/lab/Autocomplete';
10
10
  import React, { useCallback, useEffect, useState, createContext, useContext, useMemo, useRef, memo } from 'react';
11
11
  import useAsync from 'react-use/lib/useAsync';
12
+ import { z } from 'zod';
13
+ import zodToJsonSchema from 'zod-to-json-schema';
12
14
  import useEffectOnce from 'react-use/lib/useEffectOnce';
13
15
  import { Autocomplete as Autocomplete$1 } from '@material-ui/lab';
14
16
  import { scmIntegrationsApiRef, scmAuthApiRef } from '@backstage/integration-react';
@@ -236,6 +238,32 @@ class ScaffolderClient {
236
238
  }
237
239
  }
238
240
 
241
+ function makeFieldSchemaFromZod(returnSchema, uiOptionsSchema) {
242
+ return {
243
+ schema: {
244
+ returnValue: zodToJsonSchema(returnSchema),
245
+ uiOptions: uiOptionsSchema ? zodToJsonSchema(uiOptionsSchema) : void 0
246
+ },
247
+ type: null,
248
+ uiOptionsType: null
249
+ };
250
+ }
251
+
252
+ const EntityPickerFieldSchema = makeFieldSchemaFromZod(
253
+ z.string(),
254
+ z.object({
255
+ allowedKinds: z.array(z.string()).optional().describe("List of kinds of entities to derive options from"),
256
+ defaultKind: z.string().optional().describe(
257
+ "The default entity kind. Options of this kind will not be prefixed."
258
+ ),
259
+ allowArbitraryValues: z.boolean().optional().describe("Whether to allow arbitrary user input. Defaults to true"),
260
+ defaultNamespace: z.union([z.string(), z.literal(false)]).optional().describe(
261
+ "The default namespace. Options with this namespace will not be prefixed."
262
+ )
263
+ })
264
+ );
265
+ const EntityPickerSchema = EntityPickerFieldSchema.schema;
266
+
239
267
  const EntityPicker = (props) => {
240
268
  var _a, _b, _c, _d, _e;
241
269
  const {
@@ -270,32 +298,45 @@ const EntityPicker = (props) => {
270
298
  onChange(entityRefs[0]);
271
299
  }
272
300
  }, [entityRefs, onChange]);
273
- return /* @__PURE__ */ React.createElement(FormControl, {
274
- margin: "normal",
275
- required,
276
- error: (rawErrors == null ? void 0 : rawErrors.length) > 0 && !formData
277
- }, /* @__PURE__ */ React.createElement(Autocomplete, {
278
- disabled: (entityRefs == null ? void 0 : entityRefs.length) === 1,
279
- id: idSchema == null ? void 0 : idSchema.$id,
280
- value: formData || "",
281
- loading,
282
- onChange: onSelect,
283
- options: entityRefs || [],
284
- autoSelect: true,
285
- freeSolo: (_e = (_d = uiSchema["ui:options"]) == null ? void 0 : _d.allowArbitraryValues) != null ? _e : true,
286
- renderInput: (params) => /* @__PURE__ */ React.createElement(TextField, {
287
- ...params,
288
- label: title,
289
- margin: "dense",
290
- helperText: description,
291
- FormHelperTextProps: { margin: "dense", style: { marginLeft: 0 } },
292
- variant: "outlined",
301
+ return /* @__PURE__ */ React.createElement(
302
+ FormControl,
303
+ {
304
+ margin: "normal",
293
305
  required,
294
- InputProps: params.InputProps
295
- })
296
- }));
306
+ error: (rawErrors == null ? void 0 : rawErrors.length) > 0 && !formData
307
+ },
308
+ /* @__PURE__ */ React.createElement(
309
+ Autocomplete,
310
+ {
311
+ disabled: (entityRefs == null ? void 0 : entityRefs.length) === 1,
312
+ id: idSchema == null ? void 0 : idSchema.$id,
313
+ value: formData || "",
314
+ loading,
315
+ onChange: onSelect,
316
+ options: entityRefs || [],
317
+ autoSelect: true,
318
+ freeSolo: (_e = (_d = uiSchema["ui:options"]) == null ? void 0 : _d.allowArbitraryValues) != null ? _e : true,
319
+ renderInput: (params) => /* @__PURE__ */ React.createElement(
320
+ TextField,
321
+ {
322
+ ...params,
323
+ label: title,
324
+ margin: "dense",
325
+ helperText: description,
326
+ FormHelperTextProps: { margin: "dense", style: { marginLeft: 0 } },
327
+ variant: "outlined",
328
+ required,
329
+ InputProps: params.InputProps
330
+ }
331
+ )
332
+ }
333
+ )
334
+ );
297
335
  };
298
336
 
337
+ const EntityNamePickerFieldSchema = makeFieldSchemaFromZod(z.string());
338
+ const EntityNamePickerSchema = EntityNamePickerFieldSchema.schema;
339
+
299
340
  const EntityNamePicker = (props) => {
300
341
  const {
301
342
  onChange,
@@ -307,18 +348,21 @@ const EntityNamePicker = (props) => {
307
348
  idSchema,
308
349
  placeholder
309
350
  } = props;
310
- return /* @__PURE__ */ React.createElement(TextField, {
311
- id: idSchema == null ? void 0 : idSchema.$id,
312
- label: title,
313
- placeholder,
314
- helperText: description,
315
- required,
316
- value: formData != null ? formData : "",
317
- onChange: ({ target: { value } }) => onChange(value),
318
- margin: "normal",
319
- error: (rawErrors == null ? void 0 : rawErrors.length) > 0 && !formData,
320
- inputProps: { autoFocus }
321
- });
351
+ return /* @__PURE__ */ React.createElement(
352
+ TextField,
353
+ {
354
+ id: idSchema == null ? void 0 : idSchema.$id,
355
+ label: title,
356
+ placeholder,
357
+ helperText: description,
358
+ required,
359
+ value: formData != null ? formData : "",
360
+ onChange: ({ target: { value } }) => onChange(value),
361
+ margin: "normal",
362
+ error: (rawErrors == null ? void 0 : rawErrors.length) > 0 && !formData,
363
+ inputProps: { autoFocus }
364
+ }
365
+ );
322
366
  };
323
367
 
324
368
  const entityNamePickerValidation = (value, validation) => {
@@ -329,6 +373,16 @@ const entityNamePickerValidation = (value, validation) => {
329
373
  }
330
374
  };
331
375
 
376
+ const EntityTagsPickerFieldSchema = makeFieldSchemaFromZod(
377
+ z.array(z.string()),
378
+ z.object({
379
+ kinds: z.array(z.string()).optional().describe("List of kinds of entities to derive tags from"),
380
+ showCounts: z.boolean().optional().describe("Whether to show usage counts per tag"),
381
+ helperText: z.string().optional().describe("Helper text to display")
382
+ })
383
+ );
384
+ const EntityTagsPickerSchema = EntityTagsPickerFieldSchema.schema;
385
+
332
386
  const EntityTagsPicker = (props) => {
333
387
  var _a, _b, _c;
334
388
  const { formData, onChange, uiSchema } = props;
@@ -373,29 +427,47 @@ const EntityTagsPicker = (props) => {
373
427
  }
374
428
  };
375
429
  useEffectOnce(() => onChange(formData || []));
376
- return /* @__PURE__ */ React.createElement(FormControl$1, {
377
- margin: "normal"
378
- }, /* @__PURE__ */ React.createElement(Autocomplete$1, {
379
- multiple: true,
380
- freeSolo: true,
381
- filterSelectedOptions: true,
382
- onChange: setTags,
383
- value: formData || [],
384
- inputValue,
385
- loading,
386
- options: tagOptions,
387
- ChipProps: { size: "small" },
388
- renderOption: (option) => showCounts ? `${option} (${existingTags == null ? void 0 : existingTags[option]})` : option,
389
- renderInput: (params) => /* @__PURE__ */ React.createElement(TextField, {
390
- ...params,
391
- label: "Tags",
392
- onChange: (e) => setInputValue(e.target.value),
393
- error: inputError,
394
- helperText: helperText != null ? helperText : "Add any relevant tags, hit 'Enter' to add new tags. Valid format: [a-z0-9+#] separated by [-], at most 63 characters"
395
- })
396
- }));
430
+ return /* @__PURE__ */ React.createElement(FormControl$1, { margin: "normal" }, /* @__PURE__ */ React.createElement(
431
+ Autocomplete$1,
432
+ {
433
+ multiple: true,
434
+ freeSolo: true,
435
+ filterSelectedOptions: true,
436
+ onChange: setTags,
437
+ value: formData || [],
438
+ inputValue,
439
+ loading,
440
+ options: tagOptions,
441
+ ChipProps: { size: "small" },
442
+ renderOption: (option) => showCounts ? `${option} (${existingTags == null ? void 0 : existingTags[option]})` : option,
443
+ renderInput: (params) => /* @__PURE__ */ React.createElement(
444
+ TextField,
445
+ {
446
+ ...params,
447
+ label: "Tags",
448
+ onChange: (e) => setInputValue(e.target.value),
449
+ error: inputError,
450
+ helperText: helperText != null ? helperText : "Add any relevant tags, hit 'Enter' to add new tags. Valid format: [a-z0-9+#] separated by [-], at most 63 characters"
451
+ }
452
+ )
453
+ }
454
+ ));
397
455
  };
398
456
 
457
+ const OwnerPickerFieldSchema = makeFieldSchemaFromZod(
458
+ z.string(),
459
+ z.object({
460
+ allowedKinds: z.array(z.string()).default(["Group", "User"]).optional().describe(
461
+ "List of kinds of entities to derive options from. Defaults to Group and User"
462
+ ),
463
+ allowArbitraryValues: z.boolean().optional().describe("Whether to allow arbitrary user input. Defaults to true"),
464
+ defaultNamespace: z.union([z.string(), z.literal(false)]).optional().describe(
465
+ "The default namespace. Options with this namespace will not be prefixed."
466
+ )
467
+ })
468
+ );
469
+ const OwnerPickerSchema = OwnerPickerFieldSchema.schema;
470
+
399
471
  const OwnerPicker = (props) => {
400
472
  var _a, _b, _c, _d;
401
473
  const {
@@ -416,61 +488,82 @@ const OwnerPicker = (props) => {
416
488
  ...defaultNamespace !== void 0 ? { defaultNamespace } : {}
417
489
  }
418
490
  };
419
- return /* @__PURE__ */ React.createElement(EntityPicker, {
420
- ...restProps,
421
- schema: { title, description },
422
- uiSchema: ownerUiSchema
423
- });
491
+ return /* @__PURE__ */ React.createElement(
492
+ EntityPicker,
493
+ {
494
+ ...restProps,
495
+ schema: { title, description },
496
+ uiSchema: ownerUiSchema
497
+ }
498
+ );
424
499
  };
425
500
 
426
501
  const GithubRepoPicker = (props) => {
427
502
  const { allowedOwners = [], rawErrors, state, onChange } = props;
428
503
  const ownerItems = allowedOwners ? allowedOwners.map((i) => ({ label: i, value: i })) : [{ label: "Loading...", value: "loading" }];
429
504
  const { owner } = state;
430
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(FormControl, {
431
- margin: "normal",
432
- required: true,
433
- error: (rawErrors == null ? void 0 : rawErrors.length) > 0 && !owner
434
- }, (allowedOwners == null ? void 0 : allowedOwners.length) ? /* @__PURE__ */ React.createElement(Select, {
435
- native: true,
436
- label: "Owner Available",
437
- onChange: (s) => onChange({ owner: String(Array.isArray(s) ? s[0] : s) }),
438
- disabled: allowedOwners.length === 1,
439
- selected: owner,
440
- items: ownerItems
441
- }) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(InputLabel, {
442
- htmlFor: "ownerInput"
443
- }, "Owner"), /* @__PURE__ */ React.createElement(Input, {
444
- id: "ownerInput",
445
- onChange: (e) => onChange({ owner: e.target.value }),
446
- value: owner
447
- })), /* @__PURE__ */ React.createElement(FormHelperText, null, "The organization, user or project that this repo will belong to")));
505
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
506
+ FormControl,
507
+ {
508
+ margin: "normal",
509
+ required: true,
510
+ error: (rawErrors == null ? void 0 : rawErrors.length) > 0 && !owner
511
+ },
512
+ (allowedOwners == null ? void 0 : allowedOwners.length) ? /* @__PURE__ */ React.createElement(
513
+ Select,
514
+ {
515
+ native: true,
516
+ label: "Owner Available",
517
+ onChange: (s) => onChange({ owner: String(Array.isArray(s) ? s[0] : s) }),
518
+ disabled: allowedOwners.length === 1,
519
+ selected: owner,
520
+ items: ownerItems
521
+ }
522
+ ) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(InputLabel, { htmlFor: "ownerInput" }, "Owner"), /* @__PURE__ */ React.createElement(
523
+ Input,
524
+ {
525
+ id: "ownerInput",
526
+ onChange: (e) => onChange({ owner: e.target.value }),
527
+ value: owner
528
+ }
529
+ )),
530
+ /* @__PURE__ */ React.createElement(FormHelperText, null, "The organization, user or project that this repo will belong to")
531
+ ));
448
532
  };
449
533
 
450
534
  const GitlabRepoPicker = (props) => {
451
535
  const { allowedOwners = [], state, onChange, rawErrors } = props;
452
536
  const ownerItems = allowedOwners ? allowedOwners.map((i) => ({ label: i, value: i })) : [{ label: "Loading...", value: "loading" }];
453
537
  const { owner } = state;
454
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(FormControl, {
455
- margin: "normal",
456
- required: true,
457
- error: (rawErrors == null ? void 0 : rawErrors.length) > 0 && !owner
458
- }, (allowedOwners == null ? void 0 : allowedOwners.length) ? /* @__PURE__ */ React.createElement(Select, {
459
- native: true,
460
- label: "Owner Available",
461
- onChange: (selected) => onChange({
462
- owner: String(Array.isArray(selected) ? selected[0] : selected)
463
- }),
464
- disabled: allowedOwners.length === 1,
465
- selected: owner,
466
- items: ownerItems
467
- }) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(InputLabel, {
468
- htmlFor: "ownerInput"
469
- }, "Owner"), /* @__PURE__ */ React.createElement(Input, {
470
- id: "ownerInput",
471
- onChange: (e) => onChange({ owner: e.target.value }),
472
- value: owner
473
- })), /* @__PURE__ */ React.createElement(FormHelperText, null, "GitLab namespace where this repository will belong to. It can be the name of organization, group, subgroup, user, or the project.")));
538
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
539
+ FormControl,
540
+ {
541
+ margin: "normal",
542
+ required: true,
543
+ error: (rawErrors == null ? void 0 : rawErrors.length) > 0 && !owner
544
+ },
545
+ (allowedOwners == null ? void 0 : allowedOwners.length) ? /* @__PURE__ */ React.createElement(
546
+ Select,
547
+ {
548
+ native: true,
549
+ label: "Owner Available",
550
+ onChange: (selected) => onChange({
551
+ owner: String(Array.isArray(selected) ? selected[0] : selected)
552
+ }),
553
+ disabled: allowedOwners.length === 1,
554
+ selected: owner,
555
+ items: ownerItems
556
+ }
557
+ ) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(InputLabel, { htmlFor: "ownerInput" }, "Owner"), /* @__PURE__ */ React.createElement(
558
+ Input,
559
+ {
560
+ id: "ownerInput",
561
+ onChange: (e) => onChange({ owner: e.target.value }),
562
+ value: owner
563
+ }
564
+ )),
565
+ /* @__PURE__ */ React.createElement(FormHelperText, null, "GitLab namespace where this repository will belong to. It can be the name of organization, group, subgroup, user, or the project.")
566
+ ));
474
567
  };
475
568
 
476
569
  const AzureRepoPicker = (props) => {
@@ -484,41 +577,59 @@ const AzureRepoPicker = (props) => {
484
577
  const organizationItems = allowedOrganizations ? allowedOrganizations.map((i) => ({ label: i, value: i })) : [{ label: "Loading...", value: "loading" }];
485
578
  const ownerItems = allowedOwners ? allowedOwners.map((i) => ({ label: i, value: i })) : [{ label: "Loading...", value: "loading" }];
486
579
  const { organization, owner } = state;
487
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(FormControl, {
488
- margin: "normal",
489
- required: true,
490
- error: (rawErrors == null ? void 0 : rawErrors.length) > 0 && !organization
491
- }, (allowedOrganizations == null ? void 0 : allowedOrganizations.length) ? /* @__PURE__ */ React.createElement(Select, {
492
- native: true,
493
- label: "Organization",
494
- onChange: (s) => onChange({ organization: String(Array.isArray(s) ? s[0] : s) }),
495
- disabled: allowedOrganizations.length === 1,
496
- selected: organization,
497
- items: organizationItems
498
- }) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(InputLabel, {
499
- htmlFor: "orgInput"
500
- }, "Organization"), /* @__PURE__ */ React.createElement(Input, {
501
- id: "orgInput",
502
- onChange: (e) => onChange({ organization: e.target.value }),
503
- value: organization
504
- })), /* @__PURE__ */ React.createElement(FormHelperText, null, "The Organization that this repo will belong to")), /* @__PURE__ */ React.createElement(FormControl, {
505
- margin: "normal",
506
- required: true,
507
- error: (rawErrors == null ? void 0 : rawErrors.length) > 0 && !owner
508
- }, (allowedOwners == null ? void 0 : allowedOwners.length) ? /* @__PURE__ */ React.createElement(Select, {
509
- native: true,
510
- label: "Owner",
511
- onChange: (s) => onChange({ owner: String(Array.isArray(s) ? s[0] : s) }),
512
- disabled: allowedOwners.length === 1,
513
- selected: owner,
514
- items: ownerItems
515
- }) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(InputLabel, {
516
- htmlFor: "ownerInput"
517
- }, "Project"), /* @__PURE__ */ React.createElement(Input, {
518
- id: "ownerInput",
519
- onChange: (e) => onChange({ owner: e.target.value }),
520
- value: owner
521
- })), /* @__PURE__ */ React.createElement(FormHelperText, null, "The Project that this repo will belong to")));
580
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
581
+ FormControl,
582
+ {
583
+ margin: "normal",
584
+ required: true,
585
+ error: (rawErrors == null ? void 0 : rawErrors.length) > 0 && !organization
586
+ },
587
+ (allowedOrganizations == null ? void 0 : allowedOrganizations.length) ? /* @__PURE__ */ React.createElement(
588
+ Select,
589
+ {
590
+ native: true,
591
+ label: "Organization",
592
+ onChange: (s) => onChange({ organization: String(Array.isArray(s) ? s[0] : s) }),
593
+ disabled: allowedOrganizations.length === 1,
594
+ selected: organization,
595
+ items: organizationItems
596
+ }
597
+ ) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(InputLabel, { htmlFor: "orgInput" }, "Organization"), /* @__PURE__ */ React.createElement(
598
+ Input,
599
+ {
600
+ id: "orgInput",
601
+ onChange: (e) => onChange({ organization: e.target.value }),
602
+ value: organization
603
+ }
604
+ )),
605
+ /* @__PURE__ */ React.createElement(FormHelperText, null, "The Organization that this repo will belong to")
606
+ ), /* @__PURE__ */ React.createElement(
607
+ FormControl,
608
+ {
609
+ margin: "normal",
610
+ required: true,
611
+ error: (rawErrors == null ? void 0 : rawErrors.length) > 0 && !owner
612
+ },
613
+ (allowedOwners == null ? void 0 : allowedOwners.length) ? /* @__PURE__ */ React.createElement(
614
+ Select,
615
+ {
616
+ native: true,
617
+ label: "Owner",
618
+ onChange: (s) => onChange({ owner: String(Array.isArray(s) ? s[0] : s) }),
619
+ disabled: allowedOwners.length === 1,
620
+ selected: owner,
621
+ items: ownerItems
622
+ }
623
+ ) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(InputLabel, { htmlFor: "ownerInput" }, "Project"), /* @__PURE__ */ React.createElement(
624
+ Input,
625
+ {
626
+ id: "ownerInput",
627
+ onChange: (e) => onChange({ owner: e.target.value }),
628
+ value: owner
629
+ }
630
+ )),
631
+ /* @__PURE__ */ React.createElement(FormHelperText, null, "The Project that this repo will belong to")
632
+ ));
522
633
  };
523
634
 
524
635
  const BitbucketRepoPicker = (props) => {
@@ -530,59 +641,80 @@ const BitbucketRepoPicker = (props) => {
530
641
  onChange({ workspace: allowedOwners[0] });
531
642
  }
532
643
  }, [allowedOwners, host, onChange]);
533
- return /* @__PURE__ */ React.createElement(React.Fragment, null, host === "bitbucket.org" && /* @__PURE__ */ React.createElement(FormControl, {
534
- margin: "normal",
535
- required: true,
536
- error: (rawErrors == null ? void 0 : rawErrors.length) > 0 && !workspace
537
- }, (allowedOwners == null ? void 0 : allowedOwners.length) ? /* @__PURE__ */ React.createElement(Select, {
538
- native: true,
539
- label: "Allowed Workspaces",
540
- onChange: (s) => onChange({ workspace: String(Array.isArray(s) ? s[0] : s) }),
541
- disabled: allowedOwners.length === 1,
542
- selected: workspace,
543
- items: ownerItems
544
- }) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(InputLabel, {
545
- htmlFor: "workspaceInput"
546
- }, "Workspace"), /* @__PURE__ */ React.createElement(Input, {
547
- id: "workspaceInput",
548
- onChange: (e) => onChange({ workspace: e.target.value }),
549
- value: workspace
550
- })), /* @__PURE__ */ React.createElement(FormHelperText, null, "The Organization that this repo will belong to")), /* @__PURE__ */ React.createElement(FormControl, {
551
- margin: "normal",
552
- required: true,
553
- error: (rawErrors == null ? void 0 : rawErrors.length) > 0 && !project
554
- }, /* @__PURE__ */ React.createElement(InputLabel, {
555
- htmlFor: "projectInput"
556
- }, "Project"), /* @__PURE__ */ React.createElement(Input, {
557
- id: "projectInput",
558
- onChange: (e) => onChange({ project: e.target.value }),
559
- value: project
560
- }), /* @__PURE__ */ React.createElement(FormHelperText, null, "The Project that this repo will belong to")));
644
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, host === "bitbucket.org" && /* @__PURE__ */ React.createElement(
645
+ FormControl,
646
+ {
647
+ margin: "normal",
648
+ required: true,
649
+ error: (rawErrors == null ? void 0 : rawErrors.length) > 0 && !workspace
650
+ },
651
+ (allowedOwners == null ? void 0 : allowedOwners.length) ? /* @__PURE__ */ React.createElement(
652
+ Select,
653
+ {
654
+ native: true,
655
+ label: "Allowed Workspaces",
656
+ onChange: (s) => onChange({ workspace: String(Array.isArray(s) ? s[0] : s) }),
657
+ disabled: allowedOwners.length === 1,
658
+ selected: workspace,
659
+ items: ownerItems
660
+ }
661
+ ) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(InputLabel, { htmlFor: "workspaceInput" }, "Workspace"), /* @__PURE__ */ React.createElement(
662
+ Input,
663
+ {
664
+ id: "workspaceInput",
665
+ onChange: (e) => onChange({ workspace: e.target.value }),
666
+ value: workspace
667
+ }
668
+ )),
669
+ /* @__PURE__ */ React.createElement(FormHelperText, null, "The Organization that this repo will belong to")
670
+ ), /* @__PURE__ */ React.createElement(
671
+ FormControl,
672
+ {
673
+ margin: "normal",
674
+ required: true,
675
+ error: (rawErrors == null ? void 0 : rawErrors.length) > 0 && !project
676
+ },
677
+ /* @__PURE__ */ React.createElement(InputLabel, { htmlFor: "projectInput" }, "Project"),
678
+ /* @__PURE__ */ React.createElement(
679
+ Input,
680
+ {
681
+ id: "projectInput",
682
+ onChange: (e) => onChange({ project: e.target.value }),
683
+ value: project
684
+ }
685
+ ),
686
+ /* @__PURE__ */ React.createElement(FormHelperText, null, "The Project that this repo will belong to")
687
+ ));
561
688
  };
562
689
 
563
690
  const GerritRepoPicker = (props) => {
564
691
  const { onChange, rawErrors, state } = props;
565
692
  const { workspace, owner } = state;
566
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(FormControl, {
567
- margin: "normal",
568
- error: (rawErrors == null ? void 0 : rawErrors.length) > 0 && !workspace
569
- }, /* @__PURE__ */ React.createElement(InputLabel, {
570
- htmlFor: "ownerInput"
571
- }, "Owner"), /* @__PURE__ */ React.createElement(Input, {
572
- id: "ownerInput",
573
- onChange: (e) => onChange({ owner: e.target.value }),
574
- value: owner
575
- }), /* @__PURE__ */ React.createElement(FormHelperText, null, "The owner of the project (optional)")), /* @__PURE__ */ React.createElement(FormControl, {
576
- margin: "normal",
577
- required: true,
578
- error: (rawErrors == null ? void 0 : rawErrors.length) > 0 && !workspace
579
- }, /* @__PURE__ */ React.createElement(InputLabel, {
580
- htmlFor: "parentInput"
581
- }, "Parent"), /* @__PURE__ */ React.createElement(Input, {
582
- id: "parentInput",
583
- onChange: (e) => onChange({ workspace: e.target.value }),
584
- value: workspace
585
- }), /* @__PURE__ */ React.createElement(FormHelperText, null, "The project parent that the repo will belong to")));
693
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(FormControl, { margin: "normal", error: (rawErrors == null ? void 0 : rawErrors.length) > 0 && !workspace }, /* @__PURE__ */ React.createElement(InputLabel, { htmlFor: "ownerInput" }, "Owner"), /* @__PURE__ */ React.createElement(
694
+ Input,
695
+ {
696
+ id: "ownerInput",
697
+ onChange: (e) => onChange({ owner: e.target.value }),
698
+ value: owner
699
+ }
700
+ ), /* @__PURE__ */ React.createElement(FormHelperText, null, "The owner of the project (optional)")), /* @__PURE__ */ React.createElement(
701
+ FormControl,
702
+ {
703
+ margin: "normal",
704
+ required: true,
705
+ error: (rawErrors == null ? void 0 : rawErrors.length) > 0 && !workspace
706
+ },
707
+ /* @__PURE__ */ React.createElement(InputLabel, { htmlFor: "parentInput" }, "Parent"),
708
+ /* @__PURE__ */ React.createElement(
709
+ Input,
710
+ {
711
+ id: "parentInput",
712
+ onChange: (e) => onChange({ workspace: e.target.value }),
713
+ value: workspace
714
+ }
715
+ ),
716
+ /* @__PURE__ */ React.createElement(FormHelperText, null, "The project parent that the repo will belong to")
717
+ ));
586
718
  };
587
719
 
588
720
  const RepoUrlPickerHost = (props) => {
@@ -608,19 +740,27 @@ const RepoUrlPickerHost = (props) => {
608
740
  if (loading) {
609
741
  return /* @__PURE__ */ React.createElement(Progress, null);
610
742
  }
611
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(FormControl, {
612
- margin: "normal",
613
- required: true,
614
- error: (rawErrors == null ? void 0 : rawErrors.length) > 0 && !host
615
- }, /* @__PURE__ */ React.createElement(Select, {
616
- native: true,
617
- disabled: (hosts == null ? void 0 : hosts.length) === 1,
618
- label: "Host",
619
- onChange: (s) => onChange(String(Array.isArray(s) ? s[0] : s)),
620
- selected: host,
621
- items: hostsOptions,
622
- "data-testid": "host-select"
623
- }), /* @__PURE__ */ React.createElement(FormHelperText, null, "The host where the repository will be created")));
743
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
744
+ FormControl,
745
+ {
746
+ margin: "normal",
747
+ required: true,
748
+ error: (rawErrors == null ? void 0 : rawErrors.length) > 0 && !host
749
+ },
750
+ /* @__PURE__ */ React.createElement(
751
+ Select,
752
+ {
753
+ native: true,
754
+ disabled: (hosts == null ? void 0 : hosts.length) === 1,
755
+ label: "Host",
756
+ onChange: (s) => onChange(String(Array.isArray(s) ? s[0] : s)),
757
+ selected: host,
758
+ items: hostsOptions,
759
+ "data-testid": "host-select"
760
+ }
761
+ ),
762
+ /* @__PURE__ */ React.createElement(FormHelperText, null, "The host where the repository will be created")
763
+ ));
624
764
  };
625
765
 
626
766
  const RepoUrlPickerRepoName = (props) => {
@@ -633,24 +773,33 @@ const RepoUrlPickerRepoName = (props) => {
633
773
  }
634
774
  }, [allowedRepos, repoName, onChange]);
635
775
  const repoItems = allowedRepos ? allowedRepos.map((i) => ({ label: i, value: i })) : [{ label: "Loading...", value: "loading" }];
636
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(FormControl, {
637
- margin: "normal",
638
- required: true,
639
- error: (rawErrors == null ? void 0 : rawErrors.length) > 0 && !repoName
640
- }, (allowedRepos == null ? void 0 : allowedRepos.length) ? /* @__PURE__ */ React.createElement(Select, {
641
- native: true,
642
- label: "Repositories Available",
643
- onChange: (selected) => String(Array.isArray(selected) ? selected[0] : selected),
644
- disabled: allowedRepos.length === 1,
645
- selected: repoName,
646
- items: repoItems
647
- }) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(InputLabel, {
648
- htmlFor: "repoNameInput"
649
- }, "Repository"), /* @__PURE__ */ React.createElement(Input, {
650
- id: "repoNameInput",
651
- onChange: (e) => onChange(String(e.target.value)),
652
- value: repoName
653
- })), /* @__PURE__ */ React.createElement(FormHelperText, null, "The name of the repository")));
776
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
777
+ FormControl,
778
+ {
779
+ margin: "normal",
780
+ required: true,
781
+ error: (rawErrors == null ? void 0 : rawErrors.length) > 0 && !repoName
782
+ },
783
+ (allowedRepos == null ? void 0 : allowedRepos.length) ? /* @__PURE__ */ React.createElement(
784
+ Select,
785
+ {
786
+ native: true,
787
+ label: "Repositories Available",
788
+ onChange: (selected) => String(Array.isArray(selected) ? selected[0] : selected),
789
+ disabled: allowedRepos.length === 1,
790
+ selected: repoName,
791
+ items: repoItems
792
+ }
793
+ ) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(InputLabel, { htmlFor: "repoNameInput" }, "Repository"), /* @__PURE__ */ React.createElement(
794
+ Input,
795
+ {
796
+ id: "repoNameInput",
797
+ onChange: (e) => onChange(String(e.target.value)),
798
+ value: repoName
799
+ }
800
+ )),
801
+ /* @__PURE__ */ React.createElement(FormHelperText, null, "The name of the repository")
802
+ ));
654
803
  };
655
804
 
656
805
  function serializeRepoPickerUrl(data) {
@@ -702,9 +851,7 @@ const SecretsContext = createContext(
702
851
  );
703
852
  const SecretsContextProvider = ({ children }) => {
704
853
  const [secrets, setSecrets] = useState({});
705
- return /* @__PURE__ */ React.createElement(SecretsContext.Provider, {
706
- value: { secrets, setSecrets }
707
- }, children);
854
+ return /* @__PURE__ */ React.createElement(SecretsContext.Provider, { value: { secrets, setSecrets } }, children);
708
855
  };
709
856
  const useTemplateSecrets = () => {
710
857
  const value = useContext(SecretsContext);
@@ -723,6 +870,31 @@ const useTemplateSecrets = () => {
723
870
  return { setSecrets };
724
871
  };
725
872
 
873
+ const RepoUrlPickerFieldSchema = makeFieldSchemaFromZod(
874
+ z.string(),
875
+ z.object({
876
+ allowedHosts: z.array(z.string()).optional().describe("List of allowed SCM platform hosts"),
877
+ allowedOrganizations: z.array(z.string()).optional().describe("List of allowed organizations in the given SCM platform"),
878
+ allowedOwners: z.array(z.string()).optional().describe("List of allowed owners in the given SCM platform"),
879
+ allowedRepos: z.array(z.string()).optional().describe("List of allowed repos in the given SCM platform"),
880
+ requestUserCredentials: z.object({
881
+ secretsKey: z.string().describe(
882
+ "Key used within the template secrets context to store the credential"
883
+ ),
884
+ additionalScopes: z.object({
885
+ gerrit: z.array(z.string()).optional().describe("Additional Gerrit scopes to request"),
886
+ github: z.array(z.string()).optional().describe("Additional GitHub scopes to request"),
887
+ gitlab: z.array(z.string()).optional().describe("Additional GitLab scopes to request"),
888
+ bitbucket: z.array(z.string()).optional().describe("Additional BitBucket scopes to request"),
889
+ azure: z.array(z.string()).optional().describe("Additional Azure scopes to request")
890
+ }).optional().describe("Additional permission scopes to request")
891
+ }).optional().describe(
892
+ "If defined will request user credentials to auth against the given SCM platform"
893
+ )
894
+ })
895
+ );
896
+ const RepoUrlPickerSchema = RepoUrlPickerFieldSchema.schema;
897
+
726
898
  const RepoUrlPicker = (props) => {
727
899
  var _a, _b;
728
900
  const { uiSchema, onChange, rawErrors, formData } = props;
@@ -816,42 +988,63 @@ const RepoUrlPicker = (props) => {
816
988
  [state, uiSchema]
817
989
  );
818
990
  const hostType = (_b = state.host && ((_a = integrationApi.byHost(state.host)) == null ? void 0 : _a.type)) != null ? _b : null;
819
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(RepoUrlPickerHost, {
820
- host: state.host,
821
- hosts: allowedHosts,
822
- onChange: (host) => setState((prevState) => ({ ...prevState, host })),
823
- rawErrors
824
- }), hostType === "github" && /* @__PURE__ */ React.createElement(GithubRepoPicker, {
825
- allowedOwners,
826
- onChange: updateLocalState,
827
- rawErrors,
828
- state
829
- }), hostType === "gitlab" && /* @__PURE__ */ React.createElement(GitlabRepoPicker, {
830
- allowedOwners,
831
- rawErrors,
832
- state,
833
- onChange: updateLocalState
834
- }), hostType === "bitbucket" && /* @__PURE__ */ React.createElement(BitbucketRepoPicker, {
835
- allowedOwners,
836
- rawErrors,
837
- state,
838
- onChange: updateLocalState
839
- }), hostType === "azure" && /* @__PURE__ */ React.createElement(AzureRepoPicker, {
840
- allowedOrganizations,
841
- allowedOwners,
842
- rawErrors,
843
- state,
844
- onChange: updateLocalState
845
- }), hostType === "gerrit" && /* @__PURE__ */ React.createElement(GerritRepoPicker, {
846
- rawErrors,
847
- state,
848
- onChange: updateLocalState
849
- }), /* @__PURE__ */ React.createElement(RepoUrlPickerRepoName, {
850
- repoName: state.repoName,
851
- allowedRepos,
852
- onChange: (repo) => setState((prevState) => ({ ...prevState, repoName: repo })),
853
- rawErrors
854
- }));
991
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
992
+ RepoUrlPickerHost,
993
+ {
994
+ host: state.host,
995
+ hosts: allowedHosts,
996
+ onChange: (host) => setState((prevState) => ({ ...prevState, host })),
997
+ rawErrors
998
+ }
999
+ ), hostType === "github" && /* @__PURE__ */ React.createElement(
1000
+ GithubRepoPicker,
1001
+ {
1002
+ allowedOwners,
1003
+ onChange: updateLocalState,
1004
+ rawErrors,
1005
+ state
1006
+ }
1007
+ ), hostType === "gitlab" && /* @__PURE__ */ React.createElement(
1008
+ GitlabRepoPicker,
1009
+ {
1010
+ allowedOwners,
1011
+ rawErrors,
1012
+ state,
1013
+ onChange: updateLocalState
1014
+ }
1015
+ ), hostType === "bitbucket" && /* @__PURE__ */ React.createElement(
1016
+ BitbucketRepoPicker,
1017
+ {
1018
+ allowedOwners,
1019
+ rawErrors,
1020
+ state,
1021
+ onChange: updateLocalState
1022
+ }
1023
+ ), hostType === "azure" && /* @__PURE__ */ React.createElement(
1024
+ AzureRepoPicker,
1025
+ {
1026
+ allowedOrganizations,
1027
+ allowedOwners,
1028
+ rawErrors,
1029
+ state,
1030
+ onChange: updateLocalState
1031
+ }
1032
+ ), hostType === "gerrit" && /* @__PURE__ */ React.createElement(
1033
+ GerritRepoPicker,
1034
+ {
1035
+ rawErrors,
1036
+ state,
1037
+ onChange: updateLocalState
1038
+ }
1039
+ ), /* @__PURE__ */ React.createElement(
1040
+ RepoUrlPickerRepoName,
1041
+ {
1042
+ repoName: state.repoName,
1043
+ allowedRepos,
1044
+ onChange: (repo) => setState((prevState) => ({ ...prevState, repoName: repo })),
1045
+ rawErrors
1046
+ }
1047
+ ));
855
1048
  };
856
1049
 
857
1050
  const repoPickerValidation = (value, validation, context) => {
@@ -893,6 +1086,21 @@ const repoPickerValidation = (value, validation, context) => {
893
1086
  }
894
1087
  };
895
1088
 
1089
+ const OwnedEntityPickerFieldSchema = makeFieldSchemaFromZod(
1090
+ z.string(),
1091
+ z.object({
1092
+ allowedKinds: z.array(z.string()).optional().describe("List of kinds of entities to derive options from"),
1093
+ defaultKind: z.string().optional().describe(
1094
+ "The default entity kind. Options of this kind will not be prefixed."
1095
+ ),
1096
+ allowArbitraryValues: z.boolean().optional().describe("Whether to allow arbitrary user input. Defaults to true"),
1097
+ defaultNamespace: z.union([z.string(), z.literal(false)]).optional().describe(
1098
+ "The default namespace. Options with this namespace will not be prefixed."
1099
+ )
1100
+ })
1101
+ );
1102
+ const OwnedEntityPickerSchema = OwnedEntityPickerFieldSchema.schema;
1103
+
896
1104
  const OwnedEntityPicker = (props) => {
897
1105
  var _a, _b, _c, _d, _e;
898
1106
  const {
@@ -913,28 +1121,38 @@ const OwnedEntityPicker = (props) => {
913
1121
  const onSelect = (_, value) => {
914
1122
  onChange(value || "");
915
1123
  };
916
- return /* @__PURE__ */ React.createElement(FormControl, {
917
- margin: "normal",
918
- required,
919
- error: (rawErrors == null ? void 0 : rawErrors.length) > 0 && !formData
920
- }, /* @__PURE__ */ React.createElement(Autocomplete, {
921
- id: idSchema == null ? void 0 : idSchema.$id,
922
- value: formData || "",
923
- loading,
924
- onChange: onSelect,
925
- options: entityRefs || [],
926
- autoSelect: true,
927
- freeSolo: allowArbitraryValues,
928
- renderInput: (params) => /* @__PURE__ */ React.createElement(TextField, {
929
- ...params,
930
- label: title,
1124
+ return /* @__PURE__ */ React.createElement(
1125
+ FormControl,
1126
+ {
931
1127
  margin: "normal",
932
- helperText: description,
933
- variant: "outlined",
934
1128
  required,
935
- InputProps: params.InputProps
936
- })
937
- }));
1129
+ error: (rawErrors == null ? void 0 : rawErrors.length) > 0 && !formData
1130
+ },
1131
+ /* @__PURE__ */ React.createElement(
1132
+ Autocomplete,
1133
+ {
1134
+ id: idSchema == null ? void 0 : idSchema.$id,
1135
+ value: formData || "",
1136
+ loading,
1137
+ onChange: onSelect,
1138
+ options: entityRefs || [],
1139
+ autoSelect: true,
1140
+ freeSolo: allowArbitraryValues,
1141
+ renderInput: (params) => /* @__PURE__ */ React.createElement(
1142
+ TextField,
1143
+ {
1144
+ ...params,
1145
+ label: title,
1146
+ margin: "normal",
1147
+ helperText: description,
1148
+ variant: "outlined",
1149
+ required,
1150
+ InputProps: params.InputProps
1151
+ }
1152
+ )
1153
+ }
1154
+ )
1155
+ );
938
1156
  };
939
1157
  function useOwnedEntities(allowedKinds) {
940
1158
  const identityApi = useApi(identityApiRef);
@@ -1097,62 +1315,64 @@ const scaffolderPlugin = createPlugin({
1097
1315
  const EntityPickerFieldExtension = scaffolderPlugin.provide(
1098
1316
  createScaffolderFieldExtension({
1099
1317
  component: EntityPicker,
1100
- name: "EntityPicker"
1318
+ name: "EntityPicker",
1319
+ schema: EntityPickerSchema
1101
1320
  })
1102
1321
  );
1103
1322
  const EntityNamePickerFieldExtension = scaffolderPlugin.provide(
1104
1323
  createScaffolderFieldExtension({
1105
1324
  component: EntityNamePicker,
1106
1325
  name: "EntityNamePicker",
1107
- validation: entityNamePickerValidation
1326
+ validation: entityNamePickerValidation,
1327
+ schema: EntityNamePickerSchema
1108
1328
  })
1109
1329
  );
1110
1330
  const RepoUrlPickerFieldExtension = scaffolderPlugin.provide(
1111
1331
  createScaffolderFieldExtension({
1112
1332
  component: RepoUrlPicker,
1113
1333
  name: "RepoUrlPicker",
1114
- validation: repoPickerValidation
1334
+ validation: repoPickerValidation,
1335
+ schema: RepoUrlPickerSchema
1115
1336
  })
1116
1337
  );
1117
1338
  const OwnerPickerFieldExtension = scaffolderPlugin.provide(
1118
1339
  createScaffolderFieldExtension({
1119
1340
  component: OwnerPicker,
1120
- name: "OwnerPicker"
1341
+ name: "OwnerPicker",
1342
+ schema: OwnerPickerSchema
1121
1343
  })
1122
1344
  );
1123
1345
  const ScaffolderPage = scaffolderPlugin.provide(
1124
1346
  createRoutableExtension({
1125
1347
  name: "ScaffolderPage",
1126
- component: () => import('./Router-21c2e0ba.esm.js').then((m) => m.Router),
1348
+ component: () => import('./Router-95a01240.esm.js').then((m) => m.Router),
1127
1349
  mountPoint: rootRouteRef
1128
1350
  })
1129
1351
  );
1130
1352
  const OwnedEntityPickerFieldExtension = scaffolderPlugin.provide(
1131
1353
  createScaffolderFieldExtension({
1132
1354
  component: OwnedEntityPicker,
1133
- name: "OwnedEntityPicker"
1355
+ name: "OwnedEntityPicker",
1356
+ schema: OwnedEntityPickerSchema
1134
1357
  })
1135
1358
  );
1136
1359
  const EntityTagsPickerFieldExtension = scaffolderPlugin.provide(
1137
1360
  createScaffolderFieldExtension({
1138
1361
  component: EntityTagsPicker,
1139
- name: "EntityTagsPicker"
1362
+ name: "EntityTagsPicker",
1363
+ schema: EntityTagsPickerSchema
1140
1364
  })
1141
1365
  );
1142
1366
  const NextScaffolderPage = scaffolderPlugin.provide(
1143
1367
  createRoutableExtension({
1144
1368
  name: "NextScaffolderPage",
1145
- component: () => import('./index-a739a160.esm.js').then((m) => m.Router),
1369
+ component: () => import('./index-cb47594c.esm.js').then((m) => m.Router),
1146
1370
  mountPoint: nextRouteRef
1147
1371
  })
1148
1372
  );
1149
1373
 
1150
- const icon = /* @__PURE__ */ React.createElement(CheckBoxOutlineBlankIcon, {
1151
- fontSize: "small"
1152
- });
1153
- const checkedIcon = /* @__PURE__ */ React.createElement(CheckBoxIcon, {
1154
- fontSize: "small"
1155
- });
1374
+ const icon = /* @__PURE__ */ React.createElement(CheckBoxOutlineBlankIcon, { fontSize: "small" });
1375
+ const checkedIcon = /* @__PURE__ */ React.createElement(CheckBoxIcon, { fontSize: "small" });
1156
1376
  const TemplateTypePicker = () => {
1157
1377
  const alertApi = useApi(alertApiRef);
1158
1378
  const { error, loading, availableTypes, selectedTypes, setSelectedTypes } = useEntityTypeFilter();
@@ -1167,34 +1387,33 @@ const TemplateTypePicker = () => {
1167
1387
  });
1168
1388
  return null;
1169
1389
  }
1170
- return /* @__PURE__ */ React.createElement(Box, {
1171
- pb: 1,
1172
- pt: 1
1173
- }, /* @__PURE__ */ React.createElement(Typography, {
1174
- variant: "button"
1175
- }, "Categories"), /* @__PURE__ */ React.createElement(Autocomplete$1, {
1176
- multiple: true,
1177
- "aria-label": "Categories",
1178
- options: availableTypes,
1179
- value: selectedTypes,
1180
- onChange: (_, value) => setSelectedTypes(value),
1181
- renderOption: (option, { selected }) => /* @__PURE__ */ React.createElement(FormControlLabel, {
1182
- control: /* @__PURE__ */ React.createElement(Checkbox, {
1183
- icon,
1184
- checkedIcon,
1185
- checked: selected
1186
- }),
1187
- label: capitalize(option)
1188
- }),
1189
- size: "small",
1190
- popupIcon: /* @__PURE__ */ React.createElement(ExpandMoreIcon, {
1191
- "data-testid": "categories-picker-expand"
1192
- }),
1193
- renderInput: (params) => /* @__PURE__ */ React.createElement(TextField, {
1194
- ...params,
1195
- variant: "outlined"
1196
- })
1197
- }));
1390
+ return /* @__PURE__ */ React.createElement(Box, { pb: 1, pt: 1 }, /* @__PURE__ */ React.createElement(Typography, { variant: "button" }, "Categories"), /* @__PURE__ */ React.createElement(
1391
+ Autocomplete$1,
1392
+ {
1393
+ multiple: true,
1394
+ "aria-label": "Categories",
1395
+ options: availableTypes,
1396
+ value: selectedTypes,
1397
+ onChange: (_, value) => setSelectedTypes(value),
1398
+ renderOption: (option, { selected }) => /* @__PURE__ */ React.createElement(
1399
+ FormControlLabel,
1400
+ {
1401
+ control: /* @__PURE__ */ React.createElement(
1402
+ Checkbox,
1403
+ {
1404
+ icon,
1405
+ checkedIcon,
1406
+ checked: selected
1407
+ }
1408
+ ),
1409
+ label: capitalize(option)
1410
+ }
1411
+ ),
1412
+ size: "small",
1413
+ popupIcon: /* @__PURE__ */ React.createElement(ExpandMoreIcon, { "data-testid": "categories-picker-expand" }),
1414
+ renderInput: (params) => /* @__PURE__ */ React.createElement(TextField, { ...params, variant: "outlined" })
1415
+ }
1416
+ ));
1198
1417
  };
1199
1418
 
1200
1419
  function reducer(draft, action) {
@@ -1328,11 +1547,14 @@ const TaskErrors = ({ error }) => {
1328
1547
  useEffect(() => {
1329
1548
  id.current = String(Math.random());
1330
1549
  }, [error]);
1331
- return error ? /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(DismissableBanner, {
1332
- id: id.current,
1333
- variant: "warning",
1334
- message: error.message
1335
- })) : null;
1550
+ return error ? /* @__PURE__ */ React.createElement(Box, null, /* @__PURE__ */ React.createElement(
1551
+ DismissableBanner,
1552
+ {
1553
+ id: id.current,
1554
+ variant: "warning",
1555
+ message: error.message
1556
+ }
1557
+ )) : null;
1336
1558
  };
1337
1559
 
1338
1560
  const useStyles$1 = makeStyles({
@@ -1348,21 +1570,7 @@ const useStyles$1 = makeStyles({
1348
1570
  const IconLink = (props) => {
1349
1571
  const { href, text, Icon, ...linkProps } = props;
1350
1572
  const classes = useStyles$1();
1351
- return /* @__PURE__ */ React.createElement(Grid, {
1352
- container: true,
1353
- direction: "row",
1354
- spacing: 1
1355
- }, /* @__PURE__ */ React.createElement(Grid, {
1356
- item: true
1357
- }, /* @__PURE__ */ React.createElement(Typography, {
1358
- component: "div",
1359
- className: classes.svgIcon
1360
- }, Icon ? /* @__PURE__ */ React.createElement(Icon, null) : /* @__PURE__ */ React.createElement(LanguageIcon, null))), /* @__PURE__ */ React.createElement(Grid, {
1361
- item: true
1362
- }, /* @__PURE__ */ React.createElement(Link, {
1363
- to: href,
1364
- ...linkProps
1365
- }, text || href)));
1573
+ return /* @__PURE__ */ React.createElement(Grid, { container: true, direction: "row", spacing: 1 }, /* @__PURE__ */ React.createElement(Grid, { item: true }, /* @__PURE__ */ React.createElement(Typography, { component: "div", className: classes.svgIcon }, Icon ? /* @__PURE__ */ React.createElement(Icon, null) : /* @__PURE__ */ React.createElement(LanguageIcon, null))), /* @__PURE__ */ React.createElement(Grid, { item: true }, /* @__PURE__ */ React.createElement(Link, { to: href, ...linkProps }, text || href)));
1366
1574
  };
1367
1575
 
1368
1576
  const TaskPageLinks = ({ output }) => {
@@ -1373,10 +1581,7 @@ const TaskPageLinks = ({ output }) => {
1373
1581
  var _a;
1374
1582
  return key ? (_a = app.getSystemIcon(key)) != null ? _a : LanguageIcon : LanguageIcon;
1375
1583
  };
1376
- return /* @__PURE__ */ React.createElement(Box, {
1377
- px: 3,
1378
- pb: 3
1379
- }, links.filter(({ url, entityRef }) => url || entityRef).map(({ url, entityRef, title, icon }) => {
1584
+ return /* @__PURE__ */ React.createElement(Box, { px: 3, pb: 3 }, links.filter(({ url, entityRef }) => url || entityRef).map(({ url, entityRef, title, icon }) => {
1380
1585
  if (entityRef) {
1381
1586
  const entityName = parseEntityRef(entityRef, {
1382
1587
  defaultKind: "<unknown>",
@@ -1386,13 +1591,16 @@ const TaskPageLinks = ({ output }) => {
1386
1591
  return { title, icon, url: target };
1387
1592
  }
1388
1593
  return { title, icon, url };
1389
- }).map(({ url, title, icon }, i) => /* @__PURE__ */ React.createElement(IconLink, {
1390
- key: `output-link-${i}`,
1391
- href: url,
1392
- text: title != null ? title : url,
1393
- Icon: iconResolver(icon),
1394
- target: "_blank"
1395
- })));
1594
+ }).map(({ url, title, icon }, i) => /* @__PURE__ */ React.createElement(
1595
+ IconLink,
1596
+ {
1597
+ key: `output-link-${i}`,
1598
+ href: url,
1599
+ text: title != null ? title : url,
1600
+ Icon: iconResolver(icon),
1601
+ target: "_blank"
1602
+ }
1603
+ )));
1396
1604
  };
1397
1605
 
1398
1606
  const humanizeDuration = require("humanize-duration");
@@ -1434,9 +1642,7 @@ const StepTimeTicker = ({ step }) => {
1434
1642
  const formatted = Interval.fromDateTimes(startedAt, end).toDuration().valueOf();
1435
1643
  setTime(humanizeDuration(formatted, { round: true }));
1436
1644
  }, 1e3);
1437
- return /* @__PURE__ */ React.createElement(Typography$1, {
1438
- variant: "caption"
1439
- }, time);
1645
+ return /* @__PURE__ */ React.createElement(Typography$1, { variant: "caption" }, time);
1440
1646
  };
1441
1647
  const useStepIconStyles = makeStyles$1(
1442
1648
  (theme) => createStyles({
@@ -1459,9 +1665,7 @@ function TaskStepIconComponent(props) {
1459
1665
  const { active, completed, error } = props;
1460
1666
  const getMiddle = () => {
1461
1667
  if (active) {
1462
- return /* @__PURE__ */ React.createElement(CircularProgress, {
1463
- size: "24px"
1464
- });
1668
+ return /* @__PURE__ */ React.createElement(CircularProgress, { size: "24px" });
1465
1669
  }
1466
1670
  if (completed) {
1467
1671
  return /* @__PURE__ */ React.createElement(Check, null);
@@ -1471,51 +1675,48 @@ function TaskStepIconComponent(props) {
1471
1675
  }
1472
1676
  return /* @__PURE__ */ React.createElement(FiberManualRecordIcon, null);
1473
1677
  };
1474
- return /* @__PURE__ */ React.createElement("div", {
1475
- className: classNames(classes.root, {
1476
- [classes.completed]: completed,
1477
- [classes.error]: error
1478
- })
1479
- }, getMiddle());
1678
+ return /* @__PURE__ */ React.createElement(
1679
+ "div",
1680
+ {
1681
+ className: classNames(classes.root, {
1682
+ [classes.completed]: completed,
1683
+ [classes.error]: error
1684
+ })
1685
+ },
1686
+ getMiddle()
1687
+ );
1480
1688
  }
1481
1689
  const TaskStatusStepper = memo(
1482
1690
  (props) => {
1483
1691
  const { steps, currentStepId, onUserStepChange } = props;
1484
1692
  const classes = useStyles(props);
1485
- return /* @__PURE__ */ React.createElement("div", {
1486
- className: classes.root
1487
- }, /* @__PURE__ */ React.createElement(Stepper, {
1488
- activeStep: steps.findIndex((s) => s.id === currentStepId),
1489
- orientation: "vertical",
1490
- nonLinear: true
1491
- }, steps.map((step, index) => {
1492
- const isCompleted = step.status === "completed";
1493
- const isFailed = step.status === "failed";
1494
- const isActive = step.status === "processing";
1495
- const isSkipped = step.status === "skipped";
1496
- return /* @__PURE__ */ React.createElement(Step, {
1497
- key: String(index),
1498
- expanded: true
1499
- }, /* @__PURE__ */ React.createElement(StepButton, {
1500
- onClick: () => onUserStepChange(step.id)
1501
- }, /* @__PURE__ */ React.createElement(StepLabel, {
1502
- StepIconProps: {
1503
- completed: isCompleted,
1504
- error: isFailed,
1505
- active: isActive
1506
- },
1507
- StepIconComponent: TaskStepIconComponent,
1508
- className: classes.stepWrapper
1509
- }, /* @__PURE__ */ React.createElement("div", {
1510
- className: classes.labelWrapper
1511
- }, /* @__PURE__ */ React.createElement(Typography$1, {
1512
- variant: "subtitle2"
1513
- }, step.name), isSkipped ? /* @__PURE__ */ React.createElement(Typography$1, {
1514
- variant: "caption"
1515
- }, "Skipped") : /* @__PURE__ */ React.createElement(StepTimeTicker, {
1516
- step
1517
- })))));
1518
- })));
1693
+ return /* @__PURE__ */ React.createElement("div", { className: classes.root }, /* @__PURE__ */ React.createElement(
1694
+ Stepper,
1695
+ {
1696
+ activeStep: steps.findIndex((s) => s.id === currentStepId),
1697
+ orientation: "vertical",
1698
+ nonLinear: true
1699
+ },
1700
+ steps.map((step, index) => {
1701
+ const isCompleted = step.status === "completed";
1702
+ const isFailed = step.status === "failed";
1703
+ const isActive = step.status === "processing";
1704
+ const isSkipped = step.status === "skipped";
1705
+ return /* @__PURE__ */ React.createElement(Step, { key: String(index), expanded: true }, /* @__PURE__ */ React.createElement(StepButton, { onClick: () => onUserStepChange(step.id) }, /* @__PURE__ */ React.createElement(
1706
+ StepLabel,
1707
+ {
1708
+ StepIconProps: {
1709
+ completed: isCompleted,
1710
+ error: isFailed,
1711
+ active: isActive
1712
+ },
1713
+ StepIconComponent: TaskStepIconComponent,
1714
+ className: classes.stepWrapper
1715
+ },
1716
+ /* @__PURE__ */ React.createElement("div", { className: classes.labelWrapper }, /* @__PURE__ */ React.createElement(Typography$1, { variant: "subtitle2" }, step.name), isSkipped ? /* @__PURE__ */ React.createElement(Typography$1, { variant: "caption" }, "Skipped") : /* @__PURE__ */ React.createElement(StepTimeTicker, { step }))
1717
+ )));
1718
+ })
1719
+ ));
1519
1720
  }
1520
1721
  );
1521
1722
  const hasLinks = ({ links = [] }) => links.length > 0;
@@ -1584,44 +1785,39 @@ const TaskPage = ({ loadingText }) => {
1584
1785
  })}`
1585
1786
  );
1586
1787
  };
1587
- return /* @__PURE__ */ React.createElement(Page, {
1588
- themeId: "home"
1589
- }, /* @__PURE__ */ React.createElement(Header, {
1590
- pageTitleOverride: `Task ${taskId}`,
1591
- title: "Task Activity",
1592
- subtitle: `Activity for task: ${taskId}`
1593
- }), /* @__PURE__ */ React.createElement(Content, null, taskNotFound ? /* @__PURE__ */ React.createElement(ErrorPage, {
1594
- status: "404",
1595
- statusMessage: "Task not found",
1596
- additionalInfo: "No task found with this ID"
1597
- }) : /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Grid$1, {
1598
- container: true
1599
- }, /* @__PURE__ */ React.createElement(Grid$1, {
1600
- item: true,
1601
- xs: 3
1602
- }, /* @__PURE__ */ React.createElement(Paper, null, /* @__PURE__ */ React.createElement(TaskStatusStepper, {
1603
- steps,
1604
- currentStepId,
1605
- onUserStepChange: setUserSelectedStepId
1606
- }), output && hasLinks(output) && /* @__PURE__ */ React.createElement(TaskPageLinks, {
1607
- output
1608
- }), /* @__PURE__ */ React.createElement(Button, {
1609
- className: classes.button,
1610
- onClick: handleStartOver,
1611
- disabled: !completed,
1612
- variant: "contained",
1613
- color: "primary"
1614
- }, "Start Over"))), /* @__PURE__ */ React.createElement(Grid$1, {
1615
- item: true,
1616
- xs: 9
1617
- }, !currentStepId && /* @__PURE__ */ React.createElement(Progress, null), /* @__PURE__ */ React.createElement("div", {
1618
- style: { height: "80vh" }
1619
- }, /* @__PURE__ */ React.createElement(TaskErrors, {
1620
- error: taskStream.error
1621
- }), /* @__PURE__ */ React.createElement(LogViewer, {
1622
- text: logAsString
1623
- })))))));
1788
+ return /* @__PURE__ */ React.createElement(Page, { themeId: "home" }, /* @__PURE__ */ React.createElement(
1789
+ Header,
1790
+ {
1791
+ pageTitleOverride: `Task ${taskId}`,
1792
+ title: "Task Activity",
1793
+ subtitle: `Activity for task: ${taskId}`
1794
+ }
1795
+ ), /* @__PURE__ */ React.createElement(Content, null, taskNotFound ? /* @__PURE__ */ React.createElement(
1796
+ ErrorPage,
1797
+ {
1798
+ status: "404",
1799
+ statusMessage: "Task not found",
1800
+ additionalInfo: "No task found with this ID"
1801
+ }
1802
+ ) : /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(Grid$1, { container: true }, /* @__PURE__ */ React.createElement(Grid$1, { item: true, xs: 3 }, /* @__PURE__ */ React.createElement(Paper, null, /* @__PURE__ */ React.createElement(
1803
+ TaskStatusStepper,
1804
+ {
1805
+ steps,
1806
+ currentStepId,
1807
+ onUserStepChange: setUserSelectedStepId
1808
+ }
1809
+ ), output && hasLinks(output) && /* @__PURE__ */ React.createElement(TaskPageLinks, { output }), /* @__PURE__ */ React.createElement(
1810
+ Button,
1811
+ {
1812
+ className: classes.button,
1813
+ onClick: handleStartOver,
1814
+ disabled: !completed,
1815
+ variant: "contained",
1816
+ color: "primary"
1817
+ },
1818
+ "Start Over"
1819
+ ))), /* @__PURE__ */ React.createElement(Grid$1, { item: true, xs: 9 }, !currentStepId && /* @__PURE__ */ React.createElement(Progress, null), /* @__PURE__ */ React.createElement("div", { style: { height: "80vh" } }, /* @__PURE__ */ React.createElement(TaskErrors, { error: taskStream.error }), /* @__PURE__ */ React.createElement(LogViewer, { text: logAsString })))))));
1624
1820
  };
1625
1821
 
1626
- export { createScaffolderLayout as A, ScaffolderLayouts as B, EntityPickerFieldExtension as C, EntityNamePickerFieldExtension as D, EntityPicker as E, FIELD_EXTENSION_WRAPPER_KEY as F, EntityTagsPickerFieldExtension as G, OwnerPickerFieldExtension as H, OwnedEntityPickerFieldExtension as I, RepoUrlPickerFieldExtension as J, ScaffolderPage as K, LAYOUTS_WRAPPER_KEY as L, scaffolderPlugin as M, NextScaffolderPage as N, OwnerPicker as O, createNextScaffolderFieldExtension as P, useTemplateSecrets as Q, RepoUrlPicker as R, SecretsContext as S, TemplateTypePicker as T, actionsRouteRef as a, scaffolderListTaskRouteRef as b, scaffolderApiRef as c, scaffolderTaskRouteRef as d, editRouteRef as e, rootRouteRef as f, TaskStatusStepper as g, TaskPageLinks as h, FIELD_EXTENSION_KEY as i, LAYOUTS_KEY as j, SecretsContextProvider as k, legacySelectedTemplateRouteRef as l, TaskPage as m, EntityNamePicker as n, entityNamePickerValidation as o, EntityTagsPicker as p, repoPickerValidation as q, registerComponentRouteRef as r, selectedTemplateRouteRef as s, OwnedEntityPicker as t, nextSelectedTemplateRouteRef as u, viewTechDocRouteRef as v, nextRouteRef as w, ScaffolderClient as x, createScaffolderFieldExtension as y, ScaffolderFieldExtensions as z };
1627
- //# sourceMappingURL=index-49f6be11.esm.js.map
1822
+ export { OwnerPickerFieldSchema as $, OwnedEntityPickerSchema as A, nextSelectedTemplateRouteRef as B, nextRouteRef as C, ScaffolderClient as D, EntityPicker as E, FIELD_EXTENSION_WRAPPER_KEY as F, createScaffolderFieldExtension as G, ScaffolderFieldExtensions as H, createScaffolderLayout as I, ScaffolderLayouts as J, EntityPickerFieldExtension as K, LAYOUTS_WRAPPER_KEY as L, EntityNamePickerFieldExtension as M, EntityTagsPickerFieldExtension as N, OwnerPicker as O, OwnerPickerFieldExtension as P, OwnedEntityPickerFieldExtension as Q, RepoUrlPicker as R, SecretsContext as S, TemplateTypePicker as T, RepoUrlPickerFieldExtension as U, ScaffolderPage as V, scaffolderPlugin as W, NextScaffolderPage as X, createNextScaffolderFieldExtension as Y, makeFieldSchemaFromZod as Z, EntityPickerFieldSchema as _, actionsRouteRef as a, RepoUrlPickerFieldSchema as a0, OwnedEntityPickerFieldSchema as a1, EntityTagsPickerFieldSchema as a2, useTemplateSecrets as a3, scaffolderListTaskRouteRef as b, scaffolderApiRef as c, scaffolderTaskRouteRef as d, editRouteRef as e, rootRouteRef as f, TaskStatusStepper as g, TaskPageLinks as h, FIELD_EXTENSION_KEY as i, LAYOUTS_KEY as j, SecretsContextProvider as k, legacySelectedTemplateRouteRef as l, TaskPage as m, EntityPickerSchema as n, EntityNamePicker as o, entityNamePickerValidation as p, EntityNamePickerSchema as q, registerComponentRouteRef as r, selectedTemplateRouteRef as s, EntityTagsPicker as t, EntityTagsPickerSchema as u, viewTechDocRouteRef as v, repoPickerValidation as w, RepoUrlPickerSchema as x, OwnerPickerSchema as y, OwnedEntityPicker as z };
1823
+ //# sourceMappingURL=index-102258f6.esm.js.map