@backstage/plugin-scaffolder 0.11.13 → 0.11.14
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 +14 -0
- package/dist/esm/{Router-8b2aa17e.esm.js → Router-0282e15a.esm.js} +46 -58
- package/dist/esm/{Router-8b2aa17e.esm.js.map → Router-0282e15a.esm.js.map} +1 -1
- package/dist/esm/{index-385b3fc1.esm.js → index-306a8b5a.esm.js} +62 -47
- package/dist/esm/index-306a8b5a.esm.js.map +1 -0
- package/dist/index.esm.js +1 -1
- package/package.json +15 -14
- package/dist/esm/index-385b3fc1.esm.js.map +0 -1
|
@@ -43,17 +43,17 @@ class ScaffolderClient {
|
|
|
43
43
|
...this.scmIntegrationsApi.bitbucket.list(),
|
|
44
44
|
...this.scmIntegrationsApi.github.list(),
|
|
45
45
|
...this.scmIntegrationsApi.gitlab.list()
|
|
46
|
-
].map((c) => ({type: c.type, title: c.title, host: c.config.host})).filter((c) => options.allowedHosts.includes(c.host));
|
|
46
|
+
].map((c) => ({ type: c.type, title: c.title, host: c.config.host })).filter((c) => options.allowedHosts.includes(c.host));
|
|
47
47
|
}
|
|
48
48
|
async getTemplateParameterSchema(templateName) {
|
|
49
|
-
const {namespace, kind, name} = templateName;
|
|
49
|
+
const { namespace, kind, name } = templateName;
|
|
50
50
|
const token = await this.identityApi.getIdToken();
|
|
51
51
|
const baseUrl = await this.discoveryApi.getBaseUrl("scaffolder");
|
|
52
52
|
const templatePath = [namespace, kind, name].map((s) => encodeURIComponent(s)).join("/");
|
|
53
53
|
const url = `${baseUrl}/v2/templates/${templatePath}/parameter-schema`;
|
|
54
54
|
const response = await fetch(url, {
|
|
55
55
|
headers: {
|
|
56
|
-
...token && {Authorization: `Bearer ${token}`}
|
|
56
|
+
...token && { Authorization: `Bearer ${token}` }
|
|
57
57
|
}
|
|
58
58
|
});
|
|
59
59
|
if (!response.ok) {
|
|
@@ -69,16 +69,16 @@ class ScaffolderClient {
|
|
|
69
69
|
method: "POST",
|
|
70
70
|
headers: {
|
|
71
71
|
"Content-Type": "application/json",
|
|
72
|
-
...token && {Authorization: `Bearer ${token}`}
|
|
72
|
+
...token && { Authorization: `Bearer ${token}` }
|
|
73
73
|
},
|
|
74
|
-
body: JSON.stringify({templateName, values: {...values}})
|
|
74
|
+
body: JSON.stringify({ templateName, values: { ...values } })
|
|
75
75
|
});
|
|
76
76
|
if (response.status !== 201) {
|
|
77
77
|
const status = `${response.status} ${response.statusText}`;
|
|
78
78
|
const body = await response.text();
|
|
79
79
|
throw new Error(`Backend request failed, ${status} ${body.trim()}`);
|
|
80
80
|
}
|
|
81
|
-
const {id} = await response.json();
|
|
81
|
+
const { id } = await response.json();
|
|
82
82
|
return id;
|
|
83
83
|
}
|
|
84
84
|
async getTask(taskId) {
|
|
@@ -86,7 +86,7 @@ class ScaffolderClient {
|
|
|
86
86
|
const baseUrl = await this.discoveryApi.getBaseUrl("scaffolder");
|
|
87
87
|
const url = `${baseUrl}/v2/tasks/${encodeURIComponent(taskId)}`;
|
|
88
88
|
const response = await fetch(url, {
|
|
89
|
-
headers: token ? {Authorization: `Bearer ${token}`} : {}
|
|
89
|
+
headers: token ? { Authorization: `Bearer ${token}` } : {}
|
|
90
90
|
});
|
|
91
91
|
if (!response.ok) {
|
|
92
92
|
throw await ResponseError.fromResponse(response);
|
|
@@ -110,7 +110,7 @@ class ScaffolderClient {
|
|
|
110
110
|
}
|
|
111
111
|
this.discoveryApi.getBaseUrl("scaffolder").then((baseUrl) => {
|
|
112
112
|
const url = `${baseUrl}/v2/tasks/${encodeURIComponent(taskId)}/eventstream`;
|
|
113
|
-
const eventSource = new EventSource(url, {withCredentials: true});
|
|
113
|
+
const eventSource = new EventSource(url, { withCredentials: true });
|
|
114
114
|
eventSource.addEventListener("log", (event) => {
|
|
115
115
|
if (event.data) {
|
|
116
116
|
try {
|
|
@@ -147,7 +147,7 @@ class ScaffolderClient {
|
|
|
147
147
|
return new ObservableImpl((subscriber) => {
|
|
148
148
|
this.discoveryApi.getBaseUrl("scaffolder").then(async (baseUrl) => {
|
|
149
149
|
while (!subscriber.closed) {
|
|
150
|
-
const url = `${baseUrl}/v2/tasks/${encodeURIComponent(taskId)}/events?${qs.stringify({after})}`;
|
|
150
|
+
const url = `${baseUrl}/v2/tasks/${encodeURIComponent(taskId)}/events?${qs.stringify({ after })}`;
|
|
151
151
|
const response = await fetch(url);
|
|
152
152
|
if (!response.ok) {
|
|
153
153
|
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
@@ -170,7 +170,7 @@ class ScaffolderClient {
|
|
|
170
170
|
const baseUrl = await this.discoveryApi.getBaseUrl("scaffolder");
|
|
171
171
|
const token = await this.identityApi.getIdToken();
|
|
172
172
|
const response = await fetch(`${baseUrl}/v2/actions`, {
|
|
173
|
-
headers: token ? {Authorization: `Bearer ${token}`} : {}
|
|
173
|
+
headers: token ? { Authorization: `Bearer ${token}` } : {}
|
|
174
174
|
});
|
|
175
175
|
if (!response.ok) {
|
|
176
176
|
throw await ResponseError.fromResponse(response);
|
|
@@ -181,7 +181,7 @@ class ScaffolderClient {
|
|
|
181
181
|
|
|
182
182
|
const EntityPicker = ({
|
|
183
183
|
onChange,
|
|
184
|
-
schema: {title = "Entity", description = "An entity from the catalog"},
|
|
184
|
+
schema: { title = "Entity", description = "An entity from the catalog" },
|
|
185
185
|
required,
|
|
186
186
|
uiSchema,
|
|
187
187
|
rawErrors,
|
|
@@ -192,8 +192,8 @@ const EntityPicker = ({
|
|
|
192
192
|
const allowedKinds = (_a = uiSchema["ui:options"]) == null ? void 0 : _a.allowedKinds;
|
|
193
193
|
const defaultKind = (_b = uiSchema["ui:options"]) == null ? void 0 : _b.defaultKind;
|
|
194
194
|
const catalogApi = useApi(catalogApiRef);
|
|
195
|
-
const {value: entities, loading} = useAsync(() => catalogApi.getEntities(allowedKinds ? {filter: {kind: allowedKinds}} : void 0));
|
|
196
|
-
const entityRefs = entities == null ? void 0 : entities.items.map((e) => formatEntityRefTitle(e, {defaultKind}));
|
|
195
|
+
const { value: entities, loading } = useAsync(() => catalogApi.getEntities(allowedKinds ? { filter: { kind: allowedKinds } } : void 0));
|
|
196
|
+
const entityRefs = entities == null ? void 0 : entities.items.map((e) => formatEntityRefTitle(e, { defaultKind }));
|
|
197
197
|
const onSelect = (_, value) => {
|
|
198
198
|
onChange(value || "");
|
|
199
199
|
};
|
|
@@ -224,10 +224,10 @@ const EntityPicker = ({
|
|
|
224
224
|
const TextValuePicker = ({
|
|
225
225
|
onChange,
|
|
226
226
|
required,
|
|
227
|
-
schema: {title, description},
|
|
227
|
+
schema: { title, description },
|
|
228
228
|
rawErrors,
|
|
229
229
|
formData,
|
|
230
|
-
uiSchema: {"ui:autofocus": autoFocus},
|
|
230
|
+
uiSchema: { "ui:autofocus": autoFocus },
|
|
231
231
|
idSchema,
|
|
232
232
|
placeholder
|
|
233
233
|
}) => /* @__PURE__ */ React.createElement(TextField, {
|
|
@@ -237,17 +237,17 @@ const TextValuePicker = ({
|
|
|
237
237
|
helperText: description,
|
|
238
238
|
required,
|
|
239
239
|
value: formData != null ? formData : "",
|
|
240
|
-
onChange: ({target: {value}}) => onChange(value),
|
|
240
|
+
onChange: ({ target: { value } }) => onChange(value),
|
|
241
241
|
margin: "normal",
|
|
242
242
|
error: (rawErrors == null ? void 0 : rawErrors.length) > 0 && !formData,
|
|
243
|
-
inputProps: {autoFocus}
|
|
243
|
+
inputProps: { autoFocus }
|
|
244
244
|
});
|
|
245
245
|
|
|
246
246
|
const EntityNamePicker = ({
|
|
247
|
-
schema: {title = "Name", description = "Unique name of the component"},
|
|
247
|
+
schema: { title = "Name", description = "Unique name of the component" },
|
|
248
248
|
...props
|
|
249
249
|
}) => /* @__PURE__ */ React.createElement(TextValuePicker, {
|
|
250
|
-
schema: {title, description},
|
|
250
|
+
schema: { title, description },
|
|
251
251
|
...props
|
|
252
252
|
});
|
|
253
253
|
|
|
@@ -258,7 +258,7 @@ const entityNamePickerValidation = (value, validation) => {
|
|
|
258
258
|
};
|
|
259
259
|
|
|
260
260
|
const OwnerPicker = ({
|
|
261
|
-
schema: {title = "Owner", description = "The owner of the component"},
|
|
261
|
+
schema: { title = "Owner", description = "The owner of the component" },
|
|
262
262
|
uiSchema,
|
|
263
263
|
...props
|
|
264
264
|
}) => {
|
|
@@ -275,12 +275,12 @@ const OwnerPicker = ({
|
|
|
275
275
|
};
|
|
276
276
|
return /* @__PURE__ */ React.createElement(EntityPicker, {
|
|
277
277
|
...props,
|
|
278
|
-
schema: {title, description},
|
|
278
|
+
schema: { title, description },
|
|
279
279
|
uiSchema: ownerUiSchema
|
|
280
280
|
});
|
|
281
281
|
};
|
|
282
282
|
|
|
283
|
-
function splitFormData(url) {
|
|
283
|
+
function splitFormData(url, allowedOwners) {
|
|
284
284
|
let host = void 0;
|
|
285
285
|
let owner = void 0;
|
|
286
286
|
let repo = void 0;
|
|
@@ -291,7 +291,7 @@ function splitFormData(url) {
|
|
|
291
291
|
if (url) {
|
|
292
292
|
const parsed = new URL(`https://${url}`);
|
|
293
293
|
host = parsed.host;
|
|
294
|
-
owner = parsed.searchParams.get("owner") || void 0;
|
|
294
|
+
owner = parsed.searchParams.get("owner") || (allowedOwners == null ? void 0 : allowedOwners[0]);
|
|
295
295
|
repo = parsed.searchParams.get("repo") || void 0;
|
|
296
296
|
organization = parsed.searchParams.get("organization") || void 0;
|
|
297
297
|
workspace = parsed.searchParams.get("workspace") || void 0;
|
|
@@ -299,7 +299,7 @@ function splitFormData(url) {
|
|
|
299
299
|
}
|
|
300
300
|
} catch {
|
|
301
301
|
}
|
|
302
|
-
return {host, owner, repo, organization, workspace, project};
|
|
302
|
+
return { host, owner, repo, organization, workspace, project };
|
|
303
303
|
}
|
|
304
304
|
function serializeFormData(data) {
|
|
305
305
|
if (!data.host) {
|
|
@@ -329,14 +329,15 @@ const RepoUrlPicker = ({
|
|
|
329
329
|
rawErrors,
|
|
330
330
|
formData
|
|
331
331
|
}) => {
|
|
332
|
-
var _a, _b, _c;
|
|
332
|
+
var _a, _b, _c, _d, _e;
|
|
333
333
|
const scaffolderApi = useApi(scaffolderApiRef);
|
|
334
334
|
const integrationApi = useApi(scmIntegrationsApiRef);
|
|
335
335
|
const allowedHosts = (_a = uiSchema["ui:options"]) == null ? void 0 : _a.allowedHosts;
|
|
336
|
-
const
|
|
337
|
-
|
|
336
|
+
const allowedOwners = (_b = uiSchema["ui:options"]) == null ? void 0 : _b.allowedOwners;
|
|
337
|
+
const { value: integrations, loading } = useAsync(async () => {
|
|
338
|
+
return await scaffolderApi.getIntegrationsList({ allowedHosts });
|
|
338
339
|
});
|
|
339
|
-
const {host, owner, repo, organization, workspace, project} = splitFormData(formData);
|
|
340
|
+
const { host, owner, repo, organization, workspace, project } = splitFormData(formData, allowedOwners);
|
|
340
341
|
const updateHost = useCallback((evt) => {
|
|
341
342
|
onChange(serializeFormData({
|
|
342
343
|
host: evt.target.value,
|
|
@@ -435,7 +436,7 @@ const RepoUrlPicker = ({
|
|
|
435
436
|
id: "repoInput",
|
|
436
437
|
onChange: updateOrganization,
|
|
437
438
|
value: organization
|
|
438
|
-
}), /* @__PURE__ */ React.createElement(FormHelperText, null, "The name of the organization")), host && ((
|
|
439
|
+
}), /* @__PURE__ */ React.createElement(FormHelperText, null, "The name of the organization")), host && ((_c = integrationApi.byHost(host)) == null ? void 0 : _c.type) === "bitbucket" && /* @__PURE__ */ React.createElement(React.Fragment, null, host === "bitbucket.org" && /* @__PURE__ */ React.createElement(FormControl, {
|
|
439
440
|
margin: "normal",
|
|
440
441
|
required: true,
|
|
441
442
|
error: (rawErrors == null ? void 0 : rawErrors.length) > 0 && !workspace
|
|
@@ -455,7 +456,7 @@ const RepoUrlPicker = ({
|
|
|
455
456
|
id: "wokrspaceInput",
|
|
456
457
|
onChange: updateProject,
|
|
457
458
|
value: project
|
|
458
|
-
}), /* @__PURE__ */ React.createElement(FormHelperText, null, "The project where the repository will be created"))), host && ((
|
|
459
|
+
}), /* @__PURE__ */ React.createElement(FormHelperText, null, "The project where the repository will be created"))), host && ((_d = integrationApi.byHost(host)) == null ? void 0 : _d.type) !== "bitbucket" && !allowedOwners && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(FormControl, {
|
|
459
460
|
margin: "normal",
|
|
460
461
|
required: true,
|
|
461
462
|
error: (rawErrors == null ? void 0 : rawErrors.length) > 0 && !owner
|
|
@@ -465,7 +466,21 @@ const RepoUrlPicker = ({
|
|
|
465
466
|
id: "ownerInput",
|
|
466
467
|
onChange: updateOwner,
|
|
467
468
|
value: owner
|
|
468
|
-
}), /* @__PURE__ */ React.createElement(FormHelperText, null, "The organization, user or project that this repo will belong to"))), /* @__PURE__ */ React.createElement(FormControl, {
|
|
469
|
+
}), /* @__PURE__ */ React.createElement(FormHelperText, null, "The organization, user or project that this repo will belong to"))), host && ((_e = integrationApi.byHost(host)) == null ? void 0 : _e.type) !== "bitbucket" && allowedOwners && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(FormControl, {
|
|
470
|
+
margin: "normal",
|
|
471
|
+
required: true,
|
|
472
|
+
error: (rawErrors == null ? void 0 : rawErrors.length) > 0 && !owner
|
|
473
|
+
}, /* @__PURE__ */ React.createElement(InputLabel, {
|
|
474
|
+
htmlFor: "ownerInput"
|
|
475
|
+
}, "Owner Available"), /* @__PURE__ */ React.createElement(Select, {
|
|
476
|
+
native: true,
|
|
477
|
+
id: "ownerInput",
|
|
478
|
+
onChange: updateOwner,
|
|
479
|
+
value: owner
|
|
480
|
+
}, allowedOwners ? allowedOwners.map((i) => /* @__PURE__ */ React.createElement("option", {
|
|
481
|
+
key: i,
|
|
482
|
+
value: i
|
|
483
|
+
}, i)) : /* @__PURE__ */ React.createElement("p", null, "loading"), ";"), /* @__PURE__ */ React.createElement(FormHelperText, null, "The organization, user or project that this repo will belong to"))), /* @__PURE__ */ React.createElement(FormControl, {
|
|
469
484
|
margin: "normal",
|
|
470
485
|
required: true,
|
|
471
486
|
error: (rawErrors == null ? void 0 : rawErrors.length) > 0 && !repo
|
|
@@ -481,7 +496,7 @@ const RepoUrlPicker = ({
|
|
|
481
496
|
const repoPickerValidation = (value, validation, context) => {
|
|
482
497
|
var _a;
|
|
483
498
|
try {
|
|
484
|
-
const {host, searchParams} = new URL(`https://${value}`);
|
|
499
|
+
const { host, searchParams } = new URL(`https://${value}`);
|
|
485
500
|
const integrationApi = context.apiHolder.get(scmIntegrationsApiRef);
|
|
486
501
|
if (!host) {
|
|
487
502
|
validation.addError("Incomplete repository location provided, host not provided");
|
|
@@ -539,7 +554,7 @@ const scaffolderPlugin = createPlugin({
|
|
|
539
554
|
identityApi: identityApiRef,
|
|
540
555
|
scmIntegrationsApi: scmIntegrationsApiRef
|
|
541
556
|
},
|
|
542
|
-
factory: ({discoveryApi, identityApi, scmIntegrationsApi}) => new ScaffolderClient({discoveryApi, identityApi, scmIntegrationsApi})
|
|
557
|
+
factory: ({ discoveryApi, identityApi, scmIntegrationsApi }) => new ScaffolderClient({ discoveryApi, identityApi, scmIntegrationsApi })
|
|
543
558
|
})
|
|
544
559
|
],
|
|
545
560
|
routes: {
|
|
@@ -569,7 +584,7 @@ const OwnerPickerFieldExtension = scaffolderPlugin.provide(createScaffolderField
|
|
|
569
584
|
}));
|
|
570
585
|
const ScaffolderPage = scaffolderPlugin.provide(createRoutableExtension({
|
|
571
586
|
name: "ScaffolderPage",
|
|
572
|
-
component: () => import('./Router-
|
|
587
|
+
component: () => import('./Router-0282e15a.esm.js').then((m) => m.Router),
|
|
573
588
|
mountPoint: rootRouteRef
|
|
574
589
|
}));
|
|
575
590
|
|
|
@@ -595,7 +610,7 @@ const favouriteTemplateTooltip = (isStarred) => isStarred ? "Remove from favorit
|
|
|
595
610
|
const favouriteTemplateIcon = (isStarred) => isStarred ? /* @__PURE__ */ React.createElement(YellowStar, null) : /* @__PURE__ */ React.createElement(WhiteBorderStar, null);
|
|
596
611
|
const FavouriteTemplate = (props) => {
|
|
597
612
|
const classes = useStyles$1();
|
|
598
|
-
const {toggleStarredEntity, isStarredEntity} = useStarredEntity(props.entity);
|
|
613
|
+
const { toggleStarredEntity, isStarredEntity } = useStarredEntity(props.entity);
|
|
599
614
|
return /* @__PURE__ */ React.createElement(IconButton, {
|
|
600
615
|
color: "inherit",
|
|
601
616
|
className: classes.starButton,
|
|
@@ -611,7 +626,7 @@ const useStyles = makeStyles((theme) => ({
|
|
|
611
626
|
position: "relative"
|
|
612
627
|
},
|
|
613
628
|
title: {
|
|
614
|
-
backgroundImage: ({backgroundImage}) => backgroundImage
|
|
629
|
+
backgroundImage: ({ backgroundImage }) => backgroundImage
|
|
615
630
|
},
|
|
616
631
|
box: {
|
|
617
632
|
overflow: "hidden",
|
|
@@ -659,7 +674,7 @@ const getTemplateCardProps = (template) => {
|
|
|
659
674
|
const DeprecationWarning = () => {
|
|
660
675
|
const styles = useDeprecationStyles();
|
|
661
676
|
const Title = /* @__PURE__ */ React.createElement(Typography, {
|
|
662
|
-
style: {padding: 10, maxWidth: 300}
|
|
677
|
+
style: { padding: 10, maxWidth: 300 }
|
|
663
678
|
}, "This template syntax is deprecated. Click for more info.");
|
|
664
679
|
return /* @__PURE__ */ React.createElement("div", {
|
|
665
680
|
className: styles.deprecationIcon
|
|
@@ -670,15 +685,15 @@ const DeprecationWarning = () => {
|
|
|
670
685
|
className: styles.link
|
|
671
686
|
}, /* @__PURE__ */ React.createElement(WarningIcon, null))));
|
|
672
687
|
};
|
|
673
|
-
const TemplateCard = ({template, deprecated}) => {
|
|
688
|
+
const TemplateCard = ({ template, deprecated }) => {
|
|
674
689
|
var _a;
|
|
675
690
|
const backstageTheme = useTheme();
|
|
676
691
|
const rootLink = useRouteRef(rootRouteRef);
|
|
677
692
|
const templateProps = getTemplateCardProps(template);
|
|
678
693
|
const ownedByRelations = getEntityRelations(template, RELATION_OWNED_BY);
|
|
679
|
-
const themeId = backstageTheme.getPageTheme({themeId: templateProps.type}) ? templateProps.type : "other";
|
|
680
|
-
const theme = backstageTheme.getPageTheme({themeId});
|
|
681
|
-
const classes = useStyles({backgroundImage: theme.backgroundImage});
|
|
694
|
+
const themeId = backstageTheme.getPageTheme({ themeId: templateProps.type }) ? templateProps.type : "other";
|
|
695
|
+
const theme = backstageTheme.getPageTheme({ themeId });
|
|
696
|
+
const classes = useStyles({ backgroundImage: theme.backgroundImage });
|
|
682
697
|
const href = generatePath(`${rootLink()}/templates/:templateName`, {
|
|
683
698
|
templateName: templateProps.name
|
|
684
699
|
});
|
|
@@ -691,9 +706,9 @@ const TemplateCard = ({template, deprecated}) => {
|
|
|
691
706
|
}), deprecated && /* @__PURE__ */ React.createElement(DeprecationWarning, null), /* @__PURE__ */ React.createElement(ItemCardHeader, {
|
|
692
707
|
title: templateProps.title,
|
|
693
708
|
subtitle: templateProps.type,
|
|
694
|
-
classes: {root: classes.title}
|
|
709
|
+
classes: { root: classes.title }
|
|
695
710
|
})), /* @__PURE__ */ React.createElement(CardContent, {
|
|
696
|
-
style: {display: "grid"}
|
|
711
|
+
style: { display: "grid" }
|
|
697
712
|
}, /* @__PURE__ */ React.createElement(Box, {
|
|
698
713
|
className: classes.box
|
|
699
714
|
}, /* @__PURE__ */ React.createElement(Typography, {
|
|
@@ -730,7 +745,7 @@ const TemplateList = ({
|
|
|
730
745
|
TemplateCardComponent,
|
|
731
746
|
group
|
|
732
747
|
}) => {
|
|
733
|
-
const {loading, error, entities} = useEntityListProvider();
|
|
748
|
+
const { loading, error, entities } = useEntityListProvider();
|
|
734
749
|
const Card = TemplateCardComponent || TemplateCard;
|
|
735
750
|
const maybeFilteredEntities = group ? entities.filter((e) => group.filter(e)) : entities;
|
|
736
751
|
const title = group ? group.titleComponent || /* @__PURE__ */ React.createElement(ContentHeader, {
|
|
@@ -761,7 +776,7 @@ const checkedIcon = /* @__PURE__ */ React.createElement(CheckBoxIcon, {
|
|
|
761
776
|
});
|
|
762
777
|
const TemplateTypePicker = () => {
|
|
763
778
|
const alertApi = useApi(alertApiRef);
|
|
764
|
-
const {error, loading, availableTypes, selectedTypes, setSelectedTypes} = useEntityTypeFilter();
|
|
779
|
+
const { error, loading, availableTypes, selectedTypes, setSelectedTypes } = useEntityTypeFilter();
|
|
765
780
|
if (loading)
|
|
766
781
|
return /* @__PURE__ */ React.createElement(Progress, null);
|
|
767
782
|
if (!availableTypes)
|
|
@@ -784,7 +799,7 @@ const TemplateTypePicker = () => {
|
|
|
784
799
|
options: availableTypes,
|
|
785
800
|
value: selectedTypes,
|
|
786
801
|
onChange: (_, value) => setSelectedTypes(value),
|
|
787
|
-
renderOption: (option, {selected}) => /* @__PURE__ */ React.createElement(FormControlLabel, {
|
|
802
|
+
renderOption: (option, { selected }) => /* @__PURE__ */ React.createElement(FormControlLabel, {
|
|
788
803
|
control: /* @__PURE__ */ React.createElement(Checkbox, {
|
|
789
804
|
icon,
|
|
790
805
|
checkedIcon,
|
|
@@ -804,4 +819,4 @@ const TemplateTypePicker = () => {
|
|
|
804
819
|
};
|
|
805
820
|
|
|
806
821
|
export { EntityPicker as E, FIELD_EXTENSION_WRAPPER_KEY as F, OwnerPicker as O, RepoUrlPicker as R, ScaffolderClient as S, TemplateTypePicker as T, EntityNamePicker as a, registerComponentRouteRef as b, TemplateList as c, rootRouteRef as d, entityNamePickerValidation as e, FIELD_EXTENSION_KEY as f, createScaffolderFieldExtension as g, ScaffolderFieldExtensions as h, EntityPickerFieldExtension as i, EntityNamePickerFieldExtension as j, OwnerPickerFieldExtension as k, RepoUrlPickerFieldExtension as l, ScaffolderPage as m, scaffolderPlugin as n, TextValuePicker as o, FavouriteTemplate as p, repoPickerValidation as r, scaffolderApiRef as s };
|
|
807
|
-
//# sourceMappingURL=index-
|
|
822
|
+
//# sourceMappingURL=index-306a8b5a.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-306a8b5a.esm.js","sources":["../../src/api.ts","../../src/components/fields/EntityPicker/EntityPicker.tsx","../../src/components/fields/TextValuePicker/TextValuePicker.tsx","../../src/components/fields/EntityNamePicker/EntityNamePicker.tsx","../../src/components/fields/EntityNamePicker/validation.ts","../../src/components/fields/OwnerPicker/OwnerPicker.tsx","../../src/components/fields/RepoUrlPicker/RepoUrlPicker.tsx","../../src/components/fields/RepoUrlPicker/validation.ts","../../src/extensions/index.tsx","../../src/routes.ts","../../src/plugin.ts","../../src/components/FavouriteTemplate/FavouriteTemplate.tsx","../../src/components/TemplateCard/TemplateCard.tsx","../../src/components/TemplateList/TemplateList.tsx","../../src/components/TemplateTypePicker/TemplateTypePicker.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { EntityName } from '@backstage/catalog-model';\nimport {\n createApiRef,\n DiscoveryApi,\n IdentityApi,\n} from '@backstage/core-plugin-api';\nimport { ResponseError } from '@backstage/errors';\nimport { ScmIntegrationRegistry } from '@backstage/integration';\nimport { JsonObject, JsonValue, Observable } from '@backstage/types';\nimport { Field, FieldValidation } from '@rjsf/core';\nimport qs from 'qs';\nimport ObservableImpl from 'zen-observable';\nimport { ListActionsResponse, ScaffolderTask, Status } from './types';\n\nexport const scaffolderApiRef = createApiRef<ScaffolderApi>({\n id: 'plugin.scaffolder.service',\n description: 'Used to make requests towards the scaffolder backend',\n});\n\ntype TemplateParameterSchema = {\n title: string;\n steps: Array<{\n title: string;\n schema: JsonObject;\n }>;\n};\n\nexport type LogEvent = {\n type: 'log' | 'completion';\n body: {\n message: string;\n stepId?: string;\n status?: Status;\n };\n createdAt: string;\n id: string;\n taskId: string;\n};\n\nexport type CustomField = {\n name: string;\n component: Field;\n validation: (data: JsonValue, field: FieldValidation) => void;\n};\n\nexport interface ScaffolderApi {\n getTemplateParameterSchema(\n templateName: EntityName,\n ): Promise<TemplateParameterSchema>;\n\n /**\n * Executes the scaffolding of a component, given a template and its\n * parameter values.\n *\n * @param templateName Name of the Template entity for the scaffolder to use. New project is going to be created out of this template.\n * @param values Parameters for the template, e.g. name, description\n */\n scaffold(templateName: string, values: Record<string, any>): Promise<string>;\n\n getTask(taskId: string): Promise<ScaffolderTask>;\n\n getIntegrationsList(options: {\n allowedHosts: string[];\n }): Promise<{ type: string; title: string; host: string }[]>;\n\n // Returns a list of all installed actions.\n listActions(): Promise<ListActionsResponse>;\n\n streamLogs({\n taskId,\n after,\n }: {\n taskId: string;\n after?: number;\n }): Observable<LogEvent>;\n}\n\nexport class ScaffolderClient implements ScaffolderApi {\n private readonly discoveryApi: DiscoveryApi;\n private readonly identityApi: IdentityApi;\n private readonly scmIntegrationsApi: ScmIntegrationRegistry;\n private readonly useLongPollingLogs: boolean;\n\n constructor(options: {\n discoveryApi: DiscoveryApi;\n identityApi: IdentityApi;\n scmIntegrationsApi: ScmIntegrationRegistry;\n useLongPollingLogs?: boolean;\n }) {\n this.discoveryApi = options.discoveryApi;\n this.identityApi = options.identityApi;\n this.scmIntegrationsApi = options.scmIntegrationsApi;\n this.useLongPollingLogs = options.useLongPollingLogs ?? false;\n }\n\n async getIntegrationsList(options: { allowedHosts: string[] }) {\n return [\n ...this.scmIntegrationsApi.azure.list(),\n ...this.scmIntegrationsApi.bitbucket.list(),\n ...this.scmIntegrationsApi.github.list(),\n ...this.scmIntegrationsApi.gitlab.list(),\n ]\n .map(c => ({ type: c.type, title: c.title, host: c.config.host }))\n .filter(c => options.allowedHosts.includes(c.host));\n }\n\n async getTemplateParameterSchema(\n templateName: EntityName,\n ): Promise<TemplateParameterSchema> {\n const { namespace, kind, name } = templateName;\n\n const token = await this.identityApi.getIdToken();\n const baseUrl = await this.discoveryApi.getBaseUrl('scaffolder');\n const templatePath = [namespace, kind, name]\n .map(s => encodeURIComponent(s))\n .join('/');\n const url = `${baseUrl}/v2/templates/${templatePath}/parameter-schema`;\n\n const response = await fetch(url, {\n headers: {\n ...(token && { Authorization: `Bearer ${token}` }),\n },\n });\n\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n\n const schema: TemplateParameterSchema = await response.json();\n return schema;\n }\n\n /**\n * Executes the scaffolding of a component, given a template and its\n * parameter values.\n *\n * @param templateName Template name for the scaffolder to use. New project is going to be created out of this template.\n * @param values Parameters for the template, e.g. name, description\n */\n async scaffold(\n templateName: string,\n values: Record<string, any>,\n ): Promise<string> {\n const token = await this.identityApi.getIdToken();\n const url = `${await this.discoveryApi.getBaseUrl('scaffolder')}/v2/tasks`;\n const response = await fetch(url, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n ...(token && { Authorization: `Bearer ${token}` }),\n },\n body: JSON.stringify({ templateName, values: { ...values } }),\n });\n\n if (response.status !== 201) {\n const status = `${response.status} ${response.statusText}`;\n const body = await response.text();\n throw new Error(`Backend request failed, ${status} ${body.trim()}`);\n }\n\n const { id } = (await response.json()) as { id: string };\n return id;\n }\n\n async getTask(taskId: string) {\n const token = await this.identityApi.getIdToken();\n const baseUrl = await this.discoveryApi.getBaseUrl('scaffolder');\n const url = `${baseUrl}/v2/tasks/${encodeURIComponent(taskId)}`;\n const response = await fetch(url, {\n headers: token ? { Authorization: `Bearer ${token}` } : {},\n });\n\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n\n return await response.json();\n }\n\n streamLogs(opts: { taskId: string; after?: number }): Observable<LogEvent> {\n if (this.useLongPollingLogs) {\n return this.streamLogsPolling(opts);\n }\n\n return this.streamLogsEventStream(opts);\n }\n\n private streamLogsEventStream({\n taskId,\n after,\n }: {\n taskId: string;\n after?: number;\n }): Observable<LogEvent> {\n return new ObservableImpl(subscriber => {\n const params = new URLSearchParams();\n if (after !== undefined) {\n params.set('after', String(Number(after)));\n }\n\n this.discoveryApi.getBaseUrl('scaffolder').then(\n baseUrl => {\n const url = `${baseUrl}/v2/tasks/${encodeURIComponent(\n taskId,\n )}/eventstream`;\n const eventSource = new EventSource(url, { withCredentials: true });\n eventSource.addEventListener('log', (event: any) => {\n if (event.data) {\n try {\n subscriber.next(JSON.parse(event.data));\n } catch (ex) {\n subscriber.error(ex);\n }\n }\n });\n eventSource.addEventListener('completion', (event: any) => {\n if (event.data) {\n try {\n subscriber.next(JSON.parse(event.data));\n } catch (ex) {\n subscriber.error(ex);\n }\n }\n eventSource.close();\n subscriber.complete();\n });\n eventSource.addEventListener('error', event => {\n subscriber.error(event);\n });\n },\n error => {\n subscriber.error(error);\n },\n );\n });\n }\n\n private streamLogsPolling({\n taskId,\n after: inputAfter,\n }: {\n taskId: string;\n after?: number;\n }): Observable<LogEvent> {\n let after = inputAfter;\n\n return new ObservableImpl(subscriber => {\n this.discoveryApi.getBaseUrl('scaffolder').then(async baseUrl => {\n while (!subscriber.closed) {\n const url = `${baseUrl}/v2/tasks/${encodeURIComponent(\n taskId,\n )}/events?${qs.stringify({ after })}`;\n const response = await fetch(url);\n\n if (!response.ok) {\n // wait for one second to not run into an\n await new Promise(resolve => setTimeout(resolve, 1000));\n continue;\n }\n\n const logs = (await response.json()) as LogEvent[];\n\n for (const event of logs) {\n after = Number(event.id);\n\n subscriber.next(event);\n\n if (event.type === 'completion') {\n subscriber.complete();\n return;\n }\n }\n }\n });\n });\n }\n\n /**\n * @returns ListActionsResponse containing all registered actions.\n */\n async listActions(): Promise<ListActionsResponse> {\n const baseUrl = await this.discoveryApi.getBaseUrl('scaffolder');\n const token = await this.identityApi.getIdToken();\n const response = await fetch(`${baseUrl}/v2/actions`, {\n headers: token ? { Authorization: `Bearer ${token}` } : {},\n });\n\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n\n return await response.json();\n }\n}\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useApi } from '@backstage/core-plugin-api';\nimport {\n catalogApiRef,\n formatEntityRefTitle,\n} from '@backstage/plugin-catalog-react';\nimport { TextField } from '@material-ui/core';\nimport FormControl from '@material-ui/core/FormControl';\nimport Autocomplete from '@material-ui/lab/Autocomplete';\nimport { FieldProps } from '@rjsf/core';\nimport React from 'react';\nimport { useAsync } from 'react-use';\n\nexport const EntityPicker = ({\n onChange,\n schema: { title = 'Entity', description = 'An entity from the catalog' },\n required,\n uiSchema,\n rawErrors,\n formData,\n idSchema,\n}: FieldProps<string>) => {\n const allowedKinds = uiSchema['ui:options']?.allowedKinds as string[];\n const defaultKind = uiSchema['ui:options']?.defaultKind as string | undefined;\n const catalogApi = useApi(catalogApiRef);\n\n const { value: entities, loading } = useAsync(() =>\n catalogApi.getEntities(\n allowedKinds ? { filter: { kind: allowedKinds } } : undefined,\n ),\n );\n\n const entityRefs = entities?.items.map(e =>\n formatEntityRefTitle(e, { defaultKind }),\n );\n\n const onSelect = (_: any, value: string | null) => {\n onChange(value || '');\n };\n\n return (\n <FormControl\n margin=\"normal\"\n required={required}\n error={rawErrors?.length > 0 && !formData}\n >\n <Autocomplete\n id={idSchema?.$id}\n value={(formData as string) || ''}\n loading={loading}\n onChange={onSelect}\n options={entityRefs || []}\n autoSelect\n freeSolo\n renderInput={params => (\n <TextField\n {...params}\n label={title}\n margin=\"normal\"\n helperText={description}\n variant=\"outlined\"\n required={required}\n InputProps={params.InputProps}\n />\n )}\n />\n </FormControl>\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { TextField } from '@material-ui/core';\nimport { FieldProps } from '@rjsf/core';\nimport React from 'react';\n\nexport const TextValuePicker = ({\n onChange,\n required,\n schema: { title, description },\n rawErrors,\n formData,\n uiSchema: { 'ui:autofocus': autoFocus },\n idSchema,\n placeholder,\n}: FieldProps<string>) => (\n <TextField\n id={idSchema?.$id}\n label={title}\n placeholder={placeholder}\n helperText={description}\n required={required}\n value={formData ?? ''}\n onChange={({ target: { value } }) => onChange(value)}\n margin=\"normal\"\n error={rawErrors?.length > 0 && !formData}\n inputProps={{ autoFocus }}\n />\n);\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\nimport { FieldProps } from '@rjsf/core';\nimport { TextValuePicker } from '../TextValuePicker';\n\nexport const EntityNamePicker = ({\n schema: { title = 'Name', description = 'Unique name of the component' },\n ...props\n}: FieldProps<string>) => (\n <TextValuePicker schema={{ title, description }} {...props} />\n);\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FieldValidation } from '@rjsf/core';\nimport { KubernetesValidatorFunctions } from '@backstage/catalog-model';\n\nexport const entityNamePickerValidation = (\n value: string,\n validation: FieldValidation,\n) => {\n if (!KubernetesValidatorFunctions.isValidObjectName(value)) {\n validation.addError(\n 'must start and end with an alphanumeric character, and contain only alphanumeric characters, hyphens, underscores, and periods. Maximum length is 63 characters.',\n );\n }\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { FieldProps } from '@rjsf/core';\nimport React from 'react';\nimport { EntityPicker } from '../EntityPicker';\n\nexport const OwnerPicker = ({\n schema: { title = 'Owner', description = 'The owner of the component' },\n uiSchema,\n ...props\n}: FieldProps<string>) => {\n const ownerUiSchema = {\n ...uiSchema,\n 'ui:options': {\n allowedKinds: (uiSchema['ui:options']?.allowedKinds || [\n 'Group',\n 'User',\n ]) as string[],\n defaultKind: 'Group',\n },\n };\n\n return (\n <EntityPicker\n {...props}\n schema={{ title, description }}\n uiSchema={ownerUiSchema}\n />\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useCallback, useEffect } from 'react';\nimport { FieldProps } from '@rjsf/core';\nimport { scaffolderApiRef } from '../../../api';\nimport { scmIntegrationsApiRef } from '@backstage/integration-react';\nimport { useAsync } from 'react-use';\nimport Select from '@material-ui/core/Select';\nimport InputLabel from '@material-ui/core/InputLabel';\nimport Input from '@material-ui/core/Input';\nimport FormControl from '@material-ui/core/FormControl';\nimport FormHelperText from '@material-ui/core/FormHelperText';\n\nimport { useApi } from '@backstage/core-plugin-api';\nimport { Progress } from '@backstage/core-components';\n\nfunction splitFormData(url: string | undefined, allowedOwners?: string[]) {\n let host = undefined;\n let owner = undefined;\n let repo = undefined;\n let organization = undefined;\n let workspace = undefined;\n let project = undefined;\n\n try {\n if (url) {\n const parsed = new URL(`https://${url}`);\n host = parsed.host;\n owner = parsed.searchParams.get('owner') || allowedOwners?.[0];\n repo = parsed.searchParams.get('repo') || undefined;\n // This is azure dev ops specific. not used for any other provider.\n organization = parsed.searchParams.get('organization') || undefined;\n // These are bitbucket specific, not used for any other provider.\n workspace = parsed.searchParams.get('workspace') || undefined;\n project = parsed.searchParams.get('project') || undefined;\n }\n } catch {\n /* ok */\n }\n\n return { host, owner, repo, organization, workspace, project };\n}\n\nfunction serializeFormData(data: {\n host?: string;\n owner?: string;\n repo?: string;\n organization?: string;\n workspace?: string;\n project?: string;\n}) {\n if (!data.host) {\n return undefined;\n }\n\n const params = new URLSearchParams();\n if (data.owner) {\n params.set('owner', data.owner);\n }\n if (data.repo) {\n params.set('repo', data.repo);\n }\n if (data.organization) {\n params.set('organization', data.organization);\n }\n if (data.workspace) {\n params.set('workspace', data.workspace);\n }\n if (data.project) {\n params.set('project', data.project);\n }\n\n return `${data.host}?${params.toString()}`;\n}\n\nexport const RepoUrlPicker = ({\n onChange,\n uiSchema,\n rawErrors,\n formData,\n}: FieldProps<string>) => {\n const scaffolderApi = useApi(scaffolderApiRef);\n const integrationApi = useApi(scmIntegrationsApiRef);\n const allowedHosts = uiSchema['ui:options']?.allowedHosts as string[];\n const allowedOwners = uiSchema['ui:options']?.allowedOwners as string[];\n\n const { value: integrations, loading } = useAsync(async () => {\n return await scaffolderApi.getIntegrationsList({ allowedHosts });\n });\n\n const { host, owner, repo, organization, workspace, project } = splitFormData(\n formData,\n allowedOwners,\n );\n const updateHost = useCallback(\n (evt: React.ChangeEvent<{ name?: string; value: unknown }>) => {\n onChange(\n serializeFormData({\n host: evt.target.value as string,\n owner,\n repo,\n organization,\n workspace,\n project,\n }),\n );\n },\n [onChange, owner, repo, organization, workspace, project],\n );\n\n const updateOwner = useCallback(\n (evt: React.ChangeEvent<{ name?: string; value: unknown }>) =>\n onChange(\n serializeFormData({\n host,\n owner: evt.target.value as string,\n repo,\n organization,\n workspace,\n project,\n }),\n ),\n [onChange, host, repo, organization, workspace, project],\n );\n\n const updateRepo = useCallback(\n (evt: React.ChangeEvent<{ name?: string; value: unknown }>) =>\n onChange(\n serializeFormData({\n host,\n owner,\n repo: evt.target.value as string,\n organization,\n workspace,\n project,\n }),\n ),\n [onChange, host, owner, organization, workspace, project],\n );\n\n const updateOrganization = useCallback(\n (evt: React.ChangeEvent<{ name?: string; value: unknown }>) =>\n onChange(\n serializeFormData({\n host,\n owner,\n repo,\n organization: evt.target.value as string,\n workspace,\n project,\n }),\n ),\n [onChange, host, owner, repo, workspace, project],\n );\n\n const updateWorkspace = useCallback(\n (evt: React.ChangeEvent<{ name?: string; value: unknown }>) =>\n onChange(\n serializeFormData({\n host,\n owner,\n repo,\n organization,\n workspace: evt.target.value as string,\n project,\n }),\n ),\n [onChange, host, owner, repo, organization, project],\n );\n\n const updateProject = useCallback(\n (evt: React.ChangeEvent<{ name?: string; value: unknown }>) =>\n onChange(\n serializeFormData({\n host,\n owner,\n repo,\n organization,\n workspace,\n project: evt.target.value as string,\n }),\n ),\n [onChange, host, owner, repo, organization, workspace],\n );\n\n useEffect(() => {\n if (host === undefined && integrations?.length) {\n onChange(\n serializeFormData({\n host: integrations[0].host,\n owner,\n repo,\n organization,\n workspace,\n project,\n }),\n );\n }\n }, [\n onChange,\n integrations,\n host,\n owner,\n repo,\n organization,\n workspace,\n project,\n ]);\n\n if (loading) {\n return <Progress />;\n }\n\n return (\n <>\n <FormControl\n margin=\"normal\"\n required\n error={rawErrors?.length > 0 && !host}\n >\n <InputLabel htmlFor=\"hostInput\">Host</InputLabel>\n <Select native id=\"hostInput\" onChange={updateHost} value={host}>\n {integrations ? (\n integrations\n .filter(i => allowedHosts?.includes(i.host))\n .map(i => (\n <option key={i.host} value={i.host}>\n {i.title}\n </option>\n ))\n ) : (\n <p>loading</p>\n )}\n </Select>\n <FormHelperText>\n The host where the repository will be created\n </FormHelperText>\n </FormControl>\n {/* Show this for dev.azure.com only */}\n {host === 'dev.azure.com' && (\n <FormControl\n margin=\"normal\"\n required\n error={rawErrors?.length > 0 && !organization}\n >\n <InputLabel htmlFor=\"repoInput\">Organization</InputLabel>\n <Input\n id=\"repoInput\"\n onChange={updateOrganization}\n value={organization}\n />\n <FormHelperText>The name of the organization</FormHelperText>\n </FormControl>\n )}\n {host && integrationApi.byHost(host)?.type === 'bitbucket' && (\n <>\n {/* Show this for bitbucket.org only */}\n {host === 'bitbucket.org' && (\n <FormControl\n margin=\"normal\"\n required\n error={rawErrors?.length > 0 && !workspace}\n >\n <InputLabel htmlFor=\"wokrspaceInput\">Workspace</InputLabel>\n <Input\n id=\"wokrspaceInput\"\n onChange={updateWorkspace}\n value={workspace}\n />\n <FormHelperText>\n The workspace where the repository will be created\n </FormHelperText>\n </FormControl>\n )}\n <FormControl\n margin=\"normal\"\n required\n error={rawErrors?.length > 0 && !project}\n >\n <InputLabel htmlFor=\"wokrspaceInput\">Project</InputLabel>\n <Input\n id=\"wokrspaceInput\"\n onChange={updateProject}\n value={project}\n />\n <FormHelperText>\n The project where the repository will be created\n </FormHelperText>\n </FormControl>\n </>\n )}\n {/* Show this for all hosts except bitbucket */}\n {host &&\n integrationApi.byHost(host)?.type !== 'bitbucket' &&\n !allowedOwners && (\n <>\n <FormControl\n margin=\"normal\"\n required\n error={rawErrors?.length > 0 && !owner}\n >\n <InputLabel htmlFor=\"ownerInput\">Owner</InputLabel>\n <Input id=\"ownerInput\" onChange={updateOwner} value={owner} />\n <FormHelperText>\n The organization, user or project that this repo will belong to\n </FormHelperText>\n </FormControl>\n </>\n )}\n {/* Show this for all hosts except bitbucket where allowed owner is set */}\n {host &&\n integrationApi.byHost(host)?.type !== 'bitbucket' &&\n allowedOwners && (\n <>\n <FormControl\n margin=\"normal\"\n required\n error={rawErrors?.length > 0 && !owner}\n >\n <InputLabel htmlFor=\"ownerInput\">Owner Available</InputLabel>\n <Select\n native\n id=\"ownerInput\"\n onChange={updateOwner}\n value={owner}\n >\n {allowedOwners ? (\n allowedOwners.map(i => (\n <option key={i} value={i}>\n {i}\n </option>\n ))\n ) : (\n <p>loading</p>\n )}\n ;\n </Select>\n <FormHelperText>\n The organization, user or project that this repo will belong to\n </FormHelperText>\n </FormControl>\n </>\n )}\n {/* Show this for all hosts */}\n <FormControl\n margin=\"normal\"\n required\n error={rawErrors?.length > 0 && !repo}\n >\n <InputLabel htmlFor=\"repoInput\">Repository</InputLabel>\n <Input id=\"repoInput\" onChange={updateRepo} value={repo} />\n <FormHelperText>The name of the repository</FormHelperText>\n </FormControl>\n </>\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FieldValidation } from '@rjsf/core';\nimport { ApiHolder } from '@backstage/core-plugin-api';\nimport { scmIntegrationsApiRef } from '@backstage/integration-react';\n\nexport const repoPickerValidation = (\n value: string,\n validation: FieldValidation,\n context: { apiHolder: ApiHolder },\n) => {\n try {\n const { host, searchParams } = new URL(`https://${value}`);\n\n const integrationApi = context.apiHolder.get(scmIntegrationsApiRef);\n\n if (!host) {\n validation.addError(\n 'Incomplete repository location provided, host not provided',\n );\n } else {\n if (integrationApi?.byHost(host)?.type === 'bitbucket') {\n // workspace is only applicable for bitbucket cloud\n if (host === 'bitbucket.org' && !searchParams.get('workspace')) {\n validation.addError(\n 'Incomplete repository location provided, workspace not provided',\n );\n }\n\n if (!searchParams.get('project')) {\n validation.addError(\n 'Incomplete repository location provided, project not provided',\n );\n }\n }\n // For anything other than bitbucket\n else {\n if (!searchParams.get('owner')) {\n validation.addError(\n 'Incomplete repository location provided, owner not provided',\n );\n }\n }\n\n // Do this for all hosts\n if (!searchParams.get('repo')) {\n validation.addError(\n 'Incomplete repository location provided, repo not provided',\n );\n }\n }\n } catch {\n validation.addError('Unable to parse the Repository URL');\n }\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport { CustomFieldValidator, FieldExtensionOptions } from './types';\nimport { Extension, attachComponentData } from '@backstage/core-plugin-api';\n\nexport const FIELD_EXTENSION_WRAPPER_KEY = 'scaffolder.extensions.wrapper.v1';\nexport const FIELD_EXTENSION_KEY = 'scaffolder.extensions.field.v1';\n\nexport function createScaffolderFieldExtension<T = any>(\n options: FieldExtensionOptions<T>,\n): Extension<() => null> {\n return {\n expose() {\n const FieldExtensionDataHolder: any = () => null;\n\n attachComponentData(\n FieldExtensionDataHolder,\n FIELD_EXTENSION_KEY,\n options,\n );\n\n return FieldExtensionDataHolder;\n },\n };\n}\n\nexport const ScaffolderFieldExtensions: React.ComponentType = () => null;\nattachComponentData(\n ScaffolderFieldExtensions,\n FIELD_EXTENSION_WRAPPER_KEY,\n true,\n);\n\nexport type { CustomFieldValidator, FieldExtensionOptions };\n\nexport { DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS } from './default';\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n createExternalRouteRef,\n createRouteRef,\n} from '@backstage/core-plugin-api';\n\nexport const registerComponentRouteRef = createExternalRouteRef({\n id: 'register-component',\n optional: true,\n});\n\nexport const rootRouteRef = createRouteRef({\n id: 'scaffolder',\n});\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { scmIntegrationsApiRef } from '@backstage/integration-react';\nimport { scaffolderApiRef, ScaffolderClient } from './api';\nimport { EntityPicker } from './components/fields/EntityPicker';\nimport {\n entityNamePickerValidation,\n EntityNamePicker,\n} from './components/fields/EntityNamePicker';\nimport { OwnerPicker } from './components/fields/OwnerPicker';\nimport {\n repoPickerValidation,\n RepoUrlPicker,\n} from './components/fields/RepoUrlPicker';\nimport { createScaffolderFieldExtension } from './extensions';\nimport { registerComponentRouteRef, rootRouteRef } from './routes';\nimport {\n createApiFactory,\n createPlugin,\n createRoutableExtension,\n discoveryApiRef,\n identityApiRef,\n} from '@backstage/core-plugin-api';\n\nexport const scaffolderPlugin = createPlugin({\n id: 'scaffolder',\n apis: [\n createApiFactory({\n api: scaffolderApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n identityApi: identityApiRef,\n scmIntegrationsApi: scmIntegrationsApiRef,\n },\n factory: ({ discoveryApi, identityApi, scmIntegrationsApi }) =>\n new ScaffolderClient({ discoveryApi, identityApi, scmIntegrationsApi }),\n }),\n ],\n routes: {\n root: rootRouteRef,\n },\n externalRoutes: {\n registerComponent: registerComponentRouteRef,\n },\n});\n\nexport const EntityPickerFieldExtension = scaffolderPlugin.provide(\n createScaffolderFieldExtension({\n component: EntityPicker,\n name: 'EntityPicker',\n }),\n);\n\nexport const EntityNamePickerFieldExtension = scaffolderPlugin.provide(\n createScaffolderFieldExtension({\n component: EntityNamePicker,\n name: 'EntityNamePicker',\n validation: entityNamePickerValidation,\n }),\n);\n\nexport const RepoUrlPickerFieldExtension = scaffolderPlugin.provide(\n createScaffolderFieldExtension({\n component: RepoUrlPicker,\n name: 'RepoUrlPicker',\n validation: repoPickerValidation,\n }),\n);\n\nexport const OwnerPickerFieldExtension = scaffolderPlugin.provide(\n createScaffolderFieldExtension({\n component: OwnerPicker,\n name: 'OwnerPicker',\n }),\n);\n\nexport const ScaffolderPage = scaffolderPlugin.provide(\n createRoutableExtension({\n name: 'ScaffolderPage',\n component: () => import('./components/Router').then(m => m.Router),\n mountPoint: rootRouteRef,\n }),\n);\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Entity } from '@backstage/catalog-model';\nimport { useStarredEntity } from '@backstage/plugin-catalog-react';\nimport { IconButton, makeStyles, Tooltip, withStyles } from '@material-ui/core';\nimport Star from '@material-ui/icons/Star';\nimport StarBorder from '@material-ui/icons/StarBorder';\nimport React, { ComponentProps } from 'react';\n\ntype Props = ComponentProps<typeof IconButton> & { entity: Entity };\n\nconst YellowStar = withStyles({\n root: {\n color: '#f3ba37',\n },\n})(Star);\n\nconst WhiteBorderStar = withStyles({\n root: {\n color: '#ffffff',\n },\n})(StarBorder);\n\nconst useStyles = makeStyles(theme => ({\n starButton: {\n position: 'absolute',\n top: theme.spacing(0.5),\n right: theme.spacing(0.5),\n padding: '0.25rem',\n },\n}));\n\nexport const favouriteTemplateTooltip = (isStarred: boolean) =>\n isStarred ? 'Remove from favorites' : 'Add to favorites';\n\nexport const favouriteTemplateIcon = (isStarred: boolean) =>\n isStarred ? <YellowStar /> : <WhiteBorderStar />;\n\n/**\n * IconButton for showing if a current entity is starred and adding/removing it from the favourite entities\n * @param props MaterialUI IconButton props extended by required `entity` prop\n */\nexport const FavouriteTemplate = (props: Props) => {\n const classes = useStyles();\n const { toggleStarredEntity, isStarredEntity } = useStarredEntity(\n props.entity,\n );\n return (\n <IconButton\n color=\"inherit\"\n className={classes.starButton}\n {...props}\n onClick={() => toggleStarredEntity()}\n >\n <Tooltip title={favouriteTemplateTooltip(isStarredEntity)}>\n {favouriteTemplateIcon(isStarredEntity)}\n </Tooltip>\n </IconButton>\n );\n};\n","/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n Entity,\n RELATION_OWNED_BY,\n TemplateEntityV1beta2,\n} from '@backstage/catalog-model';\nimport {\n ScmIntegrationIcon,\n scmIntegrationsApiRef,\n} from '@backstage/integration-react';\nimport {\n EntityRefLinks,\n getEntityRelations,\n getEntitySourceLocation,\n} from '@backstage/plugin-catalog-react';\nimport { BackstageTheme } from '@backstage/theme';\nimport {\n Box,\n Card,\n CardActions,\n CardContent,\n CardMedia,\n Chip,\n IconButton,\n Link,\n makeStyles,\n Tooltip,\n Typography,\n useTheme,\n} from '@material-ui/core';\nimport WarningIcon from '@material-ui/icons/Warning';\nimport React from 'react';\nimport { generatePath } from 'react-router';\nimport { rootRouteRef } from '../../routes';\nimport { FavouriteTemplate } from '../FavouriteTemplate/FavouriteTemplate';\n\nimport { Button, ItemCardHeader } from '@backstage/core-components';\nimport { useApi, useRouteRef } from '@backstage/core-plugin-api';\n\nconst useStyles = makeStyles(theme => ({\n cardHeader: {\n position: 'relative',\n },\n title: {\n backgroundImage: ({ backgroundImage }: any) => backgroundImage,\n },\n box: {\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n display: '-webkit-box',\n '-webkit-line-clamp': 10,\n '-webkit-box-orient': 'vertical',\n paddingBottom: '0.8em',\n },\n label: {\n color: theme.palette.text.secondary,\n textTransform: 'uppercase',\n fontSize: '0.65rem',\n fontWeight: 'bold',\n letterSpacing: 0.5,\n lineHeight: 1,\n paddingBottom: '0.2rem',\n },\n leftButton: {\n marginRight: 'auto',\n },\n}));\n\nconst useDeprecationStyles = makeStyles(theme => ({\n deprecationIcon: {\n position: 'absolute',\n top: theme.spacing(0.5),\n right: theme.spacing(3.5),\n padding: '0.25rem',\n },\n link: {\n color: theme.palette.warning.light,\n },\n}));\n\nexport type TemplateCardProps = {\n template: TemplateEntityV1beta2;\n deprecated?: boolean;\n};\n\ntype TemplateProps = {\n description: string;\n tags: string[];\n title: string;\n type: string;\n name: string;\n};\n\nconst getTemplateCardProps = (\n template: TemplateEntityV1beta2,\n): TemplateProps & { key: string } => {\n return {\n key: template.metadata.uid!,\n name: template.metadata.name,\n title: `${(template.metadata.title || template.metadata.name) ?? ''}`,\n type: template.spec.type ?? '',\n description: template.metadata.description ?? '-',\n tags: (template.metadata?.tags as string[]) ?? [],\n };\n};\n\nconst DeprecationWarning = () => {\n const styles = useDeprecationStyles();\n\n const Title = (\n <Typography style={{ padding: 10, maxWidth: 300 }}>\n This template syntax is deprecated. Click for more info.\n </Typography>\n );\n\n return (\n <div className={styles.deprecationIcon}>\n <Tooltip title={Title}>\n <Link\n href=\"https://backstage.io/docs/features/software-templates/migrating-from-v1alpha1-to-v1beta2\"\n className={styles.link}\n >\n <WarningIcon />\n </Link>\n </Tooltip>\n </div>\n );\n};\n\nexport const TemplateCard = ({ template, deprecated }: TemplateCardProps) => {\n const backstageTheme = useTheme<BackstageTheme>();\n const rootLink = useRouteRef(rootRouteRef);\n const templateProps = getTemplateCardProps(template);\n const ownedByRelations = getEntityRelations(\n template as Entity,\n RELATION_OWNED_BY,\n );\n const themeId = backstageTheme.getPageTheme({ themeId: templateProps.type })\n ? templateProps.type\n : 'other';\n const theme = backstageTheme.getPageTheme({ themeId });\n const classes = useStyles({ backgroundImage: theme.backgroundImage });\n const href = generatePath(`${rootLink()}/templates/:templateName`, {\n templateName: templateProps.name,\n });\n\n const scmIntegrationsApi = useApi(scmIntegrationsApiRef);\n const sourceLocation = getEntitySourceLocation(template, scmIntegrationsApi);\n\n return (\n <Card>\n <CardMedia className={classes.cardHeader}>\n <FavouriteTemplate entity={template} />\n {deprecated && <DeprecationWarning />}\n <ItemCardHeader\n title={templateProps.title}\n subtitle={templateProps.type}\n classes={{ root: classes.title }}\n />\n </CardMedia>\n <CardContent style={{ display: 'grid' }}>\n <Box className={classes.box}>\n <Typography variant=\"body2\" className={classes.label}>\n Description\n </Typography>\n {templateProps.description}\n </Box>\n <Box className={classes.box}>\n <Typography variant=\"body2\" className={classes.label}>\n Owner\n </Typography>\n <EntityRefLinks entityRefs={ownedByRelations} defaultKind=\"Group\" />\n </Box>\n <Box>\n <Typography variant=\"body2\" className={classes.label}>\n Tags\n </Typography>\n {templateProps.tags?.map(tag => (\n <Chip size=\"small\" label={tag} key={tag} />\n ))}\n </Box>\n </CardContent>\n <CardActions>\n {sourceLocation && (\n <IconButton\n className={classes.leftButton}\n href={sourceLocation.locationTargetUrl}\n >\n <ScmIntegrationIcon type={sourceLocation.integrationType} />\n </IconButton>\n )}\n <Button\n color=\"primary\"\n to={href}\n aria-label={`Choose ${templateProps.title}`}\n >\n Choose\n </Button>\n </CardActions>\n </Card>\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { ComponentType } from 'react';\nimport {\n Entity,\n stringifyEntityRef,\n TemplateEntityV1beta2,\n} from '@backstage/catalog-model';\nimport {\n Content,\n ContentHeader,\n ItemCardGrid,\n Progress,\n WarningPanel,\n} from '@backstage/core-components';\nimport { useEntityListProvider } from '@backstage/plugin-catalog-react';\nimport { Link, Typography } from '@material-ui/core';\nimport { TemplateCard } from '../TemplateCard';\n\nexport type TemplateListProps = {\n TemplateCardComponent?:\n | ComponentType<{ template: TemplateEntityV1beta2 }>\n | undefined;\n group?: {\n title?: string;\n titleComponent?: React.ReactNode;\n filter: (entity: Entity) => boolean;\n };\n};\n\nexport const TemplateList = ({\n TemplateCardComponent,\n group,\n}: TemplateListProps) => {\n const { loading, error, entities } = useEntityListProvider();\n const Card = TemplateCardComponent || TemplateCard;\n const maybeFilteredEntities = group\n ? entities.filter(e => group.filter(e))\n : entities;\n const title = group ? (\n group.titleComponent || <ContentHeader title={group.title} />\n ) : (\n <ContentHeader title=\"Other Templates\" />\n );\n\n if (group && maybeFilteredEntities.length === 0) {\n return null;\n }\n return (\n <>\n {loading && <Progress />}\n\n {error && (\n <WarningPanel title=\"Oops! Something went wrong loading the templates\">\n {error.message}\n </WarningPanel>\n )}\n\n {!error && !loading && !entities.length && (\n <Typography variant=\"body2\">\n No templates found that match your filter. Learn more about{' '}\n <Link href=\"https://backstage.io/docs/features/software-templates/adding-templates\">\n adding templates\n </Link>\n .\n </Typography>\n )}\n\n <Content>\n {title}\n <ItemCardGrid>\n {maybeFilteredEntities &&\n maybeFilteredEntities?.length > 0 &&\n maybeFilteredEntities.map((template: Entity) => (\n <Card\n key={stringifyEntityRef(template)}\n template={template as TemplateEntityV1beta2}\n />\n ))}\n </ItemCardGrid>\n </Content>\n </>\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport capitalize from 'lodash/capitalize';\nimport { Progress } from '@backstage/core-components';\nimport {\n Box,\n Checkbox,\n FormControlLabel,\n TextField,\n Typography,\n} from '@material-ui/core';\nimport CheckBoxIcon from '@material-ui/icons/CheckBox';\nimport CheckBoxOutlineBlankIcon from '@material-ui/icons/CheckBoxOutlineBlank';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport { Autocomplete } from '@material-ui/lab';\nimport { useEntityTypeFilter } from '@backstage/plugin-catalog-react';\nimport { alertApiRef, useApi } from '@backstage/core-plugin-api';\n\nconst icon = <CheckBoxOutlineBlankIcon fontSize=\"small\" />;\nconst checkedIcon = <CheckBoxIcon fontSize=\"small\" />;\n\nexport const TemplateTypePicker = () => {\n const alertApi = useApi(alertApiRef);\n const { error, loading, availableTypes, selectedTypes, setSelectedTypes } =\n useEntityTypeFilter();\n\n if (loading) return <Progress />;\n\n if (!availableTypes) return null;\n\n if (error) {\n alertApi.post({\n message: `Failed to load entity types`,\n severity: 'error',\n });\n return null;\n }\n\n return (\n <Box pb={1} pt={1}>\n <Typography variant=\"button\">Categories</Typography>\n <Autocomplete\n multiple\n aria-label=\"Categories\"\n options={availableTypes}\n value={selectedTypes}\n onChange={(_: object, value: string[]) => setSelectedTypes(value)}\n renderOption={(option, { selected }) => (\n <FormControlLabel\n control={\n <Checkbox\n icon={icon}\n checkedIcon={checkedIcon}\n checked={selected}\n />\n }\n label={capitalize(option)}\n />\n )}\n size=\"small\"\n popupIcon={<ExpandMoreIcon data-testid=\"categories-picker-expand\" />}\n renderInput={params => <TextField {...params} variant=\"outlined\" />}\n />\n </Box>\n );\n};\n"],"names":["useStyles","Autocomplete"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;MA8Ba,mBAAmB,aAA4B;AAAA,EAC1D,IAAI;AAAA,EACJ,aAAa;AAAA;uBA6DwC;AAAA,EAMrD,YAAY,SAKT;AAxGL;AAyGI,SAAK,eAAe,QAAQ;AAC5B,SAAK,cAAc,QAAQ;AAC3B,SAAK,qBAAqB,QAAQ;AAClC,SAAK,qBAAqB,cAAQ,uBAAR,YAA8B;AAAA;AAAA,QAGpD,oBAAoB,SAAqC;AAC7D,WAAO;AAAA,MACL,GAAG,KAAK,mBAAmB,MAAM;AAAA,MACjC,GAAG,KAAK,mBAAmB,UAAU;AAAA,MACrC,GAAG,KAAK,mBAAmB,OAAO;AAAA,MAClC,GAAG,KAAK,mBAAmB,OAAO;AAAA,MAEjC,IAAI,UAAQ,MAAM,EAAE,MAAM,OAAO,EAAE,OAAO,MAAM,EAAE,OAAO,SACzD,OAAO,OAAK,QAAQ,aAAa,SAAS,EAAE;AAAA;AAAA,QAG3C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B,qBAAqB,MAAM;AACtC,QAAM,WAAW,OAAO;AACxB,QAAM,EAAE,OAAO,SAAS,gBAAgB,eAAe,qBACrD;AAEF,MAAI;AAAS,+CAAQ,UAAD;AAEpB,MAAI,CAAC;AAAgB,WAAO;AAE5B,MAAI,OAAO;AACT,aAAS,KAAK;AAAA,MACZ,SAAS;AAAA,MACT,UAAU;AAAA;AAEZ,WAAO;AAAA;AAGT,6CACG,KAAD;AAAA,IAAK,IAAI;AAAA,IAAG,IAAI;AAAA,yCACb,YAAD;AAAA,IAAY,SAAQ;AAAA,KAAS,mDAC5BC,gBAAD;AAAA,IACE,UAAQ;AAAA,IACR,cAAW;AAAA,IACX,SAAS;AAAA,IACT,OAAO;AAAA,IACP,UAAU,CAAC,GAAW,UAAoB,iBAAiB;AAAA,IAC3D,cAAc,CAAC,QAAQ,EAAE,mDACtB,kBAAD;AAAA,MACE,6CACG,UAAD;AAAA,QACE;AAAA,QACA;AAAA,QACA,SAAS;AAAA;AAAA,MAGb,OAAO,WAAW;AAAA;AAAA,IAGtB,MAAK;AAAA,IACL,+CAAY,gBAAD;AAAA,MAAgB,eAAY;AAAA;AAAA,IACvC,aAAa,gDAAW,WAAD;AAAA,SAAe;AAAA,MAAQ,SAAQ;AAAA;AAAA;AAAA;;;;"}
|
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { a as EntityNamePicker, j as EntityNamePickerFieldExtension, E as EntityPicker, i as EntityPickerFieldExtension, p as FavouriteTemplate, O as OwnerPicker, k as OwnerPickerFieldExtension, R as RepoUrlPicker, l as RepoUrlPickerFieldExtension, S as ScaffolderClient, h as ScaffolderFieldExtensions, m as ScaffolderPage, c as TemplateList, T as TemplateTypePicker, o as TextValuePicker, g as createScaffolderFieldExtension, n as plugin, s as scaffolderApiRef, n as scaffolderPlugin } from './esm/index-
|
|
1
|
+
export { a as EntityNamePicker, j as EntityNamePickerFieldExtension, E as EntityPicker, i as EntityPickerFieldExtension, p as FavouriteTemplate, O as OwnerPicker, k as OwnerPickerFieldExtension, R as RepoUrlPicker, l as RepoUrlPickerFieldExtension, S as ScaffolderClient, h as ScaffolderFieldExtensions, m as ScaffolderPage, c as TemplateList, T as TemplateTypePicker, o as TextValuePicker, g as createScaffolderFieldExtension, n as plugin, s as scaffolderApiRef, n as scaffolderPlugin } from './esm/index-306a8b5a.esm.js';
|
|
2
2
|
import '@backstage/catalog-model';
|
|
3
3
|
import '@backstage/integration-react';
|
|
4
4
|
import '@backstage/core-plugin-api';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-scaffolder",
|
|
3
3
|
"description": "The Backstage plugin that helps you create new things",
|
|
4
|
-
"version": "0.11.
|
|
4
|
+
"version": "0.11.14",
|
|
5
5
|
"main": "dist/index.esm.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"license": "Apache-2.0",
|
|
@@ -34,12 +34,12 @@
|
|
|
34
34
|
"@backstage/catalog-client": "^0.5.2",
|
|
35
35
|
"@backstage/catalog-model": "^0.9.7",
|
|
36
36
|
"@backstage/config": "^0.1.11",
|
|
37
|
-
"@backstage/core-components": "^0.
|
|
38
|
-
"@backstage/core-plugin-api": "^0.
|
|
37
|
+
"@backstage/core-components": "^0.8.0",
|
|
38
|
+
"@backstage/core-plugin-api": "^0.3.0",
|
|
39
39
|
"@backstage/errors": "^0.1.5",
|
|
40
40
|
"@backstage/integration": "^0.6.10",
|
|
41
|
-
"@backstage/integration-react": "^0.1.
|
|
42
|
-
"@backstage/plugin-catalog-react": "^0.6.
|
|
41
|
+
"@backstage/integration-react": "^0.1.15",
|
|
42
|
+
"@backstage/plugin-catalog-react": "^0.6.5",
|
|
43
43
|
"@backstage/theme": "^0.2.14",
|
|
44
44
|
"@backstage/types": "^0.1.1",
|
|
45
45
|
"@material-ui/core": "^4.12.2",
|
|
@@ -47,7 +47,6 @@
|
|
|
47
47
|
"@material-ui/lab": "4.0.0-alpha.57",
|
|
48
48
|
"@rjsf/core": "^3.2.1",
|
|
49
49
|
"@rjsf/material-ui": "^3.2.1",
|
|
50
|
-
"@types/react": "*",
|
|
51
50
|
"classnames": "^2.2.6",
|
|
52
51
|
"git-url-parse": "^11.6.0",
|
|
53
52
|
"humanize-duration": "^3.25.1",
|
|
@@ -56,20 +55,22 @@
|
|
|
56
55
|
"lodash": "^4.17.21",
|
|
57
56
|
"luxon": "^2.0.2",
|
|
58
57
|
"qs": "^6.9.4",
|
|
59
|
-
"react": "^16.13.1",
|
|
60
|
-
"react-dom": "^16.13.1",
|
|
61
|
-
"react-lazylog": "^4.5.2",
|
|
62
58
|
"react-router": "6.0.0-beta.0",
|
|
63
59
|
"react-router-dom": "6.0.0-beta.0",
|
|
64
60
|
"react-use": "^17.2.4",
|
|
65
61
|
"use-immer": "^0.6.0",
|
|
66
62
|
"zen-observable": "^0.8.15"
|
|
67
63
|
},
|
|
64
|
+
"peerDependencies": {
|
|
65
|
+
"@types/react": "^16.13.1 || ^17.0.0",
|
|
66
|
+
"react": "^16.13.1 || ^17.0.0"
|
|
67
|
+
},
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"@backstage/cli": "^0.10.
|
|
70
|
-
"@backstage/core-app-api": "^0.
|
|
71
|
-
"@backstage/dev-utils": "^0.2.
|
|
72
|
-
"@backstage/
|
|
69
|
+
"@backstage/cli": "^0.10.1",
|
|
70
|
+
"@backstage/core-app-api": "^0.2.0",
|
|
71
|
+
"@backstage/dev-utils": "^0.2.14",
|
|
72
|
+
"@backstage/plugin-catalog": "^0.7.4",
|
|
73
|
+
"@backstage/test-utils": "^0.1.24",
|
|
73
74
|
"@testing-library/jest-dom": "^5.10.1",
|
|
74
75
|
"@testing-library/react": "^11.2.5",
|
|
75
76
|
"@testing-library/react-hooks": "^7.0.2",
|
|
@@ -84,5 +85,5 @@
|
|
|
84
85
|
"files": [
|
|
85
86
|
"dist"
|
|
86
87
|
],
|
|
87
|
-
"gitHead": "
|
|
88
|
+
"gitHead": "562be0b43016294e27af3ad024191bb86b13b1c1"
|
|
88
89
|
}
|