@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.
- package/CHANGELOG.md +58 -0
- package/alpha/package.json +1 -1
- package/dist/esm/{Router-21c2e0ba.esm.js → Router-95a01240.esm.js} +1266 -1171
- package/dist/esm/Router-95a01240.esm.js.map +1 -0
- package/dist/esm/{index-49f6be11.esm.js → index-102258f6.esm.js} +626 -430
- package/dist/esm/index-102258f6.esm.js.map +1 -0
- package/dist/esm/{index-a739a160.esm.js → index-cb47594c.esm.js} +241 -358
- package/dist/esm/index-cb47594c.esm.js.map +1 -0
- package/dist/esm/schema-4db0f1ff.esm.js +126 -0
- package/dist/esm/schema-4db0f1ff.esm.js.map +1 -0
- package/dist/index.alpha.d.ts +156 -45
- package/dist/index.beta.d.ts +154 -45
- package/dist/index.d.ts +154 -45
- package/dist/index.esm.js +3 -1
- package/dist/index.esm.js.map +1 -1
- package/package.json +23 -21
- package/dist/esm/Router-21c2e0ba.esm.js.map +0 -1
- package/dist/esm/default-973d8e16.esm.js +0 -33
- package/dist/esm/default-973d8e16.esm.js.map +0 -1
- package/dist/esm/index-49f6be11.esm.js.map +0 -1
- package/dist/esm/index-a739a160.esm.js.map +0 -1
|
@@ -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(
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
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
|
-
|
|
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(
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
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
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
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(
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
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(
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
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(
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
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(
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
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(
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
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
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
htmlFor: "parentInput"
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
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(
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
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(
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
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(
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
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(
|
|
917
|
-
|
|
918
|
-
|
|
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
|
-
|
|
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-
|
|
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-
|
|
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
|
-
|
|
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
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
...params,
|
|
1195
|
-
|
|
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(
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
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(
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
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(
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
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
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
key: String(index),
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
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
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
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 {
|
|
1627
|
-
//# sourceMappingURL=index-
|
|
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
|