@backstage/plugin-scaffolder 1.14.1-next.1 → 1.14.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 +43 -1
- package/alpha/package.json +1 -1
- package/dist/alpha.esm.js +15 -79
- package/dist/alpha.esm.js.map +1 -1
- package/dist/esm/{TemplateEditorIntro-580933c6.esm.js → ListTasksPage-44381650.esm.js} +472 -278
- package/dist/esm/ListTasksPage-44381650.esm.js.map +1 -0
- package/dist/esm/{Router-d236b5e3.esm.js → Router-8653bb84.esm.js} +23 -17
- package/dist/esm/{Router-d236b5e3.esm.js.map → Router-8653bb84.esm.js.map} +1 -1
- package/dist/esm/TaskPage-e70ca2f8.esm.js +322 -0
- package/dist/esm/TaskPage-e70ca2f8.esm.js.map +1 -0
- package/dist/esm/{TemplateFormPreviewer-475decbc.esm.js → index-05d3e519.esm.js} +389 -22
- package/dist/esm/index-05d3e519.esm.js.map +1 -0
- package/dist/esm/{TaskPage-b9589b1b.esm.js → plugin-e86ee6a1.esm.js} +21 -320
- package/dist/esm/plugin-e86ee6a1.esm.js.map +1 -0
- package/dist/index.esm.js +7 -6
- package/dist/index.esm.js.map +1 -1
- package/package.json +19 -19
- package/dist/esm/ListTasksPage-a65cbda6.esm.js +0 -198
- package/dist/esm/ListTasksPage-a65cbda6.esm.js.map +0 -1
- package/dist/esm/TaskPage-b9589b1b.esm.js.map +0 -1
- package/dist/esm/TemplateEditorIntro-580933c6.esm.js.map +0 -1
- package/dist/esm/TemplateFormPreviewer-475decbc.esm.js.map +0 -1
- package/dist/esm/index-76380724.esm.js +0 -391
- package/dist/esm/index-76380724.esm.js.map +0 -1
|
@@ -1,10 +1,20 @@
|
|
|
1
|
-
import React, { useState, useMemo, useEffect,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
1
|
+
import React, { useCallback, useState, useMemo, useEffect, Component } from 'react';
|
|
2
|
+
import { Link, useNavigate, Navigate, useParams, useOutlet, Routes, Route } from 'react-router-dom';
|
|
3
|
+
import { useRouteRef, useApp, useApi, useRouteRefParams, AnalyticsContext, useApiHolder, alertApiRef } from '@backstage/core-plugin-api';
|
|
4
|
+
import { DocsIcon, Page, Header, Content, ContentHeader, SupportButton, ErrorPanel, ErrorPage } from '@backstage/core-components';
|
|
5
|
+
import { EntityListProvider, CatalogFilterLayout, EntitySearchBar, EntityKindPicker, UserListPicker, EntityTagPicker, catalogApiRef, humanizeEntityRef } from '@backstage/plugin-catalog-react';
|
|
6
|
+
import { ScaffolderPageContextMenu, TemplateCategoryPicker, TemplateGroups, Workflow, DefaultTemplateOutputs, TaskSteps, TaskLogStream, Stepper, Form } from '@backstage/plugin-scaffolder-react/alpha';
|
|
7
|
+
import Button from '@material-ui/core/Button';
|
|
8
|
+
import IconButton from '@material-ui/core/IconButton';
|
|
9
|
+
import useMediaQuery from '@material-ui/core/useMediaQuery';
|
|
10
|
+
import AddCircleOutline from '@material-ui/icons/AddCircleOutline';
|
|
11
|
+
import { catalogEntityCreatePermission } from '@backstage/plugin-catalog-common/alpha';
|
|
12
|
+
import { usePermission } from '@backstage/plugin-permission-react';
|
|
13
|
+
import { u as registerComponentRouteRef, p as editRouteRef, q as actionsRouteRef, t as scaffolderListTaskRouteRef, v as viewTechDocRouteRef, n as selectedTemplateRouteRef, r as rootRouteRef, o as scaffolderTaskRouteRef } from './plugin-e86ee6a1.esm.js';
|
|
14
|
+
import { parseEntityRef, stringifyEntityRef } from '@backstage/catalog-model';
|
|
15
|
+
import { useTemplateSecrets, scaffolderApiRef, useTaskEventStream, useCustomFieldExtensions, useCustomLayouts, SecretsContextProvider } from '@backstage/plugin-scaffolder-react';
|
|
16
|
+
import { u as useDryRun, a as useDirectoryEditor, D as DirectoryEditorProvider, b as DryRunProvider, T as TemplateEditorBrowser, c as TemplateEditorTextArea, d as DryRunResults, e as TemplateEditorIntro, W as WebFileSystemAccess, f as DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS, A as ActionsPage, L as ListTasksPage } from './ListTasksPage-44381650.esm.js';
|
|
17
|
+
import { makeStyles, useTheme, IconButton as IconButton$1, Popover, MenuList, MenuItem, ListItemIcon, ListItemText, Box, Paper, Button as Button$1, FormControl, InputLabel, Select, Card, CardHeader, CardContent, LinearProgress } from '@material-ui/core';
|
|
8
18
|
import qs from 'qs';
|
|
9
19
|
import { useAsync } from '@react-hookz/web';
|
|
10
20
|
import Cancel from '@material-ui/icons/Cancel';
|
|
@@ -12,18 +22,226 @@ import Retry from '@material-ui/icons/Repeat';
|
|
|
12
22
|
import Toc from '@material-ui/icons/Toc';
|
|
13
23
|
import ControlPointIcon from '@material-ui/icons/ControlPoint';
|
|
14
24
|
import MoreVert from '@material-ui/icons/MoreVert';
|
|
15
|
-
import { DefaultTemplateOutputs, TaskSteps, TaskLogStream, Stepper, Form } from '@backstage/plugin-scaffolder-react/alpha';
|
|
16
25
|
import { StreamLanguage } from '@codemirror/language';
|
|
17
26
|
import { yaml as yaml$1 } from '@codemirror/legacy-modes/mode/yaml';
|
|
18
27
|
import CloseIcon from '@material-ui/icons/Close';
|
|
19
28
|
import CodeMirror from '@uiw/react-codemirror';
|
|
20
29
|
import yaml from 'yaml';
|
|
21
|
-
import validator from '@rjsf/validator-ajv8';
|
|
22
|
-
import { u as useDryRun, a as useDirectoryEditor, D as DirectoryEditorProvider, b as DryRunProvider, T as TemplateEditorBrowser, c as TemplateEditorTextArea, d as DryRunResults } from './TemplateEditorIntro-580933c6.esm.js';
|
|
23
|
-
import { catalogApiRef, humanizeEntityRef } from '@backstage/plugin-catalog-react';
|
|
24
|
-
import useAsync$1 from 'react-use/lib/useAsync';
|
|
25
30
|
import { makeStyles as makeStyles$1 } from '@material-ui/core/styles';
|
|
26
31
|
import useDebounce from 'react-use/lib/useDebounce';
|
|
32
|
+
import validator from '@rjsf/validator-ajv8';
|
|
33
|
+
import useAsync$1 from 'react-use/lib/useAsync';
|
|
34
|
+
import '@backstage/integration-react';
|
|
35
|
+
import '@backstage/errors';
|
|
36
|
+
import 'zen-observable';
|
|
37
|
+
import 'event-source-polyfill';
|
|
38
|
+
import '@backstage/catalog-client';
|
|
39
|
+
import '@material-ui/core/FormControl';
|
|
40
|
+
import '@material-ui/lab/Autocomplete';
|
|
41
|
+
import 'zod';
|
|
42
|
+
import 'zod-to-json-schema';
|
|
43
|
+
import '@material-ui/core/FormHelperText';
|
|
44
|
+
import '@material-ui/core/Input';
|
|
45
|
+
import '@material-ui/core/InputLabel';
|
|
46
|
+
import 'react-use/lib/useEffectOnce';
|
|
47
|
+
import '@material-ui/lab';
|
|
48
|
+
import 'classnames';
|
|
49
|
+
import '@material-ui/icons/ExpandMore';
|
|
50
|
+
import '@material-ui/icons/ExpandLess';
|
|
51
|
+
import '@material-ui/core/Chip';
|
|
52
|
+
import '@material-ui/core/Card';
|
|
53
|
+
import '@material-ui/core/CardActionArea';
|
|
54
|
+
import '@material-ui/core/CardContent';
|
|
55
|
+
import '@material-ui/core/Tooltip';
|
|
56
|
+
import '@material-ui/core/Typography';
|
|
57
|
+
import '@material-ui/icons/InfoOutlined';
|
|
58
|
+
import '@material-ui/core/Accordion';
|
|
59
|
+
import '@material-ui/core/AccordionDetails';
|
|
60
|
+
import '@material-ui/core/AccordionSummary';
|
|
61
|
+
import '@material-ui/core/Divider';
|
|
62
|
+
import '@material-ui/core/List';
|
|
63
|
+
import '@material-ui/core/ListItem';
|
|
64
|
+
import '@material-ui/core/ListItemIcon';
|
|
65
|
+
import '@material-ui/core/ListItemSecondaryAction';
|
|
66
|
+
import '@material-ui/core/ListItemText';
|
|
67
|
+
import '@material-ui/icons/Check';
|
|
68
|
+
import '@material-ui/icons/Delete';
|
|
69
|
+
import '@material-ui/core/Box';
|
|
70
|
+
import '@material-ui/core/Tab';
|
|
71
|
+
import '@material-ui/core/Tabs';
|
|
72
|
+
import './TaskPage-e70ca2f8.esm.js';
|
|
73
|
+
import '@material-ui/core/Grid';
|
|
74
|
+
import '@material-ui/core/Step';
|
|
75
|
+
import '@material-ui/core/StepLabel';
|
|
76
|
+
import '@material-ui/core/Stepper';
|
|
77
|
+
import '@material-ui/icons/FiberManualRecord';
|
|
78
|
+
import 'luxon';
|
|
79
|
+
import 'react-use/lib/useInterval';
|
|
80
|
+
import '@material-ui/icons/Language';
|
|
81
|
+
import '@material-ui/icons/Refresh';
|
|
82
|
+
import '@material-ui/icons/Save';
|
|
83
|
+
import '@material-ui/lab/TreeView';
|
|
84
|
+
import '@material-ui/icons/ChevronRight';
|
|
85
|
+
import '@material-ui/lab/TreeItem';
|
|
86
|
+
import '@codemirror/view';
|
|
87
|
+
import '@material-ui/icons/Settings';
|
|
88
|
+
import '@material-ui/icons/FontDownload';
|
|
89
|
+
import 'humanize-duration';
|
|
90
|
+
|
|
91
|
+
const RegisterExistingButton = (props) => {
|
|
92
|
+
const { title, to } = props;
|
|
93
|
+
const { allowed } = usePermission({
|
|
94
|
+
permission: catalogEntityCreatePermission
|
|
95
|
+
});
|
|
96
|
+
const isXSScreen = useMediaQuery(
|
|
97
|
+
(theme) => theme.breakpoints.down("xs")
|
|
98
|
+
);
|
|
99
|
+
if (!to || !allowed) {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
return isXSScreen ? /* @__PURE__ */ React.createElement(
|
|
103
|
+
IconButton,
|
|
104
|
+
{
|
|
105
|
+
component: Link,
|
|
106
|
+
color: "primary",
|
|
107
|
+
title,
|
|
108
|
+
size: "small",
|
|
109
|
+
to
|
|
110
|
+
},
|
|
111
|
+
/* @__PURE__ */ React.createElement(AddCircleOutline, null)
|
|
112
|
+
) : /* @__PURE__ */ React.createElement(Button, { component: Link, variant: "contained", color: "primary", to }, title);
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const defaultGroup = {
|
|
116
|
+
title: "Templates",
|
|
117
|
+
filter: () => true
|
|
118
|
+
};
|
|
119
|
+
const createGroupsWithOther = (groups) => [
|
|
120
|
+
...groups,
|
|
121
|
+
{
|
|
122
|
+
title: "Other Templates",
|
|
123
|
+
filter: (e) => ![...groups].some(({ filter }) => filter(e))
|
|
124
|
+
}
|
|
125
|
+
];
|
|
126
|
+
const TemplateListPage = (props) => {
|
|
127
|
+
var _a, _b, _c;
|
|
128
|
+
const registerComponentLink = useRouteRef(registerComponentRouteRef);
|
|
129
|
+
const {
|
|
130
|
+
TemplateCardComponent,
|
|
131
|
+
groups: givenGroups = [],
|
|
132
|
+
templateFilter
|
|
133
|
+
} = props;
|
|
134
|
+
const navigate = useNavigate();
|
|
135
|
+
const editorLink = useRouteRef(editRouteRef);
|
|
136
|
+
const actionsLink = useRouteRef(actionsRouteRef);
|
|
137
|
+
const tasksLink = useRouteRef(scaffolderListTaskRouteRef);
|
|
138
|
+
const viewTechDocsLink = useRouteRef(viewTechDocRouteRef);
|
|
139
|
+
const templateRoute = useRouteRef(selectedTemplateRouteRef);
|
|
140
|
+
const app = useApp();
|
|
141
|
+
const groups = givenGroups.length ? createGroupsWithOther(givenGroups) : [defaultGroup];
|
|
142
|
+
const scaffolderPageContextMenuProps = {
|
|
143
|
+
onEditorClicked: ((_a = props == null ? void 0 : props.contextMenu) == null ? void 0 : _a.editor) !== false ? () => navigate(editorLink()) : void 0,
|
|
144
|
+
onActionsClicked: ((_b = props == null ? void 0 : props.contextMenu) == null ? void 0 : _b.actions) !== false ? () => navigate(actionsLink()) : void 0,
|
|
145
|
+
onTasksClicked: ((_c = props == null ? void 0 : props.contextMenu) == null ? void 0 : _c.tasks) !== false ? () => navigate(tasksLink()) : void 0
|
|
146
|
+
};
|
|
147
|
+
const additionalLinksForEntity = useCallback(
|
|
148
|
+
(template) => {
|
|
149
|
+
var _a2, _b2;
|
|
150
|
+
const { kind, namespace, name } = parseEntityRef(
|
|
151
|
+
stringifyEntityRef(template)
|
|
152
|
+
);
|
|
153
|
+
return ((_a2 = template.metadata.annotations) == null ? void 0 : _a2["backstage.io/techdocs-ref"]) && viewTechDocsLink ? [
|
|
154
|
+
{
|
|
155
|
+
icon: (_b2 = app.getSystemIcon("docs")) != null ? _b2 : DocsIcon,
|
|
156
|
+
text: "View TechDocs",
|
|
157
|
+
url: viewTechDocsLink({ kind, namespace, name })
|
|
158
|
+
}
|
|
159
|
+
] : [];
|
|
160
|
+
},
|
|
161
|
+
[app, viewTechDocsLink]
|
|
162
|
+
);
|
|
163
|
+
const onTemplateSelected = useCallback(
|
|
164
|
+
(template) => {
|
|
165
|
+
const { namespace, name } = parseEntityRef(stringifyEntityRef(template));
|
|
166
|
+
navigate(templateRoute({ namespace, templateName: name }));
|
|
167
|
+
},
|
|
168
|
+
[navigate, templateRoute]
|
|
169
|
+
);
|
|
170
|
+
return /* @__PURE__ */ React.createElement(EntityListProvider, null, /* @__PURE__ */ React.createElement(Page, { themeId: "website" }, /* @__PURE__ */ React.createElement(
|
|
171
|
+
Header,
|
|
172
|
+
{
|
|
173
|
+
pageTitleOverride: "Create a new component",
|
|
174
|
+
title: "Create a new component",
|
|
175
|
+
subtitle: "Create new software components using standard templates in your organization"
|
|
176
|
+
},
|
|
177
|
+
/* @__PURE__ */ React.createElement(ScaffolderPageContextMenu, { ...scaffolderPageContextMenuProps })
|
|
178
|
+
), /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(ContentHeader, { title: "Available Templates" }, /* @__PURE__ */ React.createElement(
|
|
179
|
+
RegisterExistingButton,
|
|
180
|
+
{
|
|
181
|
+
title: "Register Existing Component",
|
|
182
|
+
to: registerComponentLink && registerComponentLink()
|
|
183
|
+
}
|
|
184
|
+
), /* @__PURE__ */ React.createElement(SupportButton, null, "Create new software components using standard templates. Different templates create different kinds of components (services, websites, documentation, ...).")), /* @__PURE__ */ React.createElement(CatalogFilterLayout, null, /* @__PURE__ */ React.createElement(CatalogFilterLayout.Filters, null, /* @__PURE__ */ React.createElement(EntitySearchBar, null), /* @__PURE__ */ React.createElement(EntityKindPicker, { initialFilter: "template", hidden: true }), /* @__PURE__ */ React.createElement(
|
|
185
|
+
UserListPicker,
|
|
186
|
+
{
|
|
187
|
+
initialFilter: "all",
|
|
188
|
+
availableFilters: ["all", "starred"]
|
|
189
|
+
}
|
|
190
|
+
), /* @__PURE__ */ React.createElement(TemplateCategoryPicker, null), /* @__PURE__ */ React.createElement(EntityTagPicker, null)), /* @__PURE__ */ React.createElement(CatalogFilterLayout.Content, null, /* @__PURE__ */ React.createElement(
|
|
191
|
+
TemplateGroups,
|
|
192
|
+
{
|
|
193
|
+
groups,
|
|
194
|
+
templateFilter,
|
|
195
|
+
TemplateCardComponent,
|
|
196
|
+
onTemplateSelected,
|
|
197
|
+
additionalLinksForEntity
|
|
198
|
+
}
|
|
199
|
+
))))));
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
const TemplateWizardPage = (props) => {
|
|
203
|
+
const rootRef = useRouteRef(rootRouteRef);
|
|
204
|
+
const taskRoute = useRouteRef(scaffolderTaskRouteRef);
|
|
205
|
+
const { secrets } = useTemplateSecrets();
|
|
206
|
+
const scaffolderApi = useApi(scaffolderApiRef);
|
|
207
|
+
const navigate = useNavigate();
|
|
208
|
+
const { templateName, namespace } = useRouteRefParams(
|
|
209
|
+
selectedTemplateRouteRef
|
|
210
|
+
);
|
|
211
|
+
const templateRef = stringifyEntityRef({
|
|
212
|
+
kind: "Template",
|
|
213
|
+
namespace,
|
|
214
|
+
name: templateName
|
|
215
|
+
});
|
|
216
|
+
const onCreate = async (values) => {
|
|
217
|
+
const { taskId } = await scaffolderApi.scaffold({
|
|
218
|
+
templateRef,
|
|
219
|
+
values,
|
|
220
|
+
secrets
|
|
221
|
+
});
|
|
222
|
+
navigate(taskRoute({ taskId }));
|
|
223
|
+
};
|
|
224
|
+
const onError = () => /* @__PURE__ */ React.createElement(Navigate, { to: rootRef() });
|
|
225
|
+
return /* @__PURE__ */ React.createElement(AnalyticsContext, { attributes: { entityRef: templateRef } }, /* @__PURE__ */ React.createElement(Page, { themeId: "website" }, /* @__PURE__ */ React.createElement(
|
|
226
|
+
Header,
|
|
227
|
+
{
|
|
228
|
+
pageTitleOverride: "Create a new component",
|
|
229
|
+
title: "Create a new component",
|
|
230
|
+
subtitle: "Create new software components using standard templates in your organization"
|
|
231
|
+
}
|
|
232
|
+
), /* @__PURE__ */ React.createElement(
|
|
233
|
+
Workflow,
|
|
234
|
+
{
|
|
235
|
+
namespace,
|
|
236
|
+
templateName,
|
|
237
|
+
onCreate,
|
|
238
|
+
onError,
|
|
239
|
+
extensions: props.customFieldExtensions,
|
|
240
|
+
FormProps: props.FormProps,
|
|
241
|
+
layouts: props.layouts
|
|
242
|
+
}
|
|
243
|
+
)));
|
|
244
|
+
};
|
|
27
245
|
|
|
28
246
|
const useStyles$5 = makeStyles(() => ({
|
|
29
247
|
button: {
|
|
@@ -51,7 +269,7 @@ const ContextMenu = (props) => {
|
|
|
51
269
|
}
|
|
52
270
|
});
|
|
53
271
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
54
|
-
IconButton,
|
|
272
|
+
IconButton$1,
|
|
55
273
|
{
|
|
56
274
|
"aria-label": "more",
|
|
57
275
|
"aria-controls": "long-menu",
|
|
@@ -209,7 +427,7 @@ const OngoingTask = (props) => {
|
|
|
209
427
|
isError: Boolean(taskStream.error)
|
|
210
428
|
}
|
|
211
429
|
)), /* @__PURE__ */ React.createElement(Outputs, { output: taskStream.output }), buttonBarVisible ? /* @__PURE__ */ React.createElement(Box, { paddingBottom: 2 }, /* @__PURE__ */ React.createElement(Paper, null, /* @__PURE__ */ React.createElement(Box, { padding: 2 }, /* @__PURE__ */ React.createElement("div", { className: classes.buttonBar }, /* @__PURE__ */ React.createElement(
|
|
212
|
-
Button,
|
|
430
|
+
Button$1,
|
|
213
431
|
{
|
|
214
432
|
className: classes.cancelButton,
|
|
215
433
|
disabled: !cancelEnabled || cancelStatus !== "not-executed",
|
|
@@ -218,7 +436,7 @@ const OngoingTask = (props) => {
|
|
|
218
436
|
},
|
|
219
437
|
"Cancel"
|
|
220
438
|
), /* @__PURE__ */ React.createElement(
|
|
221
|
-
Button,
|
|
439
|
+
Button$1,
|
|
222
440
|
{
|
|
223
441
|
variant: "contained",
|
|
224
442
|
color: "primary",
|
|
@@ -229,6 +447,12 @@ const OngoingTask = (props) => {
|
|
|
229
447
|
))))) : null, logsVisible ? /* @__PURE__ */ React.createElement(Box, { paddingBottom: 2, height: "100%" }, /* @__PURE__ */ React.createElement(Paper, { style: { height: "100%" } }, /* @__PURE__ */ React.createElement(Box, { padding: 2, height: "100%" }, /* @__PURE__ */ React.createElement(TaskLogStream, { logs: taskStream.stepLogs })))) : null));
|
|
230
448
|
};
|
|
231
449
|
|
|
450
|
+
var __defProp = Object.defineProperty;
|
|
451
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
452
|
+
var __publicField = (obj, key, value) => {
|
|
453
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
454
|
+
return value;
|
|
455
|
+
};
|
|
232
456
|
const useStyles$3 = makeStyles$1({
|
|
233
457
|
containerWrapper: {
|
|
234
458
|
position: "relative",
|
|
@@ -247,9 +471,9 @@ const useStyles$3 = makeStyles$1({
|
|
|
247
471
|
class ErrorBoundary extends Component {
|
|
248
472
|
constructor() {
|
|
249
473
|
super(...arguments);
|
|
250
|
-
this
|
|
474
|
+
__publicField(this, "state", {
|
|
251
475
|
shouldRender: true
|
|
252
|
-
};
|
|
476
|
+
});
|
|
253
477
|
}
|
|
254
478
|
componentDidUpdate(prevProps) {
|
|
255
479
|
if (prevProps.invalidator !== this.props.invalidator) {
|
|
@@ -458,7 +682,7 @@ const CustomFieldExplorer = ({
|
|
|
458
682
|
onChange: (e) => handleSelectionChange(e.target.value)
|
|
459
683
|
},
|
|
460
684
|
fieldOptions.map((option, idx) => /* @__PURE__ */ React.createElement(MenuItem, { key: idx, value: option }, option.name))
|
|
461
|
-
)), /* @__PURE__ */ React.createElement(IconButton, { size: "medium", onClick: onClose, "aria-label": "Close" }, /* @__PURE__ */ React.createElement(CloseIcon, null))), /* @__PURE__ */ React.createElement("div", { className: classes.fieldForm }, /* @__PURE__ */ React.createElement(Card, null, /* @__PURE__ */ React.createElement(CardHeader, { title: "Field Options" }), /* @__PURE__ */ React.createElement(CardContent, null, /* @__PURE__ */ React.createElement(
|
|
685
|
+
)), /* @__PURE__ */ React.createElement(IconButton$1, { size: "medium", onClick: onClose, "aria-label": "Close" }, /* @__PURE__ */ React.createElement(CloseIcon, null))), /* @__PURE__ */ React.createElement("div", { className: classes.fieldForm }, /* @__PURE__ */ React.createElement(Card, null, /* @__PURE__ */ React.createElement(CardHeader, { title: "Field Options" }), /* @__PURE__ */ React.createElement(CardContent, null, /* @__PURE__ */ React.createElement(
|
|
462
686
|
Form,
|
|
463
687
|
{
|
|
464
688
|
showErrorList: false,
|
|
@@ -471,7 +695,7 @@ const CustomFieldExplorer = ({
|
|
|
471
695
|
schema: ((_a = selectedField.schema) == null ? void 0 : _a.uiOptions) || {}
|
|
472
696
|
},
|
|
473
697
|
/* @__PURE__ */ React.createElement(
|
|
474
|
-
Button,
|
|
698
|
+
Button$1,
|
|
475
699
|
{
|
|
476
700
|
variant: "contained",
|
|
477
701
|
color: "primary",
|
|
@@ -664,7 +888,7 @@ const TemplateFormPreviewer = ({
|
|
|
664
888
|
onChange: (e) => handleSelectChange(e.target.value)
|
|
665
889
|
},
|
|
666
890
|
templateOptions.map((option, idx) => /* @__PURE__ */ React.createElement(MenuItem, { key: idx, value: option.value }, option.label))
|
|
667
|
-
)), /* @__PURE__ */ React.createElement(IconButton, { size: "medium", onClick: onClose }, /* @__PURE__ */ React.createElement(CloseIcon, null))), /* @__PURE__ */ React.createElement("div", { className: classes.textArea }, /* @__PURE__ */ React.createElement(
|
|
891
|
+
)), /* @__PURE__ */ React.createElement(IconButton$1, { size: "medium", onClick: onClose }, /* @__PURE__ */ React.createElement(CloseIcon, null))), /* @__PURE__ */ React.createElement("div", { className: classes.textArea }, /* @__PURE__ */ React.createElement(
|
|
668
892
|
TemplateEditorTextArea,
|
|
669
893
|
{
|
|
670
894
|
content: templateYaml,
|
|
@@ -683,5 +907,148 @@ const TemplateFormPreviewer = ({
|
|
|
683
907
|
))));
|
|
684
908
|
};
|
|
685
909
|
|
|
686
|
-
|
|
687
|
-
|
|
910
|
+
function TemplateEditorPage(props) {
|
|
911
|
+
const [selection, setSelection] = useState();
|
|
912
|
+
let content = null;
|
|
913
|
+
if ((selection == null ? void 0 : selection.type) === "local") {
|
|
914
|
+
content = /* @__PURE__ */ React.createElement(
|
|
915
|
+
TemplateEditor,
|
|
916
|
+
{
|
|
917
|
+
directory: selection.directory,
|
|
918
|
+
fieldExtensions: props.customFieldExtensions,
|
|
919
|
+
onClose: () => setSelection(void 0),
|
|
920
|
+
layouts: props.layouts
|
|
921
|
+
}
|
|
922
|
+
);
|
|
923
|
+
} else if ((selection == null ? void 0 : selection.type) === "form") {
|
|
924
|
+
content = /* @__PURE__ */ React.createElement(
|
|
925
|
+
TemplateFormPreviewer,
|
|
926
|
+
{
|
|
927
|
+
defaultPreviewTemplate: props.defaultPreviewTemplate,
|
|
928
|
+
customFieldExtensions: props.customFieldExtensions,
|
|
929
|
+
onClose: () => setSelection(void 0),
|
|
930
|
+
layouts: props.layouts
|
|
931
|
+
}
|
|
932
|
+
);
|
|
933
|
+
} else if ((selection == null ? void 0 : selection.type) === "field-explorer") {
|
|
934
|
+
content = /* @__PURE__ */ React.createElement(
|
|
935
|
+
CustomFieldExplorer,
|
|
936
|
+
{
|
|
937
|
+
customFieldExtensions: props.customFieldExtensions,
|
|
938
|
+
onClose: () => setSelection(void 0)
|
|
939
|
+
}
|
|
940
|
+
);
|
|
941
|
+
} else {
|
|
942
|
+
content = /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(
|
|
943
|
+
TemplateEditorIntro,
|
|
944
|
+
{
|
|
945
|
+
onSelect: (option) => {
|
|
946
|
+
if (option === "local") {
|
|
947
|
+
WebFileSystemAccess.requestDirectoryAccess().then((directory) => setSelection({ type: "local", directory })).catch(() => {
|
|
948
|
+
});
|
|
949
|
+
} else if (option === "form") {
|
|
950
|
+
setSelection({ type: "form" });
|
|
951
|
+
} else if (option === "field-explorer") {
|
|
952
|
+
setSelection({ type: "field-explorer" });
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
}
|
|
956
|
+
));
|
|
957
|
+
}
|
|
958
|
+
return /* @__PURE__ */ React.createElement(Page, { themeId: "home" }, /* @__PURE__ */ React.createElement(
|
|
959
|
+
Header,
|
|
960
|
+
{
|
|
961
|
+
title: "Template Editor",
|
|
962
|
+
subtitle: "Edit, preview, and try out templates and template forms"
|
|
963
|
+
}
|
|
964
|
+
), content);
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
const Router = (props) => {
|
|
968
|
+
const {
|
|
969
|
+
components: {
|
|
970
|
+
TemplateCardComponent,
|
|
971
|
+
TemplateOutputsComponent,
|
|
972
|
+
TaskPageComponent = OngoingTask,
|
|
973
|
+
TemplateListPageComponent = TemplateListPage,
|
|
974
|
+
TemplateWizardPageComponent = TemplateWizardPage
|
|
975
|
+
} = {}
|
|
976
|
+
} = props;
|
|
977
|
+
const outlet = useOutlet() || props.children;
|
|
978
|
+
const customFieldExtensions = useCustomFieldExtensions(outlet);
|
|
979
|
+
const fieldExtensions = [
|
|
980
|
+
...customFieldExtensions,
|
|
981
|
+
...DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS.filter(
|
|
982
|
+
({ name }) => !customFieldExtensions.some(
|
|
983
|
+
(customFieldExtension) => customFieldExtension.name === name
|
|
984
|
+
)
|
|
985
|
+
)
|
|
986
|
+
];
|
|
987
|
+
const customLayouts = useCustomLayouts(outlet);
|
|
988
|
+
return /* @__PURE__ */ React.createElement(Routes, null, /* @__PURE__ */ React.createElement(
|
|
989
|
+
Route,
|
|
990
|
+
{
|
|
991
|
+
path: "/",
|
|
992
|
+
element: /* @__PURE__ */ React.createElement(
|
|
993
|
+
TemplateListPageComponent,
|
|
994
|
+
{
|
|
995
|
+
TemplateCardComponent,
|
|
996
|
+
contextMenu: props.contextMenu,
|
|
997
|
+
groups: props.groups,
|
|
998
|
+
templateFilter: props.templateFilter
|
|
999
|
+
}
|
|
1000
|
+
)
|
|
1001
|
+
}
|
|
1002
|
+
), /* @__PURE__ */ React.createElement(
|
|
1003
|
+
Route,
|
|
1004
|
+
{
|
|
1005
|
+
path: selectedTemplateRouteRef.path,
|
|
1006
|
+
element: /* @__PURE__ */ React.createElement(SecretsContextProvider, null, /* @__PURE__ */ React.createElement(
|
|
1007
|
+
TemplateWizardPageComponent,
|
|
1008
|
+
{
|
|
1009
|
+
customFieldExtensions: fieldExtensions,
|
|
1010
|
+
layouts: customLayouts,
|
|
1011
|
+
FormProps: props.FormProps
|
|
1012
|
+
}
|
|
1013
|
+
))
|
|
1014
|
+
}
|
|
1015
|
+
), /* @__PURE__ */ React.createElement(
|
|
1016
|
+
Route,
|
|
1017
|
+
{
|
|
1018
|
+
path: scaffolderTaskRouteRef.path,
|
|
1019
|
+
element: /* @__PURE__ */ React.createElement(
|
|
1020
|
+
TaskPageComponent,
|
|
1021
|
+
{
|
|
1022
|
+
TemplateOutputsComponent
|
|
1023
|
+
}
|
|
1024
|
+
)
|
|
1025
|
+
}
|
|
1026
|
+
), /* @__PURE__ */ React.createElement(
|
|
1027
|
+
Route,
|
|
1028
|
+
{
|
|
1029
|
+
path: editRouteRef.path,
|
|
1030
|
+
element: /* @__PURE__ */ React.createElement(SecretsContextProvider, null, /* @__PURE__ */ React.createElement(
|
|
1031
|
+
TemplateEditorPage,
|
|
1032
|
+
{
|
|
1033
|
+
customFieldExtensions: fieldExtensions,
|
|
1034
|
+
layouts: customLayouts
|
|
1035
|
+
}
|
|
1036
|
+
))
|
|
1037
|
+
}
|
|
1038
|
+
), /* @__PURE__ */ React.createElement(Route, { path: actionsRouteRef.path, element: /* @__PURE__ */ React.createElement(ActionsPage, null) }), /* @__PURE__ */ React.createElement(
|
|
1039
|
+
Route,
|
|
1040
|
+
{
|
|
1041
|
+
path: scaffolderListTaskRouteRef.path,
|
|
1042
|
+
element: /* @__PURE__ */ React.createElement(ListTasksPage, null)
|
|
1043
|
+
}
|
|
1044
|
+
), /* @__PURE__ */ React.createElement(
|
|
1045
|
+
Route,
|
|
1046
|
+
{
|
|
1047
|
+
path: "*",
|
|
1048
|
+
element: /* @__PURE__ */ React.createElement(ErrorPage, { status: "404", statusMessage: "Page not found" })
|
|
1049
|
+
}
|
|
1050
|
+
));
|
|
1051
|
+
};
|
|
1052
|
+
|
|
1053
|
+
export { Router };
|
|
1054
|
+
//# sourceMappingURL=index-05d3e519.esm.js.map
|