@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
|
@@ -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 {
|
|
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 {
|
|
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
|
-
|
|
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
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
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(
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
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
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
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
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
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(
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
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
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
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
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
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
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
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
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
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
|
|
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
|
|
621
|
-
return (
|
|
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, ...
|
|
504
|
+
setFormState((current) => ({ ...current, ...newFormData }));
|
|
635
505
|
};
|
|
636
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Stepper$1, {
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
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
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
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(
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
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-
|
|
680
|
+
//# sourceMappingURL=index-cb47594c.esm.js.map
|