@backstage/plugin-scaffolder 1.0.1 → 1.2.0-next.0
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 +98 -0
- package/README.md +1 -2
- package/alpha/package.json +6 -0
- package/dist/esm/{Router-773d053b.esm.js → Router-8305dc47.esm.js} +89 -48
- package/dist/esm/Router-8305dc47.esm.js.map +1 -0
- package/dist/esm/default-bae303a0.esm.js +33 -0
- package/dist/esm/default-bae303a0.esm.js.map +1 -0
- package/dist/esm/index-bd4ce41a.esm.js +337 -0
- package/dist/esm/index-bd4ce41a.esm.js.map +1 -0
- package/dist/esm/{index-25fdb62e.esm.js → index-e7455fc8.esm.js} +18 -6
- package/dist/esm/index-e7455fc8.esm.js.map +1 -0
- package/dist/index.alpha.d.ts +507 -0
- package/dist/index.beta.d.ts +484 -0
- package/dist/index.d.ts +286 -226
- package/dist/index.esm.js +1 -1
- package/package.json +25 -23
- package/dist/esm/Router-773d053b.esm.js.map +0 -1
- package/dist/esm/index-25fdb62e.esm.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-bae303a0.esm.js","sources":["../../src/extensions/default.ts"],"sourcesContent":["/*\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 { EntityPicker } from '../components/fields/EntityPicker/EntityPicker';\nimport { EntityNamePicker } from '../components/fields/EntityNamePicker/EntityNamePicker';\nimport { entityNamePickerValidation } from '../components/fields/EntityNamePicker/validation';\nimport { EntityTagsPicker } from '../components/fields/EntityTagsPicker/EntityTagsPicker';\nimport { OwnerPicker } from '../components/fields/OwnerPicker/OwnerPicker';\nimport { RepoUrlPicker } from '../components/fields/RepoUrlPicker/RepoUrlPicker';\nimport { repoPickerValidation } from '../components/fields/RepoUrlPicker/validation';\nimport { OwnedEntityPicker } from '../components/fields/OwnedEntityPicker/OwnedEntityPicker';\n\nexport const DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS = [\n {\n component: EntityPicker,\n name: 'EntityPicker',\n },\n {\n component: EntityNamePicker,\n name: 'EntityNamePicker',\n validation: entityNamePickerValidation,\n },\n {\n component: EntityTagsPicker,\n name: 'EntityTagsPicker',\n },\n {\n component: RepoUrlPicker,\n name: 'RepoUrlPicker',\n validation: repoPickerValidation,\n },\n {\n component: OwnerPicker,\n name: 'OwnerPicker',\n },\n {\n component: OwnedEntityPicker,\n name: 'OwnedEntityPicker',\n },\n];\n"],"names":[],"mappings":";;AAQY,MAAC,mCAAmC,GAAG;AACnD,EAAE;AACF,IAAI,SAAS,EAAE,YAAY;AAC3B,IAAI,IAAI,EAAE,cAAc;AACxB,GAAG;AACH,EAAE;AACF,IAAI,SAAS,EAAE,gBAAgB;AAC/B,IAAI,IAAI,EAAE,kBAAkB;AAC5B,IAAI,UAAU,EAAE,0BAA0B;AAC1C,GAAG;AACH,EAAE;AACF,IAAI,SAAS,EAAE,gBAAgB;AAC/B,IAAI,IAAI,EAAE,kBAAkB;AAC5B,GAAG;AACH,EAAE;AACF,IAAI,SAAS,EAAE,aAAa;AAC5B,IAAI,IAAI,EAAE,eAAe;AACzB,IAAI,UAAU,EAAE,oBAAoB;AACpC,GAAG;AACH,EAAE;AACF,IAAI,SAAS,EAAE,WAAW;AAC1B,IAAI,IAAI,EAAE,aAAa;AACvB,GAAG;AACH,EAAE;AACF,IAAI,SAAS,EAAE,iBAAiB;AAChC,IAAI,IAAI,EAAE,mBAAmB;AAC7B,GAAG;AACH;;;;"}
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
import React, { createContext, useState } from 'react';
|
|
2
|
+
import { useOutlet, Routes, Route } from 'react-router';
|
|
3
|
+
import { Progress, ItemCardHeader, MarkdownContent, UserIcon, Button as Button$1, Content, Link as Link$1, ItemCardGrid, ContentHeader, Page, Header, SupportButton } from '@backstage/core-components';
|
|
4
|
+
import { useEntityTypeFilter, FavoriteEntity, getEntityRelations, EntityRefLinks, useEntityList, EntityListProvider, CatalogFilterLayout, EntitySearchBar, EntityKindPicker, UserListPicker, EntityTagPicker } from '@backstage/plugin-catalog-react';
|
|
5
|
+
import capitalize from 'lodash/capitalize';
|
|
6
|
+
import { Box, Typography, FormControlLabel, Checkbox, TextField, makeStyles, useTheme, Card, CardContent, Divider, Chip, CardActions } from '@material-ui/core';
|
|
7
|
+
import CheckBoxIcon from '@material-ui/icons/CheckBox';
|
|
8
|
+
import CheckBoxOutlineBlankIcon from '@material-ui/icons/CheckBoxOutlineBlank';
|
|
9
|
+
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
|
|
10
|
+
import { Autocomplete } from '@material-ui/lab';
|
|
11
|
+
import { useApi, alertApiRef, useRouteRef, errorApiRef, useElementFilter } from '@backstage/core-plugin-api';
|
|
12
|
+
import Button from '@material-ui/core/Button';
|
|
13
|
+
import IconButton from '@material-ui/core/IconButton';
|
|
14
|
+
import useMediaQuery from '@material-ui/core/useMediaQuery';
|
|
15
|
+
import { Link } from 'react-router-dom';
|
|
16
|
+
import AddCircleOutline from '@material-ui/icons/AddCircleOutline';
|
|
17
|
+
import { catalogEntityCreatePermission } from '@backstage/plugin-catalog-common';
|
|
18
|
+
import { usePermission } from '@backstage/plugin-permission-react';
|
|
19
|
+
import { s as selectedTemplateRouteRef, a as registerComponentRouteRef, F as FIELD_EXTENSION_WRAPPER_KEY, d as FIELD_EXTENSION_KEY } from './index-e7455fc8.esm.js';
|
|
20
|
+
import { RELATION_OWNED_BY, stringifyEntityRef } from '@backstage/catalog-model';
|
|
21
|
+
import { D as DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS } from './default-bae303a0.esm.js';
|
|
22
|
+
import '@backstage/errors';
|
|
23
|
+
import 'qs';
|
|
24
|
+
import 'zen-observable';
|
|
25
|
+
import '@material-ui/core/FormControl';
|
|
26
|
+
import '@material-ui/lab/Autocomplete';
|
|
27
|
+
import 'react-use/lib/useAsync';
|
|
28
|
+
import 'react-use/lib/useEffectOnce';
|
|
29
|
+
import '@backstage/integration-react';
|
|
30
|
+
import '@material-ui/core/FormHelperText';
|
|
31
|
+
import '@material-ui/core/Input';
|
|
32
|
+
import '@material-ui/core/InputLabel';
|
|
33
|
+
import 'react-use/lib/useDebounce';
|
|
34
|
+
import '@material-ui/core/Grid';
|
|
35
|
+
import '@material-ui/core/Step';
|
|
36
|
+
import '@material-ui/core/StepLabel';
|
|
37
|
+
import '@material-ui/core/Stepper';
|
|
38
|
+
import '@material-ui/core/styles';
|
|
39
|
+
import '@material-ui/core/Typography';
|
|
40
|
+
import '@material-ui/icons/Cancel';
|
|
41
|
+
import '@material-ui/icons/Check';
|
|
42
|
+
import '@material-ui/icons/FiberManualRecord';
|
|
43
|
+
import 'classnames';
|
|
44
|
+
import 'luxon';
|
|
45
|
+
import 'react-use/lib/useInterval';
|
|
46
|
+
import 'use-immer';
|
|
47
|
+
import '@material-ui/icons/Language';
|
|
48
|
+
|
|
49
|
+
const icon = /* @__PURE__ */ React.createElement(CheckBoxOutlineBlankIcon, {
|
|
50
|
+
fontSize: "small"
|
|
51
|
+
});
|
|
52
|
+
const checkedIcon = /* @__PURE__ */ React.createElement(CheckBoxIcon, {
|
|
53
|
+
fontSize: "small"
|
|
54
|
+
});
|
|
55
|
+
const CategoryPicker = () => {
|
|
56
|
+
const alertApi = useApi(alertApiRef);
|
|
57
|
+
const { error, loading, availableTypes, selectedTypes, setSelectedTypes } = useEntityTypeFilter();
|
|
58
|
+
if (loading)
|
|
59
|
+
return /* @__PURE__ */ React.createElement(Progress, null);
|
|
60
|
+
if (error) {
|
|
61
|
+
alertApi.post({
|
|
62
|
+
message: `Failed to load entity types with error: ${error}`,
|
|
63
|
+
severity: "error"
|
|
64
|
+
});
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
if (!availableTypes)
|
|
68
|
+
return null;
|
|
69
|
+
return /* @__PURE__ */ React.createElement(Box, {
|
|
70
|
+
pb: 1,
|
|
71
|
+
pt: 1
|
|
72
|
+
}, /* @__PURE__ */ React.createElement(Typography, {
|
|
73
|
+
variant: "button"
|
|
74
|
+
}, "Categories"), /* @__PURE__ */ React.createElement(Autocomplete, {
|
|
75
|
+
multiple: true,
|
|
76
|
+
"aria-label": "Categories",
|
|
77
|
+
options: availableTypes,
|
|
78
|
+
value: selectedTypes,
|
|
79
|
+
onChange: (_, value) => setSelectedTypes(value),
|
|
80
|
+
renderOption: (option, { selected }) => /* @__PURE__ */ React.createElement(FormControlLabel, {
|
|
81
|
+
control: /* @__PURE__ */ React.createElement(Checkbox, {
|
|
82
|
+
icon,
|
|
83
|
+
checkedIcon,
|
|
84
|
+
checked: selected
|
|
85
|
+
}),
|
|
86
|
+
label: capitalize(option)
|
|
87
|
+
}),
|
|
88
|
+
size: "small",
|
|
89
|
+
popupIcon: /* @__PURE__ */ React.createElement(ExpandMoreIcon, null),
|
|
90
|
+
renderInput: (params) => /* @__PURE__ */ React.createElement(TextField, {
|
|
91
|
+
...params,
|
|
92
|
+
variant: "outlined"
|
|
93
|
+
})
|
|
94
|
+
}));
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const RegisterExistingButton = (props) => {
|
|
98
|
+
const { title, to } = props;
|
|
99
|
+
const { allowed } = usePermission({
|
|
100
|
+
permission: catalogEntityCreatePermission
|
|
101
|
+
});
|
|
102
|
+
const isXSScreen = useMediaQuery((theme) => theme.breakpoints.down("xs"));
|
|
103
|
+
if (!to || !allowed) {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
return isXSScreen ? /* @__PURE__ */ React.createElement(IconButton, {
|
|
107
|
+
component: Link,
|
|
108
|
+
color: "primary",
|
|
109
|
+
title,
|
|
110
|
+
size: "small",
|
|
111
|
+
to
|
|
112
|
+
}, /* @__PURE__ */ React.createElement(AddCircleOutline, null)) : /* @__PURE__ */ React.createElement(Button, {
|
|
113
|
+
component: Link,
|
|
114
|
+
variant: "contained",
|
|
115
|
+
color: "primary",
|
|
116
|
+
to
|
|
117
|
+
}, title);
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
const useStyles$1 = makeStyles(() => ({
|
|
121
|
+
header: {
|
|
122
|
+
backgroundImage: ({ cardBackgroundImage }) => cardBackgroundImage
|
|
123
|
+
},
|
|
124
|
+
subtitleWrapper: {
|
|
125
|
+
display: "flex",
|
|
126
|
+
justifyContent: "space-between"
|
|
127
|
+
}
|
|
128
|
+
}));
|
|
129
|
+
const CardHeader = (props) => {
|
|
130
|
+
const {
|
|
131
|
+
template: {
|
|
132
|
+
metadata: { title, name },
|
|
133
|
+
spec: { type }
|
|
134
|
+
}
|
|
135
|
+
} = props;
|
|
136
|
+
const { getPageTheme } = useTheme();
|
|
137
|
+
const themeForType = getPageTheme({ themeId: type });
|
|
138
|
+
const styles = useStyles$1({
|
|
139
|
+
cardBackgroundImage: themeForType.backgroundImage
|
|
140
|
+
});
|
|
141
|
+
const SubtitleComponent = /* @__PURE__ */ React.createElement("div", {
|
|
142
|
+
className: styles.subtitleWrapper
|
|
143
|
+
}, /* @__PURE__ */ React.createElement("div", null, type), /* @__PURE__ */ React.createElement("div", null, /* @__PURE__ */ React.createElement(FavoriteEntity, {
|
|
144
|
+
entity: props.template,
|
|
145
|
+
style: { padding: 0 }
|
|
146
|
+
})));
|
|
147
|
+
return /* @__PURE__ */ React.createElement(ItemCardHeader, {
|
|
148
|
+
title: title != null ? title : name,
|
|
149
|
+
subtitle: SubtitleComponent,
|
|
150
|
+
classes: { root: styles.header }
|
|
151
|
+
});
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
const useStyles = makeStyles((theme) => ({
|
|
155
|
+
box: {
|
|
156
|
+
overflow: "hidden",
|
|
157
|
+
textOverflow: "ellipsis",
|
|
158
|
+
display: "-webkit-box",
|
|
159
|
+
"-webkit-line-clamp": 10,
|
|
160
|
+
"-webkit-box-orient": "vertical",
|
|
161
|
+
"& p:first-child": {
|
|
162
|
+
marginTop: 0,
|
|
163
|
+
marginBottom: theme.spacing(2)
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
label: {
|
|
167
|
+
color: theme.palette.text.secondary,
|
|
168
|
+
textTransform: "uppercase",
|
|
169
|
+
fontWeight: "bold",
|
|
170
|
+
letterSpacing: 0.5,
|
|
171
|
+
lineHeight: 1,
|
|
172
|
+
fontSize: "0.75rem"
|
|
173
|
+
},
|
|
174
|
+
margin: {
|
|
175
|
+
marginBottom: theme.spacing(2)
|
|
176
|
+
},
|
|
177
|
+
footer: {
|
|
178
|
+
display: "flex",
|
|
179
|
+
justifyContent: "space-between",
|
|
180
|
+
flex: 1,
|
|
181
|
+
alignItems: "center"
|
|
182
|
+
},
|
|
183
|
+
ownedBy: {
|
|
184
|
+
display: "flex",
|
|
185
|
+
alignItems: "center",
|
|
186
|
+
flex: 1,
|
|
187
|
+
color: theme.palette.link
|
|
188
|
+
}
|
|
189
|
+
}));
|
|
190
|
+
const TemplateCard = (props) => {
|
|
191
|
+
var _a, _b, _c, _d;
|
|
192
|
+
const { template } = props;
|
|
193
|
+
const styles = useStyles();
|
|
194
|
+
const ownedByRelations = getEntityRelations(template, RELATION_OWNED_BY);
|
|
195
|
+
const templateRoute = useRouteRef(selectedTemplateRouteRef);
|
|
196
|
+
const href = templateRoute({ templateName: template.metadata.name });
|
|
197
|
+
return /* @__PURE__ */ React.createElement(Card, null, /* @__PURE__ */ React.createElement(CardHeader, {
|
|
198
|
+
template
|
|
199
|
+
}), /* @__PURE__ */ React.createElement(CardContent, null, /* @__PURE__ */ React.createElement(Box, {
|
|
200
|
+
className: styles.box
|
|
201
|
+
}, /* @__PURE__ */ React.createElement(MarkdownContent, {
|
|
202
|
+
content: (_a = template.metadata.description) != null ? _a : "No description"
|
|
203
|
+
})), ((_c = (_b = template.metadata.tags) == null ? void 0 : _b.length) != null ? _c : 0) > 0 && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Divider, {
|
|
204
|
+
className: styles.margin
|
|
205
|
+
}), /* @__PURE__ */ React.createElement(Box, null, (_d = template.metadata.tags) == null ? void 0 : _d.map((tag) => /* @__PURE__ */ React.createElement(Chip, {
|
|
206
|
+
size: "small",
|
|
207
|
+
label: tag,
|
|
208
|
+
key: tag
|
|
209
|
+
}))))), /* @__PURE__ */ React.createElement(CardActions, null, /* @__PURE__ */ React.createElement("div", {
|
|
210
|
+
className: styles.footer
|
|
211
|
+
}, /* @__PURE__ */ React.createElement("div", {
|
|
212
|
+
className: styles.ownedBy
|
|
213
|
+
}, ownedByRelations.length > 0 && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(UserIcon, null), /* @__PURE__ */ React.createElement(EntityRefLinks, {
|
|
214
|
+
entityRefs: ownedByRelations,
|
|
215
|
+
defaultKind: "Group"
|
|
216
|
+
}))), /* @__PURE__ */ React.createElement(Button$1, {
|
|
217
|
+
size: "small",
|
|
218
|
+
variant: "outlined",
|
|
219
|
+
color: "primary",
|
|
220
|
+
to: href
|
|
221
|
+
}, "Choose"))));
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
const TemplateGroup = (props) => {
|
|
225
|
+
const { templates, title, components: { CardComponent } = {} } = props;
|
|
226
|
+
const titleComponent = typeof title === "string" ? /* @__PURE__ */ React.createElement(ContentHeader, {
|
|
227
|
+
title
|
|
228
|
+
}) : title;
|
|
229
|
+
if (templates.length === 0) {
|
|
230
|
+
return /* @__PURE__ */ React.createElement(Content, null, titleComponent, /* @__PURE__ */ React.createElement(Typography, {
|
|
231
|
+
variant: "body2"
|
|
232
|
+
}, "No templates found that match your filter. Learn more about", " ", /* @__PURE__ */ React.createElement(Link$1, {
|
|
233
|
+
to: "https://backstage.io/docs/features/software-templates/adding-templates"
|
|
234
|
+
}, "adding templates"), "."));
|
|
235
|
+
}
|
|
236
|
+
const Card = CardComponent || TemplateCard;
|
|
237
|
+
return /* @__PURE__ */ React.createElement(Content, null, titleComponent, /* @__PURE__ */ React.createElement(ItemCardGrid, null, templates.map((template) => /* @__PURE__ */ React.createElement(Card, {
|
|
238
|
+
key: stringifyEntityRef(template),
|
|
239
|
+
template
|
|
240
|
+
}))));
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
const TemplateGroups = (props) => {
|
|
244
|
+
const { loading, error, entities } = useEntityList();
|
|
245
|
+
const { groups, TemplateCardComponent } = props;
|
|
246
|
+
const errorApi = useApi(errorApiRef);
|
|
247
|
+
if (loading) {
|
|
248
|
+
return /* @__PURE__ */ React.createElement(Progress, null);
|
|
249
|
+
}
|
|
250
|
+
if (error) {
|
|
251
|
+
errorApi.post(error);
|
|
252
|
+
return null;
|
|
253
|
+
}
|
|
254
|
+
if (!entities || !entities.length) {
|
|
255
|
+
return /* @__PURE__ */ React.createElement(Typography, {
|
|
256
|
+
variant: "body2"
|
|
257
|
+
}, "No templates found that match your filter. Learn more about", " ", /* @__PURE__ */ React.createElement(Link$1, {
|
|
258
|
+
to: "https://backstage.io/docs/features/software-templates/adding-templates"
|
|
259
|
+
}, "adding templates"), ".");
|
|
260
|
+
}
|
|
261
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, groups.map(({ title, filter }, index) => /* @__PURE__ */ React.createElement(TemplateGroup, {
|
|
262
|
+
key: index,
|
|
263
|
+
templates: entities.filter((e) => filter(e)),
|
|
264
|
+
title,
|
|
265
|
+
components: { CardComponent: TemplateCardComponent }
|
|
266
|
+
})));
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
const defaultGroup = {
|
|
270
|
+
title: "All Templates",
|
|
271
|
+
filter: () => true
|
|
272
|
+
};
|
|
273
|
+
const TemplateListPage = (props) => {
|
|
274
|
+
const registerComponentLink = useRouteRef(registerComponentRouteRef);
|
|
275
|
+
const { TemplateCardComponent, groups = [defaultGroup] } = props;
|
|
276
|
+
return /* @__PURE__ */ React.createElement(EntityListProvider, null, /* @__PURE__ */ React.createElement(Page, {
|
|
277
|
+
themeId: "home"
|
|
278
|
+
}, /* @__PURE__ */ React.createElement(Header, {
|
|
279
|
+
pageTitleOverride: "Create a New Component",
|
|
280
|
+
title: "Create a New Component",
|
|
281
|
+
subtitle: "Create new software components using standard templates"
|
|
282
|
+
}), /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(ContentHeader, {
|
|
283
|
+
title: "Available Templates"
|
|
284
|
+
}, /* @__PURE__ */ React.createElement(RegisterExistingButton, {
|
|
285
|
+
title: "Register Existing Component",
|
|
286
|
+
to: registerComponentLink && registerComponentLink()
|
|
287
|
+
}), /* @__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, {
|
|
288
|
+
initialFilter: "template",
|
|
289
|
+
hidden: true
|
|
290
|
+
}), /* @__PURE__ */ React.createElement(UserListPicker, {
|
|
291
|
+
initialFilter: "all",
|
|
292
|
+
availableFilters: ["all", "starred"]
|
|
293
|
+
}), /* @__PURE__ */ React.createElement(CategoryPicker, null), /* @__PURE__ */ React.createElement(EntityTagPicker, null)), /* @__PURE__ */ React.createElement(CatalogFilterLayout.Content, null, /* @__PURE__ */ React.createElement(TemplateGroups, {
|
|
294
|
+
groups,
|
|
295
|
+
TemplateCardComponent
|
|
296
|
+
}))))));
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
const SecretsContext = createContext(void 0);
|
|
300
|
+
const SecretsContextProvider = ({ children }) => {
|
|
301
|
+
const [secrets, setSecrets] = useState({});
|
|
302
|
+
return /* @__PURE__ */ React.createElement(SecretsContext.Provider, {
|
|
303
|
+
value: { secrets, setSecrets }
|
|
304
|
+
}, children);
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
const TemplateWizardPage = (_props) => {
|
|
308
|
+
return null;
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
const Router = (props) => {
|
|
312
|
+
const { components: { TemplateCardComponent } = {} } = props;
|
|
313
|
+
const outlet = useOutlet() || props.children;
|
|
314
|
+
const customFieldExtensions = useElementFilter(outlet, (elements) => elements.selectByComponentData({
|
|
315
|
+
key: FIELD_EXTENSION_WRAPPER_KEY
|
|
316
|
+
}).findComponentData({
|
|
317
|
+
key: FIELD_EXTENSION_KEY
|
|
318
|
+
}));
|
|
319
|
+
const fieldExtensions = [
|
|
320
|
+
...customFieldExtensions,
|
|
321
|
+
...DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS.filter(({ name }) => !customFieldExtensions.some((customFieldExtension) => customFieldExtension.name === name))
|
|
322
|
+
];
|
|
323
|
+
return /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(Route, {
|
|
324
|
+
element: /* @__PURE__ */ React.createElement(TemplateListPage, {
|
|
325
|
+
TemplateCardComponent,
|
|
326
|
+
groups: props.groups
|
|
327
|
+
})
|
|
328
|
+
}), /* @__PURE__ */ React.createElement(Route, {
|
|
329
|
+
path: selectedTemplateRouteRef.path,
|
|
330
|
+
element: /* @__PURE__ */ React.createElement(SecretsContextProvider, null, /* @__PURE__ */ React.createElement(TemplateWizardPage, {
|
|
331
|
+
customFieldExtensions: fieldExtensions
|
|
332
|
+
}))
|
|
333
|
+
}));
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
export { Router };
|
|
337
|
+
//# sourceMappingURL=index-bd4ce41a.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-bd4ce41a.esm.js","sources":["../../src/next/TemplateListPage/CategoryPicker.tsx","../../src/next/TemplateListPage/RegisterExistingButton.tsx","../../src/next/TemplateListPage/TemplateCard/CardHeader.tsx","../../src/next/TemplateListPage/TemplateCard/TemplateCard.tsx","../../src/next/TemplateListPage/TemplateGroup.tsx","../../src/next/TemplateListPage/TemplateGroups.tsx","../../src/next/TemplateListPage/TemplateListPage.tsx","../../src/next/TemplateWizardPage/SecretsContext/SecretsContext.tsx","../../src/next/TemplateWizardPage/TemplateWizardPage.tsx","../../src/next/Router/Router.tsx"],"sourcesContent":["/*\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\n/**\n * The Category Picker that is rendered on the left side for picking\n * categories and filtering the template list.\n */\nexport const CategoryPicker = () => {\n const alertApi = useApi(alertApiRef);\n const { error, loading, availableTypes, selectedTypes, setSelectedTypes } =\n useEntityTypeFilter();\n\n if (loading) return <Progress />;\n\n if (error) {\n alertApi.post({\n message: `Failed to load entity types with error: ${error}`,\n severity: 'error',\n });\n return null;\n }\n\n if (!availableTypes) return null;\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 />}\n renderInput={params => <TextField {...params} variant=\"outlined\" />}\n />\n </Box>\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 { BackstageTheme } from '@backstage/theme';\nimport Button from '@material-ui/core/Button';\nimport IconButton from '@material-ui/core/IconButton';\nimport useMediaQuery from '@material-ui/core/useMediaQuery';\nimport React from 'react';\nimport { Link as RouterLink, LinkProps } from 'react-router-dom';\nimport AddCircleOutline from '@material-ui/icons/AddCircleOutline';\nimport { catalogEntityCreatePermission } from '@backstage/plugin-catalog-common';\nimport { usePermission } from '@backstage/plugin-permission-react';\n\n/**\n * Properties for {@link RegisterExistingButton}\n *\n * @alpha\n */\nexport type RegisterExistingButtonProps = {\n title: string;\n} & Partial<Pick<LinkProps, 'to'>>;\n\n/**\n * A button that helps users to register an existing component.\n * @alpha\n */\nexport const RegisterExistingButton = (props: RegisterExistingButtonProps) => {\n const { title, to } = props;\n const { allowed } = usePermission({\n permission: catalogEntityCreatePermission,\n });\n const isXSScreen = useMediaQuery<BackstageTheme>(theme =>\n theme.breakpoints.down('xs'),\n );\n\n if (!to || !allowed) {\n return null;\n }\n\n return isXSScreen ? (\n <IconButton\n component={RouterLink}\n color=\"primary\"\n title={title}\n size=\"small\"\n to={to}\n >\n <AddCircleOutline />\n </IconButton>\n ) : (\n <Button component={RouterLink} variant=\"contained\" color=\"primary\" to={to}>\n {title}\n </Button>\n );\n};\n","/*\n * Copyright 2022 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 { makeStyles, useTheme } from '@material-ui/core';\nimport { ItemCardHeader } from '@backstage/core-components';\nimport { BackstageTheme } from '@backstage/theme';\nimport { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport { FavoriteEntity } from '@backstage/plugin-catalog-react';\n\nconst useStyles = makeStyles<BackstageTheme, { cardBackgroundImage: string }>(\n () => ({\n header: {\n backgroundImage: ({ cardBackgroundImage }) => cardBackgroundImage,\n },\n subtitleWrapper: {\n display: 'flex',\n justifyContent: 'space-between',\n },\n }),\n);\n\n/**\n * Props for the CardHeader component\n */\nexport interface CardHeaderProps {\n template: TemplateEntityV1beta3;\n}\n\n/**\n * The Card Header with the background for the TemplateCard.\n */\nexport const CardHeader = (props: CardHeaderProps) => {\n const {\n template: {\n metadata: { title, name },\n spec: { type },\n },\n } = props;\n const { getPageTheme } = useTheme<BackstageTheme>();\n const themeForType = getPageTheme({ themeId: type });\n\n const styles = useStyles({\n cardBackgroundImage: themeForType.backgroundImage,\n });\n\n const SubtitleComponent = (\n <div className={styles.subtitleWrapper}>\n <div>{type}</div>\n <div>\n <FavoriteEntity entity={props.template} style={{ padding: 0 }} />\n </div>\n </div>\n );\n\n return (\n <ItemCardHeader\n title={title ?? name}\n subtitle={SubtitleComponent}\n classes={{ root: styles.header }}\n />\n );\n};\n","/*\n * Copyright 2022 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 { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport {\n Box,\n Card,\n CardActions,\n CardContent,\n Chip,\n Divider,\n makeStyles,\n} from '@material-ui/core';\nimport { CardHeader } from './CardHeader';\nimport { MarkdownContent, UserIcon, Button } from '@backstage/core-components';\nimport { RELATION_OWNED_BY } from '@backstage/catalog-model';\nimport {\n EntityRefLinks,\n getEntityRelations,\n} from '@backstage/plugin-catalog-react';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport { selectedTemplateRouteRef } from '../../../routes';\nimport { BackstageTheme } from '@backstage/theme';\n\nconst useStyles = makeStyles<BackstageTheme>(theme => ({\n box: {\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n display: '-webkit-box',\n '-webkit-line-clamp': 10,\n '-webkit-box-orient': 'vertical',\n /** to make the styles for React Markdown not leak into the description */\n '& p:first-child': {\n marginTop: 0,\n marginBottom: theme.spacing(2),\n },\n },\n label: {\n color: theme.palette.text.secondary,\n textTransform: 'uppercase',\n fontWeight: 'bold',\n letterSpacing: 0.5,\n lineHeight: 1,\n fontSize: '0.75rem',\n },\n margin: {\n marginBottom: theme.spacing(2),\n },\n footer: {\n display: 'flex',\n justifyContent: 'space-between',\n flex: 1,\n alignItems: 'center',\n },\n ownedBy: {\n display: 'flex',\n alignItems: 'center',\n flex: 1,\n color: theme.palette.link,\n },\n}));\n\n/**\n * The Props for the Template Card component\n * @alpha\n */\nexport interface TemplateCardProps {\n template: TemplateEntityV1beta3;\n deprecated?: boolean;\n}\n\n/**\n * The Template Card component that is rendered in a list for each template\n * @alpha\n */\nexport const TemplateCard = (props: TemplateCardProps) => {\n const { template } = props;\n const styles = useStyles();\n const ownedByRelations = getEntityRelations(template, RELATION_OWNED_BY);\n const templateRoute = useRouteRef(selectedTemplateRouteRef);\n const href = templateRoute({ templateName: template.metadata.name });\n\n return (\n <Card>\n <CardHeader template={template} />\n <CardContent>\n <Box className={styles.box}>\n <MarkdownContent\n content={template.metadata.description ?? 'No description'}\n />\n </Box>\n {(template.metadata.tags?.length ?? 0) > 0 && (\n <>\n <Divider className={styles.margin} />\n <Box>\n {template.metadata.tags?.map(tag => (\n <Chip size=\"small\" label={tag} key={tag} />\n ))}\n </Box>\n </>\n )}\n </CardContent>\n <CardActions>\n <div className={styles.footer}>\n <div className={styles.ownedBy}>\n {ownedByRelations.length > 0 && (\n <>\n <UserIcon />\n <EntityRefLinks\n entityRefs={ownedByRelations}\n defaultKind=\"Group\"\n />\n </>\n )}\n </div>\n <Button size=\"small\" variant=\"outlined\" color=\"primary\" to={href}>\n Choose\n </Button>\n </div>\n </CardActions>\n </Card>\n );\n};\n","/*\n * Copyright 2022 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 { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport React from 'react';\nimport {\n Content,\n ContentHeader,\n ItemCardGrid,\n Link,\n} from '@backstage/core-components';\nimport { Typography } from '@material-ui/core';\nimport { TemplateCard, TemplateCardProps } from './TemplateCard';\nimport { stringifyEntityRef } from '@backstage/catalog-model';\n\nexport interface TemplateGroupProps {\n templates: TemplateEntityV1beta3[];\n title: React.ReactNode;\n components?: {\n CardComponent?: React.ComponentType<TemplateCardProps>;\n };\n}\n\nexport const TemplateGroup = (props: TemplateGroupProps) => {\n const { templates, title, components: { CardComponent } = {} } = props;\n const titleComponent =\n typeof title === 'string' ? <ContentHeader title={title} /> : title;\n\n if (templates.length === 0) {\n return (\n <Content>\n {titleComponent}\n <Typography variant=\"body2\">\n No templates found that match your filter. Learn more about{' '}\n <Link to=\"https://backstage.io/docs/features/software-templates/adding-templates\">\n adding templates\n </Link>\n .\n </Typography>\n </Content>\n );\n }\n\n const Card = CardComponent || TemplateCard;\n\n return (\n <Content>\n {titleComponent}\n <ItemCardGrid>\n {templates.map(template => (\n <Card key={stringifyEntityRef(template)} template={template} />\n ))}\n </ItemCardGrid>\n </Content>\n );\n};\n","/*\n * Copyright 2022 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 { TemplateGroup } from './TemplateGroup';\nimport { Entity } from '@backstage/catalog-model';\nimport { useEntityList } from '@backstage/plugin-catalog-react';\nimport { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport { Progress, Link } from '@backstage/core-components';\nimport { Typography } from '@material-ui/core';\nimport { errorApiRef, useApi } from '@backstage/core-plugin-api';\n\n/**\n * @alpha\n */\nexport type TemplateGroupFilter = {\n title?: React.ReactNode;\n filter: (entity: Entity) => boolean;\n};\n\nexport interface TemplateGroupsProps {\n groups: TemplateGroupFilter[];\n TemplateCardComponent?: React.ComponentType<{\n template: TemplateEntityV1beta3;\n }>;\n}\n\nexport const TemplateGroups = (props: TemplateGroupsProps) => {\n const { loading, error, entities } = useEntityList();\n const { groups, TemplateCardComponent } = props;\n const errorApi = useApi(errorApiRef);\n\n if (loading) {\n return <Progress />;\n }\n\n if (error) {\n errorApi.post(error);\n return null;\n }\n\n if (!entities || !entities.length) {\n return (\n <Typography variant=\"body2\">\n No templates found that match your filter. Learn more about{' '}\n <Link to=\"https://backstage.io/docs/features/software-templates/adding-templates\">\n adding templates\n </Link>\n .\n </Typography>\n );\n }\n\n return (\n <>\n {groups.map(({ title, filter }, index) => (\n <TemplateGroup\n key={index}\n templates={entities.filter((e): e is TemplateEntityV1beta3 =>\n filter(e),\n )}\n title={title}\n components={{ CardComponent: TemplateCardComponent }}\n />\n ))}\n </>\n );\n};\n","/*\n * Copyright 2022 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 { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\n\nimport {\n Content,\n ContentHeader,\n Header,\n Page,\n SupportButton,\n} from '@backstage/core-components';\nimport {\n EntityKindPicker,\n EntityListProvider,\n EntitySearchBar,\n EntityTagPicker,\n CatalogFilterLayout,\n UserListPicker,\n} from '@backstage/plugin-catalog-react';\nimport { CategoryPicker } from './CategoryPicker';\nimport { RegisterExistingButton } from './RegisterExistingButton';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport { registerComponentRouteRef } from '../../routes';\nimport { TemplateGroupFilter, TemplateGroups } from './TemplateGroups';\n\nexport type TemplateListPageProps = {\n TemplateCardComponent?: React.ComponentType<{\n template: TemplateEntityV1beta3;\n }>;\n groups?: TemplateGroupFilter[];\n};\n\nconst defaultGroup: TemplateGroupFilter = {\n title: 'All Templates',\n filter: () => true,\n};\n\nexport const TemplateListPage = (props: TemplateListPageProps) => {\n const registerComponentLink = useRouteRef(registerComponentRouteRef);\n const { TemplateCardComponent, groups = [defaultGroup] } = props;\n\n return (\n <EntityListProvider>\n <Page themeId=\"home\">\n <Header\n pageTitleOverride=\"Create a New Component\"\n title=\"Create a New Component\"\n subtitle=\"Create new software components using standard templates\"\n />\n <Content>\n <ContentHeader title=\"Available Templates\">\n <RegisterExistingButton\n title=\"Register Existing Component\"\n to={registerComponentLink && registerComponentLink()}\n />\n <SupportButton>\n Create new software components using standard templates. Different\n templates create different kinds of components (services,\n websites, documentation, ...).\n </SupportButton>\n </ContentHeader>\n\n <CatalogFilterLayout>\n <CatalogFilterLayout.Filters>\n <EntitySearchBar />\n <EntityKindPicker initialFilter=\"template\" hidden />\n <UserListPicker\n initialFilter=\"all\"\n availableFilters={['all', 'starred']}\n />\n <CategoryPicker />\n <EntityTagPicker />\n </CatalogFilterLayout.Filters>\n <CatalogFilterLayout.Content>\n <TemplateGroups\n groups={groups}\n TemplateCardComponent={TemplateCardComponent}\n />\n </CatalogFilterLayout.Content>\n </CatalogFilterLayout>\n </Content>\n </Page>\n </EntityListProvider>\n );\n};\n","/*\n * Copyright 2022 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, {\n useState,\n useCallback,\n useContext,\n createContext,\n PropsWithChildren,\n} from 'react';\n\ntype SecretsContextContents = {\n secrets: Record<string, string>;\n setSecrets: React.Dispatch<React.SetStateAction<Record<string, string>>>;\n};\n\n/**\n * The actual context object.\n */\nexport const SecretsContext = createContext<SecretsContextContents | undefined>(\n undefined,\n);\n\n/**\n * The Context Provider that holds the state for the secrets.\n *\n * @alpha\n */\nexport const SecretsContextProvider = ({ children }: PropsWithChildren<{}>) => {\n const [secrets, setSecrets] = useState<Record<string, string>>({});\n\n return (\n <SecretsContext.Provider value={{ secrets, setSecrets }}>\n {children}\n </SecretsContext.Provider>\n );\n};\n\n/**\n * Hook to access the secrets context.\n * @alpha\n */\nexport const useTemplateSecrets = () => {\n const value = useContext(SecretsContext);\n if (!value) {\n throw new Error(\n 'useTemplateSecrets must be used within a SecretsContextProvider',\n );\n }\n\n const { setSecrets } = value;\n\n const setSecret = useCallback(\n (input: Record<string, string>) => {\n setSecrets(currentSecrets => ({ ...currentSecrets, ...input }));\n },\n [setSecrets],\n );\n\n return { setSecret };\n};\n","/*\n * Copyright 2022 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 { FieldExtensionOptions } from '../../extensions';\n\nexport interface TemplateWizardPageProps {\n customFieldExtensions: FieldExtensionOptions<any, any>[];\n}\n\nexport const TemplateWizardPage = (_props: TemplateWizardPageProps) => {\n return null;\n};\n","/*\n * Copyright 2022 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, { PropsWithChildren } from 'react';\nimport { Routes, Route, useOutlet } from 'react-router';\nimport { TemplateListPage } from '../TemplateListPage';\nimport { SecretsContextProvider } from '../TemplateWizardPage/SecretsContext';\nimport { TemplateWizardPage } from '../TemplateWizardPage';\nimport {\n FieldExtensionOptions,\n FIELD_EXTENSION_WRAPPER_KEY,\n FIELD_EXTENSION_KEY,\n DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS,\n} from '../../extensions';\n\nimport { useElementFilter } from '@backstage/core-plugin-api';\nimport { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport { TemplateGroupFilter } from '../TemplateListPage/TemplateGroups';\nimport { selectedTemplateRouteRef } from '../../routes';\n\n/**\n * The Props for the Scaffolder Router\n *\n * @alpha\n */\nexport type NextRouterProps = {\n components?: {\n TemplateCardComponent?: React.ComponentType<{\n template: TemplateEntityV1beta3;\n }>;\n TaskPageComponent?: React.ComponentType<{}>;\n };\n groups?: TemplateGroupFilter[];\n};\n\n/**\n * The Scaffolder Router\n *\n * @alpha\n */\nexport const Router = (props: PropsWithChildren<NextRouterProps>) => {\n const { components: { TemplateCardComponent } = {} } = props;\n\n const outlet = useOutlet() || props.children;\n\n const customFieldExtensions = useElementFilter(outlet, elements =>\n elements\n .selectByComponentData({\n key: FIELD_EXTENSION_WRAPPER_KEY,\n })\n .findComponentData<FieldExtensionOptions>({\n key: FIELD_EXTENSION_KEY,\n }),\n );\n\n const fieldExtensions = [\n ...customFieldExtensions,\n ...DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS.filter(\n ({ name }) =>\n !customFieldExtensions.some(\n customFieldExtension => customFieldExtension.name === name,\n ),\n ),\n ];\n\n return (\n <Routes>\n <Route\n element={\n <TemplateListPage\n TemplateCardComponent={TemplateCardComponent}\n groups={props.groups}\n />\n }\n />\n\n <Route\n path={selectedTemplateRouteRef.path}\n element={\n <SecretsContextProvider>\n <TemplateWizardPage customFieldExtensions={fieldExtensions} />\n </SecretsContextProvider>\n }\n />\n </Routes>\n );\n};\n"],"names":["RouterLink","useStyles","Button","Link"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAM,IAAI,mBAAmB,KAAK,CAAC,aAAa,CAAC,wBAAwB,EAAE;AAC3E,EAAE,QAAQ,EAAE,OAAO;AACnB,CAAC,CAAC,CAAC;AACH,MAAM,WAAW,mBAAmB,KAAK,CAAC,aAAa,CAAC,YAAY,EAAE;AACtE,EAAE,QAAQ,EAAE,OAAO;AACnB,CAAC,CAAC,CAAC;AACI,MAAM,cAAc,GAAG,MAAM;AACpC,EAAE,MAAM,QAAQ,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;AACvC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,gBAAgB,EAAE,GAAG,mBAAmB,EAAE,CAAC;AACpG,EAAE,IAAI,OAAO;AACb,IAAI,uBAAuB,KAAK,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AAC/D,EAAE,IAAI,KAAK,EAAE;AACb,IAAI,QAAQ,CAAC,IAAI,CAAC;AAClB,MAAM,OAAO,EAAE,CAAC,wCAAwC,EAAE,KAAK,CAAC,CAAC;AACjE,MAAM,QAAQ,EAAE,OAAO;AACvB,KAAK,CAAC,CAAC;AACP,IAAI,OAAO,IAAI,CAAC;AAChB,GAAG;AACH,EAAE,IAAI,CAAC,cAAc;AACrB,IAAI,OAAO,IAAI,CAAC;AAChB,EAAE,uBAAuB,KAAK,CAAC,aAAa,CAAC,GAAG,EAAE;AAClD,IAAI,EAAE,EAAE,CAAC;AACT,IAAI,EAAE,EAAE,CAAC;AACT,GAAG,kBAAkB,KAAK,CAAC,aAAa,CAAC,UAAU,EAAE;AACrD,IAAI,OAAO,EAAE,QAAQ;AACrB,GAAG,EAAE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AAM;AAC1B,KAAK,CAAC;AACN,GAAG,CAAC,kBAAkB,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE;AACjD,IAAI,IAAI,EAAE,wBAAwB,CAAC,IAAI;AACvC,IAAI,OAAO,kBAAkB,KAAK,CAAC,aAAa,CAAC,sBAAsB,EAAE,IAAI,kBAAkB,KAAK,CAAC,aAAa,CAAC,kBAAkB,EAAE;AACvI,MAAM,qBAAqB,EAAE,eAAe;AAC5C,KAAK,CAAC,CAAC;AACP,GAAG,CAAC,CAAC,CAAC;AACN;;;;"}
|
|
@@ -51,7 +51,9 @@ class ScaffolderClient {
|
|
|
51
51
|
async getIntegrationsList(options) {
|
|
52
52
|
const integrations = [
|
|
53
53
|
...this.scmIntegrationsApi.azure.list(),
|
|
54
|
-
...this.scmIntegrationsApi.bitbucket.list(),
|
|
54
|
+
...this.scmIntegrationsApi.bitbucket.list().filter((item) => !this.scmIntegrationsApi.bitbucketCloud.byHost(item.config.host) && !this.scmIntegrationsApi.bitbucketServer.byHost(item.config.host)),
|
|
55
|
+
...this.scmIntegrationsApi.bitbucketCloud.list(),
|
|
56
|
+
...this.scmIntegrationsApi.bitbucketServer.list(),
|
|
55
57
|
...this.scmIntegrationsApi.github.list(),
|
|
56
58
|
...this.scmIntegrationsApi.gitlab.list()
|
|
57
59
|
].map((c) => ({ type: c.type, title: c.title, host: c.config.host })).filter((c) => options.allowedHosts.includes(c.host));
|
|
@@ -407,7 +409,7 @@ const GitlabRepoPicker = (props) => {
|
|
|
407
409
|
id: "ownerInput",
|
|
408
410
|
onChange: (e) => onChange({ owner: e.target.value }),
|
|
409
411
|
value: owner
|
|
410
|
-
})), /* @__PURE__ */ React.createElement(FormHelperText, null, "The organization, user
|
|
412
|
+
})), /* @__PURE__ */ React.createElement(FormHelperText, null, "The organization, groups, subgroups, user, project (also known as namespaces in gitlab), that this repo will belong to")), /* @__PURE__ */ React.createElement(FormControl, {
|
|
411
413
|
margin: "normal",
|
|
412
414
|
required: true,
|
|
413
415
|
error: (rawErrors == null ? void 0 : rawErrors.length) > 0 && !repoName
|
|
@@ -789,11 +791,16 @@ const scaffolderTaskRouteRef = createSubRouteRef({
|
|
|
789
791
|
parent: rootRouteRef,
|
|
790
792
|
path: "/tasks/:taskId"
|
|
791
793
|
});
|
|
792
|
-
createSubRouteRef({
|
|
794
|
+
const actionsRouteRef = createSubRouteRef({
|
|
793
795
|
id: "scaffolder/actions",
|
|
794
796
|
parent: rootRouteRef,
|
|
795
797
|
path: "/actions"
|
|
796
798
|
});
|
|
799
|
+
const editRouteRef = createSubRouteRef({
|
|
800
|
+
id: "scaffolder/edit",
|
|
801
|
+
parent: rootRouteRef,
|
|
802
|
+
path: "/edit"
|
|
803
|
+
});
|
|
797
804
|
|
|
798
805
|
const scaffolderPlugin = createPlugin({
|
|
799
806
|
id: "scaffolder",
|
|
@@ -839,7 +846,7 @@ const OwnerPickerFieldExtension = scaffolderPlugin.provide(createScaffolderField
|
|
|
839
846
|
}));
|
|
840
847
|
const ScaffolderPage = scaffolderPlugin.provide(createRoutableExtension({
|
|
841
848
|
name: "ScaffolderPage",
|
|
842
|
-
component: () => import('./Router-
|
|
849
|
+
component: () => import('./Router-8305dc47.esm.js').then((m) => m.Router),
|
|
843
850
|
mountPoint: rootRouteRef
|
|
844
851
|
}));
|
|
845
852
|
const OwnedEntityPickerFieldExtension = scaffolderPlugin.provide(createScaffolderFieldExtension({
|
|
@@ -850,6 +857,11 @@ const EntityTagsPickerFieldExtension = scaffolderPlugin.provide(createScaffolder
|
|
|
850
857
|
component: EntityTagsPicker,
|
|
851
858
|
name: "EntityTagsPicker"
|
|
852
859
|
}));
|
|
860
|
+
const NextScaffolderPage = scaffolderPlugin.provide(createRoutableExtension({
|
|
861
|
+
name: "NextScaffolderPage",
|
|
862
|
+
component: () => import('./index-bd4ce41a.esm.js').then((m) => m.Router),
|
|
863
|
+
mountPoint: rootRouteRef
|
|
864
|
+
}));
|
|
853
865
|
|
|
854
866
|
const icon = /* @__PURE__ */ React.createElement(CheckBoxOutlineBlankIcon, {
|
|
855
867
|
fontSize: "small"
|
|
@@ -1287,5 +1299,5 @@ const TaskPage = ({ loadingText }) => {
|
|
|
1287
1299
|
})))))));
|
|
1288
1300
|
};
|
|
1289
1301
|
|
|
1290
|
-
export { EntityPicker as E, FIELD_EXTENSION_WRAPPER_KEY as F, OwnerPicker as O, RepoUrlPicker as R, SecretsContext as S, TemplateTypePicker as T,
|
|
1291
|
-
//# sourceMappingURL=index-
|
|
1302
|
+
export { useTemplateSecrets as A, EntityPicker as E, FIELD_EXTENSION_WRAPPER_KEY as F, NextScaffolderPage as N, OwnerPicker as O, RepoUrlPicker as R, SecretsContext as S, TemplateTypePicker as T, registerComponentRouteRef as a, scaffolderApiRef as b, scaffolderTaskRouteRef as c, FIELD_EXTENSION_KEY as d, SecretsContextProvider as e, actionsRouteRef as f, editRouteRef as g, TaskPage as h, EntityNamePicker as i, entityNamePickerValidation as j, EntityTagsPicker as k, repoPickerValidation as l, OwnedEntityPicker as m, ScaffolderClient as n, createScaffolderFieldExtension as o, ScaffolderFieldExtensions as p, EntityPickerFieldExtension as q, rootRouteRef as r, selectedTemplateRouteRef as s, EntityNamePickerFieldExtension as t, EntityTagsPickerFieldExtension as u, OwnerPickerFieldExtension as v, OwnedEntityPickerFieldExtension as w, RepoUrlPickerFieldExtension as x, ScaffolderPage as y, scaffolderPlugin as z };
|
|
1303
|
+
//# sourceMappingURL=index-e7455fc8.esm.js.map
|