@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.
@@ -16,19 +16,22 @@ import { Link } from 'react-router-dom';
16
16
  import AddCircleOutline from '@material-ui/icons/AddCircleOutline';
17
17
  import { catalogEntityCreatePermission } from '@backstage/plugin-catalog-common';
18
18
  import { usePermission } from '@backstage/plugin-permission-react';
19
- import { u as nextSelectedTemplateRouteRef, v as viewTechDocRouteRef, r as registerComponentRouteRef, s as selectedTemplateRouteRef, w as nextRouteRef, d as scaffolderTaskRouteRef, S as SecretsContext, c as scaffolderApiRef, F as FIELD_EXTENSION_WRAPPER_KEY, i as FIELD_EXTENSION_KEY, k as SecretsContextProvider } from './index-49f6be11.esm.js';
19
+ import { B as nextSelectedTemplateRouteRef, v as viewTechDocRouteRef, r as registerComponentRouteRef, s as selectedTemplateRouteRef, C as nextRouteRef, d as scaffolderTaskRouteRef, S as SecretsContext, c as scaffolderApiRef, F as FIELD_EXTENSION_WRAPPER_KEY, i as FIELD_EXTENSION_KEY, k as SecretsContextProvider } from './index-102258f6.esm.js';
20
20
  import { RELATION_OWNED_BY, parseEntityRef, stringifyEntityRef, DEFAULT_NAMESPACE } from '@backstage/catalog-model';
21
21
  import LanguageIcon from '@material-ui/icons/Language';
22
22
  import useAsync from 'react-use/lib/useAsync';
23
23
  import { withTheme } from '@rjsf/core-v5';
24
24
  import { Draft07 } from 'json-schema-library';
25
+ import { c as createFieldValidation, e as extractSchemaFromStep, D as DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS } from './schema-4db0f1ff.esm.js';
25
26
  import validator from '@rjsf/validator-ajv8';
26
- import { D as DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS } from './default-973d8e16.esm.js';
27
+ import { getDefaultFormState } from '@rjsf/utils';
27
28
  import '@backstage/errors';
28
29
  import 'qs';
29
30
  import 'zen-observable';
30
31
  import '@material-ui/core/FormControl';
31
32
  import '@material-ui/lab/Autocomplete';
33
+ import 'zod';
34
+ import 'zod-to-json-schema';
32
35
  import 'react-use/lib/useEffectOnce';
33
36
  import '@backstage/integration-react';
34
37
  import '@material-ui/core/FormHelperText';
@@ -49,12 +52,8 @@ import 'luxon';
49
52
  import 'react-use/lib/useInterval';
50
53
  import 'use-immer';
51
54
 
52
- const icon = /* @__PURE__ */ React.createElement(CheckBoxOutlineBlankIcon, {
53
- fontSize: "small"
54
- });
55
- const checkedIcon = /* @__PURE__ */ React.createElement(CheckBoxIcon, {
56
- fontSize: "small"
57
- });
55
+ const icon = /* @__PURE__ */ React.createElement(CheckBoxOutlineBlankIcon, { fontSize: "small" });
56
+ const checkedIcon = /* @__PURE__ */ React.createElement(CheckBoxIcon, { fontSize: "small" });
58
57
  const CategoryPicker = () => {
59
58
  const alertApi = useApi(alertApiRef);
60
59
  const { error, loading, availableTypes, selectedTypes, setSelectedTypes } = useEntityTypeFilter();
@@ -69,32 +68,33 @@ const CategoryPicker = () => {
69
68
  }
70
69
  if (!availableTypes)
71
70
  return null;
72
- return /* @__PURE__ */ React.createElement(Box, {
73
- pb: 1,
74
- pt: 1
75
- }, /* @__PURE__ */ React.createElement(Typography, {
76
- variant: "button"
77
- }, "Categories"), /* @__PURE__ */ React.createElement(Autocomplete, {
78
- multiple: true,
79
- "aria-label": "Categories",
80
- options: availableTypes,
81
- value: selectedTypes,
82
- onChange: (_, value) => setSelectedTypes(value),
83
- renderOption: (option, { selected }) => /* @__PURE__ */ React.createElement(FormControlLabel, {
84
- control: /* @__PURE__ */ React.createElement(Checkbox, {
85
- icon,
86
- checkedIcon,
87
- checked: selected
88
- }),
89
- label: capitalize(option)
90
- }),
91
- size: "small",
92
- popupIcon: /* @__PURE__ */ React.createElement(ExpandMoreIcon, null),
93
- renderInput: (params) => /* @__PURE__ */ React.createElement(TextField, {
94
- ...params,
95
- variant: "outlined"
96
- })
97
- }));
71
+ return /* @__PURE__ */ React.createElement(Box, { pb: 1, pt: 1 }, /* @__PURE__ */ React.createElement(Typography, { variant: "button" }, "Categories"), /* @__PURE__ */ React.createElement(
72
+ Autocomplete,
73
+ {
74
+ multiple: true,
75
+ "aria-label": "Categories",
76
+ options: availableTypes,
77
+ value: selectedTypes,
78
+ onChange: (_, value) => setSelectedTypes(value),
79
+ renderOption: (option, { selected }) => /* @__PURE__ */ React.createElement(
80
+ FormControlLabel,
81
+ {
82
+ control: /* @__PURE__ */ React.createElement(
83
+ Checkbox,
84
+ {
85
+ icon,
86
+ checkedIcon,
87
+ checked: selected
88
+ }
89
+ ),
90
+ label: capitalize(option)
91
+ }
92
+ ),
93
+ size: "small",
94
+ popupIcon: /* @__PURE__ */ React.createElement(ExpandMoreIcon, null),
95
+ renderInput: (params) => /* @__PURE__ */ React.createElement(TextField, { ...params, variant: "outlined" })
96
+ }
97
+ ));
98
98
  };
99
99
 
100
100
  const RegisterExistingButton = (props) => {
@@ -108,18 +108,17 @@ const RegisterExistingButton = (props) => {
108
108
  if (!to || !allowed) {
109
109
  return null;
110
110
  }
111
- return isXSScreen ? /* @__PURE__ */ React.createElement(IconButton, {
112
- component: Link,
113
- color: "primary",
114
- title,
115
- size: "small",
116
- to
117
- }, /* @__PURE__ */ React.createElement(AddCircleOutline, null)) : /* @__PURE__ */ React.createElement(Button, {
118
- component: Link,
119
- variant: "contained",
120
- color: "primary",
121
- to
122
- }, title);
111
+ return isXSScreen ? /* @__PURE__ */ React.createElement(
112
+ IconButton,
113
+ {
114
+ component: Link,
115
+ color: "primary",
116
+ title,
117
+ size: "small",
118
+ to
119
+ },
120
+ /* @__PURE__ */ React.createElement(AddCircleOutline, null)
121
+ ) : /* @__PURE__ */ React.createElement(Button, { component: Link, variant: "contained", color: "primary", to }, title);
123
122
  };
124
123
 
125
124
  const useStyles$4 = makeStyles(
@@ -145,17 +144,15 @@ const CardHeader = (props) => {
145
144
  const styles = useStyles$4({
146
145
  cardBackgroundImage: themeForType.backgroundImage
147
146
  });
148
- const SubtitleComponent = /* @__PURE__ */ React.createElement("div", {
149
- className: styles.subtitleWrapper
150
- }, /* @__PURE__ */ React.createElement("div", null, type), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(FavoriteEntity, {
151
- entity: props.template,
152
- style: { padding: 0 }
153
- })));
154
- return /* @__PURE__ */ React.createElement(ItemCardHeader, {
155
- title: title != null ? title : name,
156
- subtitle: SubtitleComponent,
157
- classes: { root: styles.header }
158
- });
147
+ const SubtitleComponent = /* @__PURE__ */ React.createElement("div", { className: styles.subtitleWrapper }, /* @__PURE__ */ React.createElement("div", null, type), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(FavoriteEntity, { entity: props.template, style: { padding: 0 } })));
148
+ return /* @__PURE__ */ React.createElement(
149
+ ItemCardHeader,
150
+ {
151
+ title: title != null ? title : name,
152
+ subtitle: SubtitleComponent,
153
+ classes: { root: styles.header }
154
+ }
155
+ );
159
156
  };
160
157
 
161
158
  const useStyles$3 = makeStyles(() => ({
@@ -166,14 +163,7 @@ const useStyles$3 = makeStyles(() => ({
166
163
  }));
167
164
  const CardLink = ({ icon: Icon, text, url }) => {
168
165
  const styles = useStyles$3();
169
- return /* @__PURE__ */ React.createElement("div", {
170
- className: styles.linkText
171
- }, /* @__PURE__ */ React.createElement(Icon, {
172
- fontSize: "small"
173
- }), /* @__PURE__ */ React.createElement(Link$1, {
174
- style: { marginLeft: "8px" },
175
- to: url
176
- }, text || url));
166
+ return /* @__PURE__ */ React.createElement("div", { className: styles.linkText }, /* @__PURE__ */ React.createElement(Icon, { fontSize: "small" }), /* @__PURE__ */ React.createElement(Link$1, { style: { marginLeft: "8px" }, to: url }, text || url));
177
167
  };
178
168
 
179
169
  const useStyles$2 = makeStyles((theme) => ({
@@ -235,97 +225,52 @@ const TemplateCard = (props) => {
235
225
  kind: template.kind,
236
226
  name: template.metadata.name
237
227
  });
238
- return /* @__PURE__ */ React.createElement(Card, null, /* @__PURE__ */ React.createElement(CardHeader, {
239
- template
240
- }), /* @__PURE__ */ React.createElement(CardContent, null, /* @__PURE__ */ React.createElement(Grid, {
241
- container: true,
242
- spacing: 2
243
- }, /* @__PURE__ */ React.createElement(Grid, {
244
- item: true,
245
- xs: 12
246
- }, /* @__PURE__ */ React.createElement(Box, {
247
- className: styles.box
248
- }, /* @__PURE__ */ React.createElement(MarkdownContent, {
249
- className: styles.markdown,
250
- content: (_b = template.metadata.description) != null ? _b : "No description"
251
- }))), ((_d = (_c = template.metadata.tags) == null ? void 0 : _c.length) != null ? _d : 0) > 0 && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Grid, {
252
- item: true,
253
- xs: 12
254
- }, /* @__PURE__ */ React.createElement(Divider, null)), /* @__PURE__ */ React.createElement(Grid, {
255
- item: true,
256
- xs: 12
257
- }, /* @__PURE__ */ React.createElement(Grid, {
258
- container: true,
259
- spacing: 2
260
- }, (_e = template.metadata.tags) == null ? void 0 : _e.map((tag) => /* @__PURE__ */ React.createElement(Grid, {
261
- item: true
262
- }, /* @__PURE__ */ React.createElement(Chip, {
263
- style: { margin: 0 },
264
- size: "small",
265
- label: tag,
266
- key: tag
267
- })))))), (!!viewTechDocsLink || ((_f = template.metadata.links) == null ? void 0 : _f.length)) && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Grid, {
268
- item: true,
269
- xs: 12
270
- }, /* @__PURE__ */ React.createElement(Divider, null)), /* @__PURE__ */ React.createElement(Grid, {
271
- item: true,
272
- xs: 12
273
- }, /* @__PURE__ */ React.createElement(Grid, {
274
- container: true,
275
- spacing: 2
276
- }, viewTechDocsLink && /* @__PURE__ */ React.createElement(Grid, {
277
- className: styles.linkText,
278
- item: true,
279
- xs: 6
280
- }, /* @__PURE__ */ React.createElement(CardLink, {
281
- icon: iconResolver("docs"),
282
- text: "View TechDocs",
283
- url: viewTechDocsLink
284
- })), (_g = template.metadata.links) == null ? void 0 : _g.map(({ url, icon, title }) => /* @__PURE__ */ React.createElement(Grid, {
285
- className: styles.linkText,
286
- item: true,
287
- xs: 6
288
- }, /* @__PURE__ */ React.createElement(CardLink, {
289
- icon: iconResolver(icon),
290
- text: title || url,
291
- url
292
- })))))))), /* @__PURE__ */ React.createElement(CardActions, {
293
- style: { padding: "16px" }
294
- }, /* @__PURE__ */ React.createElement("div", {
295
- className: styles.footer
296
- }, /* @__PURE__ */ React.createElement("div", {
297
- className: styles.ownedBy
298
- }, ownedByRelations.length > 0 && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(UserIcon, {
299
- fontSize: "small"
300
- }), /* @__PURE__ */ React.createElement(EntityRefLinks, {
301
- style: { marginLeft: "8px" },
302
- entityRefs: ownedByRelations,
303
- defaultKind: "Group"
304
- }))), /* @__PURE__ */ React.createElement(Button$1, {
305
- size: "small",
306
- variant: "outlined",
307
- color: "primary",
308
- to: href
309
- }, "Choose"))));
228
+ return /* @__PURE__ */ React.createElement(Card, null, /* @__PURE__ */ React.createElement(CardHeader, { template }), /* @__PURE__ */ React.createElement(CardContent, null, /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 2 }, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(Box, { className: styles.box }, /* @__PURE__ */ React.createElement(
229
+ MarkdownContent,
230
+ {
231
+ className: styles.markdown,
232
+ content: (_b = template.metadata.description) != null ? _b : "No description"
233
+ }
234
+ ))), ((_d = (_c = template.metadata.tags) == null ? void 0 : _c.length) != null ? _d : 0) > 0 && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(Divider, null)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 2 }, (_e = template.metadata.tags) == null ? void 0 : _e.map((tag) => /* @__PURE__ */ React.createElement(Grid, { item: true }, /* @__PURE__ */ React.createElement(
235
+ Chip,
236
+ {
237
+ style: { margin: 0 },
238
+ size: "small",
239
+ label: tag,
240
+ key: tag
241
+ }
242
+ )))))), (!!viewTechDocsLink || ((_f = template.metadata.links) == null ? void 0 : _f.length)) && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(Divider, null)), /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 12 }, /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 2 }, viewTechDocsLink && /* @__PURE__ */ React.createElement(Grid, { className: styles.linkText, item: true, xs: 6 }, /* @__PURE__ */ React.createElement(
243
+ CardLink,
244
+ {
245
+ icon: iconResolver("docs"),
246
+ text: "View TechDocs",
247
+ url: viewTechDocsLink
248
+ }
249
+ )), (_g = template.metadata.links) == null ? void 0 : _g.map(({ url, icon, title }) => /* @__PURE__ */ React.createElement(Grid, { className: styles.linkText, item: true, xs: 6 }, /* @__PURE__ */ React.createElement(
250
+ CardLink,
251
+ {
252
+ icon: iconResolver(icon),
253
+ text: title || url,
254
+ url
255
+ }
256
+ )))))))), /* @__PURE__ */ React.createElement(CardActions, { style: { padding: "16px" } }, /* @__PURE__ */ React.createElement("div", { className: styles.footer }, /* @__PURE__ */ React.createElement("div", { className: styles.ownedBy }, ownedByRelations.length > 0 && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(UserIcon, { fontSize: "small" }), /* @__PURE__ */ React.createElement(
257
+ EntityRefLinks,
258
+ {
259
+ style: { marginLeft: "8px" },
260
+ entityRefs: ownedByRelations,
261
+ defaultKind: "Group"
262
+ }
263
+ ))), /* @__PURE__ */ React.createElement(Button$1, { size: "small", variant: "outlined", color: "primary", to: href }, "Choose"))));
310
264
  };
311
265
 
312
266
  const TemplateGroup = (props) => {
313
267
  const { templates, title, components: { CardComponent } = {} } = props;
314
- const titleComponent = typeof title === "string" ? /* @__PURE__ */ React.createElement(ContentHeader, {
315
- title
316
- }) : title;
268
+ const titleComponent = typeof title === "string" ? /* @__PURE__ */ React.createElement(ContentHeader, { title }) : title;
317
269
  if (templates.length === 0) {
318
- return /* @__PURE__ */ React.createElement(Content, null, titleComponent, /* @__PURE__ */ React.createElement(Typography, {
319
- variant: "body2"
320
- }, "No templates found that match your filter. Learn more about", " ", /* @__PURE__ */ React.createElement(Link$1, {
321
- to: "https://backstage.io/docs/features/software-templates/adding-templates"
322
- }, "adding templates"), "."));
270
+ return /* @__PURE__ */ React.createElement(Content, null, titleComponent, /* @__PURE__ */ React.createElement(Typography, { variant: "body2" }, "No templates found that match your filter. Learn more about", " ", /* @__PURE__ */ React.createElement(Link$1, { to: "https://backstage.io/docs/features/software-templates/adding-templates" }, "adding templates"), "."));
323
271
  }
324
272
  const Card = CardComponent || TemplateCard;
325
- return /* @__PURE__ */ React.createElement(Content, null, titleComponent, /* @__PURE__ */ React.createElement(ItemCardGrid, null, templates.map((template) => /* @__PURE__ */ React.createElement(Card, {
326
- key: stringifyEntityRef(template),
327
- template
328
- }))));
273
+ return /* @__PURE__ */ React.createElement(Content, null, titleComponent, /* @__PURE__ */ React.createElement(ItemCardGrid, null, templates.map((template) => /* @__PURE__ */ React.createElement(Card, { key: stringifyEntityRef(template), template }))));
329
274
  };
330
275
 
331
276
  const TemplateGroups = (props) => {
@@ -340,20 +285,19 @@ const TemplateGroups = (props) => {
340
285
  return null;
341
286
  }
342
287
  if (!entities || !entities.length) {
343
- return /* @__PURE__ */ React.createElement(Typography, {
344
- variant: "body2"
345
- }, "No templates found that match your filter. Learn more about", " ", /* @__PURE__ */ React.createElement(Link$1, {
346
- to: "https://backstage.io/docs/features/software-templates/adding-templates"
347
- }, "adding templates"), ".");
288
+ return /* @__PURE__ */ React.createElement(Typography, { variant: "body2" }, "No templates found that match your filter. Learn more about", " ", /* @__PURE__ */ React.createElement(Link$1, { to: "https://backstage.io/docs/features/software-templates/adding-templates" }, "adding templates"), ".");
348
289
  }
349
- return /* @__PURE__ */ React.createElement(React.Fragment, null, groups.map(({ title, filter }, index) => /* @__PURE__ */ React.createElement(TemplateGroup, {
350
- key: index,
351
- templates: entities.filter(
352
- (e) => filter(e)
353
- ),
354
- title,
355
- components: { CardComponent: TemplateCardComponent }
356
- })));
290
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, groups.map(({ title, filter }, index) => /* @__PURE__ */ React.createElement(
291
+ TemplateGroup,
292
+ {
293
+ key: index,
294
+ templates: entities.filter(
295
+ (e) => filter(e)
296
+ ),
297
+ title,
298
+ components: { CardComponent: TemplateCardComponent }
299
+ }
300
+ )));
357
301
  };
358
302
 
359
303
  const defaultGroup = {
@@ -363,114 +307,32 @@ const defaultGroup = {
363
307
  const TemplateListPage = (props) => {
364
308
  const registerComponentLink = useRouteRef(registerComponentRouteRef);
365
309
  const { TemplateCardComponent, groups = [] } = props;
366
- return /* @__PURE__ */ React.createElement(EntityListProvider, null, /* @__PURE__ */ React.createElement(Page, {
367
- themeId: "website"
368
- }, /* @__PURE__ */ React.createElement(Header, {
369
- pageTitleOverride: "Create a new component",
370
- title: "Create a new component",
371
- subtitle: "Create new software components using standard templates in your organization"
372
- }), /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(ContentHeader, {
373
- title: "Available Templates"
374
- }, /* @__PURE__ */ React.createElement(RegisterExistingButton, {
375
- title: "Register Existing Component",
376
- to: registerComponentLink && registerComponentLink()
377
- }), /* @__PURE__ */ React.createElement(SupportButton, null, "Create new software components using standard templates. Different templates create different kinds of components (services, websites, documentation, ...).")), /* @__PURE__ */ React.createElement(CatalogFilterLayout, null, /* @__PURE__ */ React.createElement(CatalogFilterLayout.Filters, null, /* @__PURE__ */ React.createElement(EntitySearchBar, null), /* @__PURE__ */ React.createElement(EntityKindPicker, {
378
- initialFilter: "template",
379
- hidden: true
380
- }), /* @__PURE__ */ React.createElement(UserListPicker, {
381
- initialFilter: "all",
382
- availableFilters: ["all", "starred"]
383
- }), /* @__PURE__ */ React.createElement(CategoryPicker, null), /* @__PURE__ */ React.createElement(EntityTagPicker, null)), /* @__PURE__ */ React.createElement(CatalogFilterLayout.Content, null, /* @__PURE__ */ React.createElement(TemplateGroups, {
384
- groups: [...groups, defaultGroup],
385
- TemplateCardComponent
386
- }))))));
387
- };
388
-
389
- function isObject(value) {
390
- return typeof value === "object" && value !== null && !Array.isArray(value);
391
- }
392
- function extractUiSchema(schema, uiSchema) {
393
- if (!isObject(schema)) {
394
- return;
395
- }
396
- const { properties, items, anyOf, oneOf, allOf, dependencies } = schema;
397
- for (const propName in schema) {
398
- if (!schema.hasOwnProperty(propName)) {
399
- continue;
400
- }
401
- if (propName.startsWith("ui:")) {
402
- uiSchema[propName] = schema[propName];
403
- delete schema[propName];
310
+ return /* @__PURE__ */ React.createElement(EntityListProvider, null, /* @__PURE__ */ React.createElement(Page, { themeId: "website" }, /* @__PURE__ */ React.createElement(
311
+ Header,
312
+ {
313
+ pageTitleOverride: "Create a new component",
314
+ title: "Create a new component",
315
+ subtitle: "Create new software components using standard templates in your organization"
404
316
  }
405
- }
406
- if (isObject(properties)) {
407
- for (const propName in properties) {
408
- if (!properties.hasOwnProperty(propName)) {
409
- continue;
410
- }
411
- const schemaNode = properties[propName];
412
- if (!isObject(schemaNode)) {
413
- continue;
414
- }
415
- const innerUiSchema = {};
416
- uiSchema[propName] = innerUiSchema;
417
- extractUiSchema(schemaNode, innerUiSchema);
317
+ ), /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(ContentHeader, { title: "Available Templates" }, /* @__PURE__ */ React.createElement(
318
+ RegisterExistingButton,
319
+ {
320
+ title: "Register Existing Component",
321
+ to: registerComponentLink && registerComponentLink()
418
322
  }
419
- }
420
- if (isObject(items)) {
421
- const innerUiSchema = {};
422
- uiSchema.items = innerUiSchema;
423
- extractUiSchema(items, innerUiSchema);
424
- }
425
- if (Array.isArray(anyOf)) {
426
- for (const schemaNode of anyOf) {
427
- if (!isObject(schemaNode)) {
428
- continue;
429
- }
430
- extractUiSchema(schemaNode, uiSchema);
323
+ ), /* @__PURE__ */ React.createElement(SupportButton, null, "Create new software components using standard templates. Different templates create different kinds of components (services, websites, documentation, ...).")), /* @__PURE__ */ React.createElement(CatalogFilterLayout, null, /* @__PURE__ */ React.createElement(CatalogFilterLayout.Filters, null, /* @__PURE__ */ React.createElement(EntitySearchBar, null), /* @__PURE__ */ React.createElement(EntityKindPicker, { initialFilter: "template", hidden: true }), /* @__PURE__ */ React.createElement(
324
+ UserListPicker,
325
+ {
326
+ initialFilter: "all",
327
+ availableFilters: ["all", "starred"]
431
328
  }
432
- }
433
- if (Array.isArray(oneOf)) {
434
- for (const schemaNode of oneOf) {
435
- if (!isObject(schemaNode)) {
436
- continue;
437
- }
438
- extractUiSchema(schemaNode, uiSchema);
329
+ ), /* @__PURE__ */ React.createElement(CategoryPicker, null), /* @__PURE__ */ React.createElement(EntityTagPicker, null)), /* @__PURE__ */ React.createElement(CatalogFilterLayout.Content, null, /* @__PURE__ */ React.createElement(
330
+ TemplateGroups,
331
+ {
332
+ groups: [...groups, defaultGroup],
333
+ TemplateCardComponent
439
334
  }
440
- }
441
- if (Array.isArray(allOf)) {
442
- for (const schemaNode of allOf) {
443
- if (!isObject(schemaNode)) {
444
- continue;
445
- }
446
- extractUiSchema(schemaNode, uiSchema);
447
- }
448
- }
449
- if (isObject(dependencies)) {
450
- for (const depName of Object.keys(dependencies)) {
451
- const schemaNode = dependencies[depName];
452
- if (!isObject(schemaNode)) {
453
- continue;
454
- }
455
- extractUiSchema(schemaNode, uiSchema);
456
- }
457
- }
458
- }
459
- const extractSchemaFromStep = (inputStep) => {
460
- const uiSchema = {};
461
- const returnSchema = JSON.parse(JSON.stringify(inputStep));
462
- extractUiSchema(returnSchema, uiSchema);
463
- return { uiSchema, schema: returnSchema };
464
- };
465
- const createFieldValidation = () => {
466
- const fieldValidation = {
467
- __errors: [],
468
- addError: (message) => {
469
- var _a;
470
- (_a = fieldValidation.__errors) == null ? void 0 : _a.push(message);
471
- }
472
- };
473
- return fieldValidation;
335
+ ))))));
474
336
  };
475
337
 
476
338
  const createAsyncValidators = (rootSchema, validators, context) => {
@@ -563,9 +425,7 @@ const ReviewState = (props) => {
563
425
  return [key, value];
564
426
  })
565
427
  );
566
- return /* @__PURE__ */ React.createElement(StructuredMetadataTable, {
567
- metadata: reviewData
568
- });
428
+ return /* @__PURE__ */ React.createElement(StructuredMetadataTable, { metadata: reviewData });
569
429
  };
570
430
 
571
431
  const useStyles$1 = makeStyles((theme) => ({
@@ -613,12 +473,22 @@ const Stepper = (props) => {
613
473
  const handleNext = async ({
614
474
  formData
615
475
  }) => {
476
+ var _a, _b;
616
477
  setErrors(void 0);
617
- const returnedValidation = await validation(formData);
478
+ const schema = (_a = steps[activeStep]) == null ? void 0 : _a.schema;
479
+ const rootSchema = (_b = steps[activeStep]) == null ? void 0 : _b.mergedSchema;
480
+ const newFormData = getDefaultFormState(
481
+ validator,
482
+ schema,
483
+ formData,
484
+ rootSchema,
485
+ true
486
+ );
487
+ const returnedValidation = await validation(newFormData);
618
488
  const hasErrors = Object.values(returnedValidation).some(
619
489
  (i) => {
620
- var _a;
621
- return (_a = i.__errors) == null ? void 0 : _a.length;
490
+ var _a2;
491
+ return (_a2 = i.__errors) == null ? void 0 : _a2.length;
622
492
  }
623
493
  );
624
494
  if (hasErrors) {
@@ -631,56 +501,54 @@ const Stepper = (props) => {
631
501
  return stepNum;
632
502
  });
633
503
  }
634
- setFormState((current) => ({ ...current, ...formData }));
504
+ setFormState((current) => ({ ...current, ...newFormData }));
635
505
  };
636
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Stepper$1, {
637
- activeStep,
638
- alternativeLabel: true,
639
- variant: "elevation"
640
- }, steps.map((step, index) => /* @__PURE__ */ React.createElement(Step, {
641
- key: index
642
- }, /* @__PURE__ */ React.createElement(StepLabel, null, step.title))), /* @__PURE__ */ React.createElement(Step, null, /* @__PURE__ */ React.createElement(StepLabel, null, "Review"))), /* @__PURE__ */ React.createElement("div", {
643
- className: styles.formWrapper
644
- }, activeStep < steps.length ? /* @__PURE__ */ React.createElement(Form, {
645
- validator,
646
- extraErrors: errors,
647
- formData: formState,
648
- formContext: { formData: formState },
649
- schema: steps[activeStep].schema,
650
- uiSchema: steps[activeStep].uiSchema,
651
- onSubmit: handleNext,
652
- fields: extensions,
653
- showErrorList: false
654
- }, /* @__PURE__ */ React.createElement("div", {
655
- className: styles.footer
656
- }, /* @__PURE__ */ React.createElement(Button$2, {
657
- onClick: handleBack,
658
- className: styles.backButton,
659
- disabled: activeStep < 1
660
- }, "Back"), /* @__PURE__ */ React.createElement(Button$2, {
661
- variant: "contained",
662
- color: "primary",
663
- type: "submit"
664
- }, activeStep === steps.length - 1 ? "Review" : "Next"))) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ReviewState, {
665
- formState,
666
- schemas: steps
667
- }), /* @__PURE__ */ React.createElement("div", {
668
- className: styles.footer
669
- }, /* @__PURE__ */ React.createElement(Button$2, {
670
- onClick: handleBack,
671
- className: styles.backButton,
672
- disabled: activeStep < 1
673
- }, "Back"), /* @__PURE__ */ React.createElement(Button$2, {
674
- variant: "contained",
675
- onClick: () => {
676
- props.onComplete(formState);
677
- const name = typeof formState.name === "string" ? formState.name : void 0;
678
- analytics.captureEvent(
679
- "create",
680
- name || `new ${templateName}`
681
- );
682
- }
683
- }, "Create")))));
506
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Stepper$1, { activeStep, alternativeLabel: true, variant: "elevation" }, steps.map((step, index) => /* @__PURE__ */ React.createElement(Step, { key: index }, /* @__PURE__ */ React.createElement(StepLabel, null, step.title))), /* @__PURE__ */ React.createElement(Step, null, /* @__PURE__ */ React.createElement(StepLabel, null, "Review"))), /* @__PURE__ */ React.createElement("div", { className: styles.formWrapper }, activeStep < steps.length ? /* @__PURE__ */ React.createElement(
507
+ Form,
508
+ {
509
+ validator,
510
+ extraErrors: errors,
511
+ formData: formState,
512
+ formContext: { formData: formState },
513
+ schema: steps[activeStep].schema,
514
+ uiSchema: steps[activeStep].uiSchema,
515
+ onSubmit: handleNext,
516
+ fields: extensions,
517
+ showErrorList: false,
518
+ transformErrors: props.transformErrors
519
+ },
520
+ /* @__PURE__ */ React.createElement("div", { className: styles.footer }, /* @__PURE__ */ React.createElement(
521
+ Button$2,
522
+ {
523
+ onClick: handleBack,
524
+ className: styles.backButton,
525
+ disabled: activeStep < 1
526
+ },
527
+ "Back"
528
+ ), /* @__PURE__ */ React.createElement(Button$2, { variant: "contained", color: "primary", type: "submit" }, activeStep === steps.length - 1 ? "Review" : "Next"))
529
+ ) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ReviewState, { formState, schemas: steps }), /* @__PURE__ */ React.createElement("div", { className: styles.footer }, /* @__PURE__ */ React.createElement(
530
+ Button$2,
531
+ {
532
+ onClick: handleBack,
533
+ className: styles.backButton,
534
+ disabled: activeStep < 1
535
+ },
536
+ "Back"
537
+ ), /* @__PURE__ */ React.createElement(
538
+ Button$2,
539
+ {
540
+ variant: "contained",
541
+ onClick: () => {
542
+ props.onComplete(formState);
543
+ const name = typeof formState.name === "string" ? formState.name : void 0;
544
+ analytics.captureEvent(
545
+ "create",
546
+ name || `new ${templateName}`
547
+ );
548
+ }
549
+ },
550
+ "Create"
551
+ )))));
684
552
  };
685
553
 
686
554
  const useStyles = makeStyles(() => ({
@@ -733,31 +601,39 @@ const TemplateWizardPage = (props) => {
733
601
  }
734
602
  }, [error, errorApi]);
735
603
  if (error) {
736
- return /* @__PURE__ */ React.createElement(Navigate, {
737
- to: rootRef()
738
- });
604
+ return /* @__PURE__ */ React.createElement(Navigate, { to: rootRef() });
739
605
  }
740
- return /* @__PURE__ */ React.createElement(AnalyticsContext, {
741
- attributes: { entityRef: templateRef }
742
- }, /* @__PURE__ */ React.createElement(Page, {
743
- themeId: "website"
744
- }, /* @__PURE__ */ React.createElement(Header, {
745
- pageTitleOverride: "Create a new component",
746
- title: "Create a new component",
747
- subtitle: "Create new software components using standard templates in your organization"
748
- }), /* @__PURE__ */ React.createElement(Content, null, loading && /* @__PURE__ */ React.createElement(Progress, null), manifest && /* @__PURE__ */ React.createElement(InfoCard, {
749
- title: manifest.title,
750
- subheader: /* @__PURE__ */ React.createElement(MarkdownContent, {
751
- className: styles.markdown,
752
- content: (_b = manifest.description) != null ? _b : "No description"
753
- }),
754
- noPadding: true,
755
- titleTypographyProps: { component: "h2" }
756
- }, /* @__PURE__ */ React.createElement(Stepper, {
757
- manifest,
758
- extensions: props.customFieldExtensions,
759
- onComplete
760
- })))));
606
+ return /* @__PURE__ */ React.createElement(AnalyticsContext, { attributes: { entityRef: templateRef } }, /* @__PURE__ */ React.createElement(Page, { themeId: "website" }, /* @__PURE__ */ React.createElement(
607
+ Header,
608
+ {
609
+ pageTitleOverride: "Create a new component",
610
+ title: "Create a new component",
611
+ subtitle: "Create new software components using standard templates in your organization"
612
+ }
613
+ ), /* @__PURE__ */ React.createElement(Content, null, loading && /* @__PURE__ */ React.createElement(Progress, null), manifest && /* @__PURE__ */ React.createElement(
614
+ InfoCard,
615
+ {
616
+ title: manifest.title,
617
+ subheader: /* @__PURE__ */ React.createElement(
618
+ MarkdownContent,
619
+ {
620
+ className: styles.markdown,
621
+ content: (_b = manifest.description) != null ? _b : "No description"
622
+ }
623
+ ),
624
+ noPadding: true,
625
+ titleTypographyProps: { component: "h2" }
626
+ },
627
+ /* @__PURE__ */ React.createElement(
628
+ Stepper,
629
+ {
630
+ manifest,
631
+ extensions: props.customFieldExtensions,
632
+ onComplete,
633
+ transformErrors: props.transformErrors
634
+ }
635
+ )
636
+ ))));
761
637
  };
762
638
 
763
639
  const Router = (props) => {
@@ -779,19 +655,26 @@ const Router = (props) => {
779
655
  )
780
656
  )
781
657
  ];
782
- return /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(Route, {
783
- path: "/",
784
- element: /* @__PURE__ */ React.createElement(TemplateListPage, {
785
- TemplateCardComponent,
786
- groups: props.groups
787
- })
788
- }), /* @__PURE__ */ React.createElement(Route, {
789
- path: nextSelectedTemplateRouteRef.path,
790
- element: /* @__PURE__ */ React.createElement(SecretsContextProvider, null, /* @__PURE__ */ React.createElement(TemplateWizardPage, {
791
- customFieldExtensions: fieldExtensions
792
- }))
793
- }));
658
+ return /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(
659
+ Route,
660
+ {
661
+ path: "/",
662
+ element: /* @__PURE__ */ React.createElement(
663
+ TemplateListPage,
664
+ {
665
+ TemplateCardComponent,
666
+ groups: props.groups
667
+ }
668
+ )
669
+ }
670
+ ), /* @__PURE__ */ React.createElement(
671
+ Route,
672
+ {
673
+ path: nextSelectedTemplateRouteRef.path,
674
+ element: /* @__PURE__ */ React.createElement(SecretsContextProvider, null, /* @__PURE__ */ React.createElement(TemplateWizardPage, { customFieldExtensions: fieldExtensions }))
675
+ }
676
+ ));
794
677
  };
795
678
 
796
679
  export { Router };
797
- //# sourceMappingURL=index-a739a160.esm.js.map
680
+ //# sourceMappingURL=index-cb47594c.esm.js.map