@backstage/plugin-scaffolder 1.26.0-next.0 → 1.26.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/alpha/package.json +1 -1
- package/dist/alpha/components/TemplateEditorPage/TemplateEditorIntro.esm.js +106 -88
- package/dist/alpha/components/TemplateEditorPage/TemplateEditorIntro.esm.js.map +1 -1
- package/dist/alpha/components/TemplateEditorPage/TemplateEditorPage.esm.js +4 -12
- package/dist/alpha/components/TemplateEditorPage/TemplateEditorPage.esm.js.map +1 -1
- package/dist/alpha/components/TemplateListPage/RegisterExistingButton.esm.js +1 -1
- package/dist/alpha/components/TemplateListPage/RegisterExistingButton.esm.js.map +1 -1
- package/dist/alpha.d.ts +2 -2
- package/dist/api.esm.js +5 -3
- package/dist/api.esm.js.map +1 -1
- package/dist/components/ListTasksPage/ListTasksPage.esm.js +17 -3
- package/dist/components/ListTasksPage/ListTasksPage.esm.js.map +1 -1
- package/dist/components/fields/EntityPicker/EntityPicker.esm.js +1 -1
- package/dist/components/fields/EntityPicker/EntityPicker.esm.js.map +1 -1
- package/dist/components/fields/MultiEntityPicker/MultiEntityPicker.esm.js +1 -0
- package/dist/components/fields/MultiEntityPicker/MultiEntityPicker.esm.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/translation.esm.js +2 -2
- package/dist/translation.esm.js.map +1 -1
- package/package.json +32 -23
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# @backstage/plugin-scaffolder
|
|
2
2
|
|
|
3
|
+
## 1.26.0-next.1
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- c433ae9: Improved the layout of the manage templates page (`/edit`) by adding icons and descriptions that better describe what each page is for. Updated the header menu to link back to the scaffolder create page.
|
|
8
|
+
- 7bfaf23: Text field content of the `EntityPicker` is now more readable as it uses entity title instead of entity reference.
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- f6c15d8: Apply `defaultValue` props in `MultiEntityPicker`
|
|
13
|
+
- e969dc7: Move `@types/react` to a peer dependency.
|
|
14
|
+
- 785d68f: Add support for pagination in scaffolder tasks list
|
|
15
|
+
- 94a7bcd: Change "Register Existing Component" CTA to outlined as it's not a primary action on the scaffolder pages
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
- @backstage/core-components@0.15.1-next.1
|
|
18
|
+
- @backstage/frontend-plugin-api@0.9.0-next.1
|
|
19
|
+
- @backstage/integration-react@1.2.0-next.1
|
|
20
|
+
- @backstage/core-compat-api@0.3.1-next.1
|
|
21
|
+
- @backstage/core-plugin-api@1.10.0-next.1
|
|
22
|
+
- @backstage/plugin-permission-react@0.4.27-next.1
|
|
23
|
+
- @backstage/plugin-scaffolder-react@1.13.0-next.1
|
|
24
|
+
- @backstage/plugin-catalog-react@1.14.0-next.1
|
|
25
|
+
- @backstage/integration@1.15.1-next.0
|
|
26
|
+
- @backstage/catalog-client@1.7.0
|
|
27
|
+
- @backstage/catalog-model@1.7.0
|
|
28
|
+
- @backstage/errors@1.2.4
|
|
29
|
+
- @backstage/types@1.1.1
|
|
30
|
+
- @backstage/plugin-catalog-common@1.1.0
|
|
31
|
+
- @backstage/plugin-scaffolder-common@1.5.6
|
|
32
|
+
|
|
3
33
|
## 1.26.0-next.0
|
|
4
34
|
|
|
5
35
|
### Minor Changes
|
package/alpha/package.json
CHANGED
|
@@ -2,60 +2,69 @@ import React from 'react';
|
|
|
2
2
|
import Card from '@material-ui/core/Card';
|
|
3
3
|
import CardActionArea from '@material-ui/core/CardActionArea';
|
|
4
4
|
import CardContent from '@material-ui/core/CardContent';
|
|
5
|
-
import Tooltip from '@material-ui/core/Tooltip';
|
|
6
5
|
import Typography from '@material-ui/core/Typography';
|
|
7
|
-
import InfoOutlinedIcon from '@material-ui/icons/InfoOutlined';
|
|
8
6
|
import { makeStyles } from '@material-ui/core/styles';
|
|
9
7
|
import { WebFileSystemAccess } from '../../../lib/filesystem/WebFileSystemAccess.esm.js';
|
|
10
8
|
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
11
9
|
import { scaffolderTranslationRef } from '../../../translation.esm.js';
|
|
10
|
+
import CreateNewFolderIcon from '@material-ui/icons/CreateNewFolder';
|
|
11
|
+
import ListAltIcon from '@material-ui/icons/ListAlt';
|
|
12
|
+
import FormatListBulletedIcon from '@material-ui/icons/FormatListBulleted';
|
|
13
|
+
import InfoOutlinedIcon from '@material-ui/icons/InfoOutlined';
|
|
14
|
+
import CardMedia from '@material-ui/core/CardMedia';
|
|
15
|
+
import PublishIcon from '@material-ui/icons/Publish';
|
|
16
|
+
import Tooltip from '@material-ui/core/Tooltip';
|
|
12
17
|
|
|
13
18
|
const useStyles = makeStyles((theme) => ({
|
|
19
|
+
gridRoot: {
|
|
20
|
+
display: "flex",
|
|
21
|
+
flex: 1,
|
|
22
|
+
alignItems: "center",
|
|
23
|
+
justifyContent: "center"
|
|
24
|
+
},
|
|
25
|
+
cardGrid: {
|
|
26
|
+
display: "grid",
|
|
27
|
+
maxWidth: 1e3,
|
|
28
|
+
gridTemplateColumns: "1fr 1fr",
|
|
29
|
+
gridAutoRows: "1fr 1fr",
|
|
30
|
+
gap: "1rem",
|
|
31
|
+
[theme.breakpoints.down("sm")]: {
|
|
32
|
+
gridAutoFlow: "row"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
card: {
|
|
36
|
+
display: "grid",
|
|
37
|
+
gridTemplateColumns: "auto 1fr",
|
|
38
|
+
gridTemplateRows: "1fr",
|
|
39
|
+
alignItems: "center",
|
|
40
|
+
margin: theme.spacing(0, 1),
|
|
41
|
+
marginTop: theme.spacing(2),
|
|
42
|
+
padding: theme.spacing(2)
|
|
43
|
+
},
|
|
44
|
+
icon: {
|
|
45
|
+
justifySelf: "center",
|
|
46
|
+
paddingTop: theme.spacing(1),
|
|
47
|
+
fontSize: 48
|
|
48
|
+
},
|
|
14
49
|
introText: {
|
|
15
50
|
textAlign: "center",
|
|
16
51
|
marginTop: theme.spacing(2)
|
|
17
52
|
},
|
|
18
|
-
card: {
|
|
19
|
-
position: "relative",
|
|
20
|
-
maxWidth: 340,
|
|
21
|
-
marginTop: theme.spacing(4),
|
|
22
|
-
margin: theme.spacing(0, 2)
|
|
23
|
-
},
|
|
24
53
|
infoIcon: {
|
|
25
54
|
position: "absolute",
|
|
26
55
|
top: theme.spacing(1),
|
|
27
56
|
right: theme.spacing(1)
|
|
57
|
+
},
|
|
58
|
+
cardContent: {
|
|
59
|
+
padding: theme.spacing(1)
|
|
28
60
|
}
|
|
29
61
|
}));
|
|
30
|
-
function
|
|
31
|
-
const
|
|
32
|
-
const supportsLoad = WebFileSystemAccess.isSupported();
|
|
62
|
+
function ActionCard(props) {
|
|
63
|
+
const supportsLoad = props.requireLoad ? WebFileSystemAccess.isSupported() : true;
|
|
33
64
|
const { t } = useTranslationRef(scaffolderTranslationRef);
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
disabled: !supportsLoad,
|
|
38
|
-
onClick: () => props.onSelect?.("local")
|
|
39
|
-
},
|
|
40
|
-
/* @__PURE__ */ React.createElement(CardContent, null, /* @__PURE__ */ React.createElement(
|
|
41
|
-
Typography,
|
|
42
|
-
{
|
|
43
|
-
variant: "h4",
|
|
44
|
-
component: "h3",
|
|
45
|
-
gutterBottom: true,
|
|
46
|
-
color: supportsLoad ? void 0 : "textSecondary",
|
|
47
|
-
style: { display: "flex", flexFlow: "row nowrap" }
|
|
48
|
-
},
|
|
49
|
-
t("templateEditorPage.templateEditorIntro.loadLocal.title")
|
|
50
|
-
), /* @__PURE__ */ React.createElement(
|
|
51
|
-
Typography,
|
|
52
|
-
{
|
|
53
|
-
variant: "body1",
|
|
54
|
-
color: supportsLoad ? void 0 : "textSecondary"
|
|
55
|
-
},
|
|
56
|
-
t("templateEditorPage.templateEditorIntro.loadLocal.description")
|
|
57
|
-
))
|
|
58
|
-
), !supportsLoad && /* @__PURE__ */ React.createElement("div", { className: classes.infoIcon }, /* @__PURE__ */ React.createElement(
|
|
65
|
+
const classes = useStyles();
|
|
66
|
+
const { Icon, title, description, action } = props;
|
|
67
|
+
return /* @__PURE__ */ React.createElement(Card, { className: classes.card }, !supportsLoad && /* @__PURE__ */ React.createElement(
|
|
59
68
|
Tooltip,
|
|
60
69
|
{
|
|
61
70
|
placement: "top",
|
|
@@ -64,64 +73,73 @@ function TemplateEditorIntro(props) {
|
|
|
64
73
|
)
|
|
65
74
|
},
|
|
66
75
|
/* @__PURE__ */ React.createElement(InfoOutlinedIcon, null)
|
|
67
|
-
)
|
|
68
|
-
|
|
69
|
-
|
|
76
|
+
), /* @__PURE__ */ React.createElement(CardActionArea, { onClick: action }, /* @__PURE__ */ React.createElement(CardMedia, null, /* @__PURE__ */ React.createElement(
|
|
77
|
+
Icon,
|
|
78
|
+
{
|
|
79
|
+
className: classes.icon,
|
|
80
|
+
color: supportsLoad ? void 0 : "disabled"
|
|
81
|
+
}
|
|
82
|
+
)), /* @__PURE__ */ React.createElement(CardContent, { className: classes.cardContent }, /* @__PURE__ */ React.createElement(
|
|
83
|
+
Typography,
|
|
70
84
|
{
|
|
71
|
-
|
|
72
|
-
|
|
85
|
+
gutterBottom: true,
|
|
86
|
+
variant: "h5",
|
|
87
|
+
component: "h2",
|
|
88
|
+
color: supportsLoad ? void 0 : "textSecondary"
|
|
73
89
|
},
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
t("templateEditorPage.templateEditorIntro.
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
title
|
|
91
|
+
), /* @__PURE__ */ React.createElement(Typography, { variant: "body2", color: "textSecondary", component: "p" }, description))));
|
|
92
|
+
}
|
|
93
|
+
function TemplateEditorIntro(props) {
|
|
94
|
+
const classes = useStyles();
|
|
95
|
+
const { t } = useTranslationRef(scaffolderTranslationRef);
|
|
96
|
+
return /* @__PURE__ */ React.createElement("div", { style: props.style }, /* @__PURE__ */ React.createElement(Typography, { variant: "h4", component: "h2", className: classes.introText }, t("templateEditorPage.templateEditorIntro.title")), /* @__PURE__ */ React.createElement("div", { className: classes.gridRoot }, /* @__PURE__ */ React.createElement("div", { className: classes.cardGrid }, /* @__PURE__ */ React.createElement(
|
|
97
|
+
ActionCard,
|
|
98
|
+
{
|
|
99
|
+
title: t("templateEditorPage.templateEditorIntro.loadLocal.title"),
|
|
100
|
+
description: t(
|
|
101
|
+
"templateEditorPage.templateEditorIntro.loadLocal.description"
|
|
102
|
+
),
|
|
103
|
+
requireLoad: true,
|
|
104
|
+
Icon: PublishIcon,
|
|
105
|
+
action: () => props.onSelect?.("local")
|
|
106
|
+
}
|
|
107
|
+
), /* @__PURE__ */ React.createElement(
|
|
108
|
+
ActionCard,
|
|
109
|
+
{
|
|
110
|
+
title: t(
|
|
111
|
+
"templateEditorPage.templateEditorIntro.createLocal.title"
|
|
112
|
+
),
|
|
113
|
+
description: t(
|
|
91
114
|
"templateEditorPage.templateEditorIntro.createLocal.description"
|
|
92
|
-
)
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
115
|
+
),
|
|
116
|
+
requireLoad: true,
|
|
117
|
+
action: () => props.onSelect?.("create-template"),
|
|
118
|
+
Icon: CreateNewFolderIcon
|
|
119
|
+
}
|
|
120
|
+
), /* @__PURE__ */ React.createElement(
|
|
121
|
+
ActionCard,
|
|
96
122
|
{
|
|
97
|
-
placement: "top",
|
|
98
123
|
title: t(
|
|
99
|
-
"templateEditorPage.templateEditorIntro.
|
|
100
|
-
)
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
)
|
|
108
|
-
|
|
109
|
-
"div",
|
|
124
|
+
"templateEditorPage.templateEditorIntro.fieldExplorer.title"
|
|
125
|
+
),
|
|
126
|
+
description: t(
|
|
127
|
+
"templateEditorPage.templateEditorIntro.fieldExplorer.description"
|
|
128
|
+
),
|
|
129
|
+
Icon: FormatListBulletedIcon,
|
|
130
|
+
action: () => props.onSelect?.("field-explorer")
|
|
131
|
+
}
|
|
132
|
+
), /* @__PURE__ */ React.createElement(
|
|
133
|
+
ActionCard,
|
|
110
134
|
{
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
supportsLoad && cardLoadLocal,
|
|
120
|
-
supportsLoad && cardCreateLocal,
|
|
121
|
-
cardFormEditor,
|
|
122
|
-
!supportsLoad && cardLoadLocal,
|
|
123
|
-
cardFieldExplorer
|
|
124
|
-
));
|
|
135
|
+
title: t("templateEditorPage.templateEditorIntro.formEditor.title"),
|
|
136
|
+
description: t(
|
|
137
|
+
"templateEditorPage.templateEditorIntro.formEditor.description"
|
|
138
|
+
),
|
|
139
|
+
Icon: ListAltIcon,
|
|
140
|
+
action: () => props.onSelect?.("form")
|
|
141
|
+
}
|
|
142
|
+
))));
|
|
125
143
|
}
|
|
126
144
|
|
|
127
145
|
export { TemplateEditorIntro };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TemplateEditorIntro.esm.js","sources":["../../../../src/alpha/components/TemplateEditorPage/TemplateEditorIntro.tsx"],"sourcesContent":["/*\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 Card from '@material-ui/core/Card';\nimport CardActionArea from '@material-ui/core/CardActionArea';\nimport CardContent from '@material-ui/core/CardContent';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport Typography from '@material-ui/core/Typography';\nimport InfoOutlinedIcon from '@material-ui/icons/InfoOutlined';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { WebFileSystemAccess } from '../../../lib/filesystem';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { scaffolderTranslationRef } from '../../../translation';\n\nconst useStyles = makeStyles(theme => ({\n introText: {\n textAlign: 'center',\n marginTop: theme.spacing(2),\n },\n card: {\n position: 'relative',\n maxWidth: 340,\n marginTop: theme.spacing(4),\n margin: theme.spacing(0, 2),\n },\n infoIcon: {\n position: 'absolute',\n top: theme.spacing(1),\n right: theme.spacing(1),\n },\n}));\n\ninterface EditorIntroProps {\n style?: JSX.IntrinsicElements['div']['style'];\n onSelect?: (\n option: 'create-template' | 'local' | 'form' | 'field-explorer',\n ) => void;\n}\n\nexport function TemplateEditorIntro(props: EditorIntroProps) {\n const classes = useStyles();\n const supportsLoad = WebFileSystemAccess.isSupported();\n const { t } = useTranslationRef(scaffolderTranslationRef);\n\n const cardLoadLocal = (\n <Card className={classes.card} elevation={4}>\n <CardActionArea\n disabled={!supportsLoad}\n onClick={() => props.onSelect?.('local')}\n >\n <CardContent>\n <Typography\n variant=\"h4\"\n component=\"h3\"\n gutterBottom\n color={supportsLoad ? undefined : 'textSecondary'}\n style={{ display: 'flex', flexFlow: 'row nowrap' }}\n >\n {t('templateEditorPage.templateEditorIntro.loadLocal.title')}\n </Typography>\n <Typography\n variant=\"body1\"\n color={supportsLoad ? undefined : 'textSecondary'}\n >\n {t('templateEditorPage.templateEditorIntro.loadLocal.description')}\n </Typography>\n </CardContent>\n </CardActionArea>\n {!supportsLoad && (\n <div className={classes.infoIcon}>\n <Tooltip\n placement=\"top\"\n title={t(\n 'templateEditorPage.templateEditorIntro.loadLocal.unsupportedTooltip',\n )}\n >\n <InfoOutlinedIcon />\n </Tooltip>\n </div>\n )}\n </Card>\n );\n\n const cardCreateLocal = (\n <Card className={classes.card} elevation={4}>\n <CardActionArea\n disabled={!supportsLoad}\n onClick={() => props.onSelect?.('create-template')}\n >\n <CardContent>\n <Typography\n variant=\"h4\"\n component=\"h3\"\n gutterBottom\n color={supportsLoad ? undefined : 'textSecondary'}\n style={{ display: 'flex', flexFlow: 'row nowrap' }}\n >\n {t('templateEditorPage.templateEditorIntro.createLocal.title')}\n </Typography>\n <Typography\n variant=\"body1\"\n color={supportsLoad ? undefined : 'textSecondary'}\n >\n {t(\n 'templateEditorPage.templateEditorIntro.createLocal.description',\n )}\n </Typography>\n </CardContent>\n </CardActionArea>\n {!supportsLoad && (\n <div className={classes.infoIcon}>\n <Tooltip\n placement=\"top\"\n title={t(\n 'templateEditorPage.templateEditorIntro.createLocal.unsupportedTooltip',\n )}\n >\n <InfoOutlinedIcon />\n </Tooltip>\n </div>\n )}\n </Card>\n );\n\n const cardFormEditor = (\n <Card className={classes.card} elevation={4}>\n <CardActionArea onClick={() => props.onSelect?.('form')}>\n <CardContent>\n <Typography variant=\"h4\" component=\"h3\" gutterBottom>\n {t('templateEditorPage.templateEditorIntro.formEditor.title')}\n </Typography>\n <Typography variant=\"body1\">\n {t('templateEditorPage.templateEditorIntro.formEditor.description')}\n </Typography>\n </CardContent>\n </CardActionArea>\n </Card>\n );\n\n const cardFieldExplorer = (\n <Card className={classes.card} elevation={4}>\n <CardActionArea onClick={() => props.onSelect?.('field-explorer')}>\n <CardContent>\n <Typography variant=\"h4\" component=\"h3\" gutterBottom>\n {t('templateEditorPage.templateEditorIntro.fieldExplorer.title')}\n </Typography>\n <Typography variant=\"body1\">\n {t(\n 'templateEditorPage.templateEditorIntro.fieldExplorer.description',\n )}\n </Typography>\n </CardContent>\n </CardActionArea>\n </Card>\n );\n\n return (\n <div style={props.style}>\n <Typography variant=\"h4\" component=\"h2\" className={classes.introText}>\n {t('templateEditorPage.templateEditorIntro.title')}\n </Typography>\n <div\n style={{\n display: 'flex',\n flexFlow: 'row wrap',\n alignItems: 'flex-start',\n justifyContent: 'center',\n alignContent: 'flex-start',\n }}\n >\n {supportsLoad && cardLoadLocal}\n {supportsLoad && cardCreateLocal}\n {cardFormEditor}\n {!supportsLoad && cardLoadLocal}\n {cardFieldExplorer}\n </div>\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AA4BA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,SAAW,EAAA;AAAA,IACT,SAAW,EAAA,QAAA;AAAA,IACX,SAAA,EAAW,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,GAC5B;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,QAAU,EAAA,UAAA;AAAA,IACV,QAAU,EAAA,GAAA;AAAA,IACV,SAAA,EAAW,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IAC1B,MAAQ,EAAA,KAAA,CAAM,OAAQ,CAAA,CAAA,EAAG,CAAC,CAAA;AAAA,GAC5B;AAAA,EACA,QAAU,EAAA;AAAA,IACR,QAAU,EAAA,UAAA;AAAA,IACV,GAAA,EAAK,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IACpB,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,GACxB;AACF,CAAE,CAAA,CAAA,CAAA;AASK,SAAS,oBAAoB,KAAyB,EAAA;AAC3D,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAC1B,EAAM,MAAA,YAAA,GAAe,oBAAoB,WAAY,EAAA,CAAA;AACrD,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,wBAAwB,CAAA,CAAA;AAExD,EAAA,MAAM,gCACH,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,WAAW,OAAQ,CAAA,IAAA,EAAM,WAAW,CACxC,EAAA,kBAAA,KAAA,CAAA,a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AAAA,OAChB;AAAA,KAAA;AAAA,IAEC,YAAgB,IAAA,aAAA;AAAA,IAChB,YAAgB,IAAA,eAAA;AAAA,IAChB,cAAA;AAAA,IACA,CAAC,YAAgB,IAAA,aAAA;AAAA,IACjB,iBAAA;AAAA,GAEL,CAAA,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"TemplateEditorIntro.esm.js","sources":["../../../../src/alpha/components/TemplateEditorPage/TemplateEditorIntro.tsx"],"sourcesContent":["/*\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 Card from '@material-ui/core/Card';\nimport CardActionArea from '@material-ui/core/CardActionArea';\nimport CardContent from '@material-ui/core/CardContent';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { WebFileSystemAccess } from '../../../lib/filesystem';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { scaffolderTranslationRef } from '../../../translation';\nimport CreateNewFolderIcon from '@material-ui/icons/CreateNewFolder';\nimport ListAltIcon from '@material-ui/icons/ListAlt';\nimport FormatListBulletedIcon from '@material-ui/icons/FormatListBulleted';\nimport InfoOutlinedIcon from '@material-ui/icons/InfoOutlined';\nimport CardMedia from '@material-ui/core/CardMedia';\nimport PublishIcon from '@material-ui/icons/Publish';\nimport SvgIcon from '@material-ui/core/SvgIcon';\nimport Tooltip from '@material-ui/core/Tooltip';\n\nconst useStyles = makeStyles(theme => ({\n gridRoot: {\n display: 'flex',\n flex: 1,\n alignItems: 'center',\n justifyContent: 'center',\n },\n cardGrid: {\n display: 'grid',\n maxWidth: 1000,\n gridTemplateColumns: '1fr 1fr',\n gridAutoRows: '1fr 1fr',\n gap: '1rem',\n [theme.breakpoints.down('sm')]: {\n gridAutoFlow: 'row',\n },\n },\n card: {\n display: 'grid',\n gridTemplateColumns: 'auto 1fr',\n gridTemplateRows: '1fr',\n alignItems: 'center',\n margin: theme.spacing(0, 1),\n marginTop: theme.spacing(2),\n padding: theme.spacing(2),\n },\n icon: {\n justifySelf: 'center',\n paddingTop: theme.spacing(1),\n fontSize: 48,\n },\n introText: {\n textAlign: 'center',\n marginTop: theme.spacing(2),\n },\n infoIcon: {\n position: 'absolute',\n top: theme.spacing(1),\n right: theme.spacing(1),\n },\n cardContent: {\n padding: theme.spacing(1),\n },\n}));\n\ninterface EditorIntroProps {\n style?: JSX.IntrinsicElements['div']['style'];\n onSelect?: (\n option: 'create-template' | 'local' | 'form' | 'field-explorer',\n ) => void;\n}\n\nfunction ActionCard(props: {\n title: string;\n description: string;\n Icon: typeof SvgIcon;\n action?: React.MouseEventHandler;\n requireLoad?: boolean;\n}) {\n const supportsLoad = props.requireLoad\n ? WebFileSystemAccess.isSupported()\n : true;\n const { t } = useTranslationRef(scaffolderTranslationRef);\n\n const classes = useStyles();\n const { Icon, title, description, action } = props;\n return (\n <Card className={classes.card}>\n {!supportsLoad && (\n <Tooltip\n placement=\"top\"\n title={t(\n 'templateEditorPage.templateEditorIntro.loadLocal.unsupportedTooltip',\n )}\n >\n <InfoOutlinedIcon />\n </Tooltip>\n )}\n\n <CardActionArea onClick={action}>\n <CardMedia>\n <Icon\n className={classes.icon}\n color={supportsLoad ? undefined : 'disabled'}\n />\n </CardMedia>\n <CardContent className={classes.cardContent}>\n <Typography\n gutterBottom\n variant=\"h5\"\n component=\"h2\"\n color={supportsLoad ? undefined : 'textSecondary'}\n >\n {title}\n </Typography>\n <Typography variant=\"body2\" color=\"textSecondary\" component=\"p\">\n {description}\n </Typography>\n </CardContent>\n </CardActionArea>\n </Card>\n );\n}\nexport function TemplateEditorIntro(props: EditorIntroProps) {\n const classes = useStyles();\n const { t } = useTranslationRef(scaffolderTranslationRef);\n\n return (\n <div style={props.style}>\n <Typography variant=\"h4\" component=\"h2\" className={classes.introText}>\n {t('templateEditorPage.templateEditorIntro.title')}\n </Typography>\n <div className={classes.gridRoot}>\n <div className={classes.cardGrid}>\n <ActionCard\n title={t('templateEditorPage.templateEditorIntro.loadLocal.title')}\n description={t(\n 'templateEditorPage.templateEditorIntro.loadLocal.description',\n )}\n requireLoad\n Icon={PublishIcon}\n action={() => props.onSelect?.('local')}\n />\n <ActionCard\n title={t(\n 'templateEditorPage.templateEditorIntro.createLocal.title',\n )}\n description={t(\n 'templateEditorPage.templateEditorIntro.createLocal.description',\n )}\n requireLoad\n action={() => props.onSelect?.('create-template')}\n Icon={CreateNewFolderIcon}\n />\n\n <ActionCard\n title={t(\n 'templateEditorPage.templateEditorIntro.fieldExplorer.title',\n )}\n description={t(\n 'templateEditorPage.templateEditorIntro.fieldExplorer.description',\n )}\n Icon={FormatListBulletedIcon}\n action={() => props.onSelect?.('field-explorer')}\n />\n\n <ActionCard\n title={t('templateEditorPage.templateEditorIntro.formEditor.title')}\n description={t(\n 'templateEditorPage.templateEditorIntro.formEditor.description',\n )}\n Icon={ListAltIcon}\n action={() => props.onSelect?.('form')}\n />\n </div>\n </div>\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAkCA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,QAAU,EAAA;AAAA,IACR,OAAS,EAAA,MAAA;AAAA,IACT,IAAM,EAAA,CAAA;AAAA,IACN,UAAY,EAAA,QAAA;AAAA,IACZ,cAAgB,EAAA,QAAA;AAAA,GAClB;AAAA,EACA,QAAU,EAAA;AAAA,IACR,OAAS,EAAA,MAAA;AAAA,IACT,QAAU,EAAA,GAAA;AAAA,IACV,mBAAqB,EAAA,SAAA;AAAA,IACrB,YAAc,EAAA,SAAA;AAAA,IACd,GAAK,E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GAGR,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,KAAO,EAAA,CAAA;AAAA,QACL,4DAAA;AAAA,OACF;AAAA,MACA,WAAa,EAAA,CAAA;AAAA,QACX,kEAAA;AAAA,OACF;AAAA,MACA,IAAM,EAAA,sBAAA;AAAA,MACN,MAAQ,EAAA,MAAM,KAAM,CAAA,QAAA,GAAW,gBAAgB,CAAA;AAAA,KAAA;AAAA,GAGjD,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,EAAE,yDAAyD,CAAA;AAAA,MAClE,WAAa,EAAA,CAAA;AAAA,QACX,+DAAA;AAAA,OACF;AAAA,MACA,IAAM,EAAA,WAAA;AAAA,MACN,MAAQ,EAAA,MAAM,KAAM,CAAA,QAAA,GAAW,MAAM,CAAA;AAAA,KAAA;AAAA,GAEzC,CACF,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -2,36 +2,28 @@ import React from 'react';
|
|
|
2
2
|
import { Page, Header, Content } from '@backstage/core-components';
|
|
3
3
|
import { WebFileSystemAccess, WebFileSystemStore } from '../../../lib/filesystem/WebFileSystemAccess.esm.js';
|
|
4
4
|
import { TemplateEditorIntro } from './TemplateEditorIntro.esm.js';
|
|
5
|
-
import { ScaffolderPageContextMenu } from '@backstage/plugin-scaffolder-react/alpha';
|
|
6
5
|
import { useNavigate } from 'react-router-dom';
|
|
7
6
|
import { useRouteRef } from '@backstage/core-plugin-api';
|
|
8
|
-
import {
|
|
7
|
+
import { rootRouteRef, editorRouteRef, customFieldsRouteRef, templateFormRouteRef } from '../../../routes.esm.js';
|
|
9
8
|
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
10
9
|
import { scaffolderTranslationRef } from '../../../translation.esm.js';
|
|
11
10
|
import { createExampleTemplate } from '../../../lib/filesystem/createExampleTemplate.esm.js';
|
|
12
11
|
|
|
13
12
|
function TemplateEditorPage() {
|
|
14
13
|
const navigate = useNavigate();
|
|
15
|
-
const actionsLink = useRouteRef(actionsRouteRef);
|
|
16
|
-
const tasksLink = useRouteRef(scaffolderListTaskRouteRef);
|
|
17
14
|
const createLink = useRouteRef(rootRouteRef);
|
|
18
15
|
const editorLink = useRouteRef(editorRouteRef);
|
|
19
16
|
const customFieldsLink = useRouteRef(customFieldsRouteRef);
|
|
20
17
|
const templateFormLink = useRouteRef(templateFormRouteRef);
|
|
21
18
|
const { t } = useTranslationRef(scaffolderTranslationRef);
|
|
22
|
-
const scaffolderPageContextMenuProps = {
|
|
23
|
-
onEditorClicked: void 0,
|
|
24
|
-
onActionsClicked: () => navigate(actionsLink()),
|
|
25
|
-
onTasksClicked: () => navigate(tasksLink()),
|
|
26
|
-
onCreateClicked: () => navigate(createLink())
|
|
27
|
-
};
|
|
28
19
|
return /* @__PURE__ */ React.createElement(Page, { themeId: "home" }, /* @__PURE__ */ React.createElement(
|
|
29
20
|
Header,
|
|
30
21
|
{
|
|
31
22
|
title: t("templateEditorPage.title"),
|
|
23
|
+
type: "Scaffolder",
|
|
24
|
+
typeLink: createLink(),
|
|
32
25
|
subtitle: t("templateEditorPage.subtitle")
|
|
33
|
-
}
|
|
34
|
-
/* @__PURE__ */ React.createElement(ScaffolderPageContextMenu, { ...scaffolderPageContextMenuProps })
|
|
26
|
+
}
|
|
35
27
|
), /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(
|
|
36
28
|
TemplateEditorIntro,
|
|
37
29
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TemplateEditorPage.esm.js","sources":["../../../../src/alpha/components/TemplateEditorPage/TemplateEditorPage.tsx"],"sourcesContent":["/*\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 { Content, Header, Page } from '@backstage/core-components';\n\nimport { WebFileSystemAccess } from '../../../lib/filesystem';\n\nimport { TemplateEditorIntro } from './TemplateEditorIntro';\nimport {
|
|
1
|
+
{"version":3,"file":"TemplateEditorPage.esm.js","sources":["../../../../src/alpha/components/TemplateEditorPage/TemplateEditorPage.tsx"],"sourcesContent":["/*\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 { Content, Header, Page } from '@backstage/core-components';\n\nimport { WebFileSystemAccess } from '../../../lib/filesystem';\n\nimport { TemplateEditorIntro } from './TemplateEditorIntro';\nimport { useNavigate } from 'react-router-dom';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport {\n editorRouteRef,\n customFieldsRouteRef,\n rootRouteRef,\n templateFormRouteRef,\n} from '../../../routes';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { scaffolderTranslationRef } from '../../../translation';\nimport { WebFileSystemStore } from '../../../lib/filesystem/WebFileSystemAccess';\nimport { createExampleTemplate } from '../../../lib/filesystem/createExampleTemplate';\n\nexport function TemplateEditorPage() {\n const navigate = useNavigate();\n const createLink = useRouteRef(rootRouteRef);\n const editorLink = useRouteRef(editorRouteRef);\n const customFieldsLink = useRouteRef(customFieldsRouteRef);\n const templateFormLink = useRouteRef(templateFormRouteRef);\n const { t } = useTranslationRef(scaffolderTranslationRef);\n\n return (\n <Page themeId=\"home\">\n <Header\n title={t('templateEditorPage.title')}\n type=\"Scaffolder\"\n typeLink={createLink()}\n subtitle={t('templateEditorPage.subtitle')}\n />\n <Content>\n <TemplateEditorIntro\n onSelect={option => {\n if (option === 'local') {\n WebFileSystemAccess.requestDirectoryAccess()\n .then(directory => WebFileSystemStore.setDirectory(directory))\n .then(() => navigate(editorLink()))\n .catch(() => {});\n } else if (option === 'create-template') {\n WebFileSystemAccess.requestDirectoryAccess()\n .then(directory => {\n createExampleTemplate(directory).then(() => {\n WebFileSystemStore.setDirectory(directory);\n navigate(editorLink());\n });\n })\n .catch(() => {});\n } else if (option === 'form') {\n navigate(templateFormLink());\n } else if (option === 'field-explorer') {\n navigate(customFieldsLink());\n }\n }}\n />\n </Content>\n </Page>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAkCO,SAAS,kBAAqB,GAAA;AACnC,EAAA,MAAM,WAAW,WAAY,EAAA,CAAA;AAC7B,EAAM,MAAA,UAAA,GAAa,YAAY,YAAY,CAAA,CAAA;AAC3C,EAAM,MAAA,UAAA,GAAa,YAAY,cAAc,CAAA,CAAA;AAC7C,EAAM,MAAA,gBAAA,GAAmB,YAAY,oBAAoB,CAAA,CAAA;AACzD,EAAM,MAAA,gBAAA,GAAmB,YAAY,oBAAoB,CAAA,CAAA;AACzD,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,wBAAwB,CAAA,CAAA;AAExD,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,OAAA,EAAQ,MACZ,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,EAAE,0BAA0B,CAAA;AAAA,MACnC,IAAK,EAAA,YAAA;AAAA,MACL,UAAU,UAAW,EAAA;AAAA,MACrB,QAAA,EAAU,EAAE,6BAA6B,CAAA;AAAA,KAAA;AAAA,GAC3C,sCACC,OACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,mBAAA;AAAA,IAAA;AAAA,MACC,UAAU,CAAU,MAAA,KAAA;AAClB,QAAA,IAAI,WAAW,OAAS,EAAA;AACtB,UAAA,mBAAA,CAAoB,wBACjB,CAAA,IAAA,CAAK,CAAa,SAAA,KAAA,kBAAA,CAAmB,aAAa,SAAS,CAAC,CAC5D,CAAA,IAAA,CAAK,MAAM,QAAS,CAAA,UAAA,EAAY,CAAC,CAAA,CACjC,MAAM,MAAM;AAAA,WAAE,CAAA,CAAA;AAAA,SACnB,MAAA,IAAW,WAAW,iBAAmB,EAAA;AACvC,UAAoB,mBAAA,CAAA,sBAAA,EACjB,CAAA,IAAA,CAAK,CAAa,SAAA,KAAA;AACjB,YAAsB,qBAAA,CAAA,SAAS,CAAE,CAAA,IAAA,CAAK,MAAM;AAC1C,cAAA,kBAAA,CAAmB,aAAa,SAAS,CAAA,CAAA;AACzC,cAAA,QAAA,CAAS,YAAY,CAAA,CAAA;AAAA,aACtB,CAAA,CAAA;AAAA,WACF,CACA,CAAA,KAAA,CAAM,MAAM;AAAA,WAAE,CAAA,CAAA;AAAA,SACnB,MAAA,IAAW,WAAW,MAAQ,EAAA;AAC5B,UAAA,QAAA,CAAS,kBAAkB,CAAA,CAAA;AAAA,SAC7B,MAAA,IAAW,WAAW,gBAAkB,EAAA;AACtC,UAAA,QAAA,CAAS,kBAAkB,CAAA,CAAA;AAAA,SAC7B;AAAA,OACF;AAAA,KAAA;AAAA,GAEJ,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -28,7 +28,7 @@ const RegisterExistingButton = (props) => {
|
|
|
28
28
|
to
|
|
29
29
|
},
|
|
30
30
|
/* @__PURE__ */ React.createElement(CreateComponentIcon, null)
|
|
31
|
-
) : /* @__PURE__ */ React.createElement(Button, { component: Link, variant: "
|
|
31
|
+
) : /* @__PURE__ */ React.createElement(Button, { component: Link, variant: "outlined", color: "primary", to }, title);
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
export { RegisterExistingButton };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RegisterExistingButton.esm.js","sources":["../../../../src/alpha/components/TemplateListPage/RegisterExistingButton.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 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/alpha';\nimport { usePermission } from '@backstage/plugin-permission-react';\nimport { Theme } from '@material-ui/core/styles';\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<Theme>(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=\"
|
|
1
|
+
{"version":3,"file":"RegisterExistingButton.esm.js","sources":["../../../../src/alpha/components/TemplateListPage/RegisterExistingButton.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 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/alpha';\nimport { usePermission } from '@backstage/plugin-permission-react';\nimport { Theme } from '@material-ui/core/styles';\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<Theme>(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=\"outlined\" color=\"primary\" to={to}>\n {title}\n </Button>\n );\n};\n"],"names":["RouterLink","AddCircleOutline"],"mappings":";;;;;;;;;AAuCa,MAAA,sBAAA,GAAyB,CAAC,KAAuC,KAAA;AAC5E,EAAM,MAAA,EAAE,KAAO,EAAA,EAAA,EAAO,GAAA,KAAA,CAAA;AACtB,EAAM,MAAA,EAAE,OAAQ,EAAA,GAAI,aAAc,CAAA;AAAA,IAChC,UAAY,EAAA,6BAAA;AAAA,GACb,CAAA,CAAA;AACD,EAAA,MAAM,UAAa,GAAA,aAAA;AAAA,IAAqB,CACtC,KAAA,KAAA,KAAA,CAAM,WAAY,CAAA,IAAA,CAAK,IAAI,CAAA;AAAA,GAC7B,CAAA;AAEA,EAAI,IAAA,CAAC,EAAM,IAAA,CAAC,OAAS,EAAA;AACnB,IAAO,OAAA,IAAA,CAAA;AAAA,GACT;AAEA,EAAA,OAAO,UACL,mBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,SAAW,EAAAA,IAAA;AAAA,MACX,KAAM,EAAA,SAAA;AAAA,MACN,KAAA;AAAA,MACA,IAAK,EAAA,OAAA;AAAA,MACL,EAAA;AAAA,KAAA;AAAA,wCAECC,mBAAiB,EAAA,IAAA,CAAA;AAAA,GACpB,mBAEC,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EAAO,SAAW,EAAAD,IAAA,EAAY,SAAQ,UAAW,EAAA,KAAA,EAAM,SAAU,EAAA,EAAA,EAAA,EAC/D,KACH,CAAA,CAAA;AAEJ;;;;"}
|
package/dist/alpha.d.ts
CHANGED
|
@@ -158,7 +158,7 @@ declare const scaffolderTranslationRef: _backstage_core_plugin_api_alpha.Transla
|
|
|
158
158
|
readonly "templateTypePicker.title": "Categories";
|
|
159
159
|
readonly "templateFormPage.title": "Template Form Playground";
|
|
160
160
|
readonly "templateFormPage.subtitle": "Edit, preview, and try out templates and template forms";
|
|
161
|
-
readonly "templateEditorPage.title": "
|
|
161
|
+
readonly "templateEditorPage.title": "Manage Templates";
|
|
162
162
|
readonly "templateEditorPage.subtitle": "Edit, preview, and try out templates and template forms";
|
|
163
163
|
readonly "templateEditorPage.dryRunResults.title": "Dry-run results";
|
|
164
164
|
readonly "templateEditorPage.dryRunResultsList.title": "Result {{resultId}}";
|
|
@@ -184,7 +184,7 @@ declare const scaffolderTranslationRef: _backstage_core_plugin_api_alpha.Transla
|
|
|
184
184
|
readonly "templateEditorPage.templateEditorIntro.createLocal.title": "Create New Template";
|
|
185
185
|
readonly "templateEditorPage.templateEditorIntro.createLocal.description": "Create a local template directory, allowing you to both edit and try executing your own template.";
|
|
186
186
|
readonly "templateEditorPage.templateEditorIntro.createLocal.unsupportedTooltip": "Only supported in some Chromium-based browsers";
|
|
187
|
-
readonly "templateEditorPage.templateEditorIntro.formEditor.title": "
|
|
187
|
+
readonly "templateEditorPage.templateEditorIntro.formEditor.title": "Template playground";
|
|
188
188
|
readonly "templateEditorPage.templateEditorIntro.formEditor.description": "Preview and edit a template form, either using a sample template or by loading a template from the catalog.";
|
|
189
189
|
readonly "templateEditorPage.templateEditorIntro.fieldExplorer.title": "Custom Field Explorer";
|
|
190
190
|
readonly "templateEditorPage.templateEditorIntro.fieldExplorer.description": "View and play around with available installed custom field extensions.";
|
package/dist/api.esm.js
CHANGED
|
@@ -25,9 +25,11 @@ class ScaffolderClient {
|
|
|
25
25
|
}
|
|
26
26
|
const baseUrl = await this.discoveryApi.getBaseUrl("scaffolder");
|
|
27
27
|
const { userEntityRef } = await this.identityApi.getBackstageIdentity();
|
|
28
|
-
const query = qs.stringify(
|
|
29
|
-
options.filterByOwnership === "owned" ?
|
|
30
|
-
|
|
28
|
+
const query = qs.stringify({
|
|
29
|
+
createdBy: options.filterByOwnership === "owned" ? userEntityRef : void 0,
|
|
30
|
+
limit: options.limit,
|
|
31
|
+
offset: options.offset
|
|
32
|
+
});
|
|
31
33
|
const response = await this.fetchApi.fetch(`${baseUrl}/v2/tasks?${query}`);
|
|
32
34
|
if (!response.ok) {
|
|
33
35
|
throw await ResponseError.fromResponse(response);
|
package/dist/api.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.esm.js","sources":["../src/api.ts"],"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 { parseEntityRef } from '@backstage/catalog-model';\nimport {\n DiscoveryApi,\n FetchApi,\n IdentityApi,\n} from '@backstage/core-plugin-api';\nimport { ResponseError } from '@backstage/errors';\nimport { ScmIntegrationRegistry } from '@backstage/integration';\nimport { Observable } from '@backstage/types';\nimport qs from 'qs';\nimport ObservableImpl from 'zen-observable';\nimport {\n ListActionsResponse,\n LogEvent,\n ScaffolderApi,\n ScaffolderScaffoldOptions,\n ScaffolderScaffoldResponse,\n ScaffolderStreamLogsOptions,\n ScaffolderGetIntegrationsListOptions,\n ScaffolderGetIntegrationsListResponse,\n ScaffolderTask,\n ScaffolderDryRunOptions,\n ScaffolderDryRunResponse,\n TemplateParameterSchema,\n} from '@backstage/plugin-scaffolder-react';\n\nimport queryString from 'qs';\nimport {\n EventSourceMessage,\n fetchEventSource,\n} from '@microsoft/fetch-event-source';\n\n/**\n * An API to interact with the scaffolder backend.\n *\n * @public\n */\nexport class ScaffolderClient implements ScaffolderApi {\n private readonly discoveryApi: DiscoveryApi;\n private readonly scmIntegrationsApi: ScmIntegrationRegistry;\n private readonly fetchApi: FetchApi;\n private readonly identityApi?: IdentityApi;\n private readonly useLongPollingLogs: boolean;\n\n constructor(options: {\n discoveryApi: DiscoveryApi;\n fetchApi: FetchApi;\n identityApi?: IdentityApi;\n scmIntegrationsApi: ScmIntegrationRegistry;\n useLongPollingLogs?: boolean;\n }) {\n this.discoveryApi = options.discoveryApi;\n this.fetchApi = options.fetchApi ?? { fetch };\n this.scmIntegrationsApi = options.scmIntegrationsApi;\n this.useLongPollingLogs = options.useLongPollingLogs ?? false;\n this.identityApi = options.identityApi;\n }\n\n async listTasks(options: {\n filterByOwnership: 'owned' | 'all';\n }): Promise<{ tasks: ScaffolderTask[] }> {\n if (!this.identityApi) {\n throw new Error(\n 'IdentityApi is not available in the ScaffolderClient, please pass through the IdentityApi to the ScaffolderClient constructor in order to use the listTasks method',\n );\n }\n const baseUrl = await this.discoveryApi.getBaseUrl('scaffolder');\n const { userEntityRef } = await this.identityApi.getBackstageIdentity();\n\n const query = queryString.stringify(\n options.filterByOwnership === 'owned' ? { createdBy: userEntityRef } : {},\n );\n\n const response = await this.fetchApi.fetch(`${baseUrl}/v2/tasks?${query}`);\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n\n return await response.json();\n }\n\n async getIntegrationsList(\n options: ScaffolderGetIntegrationsListOptions,\n ): Promise<ScaffolderGetIntegrationsListResponse> {\n const integrations = [\n ...this.scmIntegrationsApi.azure.list(),\n ...this.scmIntegrationsApi.bitbucket\n .list()\n .filter(\n item =>\n !this.scmIntegrationsApi.bitbucketCloud.byHost(item.config.host) &&\n !this.scmIntegrationsApi.bitbucketServer.byHost(item.config.host),\n ),\n ...this.scmIntegrationsApi.bitbucketCloud.list(),\n ...this.scmIntegrationsApi.bitbucketServer.list(),\n ...this.scmIntegrationsApi.gerrit.list(),\n ...this.scmIntegrationsApi.gitea.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 return {\n integrations,\n };\n }\n\n async getTemplateParameterSchema(\n templateRef: string,\n ): Promise<TemplateParameterSchema> {\n const { namespace, kind, name } = parseEntityRef(templateRef, {\n defaultKind: 'template',\n });\n\n const baseUrl = await this.discoveryApi.getBaseUrl('scaffolder');\n const templatePath = [namespace, kind, name]\n .map(s => encodeURIComponent(s))\n .join('/');\n\n const url = `${baseUrl}/v2/templates/${templatePath}/parameter-schema`;\n\n const response = await this.fetchApi.fetch(url);\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 async scaffold(\n options: ScaffolderScaffoldOptions,\n ): Promise<ScaffolderScaffoldResponse> {\n const { templateRef, values, secrets = {} } = options;\n const url = `${await this.discoveryApi.getBaseUrl('scaffolder')}/v2/tasks`;\n const response = await this.fetchApi.fetch(url, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n templateRef,\n values: { ...values },\n secrets,\n }),\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 { taskId: id };\n }\n\n async getTask(taskId: string): Promise<ScaffolderTask> {\n const baseUrl = await this.discoveryApi.getBaseUrl('scaffolder');\n const url = `${baseUrl}/v2/tasks/${encodeURIComponent(taskId)}`;\n\n const response = await this.fetchApi.fetch(url);\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n\n return await response.json();\n }\n\n streamLogs(options: ScaffolderStreamLogsOptions): Observable<LogEvent> {\n if (this.useLongPollingLogs) {\n return this.streamLogsPolling(options);\n }\n\n return this.streamLogsEventStream(options);\n }\n\n async dryRun(\n options: ScaffolderDryRunOptions,\n ): Promise<ScaffolderDryRunResponse> {\n const baseUrl = await this.discoveryApi.getBaseUrl('scaffolder');\n const response = await this.fetchApi.fetch(`${baseUrl}/v2/dry-run`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n template: options.template,\n values: options.values,\n secrets: options.secrets,\n directoryContents: options.directoryContents,\n }),\n });\n\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n\n return response.json();\n }\n\n private streamLogsEventStream({\n isTaskRecoverable,\n taskId,\n after,\n }: ScaffolderStreamLogsOptions): 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\n const processEvent = (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\n const ctrl = new AbortController();\n void fetchEventSource(url, {\n fetch: this.fetchApi.fetch,\n signal: ctrl.signal,\n onmessage(e: EventSourceMessage) {\n if (e.event === 'log') {\n processEvent(e);\n return;\n } else if (e.event === 'completion' && !isTaskRecoverable) {\n processEvent(e);\n subscriber.complete();\n ctrl.abort();\n return;\n }\n processEvent(e);\n },\n onerror(err) {\n subscriber.error(err);\n },\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 this.fetchApi.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 async listActions(): Promise<ListActionsResponse> {\n const baseUrl = await this.discoveryApi.getBaseUrl('scaffolder');\n const response = await this.fetchApi.fetch(`${baseUrl}/v2/actions`);\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n\n return await response.json();\n }\n\n async cancelTask(taskId: string): Promise<void> {\n const baseUrl = await this.discoveryApi.getBaseUrl('scaffolder');\n const url = `${baseUrl}/v2/tasks/${encodeURIComponent(taskId)}/cancel`;\n\n const response = await this.fetchApi.fetch(url, {\n method: 'POST',\n });\n\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n\n return await response.json();\n }\n\n async retry?(taskId: string): Promise<void> {\n const baseUrl = await this.discoveryApi.getBaseUrl('scaffolder');\n const url = `${baseUrl}/v2/tasks/${encodeURIComponent(taskId)}/retry`;\n\n const response = await this.fetchApi.fetch(url, {\n method: 'POST',\n });\n\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n\n return await response.json();\n }\n\n async autocomplete({\n token,\n resource,\n provider,\n context,\n }: {\n token: string;\n provider: string;\n resource: string;\n context?: Record<string, string>;\n }): Promise<{ results: { title: string }[] }> {\n const baseUrl = await this.discoveryApi.getBaseUrl('scaffolder');\n\n const url = `${baseUrl}/v2/autocomplete/${provider}/${resource}`;\n\n const response = await this.fetchApi.fetch(url, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n token,\n context: context ?? {},\n }),\n });\n\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n\n const { results } = await response.json();\n return { results };\n }\n}\n"],"names":["queryString"],"mappings":";;;;;;AAqDO,MAAM,gBAA0C,CAAA;AAAA,EACpC,YAAA,CAAA;AAAA,EACA,kBAAA,CAAA;AAAA,EACA,QAAA,CAAA;AAAA,EACA,WAAA,CAAA;AAAA,EACA,kBAAA,CAAA;AAAA,EAEjB,YAAY,OAMT,EAAA;AACD,IAAA,IAAA,CAAK,eAAe,OAAQ,CAAA,YAAA,CAAA;AAC5B,IAAA,IAAA,CAAK,QAAW,GAAA,OAAA,CAAQ,QAAY,IAAA,EAAE,KAAM,EAAA,CAAA;AAC5C,IAAA,IAAA,CAAK,qBAAqB,OAAQ,CAAA,kBAAA,CAAA;AAClC,IAAK,IAAA,CAAA,kBAAA,GAAqB,QAAQ,kBAAsB,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A;AAAA,IACjB,KAAA;AAAA,IACA,QAAA;AAAA,IACA,QAAA;AAAA,IACA,OAAA;AAAA,GAM4C,EAAA;AAC5C,IAAA,MAAM,OAAU,GAAA,MAAM,IAAK,CAAA,YAAA,CAAa,WAAW,YAAY,CAAA,CAAA;AAE/D,IAAA,MAAM,MAAM,CAAG,EAAA,OAAO,CAAoB,iBAAA,EAAA,QAAQ,IAAI,QAAQ,CAAA,CAAA,CAAA;AAE9D,IAAA,MAAM,QAAW,GAAA,MAAM,IAAK,CAAA,QAAA,CAAS,MAAM,GAAK,EAAA;AAAA,MAC9C,MAAQ,EAAA,MAAA;AAAA,MACR,OAAS,EAAA;AAAA,QACP,cAAgB,EAAA,kBAAA;AAAA,OAClB;AAAA,MACA,IAAA,EAAM,KAAK,SAAU,CAAA;AAAA,QACnB,KAAA;AAAA,QACA,OAAA,EAAS,WAAW,EAAC;AAAA,OACtB,CAAA;AAAA,KACF,CAAA,CAAA;AAED,IAAI,IAAA,CAAC,SAAS,EAAI,EAAA;AAChB,MAAM,MAAA,MAAM,aAAc,CAAA,YAAA,CAAa,QAAQ,CAAA,CAAA;AAAA,KACjD;AAEA,IAAA,MAAM,EAAE,OAAA,EAAY,GAAA,MAAM,SAAS,IAAK,EAAA,CAAA;AACxC,IAAA,OAAO,EAAE,OAAQ,EAAA,CAAA;AAAA,GACnB;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"api.esm.js","sources":["../src/api.ts"],"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 { parseEntityRef } from '@backstage/catalog-model';\nimport {\n DiscoveryApi,\n FetchApi,\n IdentityApi,\n} from '@backstage/core-plugin-api';\nimport { ResponseError } from '@backstage/errors';\nimport { ScmIntegrationRegistry } from '@backstage/integration';\nimport { Observable } from '@backstage/types';\nimport qs from 'qs';\nimport queryString from 'qs';\nimport ObservableImpl from 'zen-observable';\nimport {\n ListActionsResponse,\n LogEvent,\n ScaffolderApi,\n ScaffolderDryRunOptions,\n ScaffolderDryRunResponse,\n ScaffolderGetIntegrationsListOptions,\n ScaffolderGetIntegrationsListResponse,\n ScaffolderScaffoldOptions,\n ScaffolderScaffoldResponse,\n ScaffolderStreamLogsOptions,\n ScaffolderTask,\n TemplateParameterSchema,\n} from '@backstage/plugin-scaffolder-react';\nimport {\n EventSourceMessage,\n fetchEventSource,\n} from '@microsoft/fetch-event-source';\n\n/**\n * An API to interact with the scaffolder backend.\n *\n * @public\n */\nexport class ScaffolderClient implements ScaffolderApi {\n private readonly discoveryApi: DiscoveryApi;\n private readonly scmIntegrationsApi: ScmIntegrationRegistry;\n private readonly fetchApi: FetchApi;\n private readonly identityApi?: IdentityApi;\n private readonly useLongPollingLogs: boolean;\n\n constructor(options: {\n discoveryApi: DiscoveryApi;\n fetchApi: FetchApi;\n identityApi?: IdentityApi;\n scmIntegrationsApi: ScmIntegrationRegistry;\n useLongPollingLogs?: boolean;\n }) {\n this.discoveryApi = options.discoveryApi;\n this.fetchApi = options.fetchApi ?? { fetch };\n this.scmIntegrationsApi = options.scmIntegrationsApi;\n this.useLongPollingLogs = options.useLongPollingLogs ?? false;\n this.identityApi = options.identityApi;\n }\n\n async listTasks(options: {\n filterByOwnership: 'owned' | 'all';\n limit?: number;\n offset?: number;\n }): Promise<{ tasks: ScaffolderTask[]; totalTasks?: number }> {\n if (!this.identityApi) {\n throw new Error(\n 'IdentityApi is not available in the ScaffolderClient, please pass through the IdentityApi to the ScaffolderClient constructor in order to use the listTasks method',\n );\n }\n const baseUrl = await this.discoveryApi.getBaseUrl('scaffolder');\n const { userEntityRef } = await this.identityApi.getBackstageIdentity();\n\n const query = queryString.stringify({\n createdBy:\n options.filterByOwnership === 'owned' ? userEntityRef : undefined,\n limit: options.limit,\n offset: options.offset,\n });\n\n const response = await this.fetchApi.fetch(`${baseUrl}/v2/tasks?${query}`);\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n\n return await response.json();\n }\n\n async getIntegrationsList(\n options: ScaffolderGetIntegrationsListOptions,\n ): Promise<ScaffolderGetIntegrationsListResponse> {\n const integrations = [\n ...this.scmIntegrationsApi.azure.list(),\n ...this.scmIntegrationsApi.bitbucket\n .list()\n .filter(\n item =>\n !this.scmIntegrationsApi.bitbucketCloud.byHost(item.config.host) &&\n !this.scmIntegrationsApi.bitbucketServer.byHost(item.config.host),\n ),\n ...this.scmIntegrationsApi.bitbucketCloud.list(),\n ...this.scmIntegrationsApi.bitbucketServer.list(),\n ...this.scmIntegrationsApi.gerrit.list(),\n ...this.scmIntegrationsApi.gitea.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 return {\n integrations,\n };\n }\n\n async getTemplateParameterSchema(\n templateRef: string,\n ): Promise<TemplateParameterSchema> {\n const { namespace, kind, name } = parseEntityRef(templateRef, {\n defaultKind: 'template',\n });\n\n const baseUrl = await this.discoveryApi.getBaseUrl('scaffolder');\n const templatePath = [namespace, kind, name]\n .map(s => encodeURIComponent(s))\n .join('/');\n\n const url = `${baseUrl}/v2/templates/${templatePath}/parameter-schema`;\n\n const response = await this.fetchApi.fetch(url);\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 async scaffold(\n options: ScaffolderScaffoldOptions,\n ): Promise<ScaffolderScaffoldResponse> {\n const { templateRef, values, secrets = {} } = options;\n const url = `${await this.discoveryApi.getBaseUrl('scaffolder')}/v2/tasks`;\n const response = await this.fetchApi.fetch(url, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n templateRef,\n values: { ...values },\n secrets,\n }),\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 { taskId: id };\n }\n\n async getTask(taskId: string): Promise<ScaffolderTask> {\n const baseUrl = await this.discoveryApi.getBaseUrl('scaffolder');\n const url = `${baseUrl}/v2/tasks/${encodeURIComponent(taskId)}`;\n\n const response = await this.fetchApi.fetch(url);\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n\n return await response.json();\n }\n\n streamLogs(options: ScaffolderStreamLogsOptions): Observable<LogEvent> {\n if (this.useLongPollingLogs) {\n return this.streamLogsPolling(options);\n }\n\n return this.streamLogsEventStream(options);\n }\n\n async dryRun(\n options: ScaffolderDryRunOptions,\n ): Promise<ScaffolderDryRunResponse> {\n const baseUrl = await this.discoveryApi.getBaseUrl('scaffolder');\n const response = await this.fetchApi.fetch(`${baseUrl}/v2/dry-run`, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n template: options.template,\n values: options.values,\n secrets: options.secrets,\n directoryContents: options.directoryContents,\n }),\n });\n\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n\n return response.json();\n }\n\n private streamLogsEventStream({\n isTaskRecoverable,\n taskId,\n after,\n }: ScaffolderStreamLogsOptions): 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\n const processEvent = (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\n const ctrl = new AbortController();\n void fetchEventSource(url, {\n fetch: this.fetchApi.fetch,\n signal: ctrl.signal,\n onmessage(e: EventSourceMessage) {\n if (e.event === 'log') {\n processEvent(e);\n return;\n } else if (e.event === 'completion' && !isTaskRecoverable) {\n processEvent(e);\n subscriber.complete();\n ctrl.abort();\n return;\n }\n processEvent(e);\n },\n onerror(err) {\n subscriber.error(err);\n },\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 this.fetchApi.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 async listActions(): Promise<ListActionsResponse> {\n const baseUrl = await this.discoveryApi.getBaseUrl('scaffolder');\n const response = await this.fetchApi.fetch(`${baseUrl}/v2/actions`);\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n\n return await response.json();\n }\n\n async cancelTask(taskId: string): Promise<void> {\n const baseUrl = await this.discoveryApi.getBaseUrl('scaffolder');\n const url = `${baseUrl}/v2/tasks/${encodeURIComponent(taskId)}/cancel`;\n\n const response = await this.fetchApi.fetch(url, {\n method: 'POST',\n });\n\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n\n return await response.json();\n }\n\n async retry?(taskId: string): Promise<void> {\n const baseUrl = await this.discoveryApi.getBaseUrl('scaffolder');\n const url = `${baseUrl}/v2/tasks/${encodeURIComponent(taskId)}/retry`;\n\n const response = await this.fetchApi.fetch(url, {\n method: 'POST',\n });\n\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n\n return await response.json();\n }\n\n async autocomplete({\n token,\n resource,\n provider,\n context,\n }: {\n token: string;\n provider: string;\n resource: string;\n context?: Record<string, string>;\n }): Promise<{ results: { title: string }[] }> {\n const baseUrl = await this.discoveryApi.getBaseUrl('scaffolder');\n\n const url = `${baseUrl}/v2/autocomplete/${provider}/${resource}`;\n\n const response = await this.fetchApi.fetch(url, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n token,\n context: context ?? {},\n }),\n });\n\n if (!response.ok) {\n throw await ResponseError.fromResponse(response);\n }\n\n const { results } = await response.json();\n return { results };\n }\n}\n"],"names":["queryString"],"mappings":";;;;;;AAoDO,MAAM,gBAA0C,CAAA;AAAA,EACpC,YAAA,CAAA;AAAA,EACA,kBAAA,CAAA;AAAA,EACA,QAAA,CAAA;AAAA,EACA,WAAA,CAAA;AAAA,EACA,kBAAA,CAAA;AAAA,EAEjB,YAAY,OAMT,EAAA;AACD,IAAA,IAAA,CAAK,eAAe,OAAQ,CAAA,YAAA,CAAA;AAC5B,IAAA,IAAA,CAAK,QAAW,GAAA,OAAA,CAAQ,QAAY,IAAA,EAAE,KAAM,EAAA,CAAA;AAC5C,IAAA,IAAA,CAAK,qBAAqB,OAAQ,CAAA,kBAAA,CAAA;AAClC,IAAK,IAAA,CAAA,kBAAA,GAAqB,QAAQ,kBAAsB,IAAA,KAAA,CAAA;AACxD,IAAA,IAAA,CAAK,cAAc,OAAQ,CAAA,WAAA,CAAA;AAAA,GAC7B;AAAA,EAEA,MAAM,UAAU,OAI8C,EAAA;AAC5D,IAAI,IAAA,CAAC,KAAK,WAAa,EAAA;AACrB,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,oKAAA;AAAA,OACF,CAAA;AAAA,KACF;AACA,IAAA,MA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AAA,CAAA;AAE/D,IAAA,MAAM,MAAM,CAAG,EAAA,OAAO,CAAoB,iBAAA,EAAA,QAAQ,IAAI,QAAQ,CAAA,CAAA,CAAA;AAE9D,IAAA,MAAM,QAAW,GAAA,MAAM,IAAK,CAAA,QAAA,CAAS,MAAM,GAAK,EAAA;AAAA,MAC9C,MAAQ,EAAA,MAAA;AAAA,MACR,OAAS,EAAA;AAAA,QACP,cAAgB,EAAA,kBAAA;AAAA,OAClB;AAAA,MACA,IAAA,EAAM,KAAK,SAAU,CAAA;AAAA,QACnB,KAAA;AAAA,QACA,OAAA,EAAS,WAAW,EAAC;AAAA,OACtB,CAAA;AAAA,KACF,CAAA,CAAA;AAED,IAAI,IAAA,CAAC,SAAS,EAAI,EAAA;AAChB,MAAM,MAAA,MAAM,aAAc,CAAA,YAAA,CAAa,QAAQ,CAAA,CAAA;AAAA,KACjD;AAEA,IAAA,MAAM,EAAE,OAAA,EAAY,GAAA,MAAM,SAAS,IAAK,EAAA,CAAA;AACxC,IAAA,OAAO,EAAE,OAAQ,EAAA,CAAA;AAAA,GACnB;AACF;;;;"}
|
|
@@ -18,18 +18,24 @@ import { scaffolderTranslationRef } from '../../translation.esm.js';
|
|
|
18
18
|
const ListTaskPageContent = (props) => {
|
|
19
19
|
const { initiallySelectedFilter = "owned" } = props;
|
|
20
20
|
const { t } = useTranslationRef(scaffolderTranslationRef);
|
|
21
|
+
const [limit, setLimit] = useState(5);
|
|
22
|
+
const [page, setPage] = useState(0);
|
|
21
23
|
const scaffolderApi = useApi(scaffolderApiRef);
|
|
22
24
|
const rootLink = useRouteRef(rootRouteRef);
|
|
23
25
|
const [ownerFilter, setOwnerFilter] = useState(initiallySelectedFilter);
|
|
24
26
|
const { value, loading, error } = useAsync(() => {
|
|
25
27
|
if (scaffolderApi.listTasks) {
|
|
26
|
-
return scaffolderApi.listTasks?.({
|
|
28
|
+
return scaffolderApi.listTasks?.({
|
|
29
|
+
filterByOwnership: ownerFilter,
|
|
30
|
+
limit,
|
|
31
|
+
offset: page * limit
|
|
32
|
+
});
|
|
27
33
|
}
|
|
28
34
|
console.warn(
|
|
29
35
|
"listTasks is not implemented in the scaffolderApi, please make sure to implement this method."
|
|
30
36
|
);
|
|
31
|
-
return Promise.resolve({ tasks: [] });
|
|
32
|
-
}, [scaffolderApi, ownerFilter]);
|
|
37
|
+
return Promise.resolve({ tasks: [], totalTasks: 0 });
|
|
38
|
+
}, [scaffolderApi, ownerFilter, limit, page]);
|
|
33
39
|
if (loading) {
|
|
34
40
|
return /* @__PURE__ */ React.createElement(Progress, null);
|
|
35
41
|
}
|
|
@@ -52,7 +58,15 @@ const ListTaskPageContent = (props) => {
|
|
|
52
58
|
)), /* @__PURE__ */ React.createElement(CatalogFilterLayout.Content, null, /* @__PURE__ */ React.createElement(
|
|
53
59
|
Table,
|
|
54
60
|
{
|
|
61
|
+
onRowsPerPageChange: (pageSize) => {
|
|
62
|
+
setPage(0);
|
|
63
|
+
setLimit(pageSize);
|
|
64
|
+
},
|
|
65
|
+
onPageChange: (newPage) => setPage(newPage),
|
|
66
|
+
options: { pageSize: limit, emptyRowsWhenPaging: false },
|
|
55
67
|
data: value?.tasks ?? [],
|
|
68
|
+
page,
|
|
69
|
+
totalCount: value?.totalTasks ?? 0,
|
|
56
70
|
title: t("listTaskPage.content.tableTitle"),
|
|
57
71
|
columns: [
|
|
58
72
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListTasksPage.esm.js","sources":["../../../src/components/ListTasksPage/ListTasksPage.tsx"],"sourcesContent":["/*\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 {\n Content,\n EmptyState,\n ErrorPanel,\n Header,\n Link,\n Page,\n Progress,\n Table,\n} from '@backstage/core-components';\nimport { useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport { CatalogFilterLayout } from '@backstage/plugin-catalog-react';\nimport useAsync from 'react-use/esm/useAsync';\nimport React, { useState } from 'react';\nimport {\n ScaffolderTask,\n scaffolderApiRef,\n} from '@backstage/plugin-scaffolder-react';\nimport { OwnerListPicker } from './OwnerListPicker';\nimport {\n CreatedAtColumn,\n OwnerEntityColumn,\n TaskStatusColumn,\n TemplateTitleColumn,\n} from './columns';\nimport { actionsRouteRef, editRouteRef, rootRouteRef } from '../../routes';\nimport { ScaffolderPageContextMenu } from '@backstage/plugin-scaffolder-react/alpha';\nimport { useNavigate } from 'react-router-dom';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { scaffolderTranslationRef } from '../../translation';\n\nexport interface MyTaskPageProps {\n initiallySelectedFilter?: 'owned' | 'all';\n}\n\nconst ListTaskPageContent = (props: MyTaskPageProps) => {\n const { initiallySelectedFilter = 'owned' } = props;\n const { t } = useTranslationRef(scaffolderTranslationRef);\n\n const scaffolderApi = useApi(scaffolderApiRef);\n const rootLink = useRouteRef(rootRouteRef);\n\n const [ownerFilter, setOwnerFilter] = useState(initiallySelectedFilter);\n const { value, loading, error } = useAsync(() => {\n if (scaffolderApi.listTasks) {\n return scaffolderApi.listTasks?.({ filterByOwnership: ownerFilter });\n }\n\n // eslint-disable-next-line no-console\n console.warn(\n 'listTasks is not implemented in the scaffolderApi, please make sure to implement this method.',\n );\n\n return Promise.resolve({ tasks: [] });\n }, [scaffolderApi, ownerFilter]);\n\n if (loading) {\n return <Progress />;\n }\n\n if (error) {\n return (\n <>\n <ErrorPanel error={error} />\n <EmptyState\n missing=\"info\"\n title={t('listTaskPage.content.emptyState.title')}\n description={t('listTaskPage.content.emptyState.description')}\n />\n </>\n );\n }\n\n return (\n <CatalogFilterLayout>\n <CatalogFilterLayout.Filters>\n <OwnerListPicker\n filter={ownerFilter}\n onSelectOwner={id => setOwnerFilter(id)}\n />\n </CatalogFilterLayout.Filters>\n <CatalogFilterLayout.Content>\n <Table<ScaffolderTask>\n data={value?.tasks ?? []}\n title={t('listTaskPage.content.tableTitle')}\n columns={[\n {\n title: t('listTaskPage.content.tableCell.taskID'),\n field: 'id',\n render: row => (\n <Link to={`${rootLink()}/tasks/${row.id}`}>{row.id}</Link>\n ),\n },\n {\n title: t('listTaskPage.content.tableCell.template'),\n field: 'spec.templateInfo.entity.metadata.title',\n render: row => (\n <TemplateTitleColumn\n entityRef={row.spec.templateInfo?.entityRef}\n />\n ),\n },\n {\n title: t('listTaskPage.content.tableCell.created'),\n field: 'createdAt',\n render: row => <CreatedAtColumn createdAt={row.createdAt} />,\n },\n {\n title: t('listTaskPage.content.tableCell.owner'),\n field: 'createdBy',\n render: row => (\n <OwnerEntityColumn entityRef={row.spec?.user?.ref} />\n ),\n },\n {\n title: t('listTaskPage.content.tableCell.status'),\n field: 'status',\n render: row => <TaskStatusColumn status={row.status} />,\n },\n ]}\n />\n </CatalogFilterLayout.Content>\n </CatalogFilterLayout>\n );\n};\n\nexport const ListTasksPage = (props: MyTaskPageProps) => {\n const navigate = useNavigate();\n const editorLink = useRouteRef(editRouteRef);\n const actionsLink = useRouteRef(actionsRouteRef);\n const createLink = useRouteRef(rootRouteRef);\n const { t } = useTranslationRef(scaffolderTranslationRef);\n\n const scaffolderPageContextMenuProps = {\n onEditorClicked: () => navigate(editorLink()),\n onActionsClicked: () => navigate(actionsLink()),\n onTasksClicked: undefined,\n onCreateClicked: () => navigate(createLink()),\n };\n return (\n <Page themeId=\"home\">\n <Header\n pageTitleOverride={t('listTaskPage.pageTitle')}\n title={t('listTaskPage.title')}\n subtitle={t('listTaskPage.subtitle')}\n >\n <ScaffolderPageContextMenu {...scaffolderPageContextMenuProps} />\n </Header>\n <Content>\n <ListTaskPageContent {...props} />\n </Content>\n </Page>\n );\n};\n"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,EAAA,MAAM,QAAS,CAAA,UAAA,EAAY,CAAA;AAAA,GAC9C,CAAA;AACA,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,OAAA,EAAQ,MACZ,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,iBAAA,EAAmB,EAAE,wBAAwB,CAAA;AAAA,MAC7C,KAAA,EAAO,EAAE,oBAAoB,CAAA;AAAA,MAC7B,QAAA,EAAU,EAAE,uBAAuB,CAAA;AAAA,KAAA;AAAA,oBAEnC,KAAA,CAAA,aAAA,CAAC,yBAA2B,EAAA,EAAA,GAAG,8BAAgC,EAAA,CAAA;AAAA,GACjE,sCACC,OACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,uBAAqB,GAAG,KAAA,EAAO,CAClC,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"ListTasksPage.esm.js","sources":["../../../src/components/ListTasksPage/ListTasksPage.tsx"],"sourcesContent":["/*\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 {\n Content,\n EmptyState,\n ErrorPanel,\n Header,\n Link,\n Page,\n Progress,\n Table,\n} from '@backstage/core-components';\nimport { useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport { CatalogFilterLayout } from '@backstage/plugin-catalog-react';\nimport useAsync from 'react-use/esm/useAsync';\nimport React, { useState } from 'react';\nimport {\n scaffolderApiRef,\n ScaffolderTask,\n} from '@backstage/plugin-scaffolder-react';\nimport { OwnerListPicker } from './OwnerListPicker';\nimport {\n CreatedAtColumn,\n OwnerEntityColumn,\n TaskStatusColumn,\n TemplateTitleColumn,\n} from './columns';\nimport { actionsRouteRef, editRouteRef, rootRouteRef } from '../../routes';\nimport { ScaffolderPageContextMenu } from '@backstage/plugin-scaffolder-react/alpha';\nimport { useNavigate } from 'react-router-dom';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { scaffolderTranslationRef } from '../../translation';\n\nexport interface MyTaskPageProps {\n initiallySelectedFilter?: 'owned' | 'all';\n}\n\nconst ListTaskPageContent = (props: MyTaskPageProps) => {\n const { initiallySelectedFilter = 'owned' } = props;\n const { t } = useTranslationRef(scaffolderTranslationRef);\n const [limit, setLimit] = useState(5);\n const [page, setPage] = useState(0);\n\n const scaffolderApi = useApi(scaffolderApiRef);\n const rootLink = useRouteRef(rootRouteRef);\n\n const [ownerFilter, setOwnerFilter] = useState(initiallySelectedFilter);\n const { value, loading, error } = useAsync(() => {\n if (scaffolderApi.listTasks) {\n return scaffolderApi.listTasks?.({\n filterByOwnership: ownerFilter,\n limit,\n offset: page * limit,\n });\n }\n\n // eslint-disable-next-line no-console\n console.warn(\n 'listTasks is not implemented in the scaffolderApi, please make sure to implement this method.',\n );\n\n return Promise.resolve({ tasks: [], totalTasks: 0 });\n }, [scaffolderApi, ownerFilter, limit, page]);\n\n if (loading) {\n return <Progress />;\n }\n\n if (error) {\n return (\n <>\n <ErrorPanel error={error} />\n <EmptyState\n missing=\"info\"\n title={t('listTaskPage.content.emptyState.title')}\n description={t('listTaskPage.content.emptyState.description')}\n />\n </>\n );\n }\n\n return (\n <CatalogFilterLayout>\n <CatalogFilterLayout.Filters>\n <OwnerListPicker\n filter={ownerFilter}\n onSelectOwner={id => setOwnerFilter(id)}\n />\n </CatalogFilterLayout.Filters>\n <CatalogFilterLayout.Content>\n <Table<ScaffolderTask>\n onRowsPerPageChange={pageSize => {\n setPage(0);\n setLimit(pageSize);\n }}\n onPageChange={newPage => setPage(newPage)}\n options={{ pageSize: limit, emptyRowsWhenPaging: false }}\n data={value?.tasks ?? []}\n page={page}\n totalCount={value?.totalTasks ?? 0}\n title={t('listTaskPage.content.tableTitle')}\n columns={[\n {\n title: t('listTaskPage.content.tableCell.taskID'),\n field: 'id',\n render: row => (\n <Link to={`${rootLink()}/tasks/${row.id}`}>{row.id}</Link>\n ),\n },\n {\n title: t('listTaskPage.content.tableCell.template'),\n field: 'spec.templateInfo.entity.metadata.title',\n render: row => (\n <TemplateTitleColumn\n entityRef={row.spec.templateInfo?.entityRef}\n />\n ),\n },\n {\n title: t('listTaskPage.content.tableCell.created'),\n field: 'createdAt',\n render: row => <CreatedAtColumn createdAt={row.createdAt} />,\n },\n {\n title: t('listTaskPage.content.tableCell.owner'),\n field: 'createdBy',\n render: row => (\n <OwnerEntityColumn entityRef={row.spec?.user?.ref} />\n ),\n },\n {\n title: t('listTaskPage.content.tableCell.status'),\n field: 'status',\n render: row => <TaskStatusColumn status={row.status} />,\n },\n ]}\n />\n </CatalogFilterLayout.Content>\n </CatalogFilterLayout>\n );\n};\n\nexport const ListTasksPage = (props: MyTaskPageProps) => {\n const navigate = useNavigate();\n const editorLink = useRouteRef(editRouteRef);\n const actionsLink = useRouteRef(actionsRouteRef);\n const createLink = useRouteRef(rootRouteRef);\n const { t } = useTranslationRef(scaffolderTranslationRef);\n\n const scaffolderPageContextMenuProps = {\n onEditorClicked: () => navigate(editorLink()),\n onActionsClicked: () => navigate(actionsLink()),\n onTasksClicked: undefined,\n onCreateClicked: () => navigate(createLink()),\n };\n return (\n <Page themeId=\"home\">\n <Header\n pageTitleOverride={t('listTaskPage.pageTitle')}\n title={t('listTaskPage.title')}\n subtitle={t('listTaskPage.subtitle')}\n >\n <ScaffolderPageContextMenu {...scaffolderPageContextMenuProps} />\n </Header>\n <Content>\n <ListTaskPageContent {...props} />\n </Content>\n </Page>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAkDA,MAAM,mBAAA,GAAsB,CAAC,KAA2B,KAAA;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,GAAgB,CAAC,KAA2B,KAAA;AACvD,EAAA,MAAM,WAAW,WAAY,EAAA,CAAA;AAC7B,EAAM,MAAA,UAAA,GAAa,YAAY,YAAY,CAAA,CAAA;AAC3C,EAAM,MAAA,WAAA,GAAc,YAAY,eAAe,CAAA,CAAA;AAC/C,EAAM,MAAA,UAAA,GAAa,YAAY,YAAY,CAAA,CAAA;AAC3C,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,wBAAwB,CAAA,CAAA;AAExD,EAAA,MAAM,8BAAiC,GAAA;AAAA,IACrC,eAAiB,EAAA,MAAM,QAAS,CAAA,UAAA,EAAY,CAAA;AAAA,IAC5C,gBAAkB,EAAA,MAAM,QAAS,CAAA,WAAA,EAAa,CAAA;AAAA,IAC9C,cAAgB,EAAA,KAAA,CAAA;AAAA,IAChB,eAAiB,EAAA,MAAM,QAAS,CAAA,UAAA,EAAY,CAAA;AAAA,GAC9C,CAAA;AACA,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,OAAA,EAAQ,MACZ,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,iBAAA,EAAmB,EAAE,wBAAwB,CAAA;AAAA,MAC7C,KAAA,EAAO,EAAE,oBAAoB,CAAA;AAAA,MAC7B,QAAA,EAAU,EAAE,uBAAuB,CAAA;AAAA,KAAA;AAAA,oBAEnC,KAAA,CAAA,aAAA,CAAC,yBAA2B,EAAA,EAAA,GAAG,8BAAgC,EAAA,CAAA;AAAA,GACjE,sCACC,OACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,uBAAqB,GAAG,KAAA,EAAO,CAClC,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -114,7 +114,7 @@ const EntityPicker = (props) => {
|
|
|
114
114
|
options: entities?.catalogEntities || [],
|
|
115
115
|
getOptionLabel: (option) => (
|
|
116
116
|
// option can be a string due to freeSolo.
|
|
117
|
-
typeof option === "string" ? option : entities?.entityRefToPresentation.get(stringifyEntityRef(option))?.
|
|
117
|
+
typeof option === "string" ? option : entities?.entityRefToPresentation.get(stringifyEntityRef(option))?.primaryTitle
|
|
118
118
|
),
|
|
119
119
|
autoSelect: true,
|
|
120
120
|
freeSolo: allowArbitraryValues,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityPicker.esm.js","sources":["../../../../src/components/fields/EntityPicker/EntityPicker.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 */\nimport {\n type EntityFilterQuery,\n CATALOG_FILTER_EXISTS,\n} from '@backstage/catalog-client';\nimport {\n Entity,\n parseEntityRef,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport { useApi } from '@backstage/core-plugin-api';\nimport {\n EntityDisplayName,\n EntityRefPresentationSnapshot,\n catalogApiRef,\n entityPresentationApiRef,\n} from '@backstage/plugin-catalog-react';\nimport TextField from '@material-ui/core/TextField';\nimport FormControl from '@material-ui/core/FormControl';\nimport Autocomplete, {\n AutocompleteChangeReason,\n createFilterOptions,\n} from '@material-ui/lab/Autocomplete';\nimport React, { useCallback, useEffect } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport {\n EntityPickerFilterQueryValue,\n EntityPickerProps,\n EntityPickerUiOptions,\n EntityPickerFilterQuery,\n} from './schema';\nimport { VirtualizedListbox } from '../VirtualizedListbox';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { scaffolderTranslationRef } from '../../../translation';\n\nexport { EntityPickerSchema } from './schema';\n\n/**\n * The underlying component that is rendered in the form for the `EntityPicker`\n * field extension.\n *\n * @public\n */\nexport const EntityPicker = (props: EntityPickerProps) => {\n const { t } = useTranslationRef(scaffolderTranslationRef);\n const {\n onChange,\n schema: {\n title = t('fields.entityPicker.title'),\n description = t('fields.entityPicker.description'),\n },\n required,\n uiSchema,\n rawErrors,\n formData,\n idSchema,\n } = props;\n const catalogFilter = buildCatalogFilter(uiSchema);\n const defaultKind = uiSchema['ui:options']?.defaultKind;\n const defaultNamespace =\n uiSchema['ui:options']?.defaultNamespace || undefined;\n\n const catalogApi = useApi(catalogApiRef);\n const entityPresentationApi = useApi(entityPresentationApiRef);\n\n const { value: entities, loading } = useAsync(async () => {\n const fields = [\n 'metadata.name',\n 'metadata.namespace',\n 'metadata.title',\n 'kind',\n ];\n const { items } = await catalogApi.getEntities(\n catalogFilter\n ? { filter: catalogFilter, fields }\n : { filter: undefined, fields },\n );\n\n const entityRefToPresentation = new Map<\n string,\n EntityRefPresentationSnapshot\n >(\n await Promise.all(\n items.map(async item => {\n const presentation = await entityPresentationApi.forEntity(item)\n .promise;\n return [stringifyEntityRef(item), presentation] as [\n string,\n EntityRefPresentationSnapshot,\n ];\n }),\n ),\n );\n\n return { catalogEntities: items, entityRefToPresentation };\n });\n\n const allowArbitraryValues =\n uiSchema['ui:options']?.allowArbitraryValues ?? true;\n\n const getLabel = useCallback(\n (freeSoloValue: string) => {\n try {\n // Will throw if defaultKind or defaultNamespace are not set\n const parsedRef = parseEntityRef(freeSoloValue, {\n defaultKind,\n defaultNamespace,\n });\n\n return stringifyEntityRef(parsedRef);\n } catch (err) {\n return freeSoloValue;\n }\n },\n [defaultKind, defaultNamespace],\n );\n\n const onSelect = useCallback(\n (_: any, ref: string | Entity | null, reason: AutocompleteChangeReason) => {\n // ref can either be a string from free solo entry or\n if (typeof ref !== 'string') {\n // if ref does not exist: pass 'undefined' to trigger validation for required value\n onChange(ref ? stringifyEntityRef(ref as Entity) : undefined);\n } else {\n if (reason === 'blur' || reason === 'create-option') {\n // Add in default namespace, etc.\n let entityRef = ref;\n try {\n // Attempt to parse the entity ref into it's full form.\n entityRef = stringifyEntityRef(\n parseEntityRef(ref as string, {\n defaultKind,\n defaultNamespace,\n }),\n );\n } catch (err) {\n // If the passed in value isn't an entity ref, do nothing.\n }\n // We need to check against formData here as that's the previous value for this field.\n if (formData !== ref || allowArbitraryValues) {\n onChange(entityRef);\n }\n }\n }\n },\n [onChange, formData, defaultKind, defaultNamespace, allowArbitraryValues],\n );\n\n // Since free solo can be enabled, attempt to parse as a full entity ref first, then fall\n // back to the given value.\n const selectedEntity =\n entities?.catalogEntities.find(e => stringifyEntityRef(e) === formData) ??\n (allowArbitraryValues && formData ? getLabel(formData) : '');\n\n useEffect(() => {\n if (entities?.catalogEntities.length === 1 && selectedEntity === '') {\n onChange(stringifyEntityRef(entities.catalogEntities[0]));\n }\n }, [entities, onChange, selectedEntity]);\n\n return (\n <FormControl\n margin=\"normal\"\n required={required}\n error={rawErrors?.length > 0 && !formData}\n >\n <Autocomplete\n disabled={entities?.catalogEntities.length === 1}\n id={idSchema?.$id}\n value={selectedEntity}\n loading={loading}\n onChange={onSelect}\n options={entities?.catalogEntities || []}\n getOptionLabel={option =>\n // option can be a string due to freeSolo.\n typeof option === 'string'\n ? option\n : entities?.entityRefToPresentation.get(stringifyEntityRef(option))\n ?.entityRef!\n }\n autoSelect\n freeSolo={allowArbitraryValues}\n renderInput={params => (\n <TextField\n {...params}\n label={title}\n margin=\"dense\"\n helperText={description}\n FormHelperTextProps={{ margin: 'dense', style: { marginLeft: 0 } }}\n variant=\"outlined\"\n required={required}\n InputProps={params.InputProps}\n />\n )}\n renderOption={option => <EntityDisplayName entityRef={option} />}\n filterOptions={createFilterOptions<Entity>({\n stringify: option =>\n entities?.entityRefToPresentation.get(stringifyEntityRef(option))\n ?.primaryTitle!,\n })}\n ListboxComponent={VirtualizedListbox}\n />\n </FormControl>\n );\n};\n\n/**\n * Converts a especial `{exists: true}` value to the `CATALOG_FILTER_EXISTS` symbol.\n *\n * @param value - The value to convert.\n * @returns The converted value.\n */\nfunction convertOpsValues(\n value: Exclude<EntityPickerFilterQueryValue, Array<any>>,\n): string | symbol {\n if (typeof value === 'object' && value.exists) {\n return CATALOG_FILTER_EXISTS;\n }\n return value?.toString();\n}\n\n/**\n * Converts schema filters to entity filter query, replacing `{exists:true}` values\n * with the constant `CATALOG_FILTER_EXISTS`.\n *\n * @param schemaFilters - An object containing schema filters with keys as filter names\n * and values as filter values.\n * @returns An object with the same keys as the input object, but with `{exists:true}` values\n * transformed to `CATALOG_FILTER_EXISTS` symbol.\n */\nfunction convertSchemaFiltersToQuery(\n schemaFilters: EntityPickerFilterQuery,\n): Exclude<EntityFilterQuery, Array<any>> {\n const query: EntityFilterQuery = {};\n\n for (const [key, value] of Object.entries(schemaFilters)) {\n if (Array.isArray(value)) {\n query[key] = value;\n } else {\n query[key] = convertOpsValues(value);\n }\n }\n\n return query;\n}\n\n/**\n * Builds an `EntityFilterQuery` based on the `uiSchema` passed in.\n * If `catalogFilter` is specified in the `uiSchema`, it is converted to a `EntityFilterQuery`.\n * If `allowedKinds` is specified in the `uiSchema` will support the legacy `allowedKinds` option.\n *\n * @param uiSchema The `uiSchema` of an `EntityPicker` component.\n * @returns An `EntityFilterQuery` based on the `uiSchema`, or `undefined` if `catalogFilter` is not specified in the `uiSchema`.\n */\nfunction buildCatalogFilter(\n uiSchema: EntityPickerProps['uiSchema'],\n): EntityFilterQuery | undefined {\n const allowedKinds = uiSchema['ui:options']?.allowedKinds;\n\n const catalogFilter: EntityPickerUiOptions['catalogFilter'] | undefined =\n uiSchema['ui:options']?.catalogFilter ||\n (allowedKinds && { kind: allowedKinds });\n\n if (!catalogFilter) {\n return undefined;\n }\n\n if (Array.isArray(catalogFilter)) {\n return catalogFilter.map(convertSchemaFiltersToQuery);\n }\n\n return convertSchemaFiltersToQuery(catalogFilter);\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAyDa,MAAA,YAAA,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AA,OAAO,OAAO,QAAS,EAAA,CAAA;AACzB,CAAA;AAWA,SAAS,4BACP,aACwC,EAAA;AACxC,EAAA,MAAM,QAA2B,EAAC,CAAA;AAElC,EAAA,KAAA,MAAW,CAAC,GAAK,EAAA,KAAK,KAAK,MAAO,CAAA,OAAA,CAAQ,aAAa,CAAG,EAAA;AACxD,IAAI,IAAA,KAAA,CAAM,OAAQ,CAAA,KAAK,CAAG,EAAA;AACxB,MAAA,KAAA,CAAM,GAAG,CAAI,GAAA,KAAA,CAAA;AAAA,KACR,MAAA;AACL,MAAM,KAAA,CAAA,GAAG,CAAI,GAAA,gBAAA,CAAiB,KAAK,CAAA,CAAA;AAAA,KACrC;AAAA,GACF;AAEA,EAAO,OAAA,KAAA,CAAA;AACT,CAAA;AAUA,SAAS,mBACP,QAC+B,EAAA;AAC/B,EAAM,MAAA,YAAA,GAAe,QAAS,CAAA,YAAY,CAAG,EAAA,YAAA,CAAA;AAE7C,EAAM,MAAA,aAAA,GACJ,SAAS,YAAY,CAAA,EAAG,iBACvB,YAAgB,IAAA,EAAE,MAAM,YAAa,EAAA,CAAA;AAExC,EAAA,IAAI,CAAC,aAAe,EAAA;AAClB,IAAO,OAAA,KAAA,CAAA,CAAA;AAAA,GACT;AAEA,EAAI,IAAA,KAAA,CAAM,OAAQ,CAAA,aAAa,CAAG,EAAA;AAChC,IAAO,OAAA,aAAA,CAAc,IAAI,2BAA2B,CAAA,CAAA;AAAA,GACtD;AAEA,EAAA,OAAO,4BAA4B,aAAa,CAAA,CAAA;AAClD;;;;"}
|
|
1
|
+
{"version":3,"file":"EntityPicker.esm.js","sources":["../../../../src/components/fields/EntityPicker/EntityPicker.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 */\nimport {\n type EntityFilterQuery,\n CATALOG_FILTER_EXISTS,\n} from '@backstage/catalog-client';\nimport {\n Entity,\n parseEntityRef,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport { useApi } from '@backstage/core-plugin-api';\nimport {\n EntityDisplayName,\n EntityRefPresentationSnapshot,\n catalogApiRef,\n entityPresentationApiRef,\n} from '@backstage/plugin-catalog-react';\nimport TextField from '@material-ui/core/TextField';\nimport FormControl from '@material-ui/core/FormControl';\nimport Autocomplete, {\n AutocompleteChangeReason,\n createFilterOptions,\n} from '@material-ui/lab/Autocomplete';\nimport React, { useCallback, useEffect } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport {\n EntityPickerFilterQueryValue,\n EntityPickerProps,\n EntityPickerUiOptions,\n EntityPickerFilterQuery,\n} from './schema';\nimport { VirtualizedListbox } from '../VirtualizedListbox';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { scaffolderTranslationRef } from '../../../translation';\n\nexport { EntityPickerSchema } from './schema';\n\n/**\n * The underlying component that is rendered in the form for the `EntityPicker`\n * field extension.\n *\n * @public\n */\nexport const EntityPicker = (props: EntityPickerProps) => {\n const { t } = useTranslationRef(scaffolderTranslationRef);\n const {\n onChange,\n schema: {\n title = t('fields.entityPicker.title'),\n description = t('fields.entityPicker.description'),\n },\n required,\n uiSchema,\n rawErrors,\n formData,\n idSchema,\n } = props;\n const catalogFilter = buildCatalogFilter(uiSchema);\n const defaultKind = uiSchema['ui:options']?.defaultKind;\n const defaultNamespace =\n uiSchema['ui:options']?.defaultNamespace || undefined;\n\n const catalogApi = useApi(catalogApiRef);\n const entityPresentationApi = useApi(entityPresentationApiRef);\n\n const { value: entities, loading } = useAsync(async () => {\n const fields = [\n 'metadata.name',\n 'metadata.namespace',\n 'metadata.title',\n 'kind',\n ];\n const { items } = await catalogApi.getEntities(\n catalogFilter\n ? { filter: catalogFilter, fields }\n : { filter: undefined, fields },\n );\n\n const entityRefToPresentation = new Map<\n string,\n EntityRefPresentationSnapshot\n >(\n await Promise.all(\n items.map(async item => {\n const presentation = await entityPresentationApi.forEntity(item)\n .promise;\n return [stringifyEntityRef(item), presentation] as [\n string,\n EntityRefPresentationSnapshot,\n ];\n }),\n ),\n );\n\n return { catalogEntities: items, entityRefToPresentation };\n });\n\n const allowArbitraryValues =\n uiSchema['ui:options']?.allowArbitraryValues ?? true;\n\n const getLabel = useCallback(\n (freeSoloValue: string) => {\n try {\n // Will throw if defaultKind or defaultNamespace are not set\n const parsedRef = parseEntityRef(freeSoloValue, {\n defaultKind,\n defaultNamespace,\n });\n\n return stringifyEntityRef(parsedRef);\n } catch (err) {\n return freeSoloValue;\n }\n },\n [defaultKind, defaultNamespace],\n );\n\n const onSelect = useCallback(\n (_: any, ref: string | Entity | null, reason: AutocompleteChangeReason) => {\n // ref can either be a string from free solo entry or\n if (typeof ref !== 'string') {\n // if ref does not exist: pass 'undefined' to trigger validation for required value\n onChange(ref ? stringifyEntityRef(ref as Entity) : undefined);\n } else {\n if (reason === 'blur' || reason === 'create-option') {\n // Add in default namespace, etc.\n let entityRef = ref;\n try {\n // Attempt to parse the entity ref into it's full form.\n entityRef = stringifyEntityRef(\n parseEntityRef(ref as string, {\n defaultKind,\n defaultNamespace,\n }),\n );\n } catch (err) {\n // If the passed in value isn't an entity ref, do nothing.\n }\n // We need to check against formData here as that's the previous value for this field.\n if (formData !== ref || allowArbitraryValues) {\n onChange(entityRef);\n }\n }\n }\n },\n [onChange, formData, defaultKind, defaultNamespace, allowArbitraryValues],\n );\n\n // Since free solo can be enabled, attempt to parse as a full entity ref first, then fall\n // back to the given value.\n const selectedEntity =\n entities?.catalogEntities.find(e => stringifyEntityRef(e) === formData) ??\n (allowArbitraryValues && formData ? getLabel(formData) : '');\n\n useEffect(() => {\n if (entities?.catalogEntities.length === 1 && selectedEntity === '') {\n onChange(stringifyEntityRef(entities.catalogEntities[0]));\n }\n }, [entities, onChange, selectedEntity]);\n\n return (\n <FormControl\n margin=\"normal\"\n required={required}\n error={rawErrors?.length > 0 && !formData}\n >\n <Autocomplete\n disabled={entities?.catalogEntities.length === 1}\n id={idSchema?.$id}\n value={selectedEntity}\n loading={loading}\n onChange={onSelect}\n options={entities?.catalogEntities || []}\n getOptionLabel={option =>\n // option can be a string due to freeSolo.\n typeof option === 'string'\n ? option\n : entities?.entityRefToPresentation.get(stringifyEntityRef(option))\n ?.primaryTitle!\n }\n autoSelect\n freeSolo={allowArbitraryValues}\n renderInput={params => (\n <TextField\n {...params}\n label={title}\n margin=\"dense\"\n helperText={description}\n FormHelperTextProps={{ margin: 'dense', style: { marginLeft: 0 } }}\n variant=\"outlined\"\n required={required}\n InputProps={params.InputProps}\n />\n )}\n renderOption={option => <EntityDisplayName entityRef={option} />}\n filterOptions={createFilterOptions<Entity>({\n stringify: option =>\n entities?.entityRefToPresentation.get(stringifyEntityRef(option))\n ?.primaryTitle!,\n })}\n ListboxComponent={VirtualizedListbox}\n />\n </FormControl>\n );\n};\n\n/**\n * Converts a especial `{exists: true}` value to the `CATALOG_FILTER_EXISTS` symbol.\n *\n * @param value - The value to convert.\n * @returns The converted value.\n */\nfunction convertOpsValues(\n value: Exclude<EntityPickerFilterQueryValue, Array<any>>,\n): string | symbol {\n if (typeof value === 'object' && value.exists) {\n return CATALOG_FILTER_EXISTS;\n }\n return value?.toString();\n}\n\n/**\n * Converts schema filters to entity filter query, replacing `{exists:true}` values\n * with the constant `CATALOG_FILTER_EXISTS`.\n *\n * @param schemaFilters - An object containing schema filters with keys as filter names\n * and values as filter values.\n * @returns An object with the same keys as the input object, but with `{exists:true}` values\n * transformed to `CATALOG_FILTER_EXISTS` symbol.\n */\nfunction convertSchemaFiltersToQuery(\n schemaFilters: EntityPickerFilterQuery,\n): Exclude<EntityFilterQuery, Array<any>> {\n const query: EntityFilterQuery = {};\n\n for (const [key, value] of Object.entries(schemaFilters)) {\n if (Array.isArray(value)) {\n query[key] = value;\n } else {\n query[key] = convertOpsValues(value);\n }\n }\n\n return query;\n}\n\n/**\n * Builds an `EntityFilterQuery` based on the `uiSchema` passed in.\n * If `catalogFilter` is specified in the `uiSchema`, it is converted to a `EntityFilterQuery`.\n * If `allowedKinds` is specified in the `uiSchema` will support the legacy `allowedKinds` option.\n *\n * @param uiSchema The `uiSchema` of an `EntityPicker` component.\n * @returns An `EntityFilterQuery` based on the `uiSchema`, or `undefined` if `catalogFilter` is not specified in the `uiSchema`.\n */\nfunction buildCatalogFilter(\n uiSchema: EntityPickerProps['uiSchema'],\n): EntityFilterQuery | undefined {\n const allowedKinds = uiSchema['ui:options']?.allowedKinds;\n\n const catalogFilter: EntityPickerUiOptions['catalogFilter'] | undefined =\n uiSchema['ui:options']?.catalogFilter ||\n (allowedKinds && { kind: allowedKinds });\n\n if (!catalogFilter) {\n return undefined;\n }\n\n if (Array.isArray(catalogFilter)) {\n return catalogFilter.map(convertSchemaFiltersToQuery);\n }\n\n return convertSchemaFiltersToQuery(catalogFilter);\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAyDa,MAAA,YAAA,GAAe,CAAC,KAA6B,KAAA;AACxD,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,wBAAwB,CAAA,CAAA;AACxD,EAAM,MAAA;AAAA,IACJ,QAAA;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,KAAA,GAAQ,EAAE,2BAA2B,CAAA;AAAA,MACrC,WAAA,GAAc,EAAE,iCAAiC,CAAA;AAAA,KACnD;AAAA,IACA,QAAA;AAAA,IACA,QAAA;AAAA,IACA,SAAA;AAAA,IACA,QAAA;AAAA,IACA,QAAA;AAAA,GACE,GAAA,KAAA,CAAA;AACJ,EAAM,MAAA,aAAA,GAAgB,mBAAmB,QAAQ,CAAA,CAAA;AACjD,EAAM,MAAA,WAAA,GAAc,QAAS,CAAA,YAAY,CAAG,E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,mBACP,QAC+B,EAAA;AAC/B,EAAM,MAAA,YAAA,GAAe,QAAS,CAAA,YAAY,CAAG,EAAA,YAAA,CAAA;AAE7C,EAAM,MAAA,aAAA,GACJ,SAAS,YAAY,CAAA,EAAG,iBACvB,YAAgB,IAAA,EAAE,MAAM,YAAa,EAAA,CAAA;AAExC,EAAA,IAAI,CAAC,aAAe,EAAA;AAClB,IAAO,OAAA,KAAA,CAAA,CAAA;AAAA,GACT;AAEA,EAAI,IAAA,KAAA,CAAM,OAAQ,CAAA,aAAa,CAAG,EAAA;AAChC,IAAO,OAAA,aAAA,CAAc,IAAI,2BAA2B,CAAA,CAAA;AAAA,GACtD;AAEA,EAAA,OAAO,4BAA4B,aAAa,CAAA,CAAA;AAClD;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiEntityPicker.esm.js","sources":["../../../../src/components/fields/MultiEntityPicker/MultiEntityPicker.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 */\nimport {\n type EntityFilterQuery,\n CATALOG_FILTER_EXISTS,\n} from '@backstage/catalog-client';\nimport {\n Entity,\n parseEntityRef,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport { useApi } from '@backstage/core-plugin-api';\nimport {\n catalogApiRef,\n entityPresentationApiRef,\n EntityDisplayName,\n EntityRefPresentationSnapshot,\n} from '@backstage/plugin-catalog-react';\nimport TextField from '@material-ui/core/TextField';\nimport FormControl from '@material-ui/core/FormControl';\nimport Autocomplete, {\n AutocompleteChangeReason,\n} from '@material-ui/lab/Autocomplete';\nimport React, { useCallback, useEffect, useState } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport { FieldValidation } from '@rjsf/utils';\nimport {\n MultiEntityPickerFilterQueryValue,\n MultiEntityPickerProps,\n MultiEntityPickerUiOptions,\n MultiEntityPickerFilterQuery,\n} from './schema';\nimport { VirtualizedListbox } from '../VirtualizedListbox';\n\nexport { MultiEntityPickerSchema } from './schema';\n\n/**\n * The underlying component that is rendered in the form for the `MultiEntityPicker`\n * field extension.\n */\nexport const MultiEntityPicker = (props: MultiEntityPickerProps) => {\n const {\n onChange,\n schema: { title = 'Entity', description = 'An entity from the catalog' },\n required,\n uiSchema,\n rawErrors,\n formData,\n idSchema,\n } = props;\n const catalogFilter = buildCatalogFilter(uiSchema);\n const defaultKind = uiSchema['ui:options']?.defaultKind;\n const defaultNamespace =\n uiSchema['ui:options']?.defaultNamespace || undefined;\n const [noOfItemsSelected, setNoOfItemsSelected] = useState(0);\n\n const catalogApi = useApi(catalogApiRef);\n const entityPresentationApi = useApi(entityPresentationApiRef);\n const { value: entities, loading } = useAsync(async () => {\n const { items } = await catalogApi.getEntities(\n catalogFilter ? { filter: catalogFilter } : undefined,\n );\n const entityRefToPresentation = new Map<\n string,\n EntityRefPresentationSnapshot\n >(\n await Promise.all(\n items.map(async item => {\n const presentation = await entityPresentationApi.forEntity(item)\n .promise;\n return [stringifyEntityRef(item), presentation] as [\n string,\n EntityRefPresentationSnapshot,\n ];\n }),\n ),\n );\n return { entities: items, entityRefToPresentation };\n });\n const allowArbitraryValues =\n uiSchema['ui:options']?.allowArbitraryValues ?? true;\n\n // if not specified, maxItems defaults to undefined\n const maxItems = props.schema.maxItems;\n\n const onSelect = useCallback(\n (_: any, refs: (string | Entity)[], reason: AutocompleteChangeReason) => {\n const values = refs\n .map(ref => {\n if (typeof ref !== 'string') {\n // if ref does not exist: pass 'undefined' to trigger validation for required value\n return ref ? stringifyEntityRef(ref as Entity) : undefined;\n }\n if (reason === 'blur' || reason === 'create-option') {\n // Add in default namespace, etc.\n let entityRef = ref;\n try {\n // Attempt to parse the entity ref into it's full form.\n entityRef = stringifyEntityRef(\n parseEntityRef(ref as string, {\n defaultKind,\n defaultNamespace,\n }),\n );\n } catch (err) {\n // If the passed in value isn't an entity ref, do nothing.\n }\n\n // We need to check against formData here as that's the previous value for this field.\n if (formData?.includes(ref) || allowArbitraryValues) {\n return entityRef;\n }\n }\n\n return undefined;\n })\n .filter(ref => ref !== undefined) as string[];\n\n setNoOfItemsSelected(values.length);\n onChange(values);\n },\n [onChange, formData, defaultKind, defaultNamespace, allowArbitraryValues],\n );\n\n useEffect(() => {\n if (entities?.entities?.length === 1) {\n onChange([stringifyEntityRef(entities?.entities[0])]);\n }\n }, [entities, onChange]);\n\n return (\n <FormControl\n margin=\"normal\"\n required={required}\n error={rawErrors?.length > 0 && !formData}\n >\n <Autocomplete\n multiple\n filterSelectedOptions\n disabled={entities?.entities?.length === 1}\n id={idSchema?.$id}\n loading={loading}\n onChange={onSelect}\n options={entities?.entities || []}\n renderOption={option => <EntityDisplayName entityRef={option} />}\n getOptionLabel={option =>\n // option can be a string due to freeSolo.\n typeof option === 'string'\n ? option\n : entities?.entityRefToPresentation.get(stringifyEntityRef(option))\n ?.entityRef!\n }\n getOptionDisabled={_options =>\n maxItems ? noOfItemsSelected >= maxItems : false\n }\n autoSelect\n freeSolo={allowArbitraryValues}\n renderInput={params => (\n <TextField\n {...params}\n label={title}\n margin=\"dense\"\n helperText={description}\n FormHelperTextProps={{\n margin: 'dense',\n style: { marginLeft: 0 },\n }}\n variant=\"outlined\"\n required={required}\n InputProps={{\n ...params.InputProps,\n required: formData?.length === 0 && required,\n }}\n />\n )}\n ListboxComponent={VirtualizedListbox}\n />\n </FormControl>\n );\n};\n\nexport const validateMultiEntityPickerValidation = (\n values: string[],\n validation: FieldValidation,\n) => {\n values.forEach(value => {\n try {\n parseEntityRef(value);\n } catch {\n validation.addError(`${value} is not a valid entity ref`);\n }\n });\n};\n\n/**\n * Converts a special `{exists: true}` value to the `CATALOG_FILTER_EXISTS` symbol.\n *\n * @param value - The value to convert.\n * @returns The converted value.\n */\nfunction convertOpsValues(\n value: Exclude<MultiEntityPickerFilterQueryValue, Array<any>>,\n): string | symbol {\n if (typeof value === 'object' && value.exists) {\n return CATALOG_FILTER_EXISTS;\n }\n return value?.toString();\n}\n\n/**\n * Converts schema filters to entity filter query, replacing `{exists:true}` values\n * with the constant `CATALOG_FILTER_EXISTS`.\n *\n * @param schemaFilters - An object containing schema filters with keys as filter names\n * and values as filter values.\n * @returns An object with the same keys as the input object, but with `{exists:true}` values\n * transformed to `CATALOG_FILTER_EXISTS` symbol.\n */\nfunction convertSchemaFiltersToQuery(\n schemaFilters: MultiEntityPickerFilterQuery,\n): Exclude<EntityFilterQuery, Array<any>> {\n const query: EntityFilterQuery = {};\n\n for (const [key, value] of Object.entries(schemaFilters)) {\n if (Array.isArray(value)) {\n query[key] = value;\n } else {\n query[key] = convertOpsValues(value);\n }\n }\n\n return query;\n}\n\n/**\n * Builds an `EntityFilterQuery` based on the `uiSchema` passed in.\n * If `catalogFilter` is specified in the `uiSchema`, it is converted to a `EntityFilterQuery`.\n *\n * @param uiSchema The `uiSchema` of an `EntityPicker` component.\n * @returns An `EntityFilterQuery` based on the `uiSchema`, or `undefined` if `catalogFilter` is not specified in the `uiSchema`.\n */\nfunction buildCatalogFilter(\n uiSchema: MultiEntityPickerProps['uiSchema'],\n): EntityFilterQuery | undefined {\n const catalogFilter: MultiEntityPickerUiOptions['catalogFilter'] | undefined =\n uiSchema['ui:options']?.catalogFilter;\n\n if (!catalogFilter) {\n return undefined;\n }\n\n if (Array.isArray(catalogFilter)) {\n return catalogFilter.map(convertSchemaFiltersToQuery);\n }\n\n return convertSchemaFiltersToQuery(catalogFilter);\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAqDa,MAAA,iBAAA,GAAoB,CAAC,KAAkC,KAAA;AAClE,EAAM,MAAA;AAAA,IACJ,QAAA;AAAA,IACA,MAAQ,EAAA,E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AA,KAAK,KAAK,MAAO,CAAA,OAAA,CAAQ,aAAa,CAAG,EAAA;AACxD,IAAI,IAAA,KAAA,CAAM,OAAQ,CAAA,KAAK,CAAG,EAAA;AACxB,MAAA,KAAA,CAAM,GAAG,CAAI,GAAA,KAAA,CAAA;AAAA,KACR,MAAA;AACL,MAAM,KAAA,CAAA,GAAG,CAAI,GAAA,gBAAA,CAAiB,KAAK,CAAA,CAAA;AAAA,KACrC;AAAA,GACF;AAEA,EAAO,OAAA,KAAA,CAAA;AACT,CAAA;AASA,SAAS,mBACP,QAC+B,EAAA;AAC/B,EAAM,MAAA,aAAA,GACJ,QAAS,CAAA,YAAY,CAAG,EAAA,aAAA,CAAA;AAE1B,EAAA,IAAI,CAAC,aAAe,EAAA;AAClB,IAAO,OAAA,KAAA,CAAA,CAAA;AAAA,GACT;AAEA,EAAI,IAAA,KAAA,CAAM,OAAQ,CAAA,aAAa,CAAG,EAAA;AAChC,IAAO,OAAA,aAAA,CAAc,IAAI,2BAA2B,CAAA,CAAA;AAAA,GACtD;AAEA,EAAA,OAAO,4BAA4B,aAAa,CAAA,CAAA;AAClD;;;;"}
|
|
1
|
+
{"version":3,"file":"MultiEntityPicker.esm.js","sources":["../../../../src/components/fields/MultiEntityPicker/MultiEntityPicker.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 */\nimport {\n type EntityFilterQuery,\n CATALOG_FILTER_EXISTS,\n} from '@backstage/catalog-client';\nimport {\n Entity,\n parseEntityRef,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport { useApi } from '@backstage/core-plugin-api';\nimport {\n catalogApiRef,\n entityPresentationApiRef,\n EntityDisplayName,\n EntityRefPresentationSnapshot,\n} from '@backstage/plugin-catalog-react';\nimport TextField from '@material-ui/core/TextField';\nimport FormControl from '@material-ui/core/FormControl';\nimport Autocomplete, {\n AutocompleteChangeReason,\n} from '@material-ui/lab/Autocomplete';\nimport React, { useCallback, useEffect, useState } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport { FieldValidation } from '@rjsf/utils';\nimport {\n MultiEntityPickerFilterQueryValue,\n MultiEntityPickerProps,\n MultiEntityPickerUiOptions,\n MultiEntityPickerFilterQuery,\n} from './schema';\nimport { VirtualizedListbox } from '../VirtualizedListbox';\n\nexport { MultiEntityPickerSchema } from './schema';\n\n/**\n * The underlying component that is rendered in the form for the `MultiEntityPicker`\n * field extension.\n */\nexport const MultiEntityPicker = (props: MultiEntityPickerProps) => {\n const {\n onChange,\n schema: { title = 'Entity', description = 'An entity from the catalog' },\n required,\n uiSchema,\n rawErrors,\n formData,\n idSchema,\n } = props;\n const catalogFilter = buildCatalogFilter(uiSchema);\n const defaultKind = uiSchema['ui:options']?.defaultKind;\n const defaultNamespace =\n uiSchema['ui:options']?.defaultNamespace || undefined;\n const [noOfItemsSelected, setNoOfItemsSelected] = useState(0);\n\n const catalogApi = useApi(catalogApiRef);\n const entityPresentationApi = useApi(entityPresentationApiRef);\n const { value: entities, loading } = useAsync(async () => {\n const { items } = await catalogApi.getEntities(\n catalogFilter ? { filter: catalogFilter } : undefined,\n );\n const entityRefToPresentation = new Map<\n string,\n EntityRefPresentationSnapshot\n >(\n await Promise.all(\n items.map(async item => {\n const presentation = await entityPresentationApi.forEntity(item)\n .promise;\n return [stringifyEntityRef(item), presentation] as [\n string,\n EntityRefPresentationSnapshot,\n ];\n }),\n ),\n );\n return { entities: items, entityRefToPresentation };\n });\n const allowArbitraryValues =\n uiSchema['ui:options']?.allowArbitraryValues ?? true;\n\n // if not specified, maxItems defaults to undefined\n const maxItems = props.schema.maxItems;\n\n const onSelect = useCallback(\n (_: any, refs: (string | Entity)[], reason: AutocompleteChangeReason) => {\n const values = refs\n .map(ref => {\n if (typeof ref !== 'string') {\n // if ref does not exist: pass 'undefined' to trigger validation for required value\n return ref ? stringifyEntityRef(ref as Entity) : undefined;\n }\n if (reason === 'blur' || reason === 'create-option') {\n // Add in default namespace, etc.\n let entityRef = ref;\n try {\n // Attempt to parse the entity ref into it's full form.\n entityRef = stringifyEntityRef(\n parseEntityRef(ref as string, {\n defaultKind,\n defaultNamespace,\n }),\n );\n } catch (err) {\n // If the passed in value isn't an entity ref, do nothing.\n }\n\n // We need to check against formData here as that's the previous value for this field.\n if (formData?.includes(ref) || allowArbitraryValues) {\n return entityRef;\n }\n }\n\n return undefined;\n })\n .filter(ref => ref !== undefined) as string[];\n\n setNoOfItemsSelected(values.length);\n onChange(values);\n },\n [onChange, formData, defaultKind, defaultNamespace, allowArbitraryValues],\n );\n\n useEffect(() => {\n if (entities?.entities?.length === 1) {\n onChange([stringifyEntityRef(entities?.entities[0])]);\n }\n }, [entities, onChange]);\n\n return (\n <FormControl\n margin=\"normal\"\n required={required}\n error={rawErrors?.length > 0 && !formData}\n >\n <Autocomplete\n multiple\n filterSelectedOptions\n disabled={entities?.entities?.length === 1}\n id={idSchema?.$id}\n defaultValue={formData}\n loading={loading}\n onChange={onSelect}\n options={entities?.entities || []}\n renderOption={option => <EntityDisplayName entityRef={option} />}\n getOptionLabel={option =>\n // option can be a string due to freeSolo.\n typeof option === 'string'\n ? option\n : entities?.entityRefToPresentation.get(stringifyEntityRef(option))\n ?.entityRef!\n }\n getOptionDisabled={_options =>\n maxItems ? noOfItemsSelected >= maxItems : false\n }\n autoSelect\n freeSolo={allowArbitraryValues}\n renderInput={params => (\n <TextField\n {...params}\n label={title}\n margin=\"dense\"\n helperText={description}\n FormHelperTextProps={{\n margin: 'dense',\n style: { marginLeft: 0 },\n }}\n variant=\"outlined\"\n required={required}\n InputProps={{\n ...params.InputProps,\n required: formData?.length === 0 && required,\n }}\n />\n )}\n ListboxComponent={VirtualizedListbox}\n />\n </FormControl>\n );\n};\n\nexport const validateMultiEntityPickerValidation = (\n values: string[],\n validation: FieldValidation,\n) => {\n values.forEach(value => {\n try {\n parseEntityRef(value);\n } catch {\n validation.addError(`${value} is not a valid entity ref`);\n }\n });\n};\n\n/**\n * Converts a special `{exists: true}` value to the `CATALOG_FILTER_EXISTS` symbol.\n *\n * @param value - The value to convert.\n * @returns The converted value.\n */\nfunction convertOpsValues(\n value: Exclude<MultiEntityPickerFilterQueryValue, Array<any>>,\n): string | symbol {\n if (typeof value === 'object' && value.exists) {\n return CATALOG_FILTER_EXISTS;\n }\n return value?.toString();\n}\n\n/**\n * Converts schema filters to entity filter query, replacing `{exists:true}` values\n * with the constant `CATALOG_FILTER_EXISTS`.\n *\n * @param schemaFilters - An object containing schema filters with keys as filter names\n * and values as filter values.\n * @returns An object with the same keys as the input object, but with `{exists:true}` values\n * transformed to `CATALOG_FILTER_EXISTS` symbol.\n */\nfunction convertSchemaFiltersToQuery(\n schemaFilters: MultiEntityPickerFilterQuery,\n): Exclude<EntityFilterQuery, Array<any>> {\n const query: EntityFilterQuery = {};\n\n for (const [key, value] of Object.entries(schemaFilters)) {\n if (Array.isArray(value)) {\n query[key] = value;\n } else {\n query[key] = convertOpsValues(value);\n }\n }\n\n return query;\n}\n\n/**\n * Builds an `EntityFilterQuery` based on the `uiSchema` passed in.\n * If `catalogFilter` is specified in the `uiSchema`, it is converted to a `EntityFilterQuery`.\n *\n * @param uiSchema The `uiSchema` of an `EntityPicker` component.\n * @returns An `EntityFilterQuery` based on the `uiSchema`, or `undefined` if `catalogFilter` is not specified in the `uiSchema`.\n */\nfunction buildCatalogFilter(\n uiSchema: MultiEntityPickerProps['uiSchema'],\n): EntityFilterQuery | undefined {\n const catalogFilter: MultiEntityPickerUiOptions['catalogFilter'] | undefined =\n uiSchema['ui:options']?.catalogFilter;\n\n if (!catalogFilter) {\n return undefined;\n }\n\n if (Array.isAr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O,KAAA,KAAU,QAAY,IAAA,KAAA,CAAM,MAAQ,EAAA;AAC7C,IAAO,OAAA,qBAAA,CAAA;AAAA,GACT;AACA,EAAA,OAAO,OAAO,QAAS,EAAA,CAAA;AACzB,CAAA;AAWA,SAAS,4BACP,aACwC,EAAA;AACxC,EAAA,MAAM,QAA2B,EAAC,CAAA;AAElC,EAAA,KAAA,MAAW,CAAC,GAAK,EAAA,KAAK,KAAK,MAAO,CAAA,OAAA,CAAQ,aAAa,CAAG,EAAA;AACxD,IAAI,IAAA,KAAA,CAAM,OAAQ,CAAA,KAAK,CAAG,EAAA;AACxB,MAAA,KAAA,CAAM,GAAG,CAAI,GAAA,KAAA,CAAA;AAAA,KACR,MAAA;AACL,MAAM,KAAA,CAAA,GAAG,CAAI,GAAA,gBAAA,CAAiB,KAAK,CAAA,CAAA;AAAA,KACrC;AAAA,GACF;AAEA,EAAO,OAAA,KAAA,CAAA;AACT,CAAA;AASA,SAAS,mBACP,QAC+B,EAAA;AAC/B,EAAM,MAAA,aAAA,GACJ,QAAS,CAAA,YAAY,CAAG,EAAA,aAAA,CAAA;AAE1B,EAAA,IAAI,CAAC,aAAe,EAAA;AAClB,IAAO,OAAA,KAAA,CAAA,CAAA;AAAA,GACT;AAEA,EAAI,IAAA,KAAA,CAAM,OAAQ,CAAA,aAAa,CAAG,EAAA;AAChC,IAAO,OAAA,aAAA,CAAc,IAAI,2BAA2B,CAAA,CAAA;AAAA,GACtD;AAEA,EAAA,OAAO,4BAA4B,aAAa,CAAA,CAAA;AAClD;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -33,8 +33,11 @@ declare class ScaffolderClient implements ScaffolderApi$1 {
|
|
|
33
33
|
});
|
|
34
34
|
listTasks(options: {
|
|
35
35
|
filterByOwnership: 'owned' | 'all';
|
|
36
|
+
limit?: number;
|
|
37
|
+
offset?: number;
|
|
36
38
|
}): Promise<{
|
|
37
39
|
tasks: ScaffolderTask$1[];
|
|
40
|
+
totalTasks?: number;
|
|
38
41
|
}>;
|
|
39
42
|
getIntegrationsList(options: ScaffolderGetIntegrationsListOptions$1): Promise<ScaffolderGetIntegrationsListResponse$1>;
|
|
40
43
|
getTemplateParameterSchema(templateRef: string): Promise<TemplateParameterSchema$1>;
|
package/dist/translation.esm.js
CHANGED
|
@@ -177,7 +177,7 @@ const scaffolderTranslationRef = createTranslationRef({
|
|
|
177
177
|
subtitle: "Edit, preview, and try out templates and template forms"
|
|
178
178
|
},
|
|
179
179
|
templateEditorPage: {
|
|
180
|
-
title: "
|
|
180
|
+
title: "Manage Templates",
|
|
181
181
|
subtitle: "Edit, preview, and try out templates and template forms",
|
|
182
182
|
dryRunResults: {
|
|
183
183
|
title: "Dry-run results"
|
|
@@ -229,7 +229,7 @@ const scaffolderTranslationRef = createTranslationRef({
|
|
|
229
229
|
unsupportedTooltip: "Only supported in some Chromium-based browsers"
|
|
230
230
|
},
|
|
231
231
|
formEditor: {
|
|
232
|
-
title: "
|
|
232
|
+
title: "Template playground",
|
|
233
233
|
description: "Preview and edit a template form, either using a sample template or by loading a template from the catalog."
|
|
234
234
|
},
|
|
235
235
|
fieldExplorer: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translation.esm.js","sources":["../src/translation.ts"],"sourcesContent":["/*\n * Copyright 2024 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 { createTranslationRef } from '@backstage/core-plugin-api/alpha';\n\n/** @alpha */\nexport const scaffolderTranslationRef = createTranslationRef({\n id: 'scaffolder',\n messages: {\n actionsPage: {\n title: 'Installed actions',\n pageTitle: 'Create a New Component',\n subtitle: 'This is the collection of all installed actions',\n content: {\n emptyState: {\n title: 'No information to display',\n description:\n 'There are no actions installed or there was an issue communicating with backend.',\n },\n tableCell: {\n name: 'Name',\n title: 'Title',\n description: 'Description',\n type: 'Type',\n },\n noRowsDescription: 'No schema defined',\n },\n action: {\n input: 'Input',\n output: 'Output',\n examples: 'Examples',\n },\n },\n fields: {\n entityNamePicker: {\n title: 'Name',\n description: 'Unique name of the component',\n },\n entityPicker: {\n title: 'Entity',\n description: 'An entity from the catalog',\n },\n entityTagsPicker: {\n title: 'Tags',\n description:\n \"Add any relevant tags, hit 'Enter' to add new tags. Valid format: [a-z0-9+#] separated by [-], at most 63 characters\",\n },\n myGroupsPicker: {\n title: 'Entity',\n description: 'An entity from the catalog',\n },\n ownedEntityPicker: {\n title: 'Entity',\n description: 'An entity from the catalog',\n },\n ownerPicker: {\n title: 'Owner',\n description: 'The owner of the component',\n },\n azureRepoPicker: {\n organization: {\n title: 'Organization',\n description: 'The Organization that this repo will belong to',\n },\n project: {\n title: 'Project',\n description: 'The Project that this repo will belong to',\n },\n },\n bitbucketRepoPicker: {\n workspaces: {\n title: 'Allowed Workspaces',\n inputTitle: 'Workspaces',\n description: 'The Workspace that this repo will belong to',\n },\n project: {\n title: 'Allowed Projects',\n inputTitle: 'Projects',\n description: 'The Project that this repo will belong to',\n },\n },\n gerritRepoPicker: {\n owner: {\n title: 'Owner',\n description: 'The owner of the project (optional)',\n },\n parent: {\n title: 'Parent',\n description: 'The project parent that the repo will belong to',\n },\n },\n giteaRepoPicker: {\n owner: {\n title: 'Owner Available',\n inputTitle: 'Owner',\n description:\n 'Gitea namespace where this repository will belong to. It can be the name of organization, group, subgroup, user, or the project.',\n },\n },\n githubRepoPicker: {\n owner: {\n title: 'Owner Available',\n inputTitle: 'Owner',\n description:\n 'The organization, user or project that this repo will belong to',\n },\n },\n gitlabRepoPicker: {\n owner: {\n title: 'Owner Available',\n inputTitle: 'Owner',\n description:\n 'GitLab namespace where this repository will belong to. It can be the name of organization, group, subgroup, user, or the project.',\n },\n },\n repoUrlPicker: {\n host: {\n title: 'Host',\n description: 'The host where the repository will be created',\n },\n repository: {\n title: 'Repositories Available',\n inputTitle: 'Repository',\n description: 'The name of the repository',\n },\n },\n },\n listTaskPage: {\n title: 'List template tasks',\n pageTitle: 'Templates Tasks',\n subtitle: 'All tasks that have been started',\n content: {\n emptyState: {\n title: 'No information to display',\n description:\n 'There are no tasks or there was an issue communicating with backend.',\n },\n tableTitle: 'Tasks',\n tableCell: {\n taskID: 'Task ID',\n template: 'Template',\n created: 'Created',\n owner: 'Owner',\n status: 'Status',\n },\n },\n },\n ownerListPicker: {\n title: 'Task Owner',\n options: {\n owned: 'Owned',\n all: 'All',\n },\n },\n ongoingTask: {\n title: 'Run of',\n pageTitle: {\n hasTemplateName: 'Run of {{templateName}}',\n noTemplateName: 'Scaffolder Run',\n },\n subtitle: 'Task {{taskId}}',\n cancelButtonTitle: 'Cancel',\n retryButtonTitle: 'Retry',\n startOverButtonTitle: 'Start Over',\n hideLogsButtonTitle: 'Hide Logs',\n showLogsButtonTitle: 'Show Logs',\n contextMenu: {\n hideLogs: 'Hide Logs',\n showLogs: 'Show Logs',\n hideButtonBar: 'Hide Button Bar',\n retry: 'Retry',\n showButtonBar: 'Show Button Bar',\n startOver: 'Start Over',\n cancel: 'Cancel',\n },\n },\n templateEditorForm: {\n stepper: {\n emptyText: 'There are no spec parameters in the template to preview.',\n },\n },\n templateTypePicker: {\n title: 'Categories',\n },\n templateFormPage: {\n title: 'Template Form Playground',\n subtitle: 'Edit, preview, and try out templates and template forms',\n },\n templateEditorPage: {\n title: 'Template Editor',\n subtitle: 'Edit, preview, and try out templates and template forms',\n dryRunResults: {\n title: 'Dry-run results',\n },\n dryRunResultsList: {\n title: 'Result {{resultId}}',\n downloadButtonTitle: 'Download as .zip',\n deleteButtonTitle: 'Delete result',\n },\n dryRunResultsView: {\n tab: {\n files: 'Files',\n log: 'Log',\n output: 'Output',\n },\n },\n taskStatusStepper: {\n skippedStepTitle: 'Skipped',\n },\n customFieldExplorer: {\n selectFieldLabel: 'Choose Custom Field Extension',\n fieldForm: {\n title: 'Field Options',\n applyButtonTitle: 'Apply',\n },\n fieldPreview: {\n title: 'Field Preview',\n },\n preview: {\n title: 'Template Spec',\n },\n },\n templateEditorBrowser: {\n closeConfirmMessage: 'Are you sure? Unsaved changes will be lost',\n saveIconTooltip: 'Save all files',\n reloadIconTooltip: 'Reload directory',\n closeIconTooltip: 'Close directory',\n },\n templateEditorIntro: {\n title: 'Get started by choosing one of the options below',\n loadLocal: {\n title: 'Load Template Directory',\n description:\n 'Load a local template directory, allowing you to both edit and try executing your own template.',\n unsupportedTooltip: 'Only supported in some Chromium-based browsers',\n },\n createLocal: {\n title: 'Create New Template',\n description:\n 'Create a local template directory, allowing you to both edit and try executing your own template.',\n unsupportedTooltip: 'Only supported in some Chromium-based browsers',\n },\n formEditor: {\n title: 'Edit Template Form',\n description:\n 'Preview and edit a template form, either using a sample template or by loading a template from the catalog.',\n },\n fieldExplorer: {\n title: 'Custom Field Explorer',\n description:\n 'View and play around with available installed custom field extensions.',\n },\n },\n templateEditorTextArea: {\n saveIconTooltip: 'Save file',\n refreshIconTooltip: 'Reload file',\n },\n templateFormPreviewer: {\n title: 'Load Existing Template',\n },\n },\n templateListPage: {\n title: 'Create a new component',\n subtitle:\n 'Create new software components using standard templates in your organization',\n pageTitle: 'Create a new component',\n templateGroups: {\n defaultTitle: 'Templates',\n otherTitle: 'Other Templates',\n },\n contentHeader: {\n registerExistingButtonTitle: 'Register Existing Component',\n supportButtonTitle:\n 'Create new software components using standard templates. Different templates create different kinds of components (services, websites, documentation, ...).',\n },\n additionalLinksForEntity: {\n viewTechDocsTitle: 'View TechDocs',\n },\n },\n templateWizardPage: {\n title: 'Create a new component',\n subtitle:\n 'Create new software components using standard templates in your organization',\n pageTitle: 'Create a new component',\n pageContextMenu: {\n editConfigurationTitle: 'Edit Configuration',\n },\n },\n },\n});\n"],"names":[],"mappings":";;AAkBO,MA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A,MACA,wBAA0B,EAAA;AAAA,QACxB,iBAAmB,EAAA,eAAA;AAAA,OACrB;AAAA,KACF;AAAA,IACA,kBAAoB,EAAA;AAAA,MAClB,KAAO,EAAA,wBAAA;AAAA,MACP,QACE,EAAA,8EAAA;AAAA,MACF,SAAW,EAAA,wBAAA;AAAA,MACX,eAAiB,EAAA;AAAA,QACf,sBAAwB,EAAA,oBAAA;AAAA,OAC1B;AAAA,KACF;AAAA,GACF;AACF,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"translation.esm.js","sources":["../src/translation.ts"],"sourcesContent":["/*\n * Copyright 2024 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 { createTranslationRef } from '@backstage/core-plugin-api/alpha';\n\n/** @alpha */\nexport const scaffolderTranslationRef = createTranslationRef({\n id: 'scaffolder',\n messages: {\n actionsPage: {\n title: 'Installed actions',\n pageTitle: 'Create a New Component',\n subtitle: 'This is the collection of all installed actions',\n content: {\n emptyState: {\n title: 'No information to display',\n description:\n 'There are no actions installed or there was an issue communicating with backend.',\n },\n tableCell: {\n name: 'Name',\n title: 'Title',\n description: 'Description',\n type: 'Type',\n },\n noRowsDescription: 'No schema defined',\n },\n action: {\n input: 'Input',\n output: 'Output',\n examples: 'Examples',\n },\n },\n fields: {\n entityNamePicker: {\n title: 'Name',\n description: 'Unique name of the component',\n },\n entityPicker: {\n title: 'Entity',\n description: 'An entity from the catalog',\n },\n entityTagsPicker: {\n title: 'Tags',\n description:\n \"Add any relevant tags, hit 'Enter' to add new tags. Valid format: [a-z0-9+#] separated by [-], at most 63 characters\",\n },\n myGroupsPicker: {\n title: 'Entity',\n description: 'An entity from the catalog',\n },\n ownedEntityPicker: {\n title: 'Entity',\n description: 'An entity from the catalog',\n },\n ownerPicker: {\n title: 'Owner',\n description: 'The owner of the component',\n },\n azureRepoPicker: {\n organization: {\n title: 'Organization',\n description: 'The Organization that this repo will belong to',\n },\n project: {\n title: 'Project',\n description: 'The Project that this repo will belong to',\n },\n },\n bitbucketRepoPicker: {\n workspaces: {\n title: 'Allowed Workspaces',\n inputTitle: 'Workspaces',\n description: 'The Workspace that this repo will belong to',\n },\n project: {\n title: 'Allowed Projects',\n inputTitle: 'Projects',\n description: 'The Project that this repo will belong to',\n },\n },\n gerritRepoPicker: {\n owner: {\n title: 'Owner',\n description: 'The owner of the project (optional)',\n },\n parent: {\n title: 'Parent',\n description: 'The project parent that the repo will belong to',\n },\n },\n giteaRepoPicker: {\n owner: {\n title: 'Owner Available',\n inputTitle: 'Owner',\n description:\n 'Gitea namespace where this repository will belong to. It can be the name of organization, group, subgroup, user, or the project.',\n },\n },\n githubRepoPicker: {\n owner: {\n title: 'Owner Available',\n inputTitle: 'Owner',\n description:\n 'The organization, user or project that this repo will belong to',\n },\n },\n gitlabRepoPicker: {\n owner: {\n title: 'Owner Available',\n inputTitle: 'Owner',\n description:\n 'GitLab namespace where this repository will belong to. It can be the name of organization, group, subgroup, user, or the project.',\n },\n },\n repoUrlPicker: {\n host: {\n title: 'Host',\n description: 'The host where the repository will be created',\n },\n repository: {\n title: 'Repositories Available',\n inputTitle: 'Repository',\n description: 'The name of the repository',\n },\n },\n },\n listTaskPage: {\n title: 'List template tasks',\n pageTitle: 'Templates Tasks',\n subtitle: 'All tasks that have been started',\n content: {\n emptyState: {\n title: 'No information to display',\n description:\n 'There are no tasks or there was an issue communicating with backend.',\n },\n tableTitle: 'Tasks',\n tableCell: {\n taskID: 'Task ID',\n template: 'Template',\n created: 'Created',\n owner: 'Owner',\n status: 'Status',\n },\n },\n },\n ownerListPicker: {\n title: 'Task Owner',\n options: {\n owned: 'Owned',\n all: 'All',\n },\n },\n ongoingTask: {\n title: 'Run of',\n pageTitle: {\n hasTemplateName: 'Run of {{templateName}}',\n noTemplateName: 'Scaffolder Run',\n },\n subtitle: 'Task {{taskId}}',\n cancelButtonTitle: 'Cancel',\n retryButtonTitle: 'Retry',\n startOverButtonTitle: 'Start Over',\n hideLogsButtonTitle: 'Hide Logs',\n showLogsButtonTitle: 'Show Logs',\n contextMenu: {\n hideLogs: 'Hide Logs',\n showLogs: 'Show Logs',\n hideButtonBar: 'Hide Button Bar',\n retry: 'Retry',\n showButtonBar: 'Show Button Bar',\n startOver: 'Start Over',\n cancel: 'Cancel',\n },\n },\n templateEditorForm: {\n stepper: {\n emptyText: 'There are no spec parameters in the template to preview.',\n },\n },\n templateTypePicker: {\n title: 'Categories',\n },\n templateFormPage: {\n title: 'Template Form Playground',\n subtitle: 'Edit, preview, and try out templates and template forms',\n },\n templateEditorPage: {\n title: 'Manage Templates',\n subtitle: 'Edit, preview, and try out templates and template forms',\n dryRunResults: {\n title: 'Dry-run results',\n },\n dryRunResultsList: {\n title: 'Result {{resultId}}',\n downloadButtonTitle: 'Download as .zip',\n deleteButtonTitle: 'Delete result',\n },\n dryRunResultsView: {\n tab: {\n files: 'Files',\n log: 'Log',\n output: 'Output',\n },\n },\n taskStatusStepper: {\n skippedStepTitle: 'Skipped',\n },\n customFieldExplorer: {\n selectFieldLabel: 'Choose Custom Field Extension',\n fieldForm: {\n title: 'Field Options',\n applyButtonTitle: 'Apply',\n },\n fieldPreview: {\n title: 'Field Preview',\n },\n preview: {\n title: 'Template Spec',\n },\n },\n templateEditorBrowser: {\n closeConfirmMessage: 'Are you sure? Unsaved changes will be lost',\n saveIconTooltip: 'Save all files',\n reloadIconTooltip: 'Reload directory',\n closeIconTooltip: 'Close directory',\n },\n templateEditorIntro: {\n title: 'Get started by choosing one of the options below',\n loadLocal: {\n title: 'Load Template Directory',\n description:\n 'Load a local template directory, allowing you to both edit and try executing your own template.',\n unsupportedTooltip: 'Only supported in some Chromium-based browsers',\n },\n createLocal: {\n title: 'Create New Template',\n description:\n 'Create a local template directory, allowing you to both edit and try executing your own template.',\n unsupportedTooltip: 'Only supported in some Chromium-based browsers',\n },\n formEditor: {\n title: 'Template playground',\n description:\n 'Preview and edit a template form, either using a sample template or by loading a template from the catalog.',\n },\n fieldExplorer: {\n title: 'Custom Field Explorer',\n description:\n 'View and play around with available installed custom field extensions.',\n },\n },\n templateEditorTextArea: {\n saveIconTooltip: 'Save file',\n refreshIconTooltip: 'Reload file',\n },\n templateFormPreviewer: {\n title: 'Load Existing Template',\n },\n },\n templateListPage: {\n title: 'Create a new component',\n subtitle:\n 'Create new software components using standard templates in your organization',\n pageTitle: 'Create a new component',\n templateGroups: {\n defaultTitle: 'Templates',\n otherTitle: 'Other Templates',\n },\n contentHeader: {\n registerExistingButtonTitle: 'Register Existing Component',\n supportButtonTitle:\n 'Create new software components using standard templates. Different templates create different kinds of components (services, websites, documentation, ...).',\n },\n additionalLinksForEntity: {\n viewTechDocsTitle: 'View TechDocs',\n },\n },\n templateWizardPage: {\n title: 'Create a new component',\n subtitle:\n 'Create new software components using standard templates in your organization',\n pageTitle: 'Create a new component',\n pageContextMenu: {\n editConfigurationTitle: 'Edit Configuration',\n },\n },\n },\n});\n"],"names":[],"mappings":";;AAkBO,MAAM,2BAA2B,oBAAqB,CAAA;AAAA,EAC3D,EAAI,EAAA,YAAA;AAAA,EACJ,QAAU,EAAA;AAAA,IACR,WAAa,EAAA;AAAA,MACX,KAAO,EAAA,mBAAA;AAAA,MACP,SAAW,EAAA,wBAAA;AAAA,MACX,QAAU,EAAA,iDAAA;AAAA,MACV,OAAS,EAAA;AAAA,QACP,UAAY,EAAA;AAAA,UACV,KAAO,EAAA,2BAAA;AAAA,UACP,WACE,EAAA,kFAAA;AAAA,SACJ;AAAA,QACA,SAAW,EAAA;AAAA,UACT,IAAM,EAAA,MAAA;AAAA,UACN,KAAO,EAAA,OAAA;AAAA,UACP,WAAa,EAAA,aAAA;AAA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
3
|
+
"version": "1.26.0-next.1",
|
|
4
4
|
"description": "The Backstage plugin that helps you create new things",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "frontend-plugin",
|
|
@@ -58,21 +58,21 @@
|
|
|
58
58
|
"test": "backstage-cli package test"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@backstage/catalog-client": "
|
|
62
|
-
"@backstage/catalog-model": "
|
|
63
|
-
"@backstage/core-compat-api": "
|
|
64
|
-
"@backstage/core-components": "
|
|
65
|
-
"@backstage/core-plugin-api": "
|
|
66
|
-
"@backstage/errors": "
|
|
67
|
-
"@backstage/frontend-plugin-api": "
|
|
68
|
-
"@backstage/integration": "
|
|
69
|
-
"@backstage/integration-react": "
|
|
70
|
-
"@backstage/plugin-catalog-common": "
|
|
71
|
-
"@backstage/plugin-catalog-react": "
|
|
72
|
-
"@backstage/plugin-permission-react": "
|
|
73
|
-
"@backstage/plugin-scaffolder-common": "
|
|
74
|
-
"@backstage/plugin-scaffolder-react": "
|
|
75
|
-
"@backstage/types": "
|
|
61
|
+
"@backstage/catalog-client": "1.7.0",
|
|
62
|
+
"@backstage/catalog-model": "1.7.0",
|
|
63
|
+
"@backstage/core-compat-api": "0.3.1-next.1",
|
|
64
|
+
"@backstage/core-components": "0.15.1-next.1",
|
|
65
|
+
"@backstage/core-plugin-api": "1.10.0-next.1",
|
|
66
|
+
"@backstage/errors": "1.2.4",
|
|
67
|
+
"@backstage/frontend-plugin-api": "0.9.0-next.1",
|
|
68
|
+
"@backstage/integration": "1.15.1-next.0",
|
|
69
|
+
"@backstage/integration-react": "1.2.0-next.1",
|
|
70
|
+
"@backstage/plugin-catalog-common": "1.1.0",
|
|
71
|
+
"@backstage/plugin-catalog-react": "1.14.0-next.1",
|
|
72
|
+
"@backstage/plugin-permission-react": "0.4.27-next.1",
|
|
73
|
+
"@backstage/plugin-scaffolder-common": "1.5.6",
|
|
74
|
+
"@backstage/plugin-scaffolder-react": "1.13.0-next.1",
|
|
75
|
+
"@backstage/types": "1.1.1",
|
|
76
76
|
"@codemirror/language": "^6.0.0",
|
|
77
77
|
"@codemirror/legacy-modes": "^6.1.0",
|
|
78
78
|
"@codemirror/view": "^6.0.0",
|
|
@@ -85,7 +85,6 @@
|
|
|
85
85
|
"@rjsf/material-ui": "5.21.1",
|
|
86
86
|
"@rjsf/utils": "5.21.1",
|
|
87
87
|
"@rjsf/validator-ajv8": "5.21.1",
|
|
88
|
-
"@types/react": "^16.13.1 || ^17.0.0 || ^18.0.0",
|
|
89
88
|
"@uiw/react-codemirror": "^4.9.3",
|
|
90
89
|
"classnames": "^2.2.6",
|
|
91
90
|
"git-url-parse": "^14.0.0",
|
|
@@ -106,27 +105,37 @@
|
|
|
106
105
|
"zod-to-json-schema": "^3.20.4"
|
|
107
106
|
},
|
|
108
107
|
"devDependencies": {
|
|
109
|
-
"@backstage/cli": "
|
|
110
|
-
"@backstage/core-app-api": "
|
|
111
|
-
"@backstage/dev-utils": "
|
|
112
|
-
"@backstage/plugin-catalog": "
|
|
113
|
-
"@backstage/plugin-permission-common": "
|
|
114
|
-
"@backstage/test-utils": "
|
|
108
|
+
"@backstage/cli": "0.28.0-next.1",
|
|
109
|
+
"@backstage/core-app-api": "1.15.1-next.1",
|
|
110
|
+
"@backstage/dev-utils": "1.1.2-next.1",
|
|
111
|
+
"@backstage/plugin-catalog": "1.24.0-next.1",
|
|
112
|
+
"@backstage/plugin-permission-common": "0.8.1",
|
|
113
|
+
"@backstage/test-utils": "1.6.1-next.1",
|
|
115
114
|
"@testing-library/dom": "^10.0.0",
|
|
116
115
|
"@testing-library/jest-dom": "^6.0.0",
|
|
117
116
|
"@testing-library/react": "^16.0.0",
|
|
118
117
|
"@testing-library/user-event": "^14.0.0",
|
|
119
118
|
"@types/humanize-duration": "^3.18.1",
|
|
120
119
|
"@types/json-schema": "^7.0.9",
|
|
120
|
+
"@types/react": "^18.0.0",
|
|
121
121
|
"@types/react-resizable": "^3.0.8",
|
|
122
122
|
"@types/react-window": "^1.8.8",
|
|
123
123
|
"msw": "^1.0.0",
|
|
124
|
+
"react": "^18.0.2",
|
|
125
|
+
"react-dom": "^18.0.2",
|
|
126
|
+
"react-router-dom": "^6.3.0",
|
|
124
127
|
"swr": "^2.0.0"
|
|
125
128
|
},
|
|
126
129
|
"peerDependencies": {
|
|
130
|
+
"@types/react": "^16.13.1 || ^17.0.0 || ^18.0.0",
|
|
127
131
|
"react": "^16.13.1 || ^17.0.0 || ^18.0.0",
|
|
128
132
|
"react-dom": "^16.13.1 || ^17.0.0 || ^18.0.0",
|
|
129
133
|
"react-router-dom": "6.0.0-beta.0 || ^6.3.0"
|
|
130
134
|
},
|
|
135
|
+
"peerDependenciesMeta": {
|
|
136
|
+
"@types/react": {
|
|
137
|
+
"optional": true
|
|
138
|
+
}
|
|
139
|
+
},
|
|
131
140
|
"module": "./dist/index.esm.js"
|
|
132
141
|
}
|