@backstage/plugin-scaffolder 1.15.1 → 1.16.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/alpha/package.json +1 -1
- package/dist/alpha.d.ts +36 -10
- package/dist/alpha.esm.js +87 -11
- package/dist/alpha.esm.js.map +1 -1
- package/dist/esm/{ListTasksPage-b7beed35.esm.js → DryRunResults-a4d44358.esm.js} +1132 -829
- package/dist/esm/DryRunResults-a4d44358.esm.js.map +1 -0
- package/dist/esm/{plugin-76d8b756.esm.js → OngoingTask-8acb140b.esm.js} +292 -11
- package/dist/esm/OngoingTask-8acb140b.esm.js.map +1 -0
- package/dist/esm/{Router-f5f81642.esm.js → Router-b60d8000.esm.js} +172 -168
- package/dist/esm/Router-b60d8000.esm.js.map +1 -0
- package/dist/esm/{index-e1da2925.esm.js → index-52e5acc5.esm.js} +79 -279
- package/dist/esm/index-52e5acc5.esm.js.map +1 -0
- package/dist/index.d.ts +17 -14
- package/dist/index.esm.js +9 -17
- package/dist/index.esm.js.map +1 -1
- package/dist/types/{plugin.d-2d1240f7.d.ts → plugin.d-63255bd3.d.ts} +43 -76
- package/package.json +19 -20
- package/dist/esm/ListTasksPage-b7beed35.esm.js.map +0 -1
- package/dist/esm/Router-f5f81642.esm.js.map +0 -1
- package/dist/esm/TaskPage-d1a669e0.esm.js +0 -322
- package/dist/esm/TaskPage-d1a669e0.esm.js.map +0 -1
- package/dist/esm/TemplateTypePicker-efec8c34.esm.js +0 -66
- package/dist/esm/TemplateTypePicker-efec8c34.esm.js.map +0 -1
- package/dist/esm/index-e1da2925.esm.js.map +0 -1
- package/dist/esm/plugin-76d8b756.esm.js.map +0 -1
|
@@ -1,60 +1,47 @@
|
|
|
1
|
-
import React, { useCallback, useState, useMemo,
|
|
2
|
-
import { Link, useNavigate, Navigate,
|
|
1
|
+
import React, { useCallback, useState, useMemo, Component } from 'react';
|
|
2
|
+
import { Link, useNavigate, Navigate, useOutlet, Routes, Route } from 'react-router-dom';
|
|
3
|
+
import { useTemplateSecrets, scaffolderApiRef, useCustomFieldExtensions, useCustomLayouts, SecretsContextProvider } from '@backstage/plugin-scaffolder-react';
|
|
4
|
+
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 './DryRunResults-a4d44358.esm.js';
|
|
5
|
+
import { u as registerComponentRouteRef, p as editRouteRef, q as actionsRouteRef, t as scaffolderListTaskRouteRef, v as viewTechDocRouteRef, o as selectedTemplateRouteRef, r as rootRouteRef, w as scaffolderTaskRouteRef, e as OngoingTask } from './OngoingTask-8acb140b.esm.js';
|
|
6
|
+
import { DocsIcon, Page, Header, Content, ContentHeader, SupportButton, ErrorPage } from '@backstage/core-components';
|
|
3
7
|
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
8
|
import { EntityListProvider, CatalogFilterLayout, EntitySearchBar, EntityKindPicker, UserListPicker, EntityTagPicker, catalogApiRef, humanizeEntityRef } from '@backstage/plugin-catalog-react';
|
|
6
|
-
import { ScaffolderPageContextMenu, TemplateCategoryPicker, TemplateGroups, Workflow,
|
|
9
|
+
import { ScaffolderPageContextMenu, TemplateCategoryPicker, TemplateGroups, Workflow, createAsyncValidators, Stepper, Form } from '@backstage/plugin-scaffolder-react/alpha';
|
|
7
10
|
import Button from '@material-ui/core/Button';
|
|
8
11
|
import IconButton from '@material-ui/core/IconButton';
|
|
9
12
|
import useMediaQuery from '@material-ui/core/useMediaQuery';
|
|
10
13
|
import AddCircleOutline from '@material-ui/icons/AddCircleOutline';
|
|
11
14
|
import { catalogEntityCreatePermission } from '@backstage/plugin-catalog-common/alpha';
|
|
12
15
|
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-76d8b756.esm.js';
|
|
14
16
|
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-b7beed35.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';
|
|
18
|
-
import qs from 'qs';
|
|
19
|
-
import { useAsync } from '@react-hookz/web';
|
|
20
|
-
import Cancel from '@material-ui/icons/Cancel';
|
|
21
|
-
import Retry from '@material-ui/icons/Repeat';
|
|
22
|
-
import Toc from '@material-ui/icons/Toc';
|
|
23
|
-
import ControlPointIcon from '@material-ui/icons/ControlPoint';
|
|
24
|
-
import MoreVert from '@material-ui/icons/MoreVert';
|
|
25
17
|
import { StreamLanguage } from '@codemirror/language';
|
|
26
18
|
import { yaml as yaml$1 } from '@codemirror/legacy-modes/mode/yaml';
|
|
19
|
+
import { makeStyles as makeStyles$1, FormControl, InputLabel, Select, MenuItem, IconButton as IconButton$1, Card, CardHeader, CardContent, Button as Button$1, LinearProgress } from '@material-ui/core';
|
|
27
20
|
import CloseIcon from '@material-ui/icons/Close';
|
|
28
21
|
import CodeMirror from '@uiw/react-codemirror';
|
|
29
22
|
import yaml from 'yaml';
|
|
30
|
-
import { makeStyles
|
|
23
|
+
import { makeStyles } from '@material-ui/core/styles';
|
|
31
24
|
import useDebounce from 'react-use/lib/useDebounce';
|
|
32
25
|
import validator from '@rjsf/validator-ajv8';
|
|
33
|
-
import 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';
|
|
26
|
+
import useAsync from 'react-use/lib/useAsync';
|
|
48
27
|
import 'classnames';
|
|
49
28
|
import '@material-ui/icons/ExpandMore';
|
|
50
29
|
import '@material-ui/icons/ExpandLess';
|
|
51
30
|
import '@material-ui/core/Chip';
|
|
31
|
+
import '@material-ui/icons/Settings';
|
|
32
|
+
import '@material-ui/icons/FontDownload';
|
|
33
|
+
import 'luxon';
|
|
34
|
+
import 'humanize-duration';
|
|
35
|
+
import '@material-ui/core/Typography';
|
|
52
36
|
import '@material-ui/core/Card';
|
|
53
37
|
import '@material-ui/core/CardActionArea';
|
|
54
38
|
import '@material-ui/core/CardContent';
|
|
55
39
|
import '@material-ui/core/Tooltip';
|
|
56
|
-
import '@material-ui/core/Typography';
|
|
57
40
|
import '@material-ui/icons/InfoOutlined';
|
|
41
|
+
import '@material-ui/icons/Refresh';
|
|
42
|
+
import '@material-ui/icons/Save';
|
|
43
|
+
import '@codemirror/view';
|
|
44
|
+
import '@react-hookz/web';
|
|
58
45
|
import '@material-ui/core/Accordion';
|
|
59
46
|
import '@material-ui/core/AccordionDetails';
|
|
60
47
|
import '@material-ui/core/AccordionSummary';
|
|
@@ -64,30 +51,45 @@ import '@material-ui/core/ListItem';
|
|
|
64
51
|
import '@material-ui/core/ListItemIcon';
|
|
65
52
|
import '@material-ui/core/ListItemSecondaryAction';
|
|
66
53
|
import '@material-ui/core/ListItemText';
|
|
54
|
+
import '@material-ui/icons/Cancel';
|
|
67
55
|
import '@material-ui/icons/Check';
|
|
68
56
|
import '@material-ui/icons/Delete';
|
|
69
57
|
import '@material-ui/icons/GetApp';
|
|
70
58
|
import '@material-ui/core/Box';
|
|
71
59
|
import '@material-ui/core/Tab';
|
|
72
60
|
import '@material-ui/core/Tabs';
|
|
73
|
-
import '
|
|
61
|
+
import '@material-ui/lab/TreeView';
|
|
62
|
+
import '@material-ui/icons/ChevronRight';
|
|
63
|
+
import '@material-ui/lab/TreeItem';
|
|
64
|
+
import '@material-ui/icons/Language';
|
|
74
65
|
import '@material-ui/core/Grid';
|
|
75
66
|
import '@material-ui/core/Step';
|
|
76
67
|
import '@material-ui/core/StepLabel';
|
|
77
68
|
import '@material-ui/core/Stepper';
|
|
78
69
|
import '@material-ui/icons/FiberManualRecord';
|
|
79
|
-
import '
|
|
70
|
+
import 'qs';
|
|
80
71
|
import 'react-use/lib/useInterval';
|
|
81
|
-
import '@
|
|
82
|
-
import '@
|
|
83
|
-
import '
|
|
84
|
-
import '
|
|
85
|
-
import '@
|
|
86
|
-
import '@material-ui/
|
|
87
|
-
import '@
|
|
88
|
-
import '
|
|
89
|
-
import '
|
|
90
|
-
import '
|
|
72
|
+
import '@backstage/integration-react';
|
|
73
|
+
import '@backstage/errors';
|
|
74
|
+
import 'zen-observable';
|
|
75
|
+
import 'event-source-polyfill';
|
|
76
|
+
import '@backstage/catalog-client';
|
|
77
|
+
import '@material-ui/core/FormControl';
|
|
78
|
+
import '@material-ui/lab/Autocomplete';
|
|
79
|
+
import 'zod';
|
|
80
|
+
import 'zod-to-json-schema';
|
|
81
|
+
import '@material-ui/core/FormHelperText';
|
|
82
|
+
import '@material-ui/core/Input';
|
|
83
|
+
import '@material-ui/core/InputLabel';
|
|
84
|
+
import 'react-use/lib/useEffectOnce';
|
|
85
|
+
import '@material-ui/lab';
|
|
86
|
+
import 'lodash/capitalize';
|
|
87
|
+
import '@material-ui/icons/CheckBox';
|
|
88
|
+
import '@material-ui/icons/CheckBoxOutlineBlank';
|
|
89
|
+
import '@material-ui/icons/Repeat';
|
|
90
|
+
import '@material-ui/icons/Toc';
|
|
91
|
+
import '@material-ui/icons/ControlPoint';
|
|
92
|
+
import '@material-ui/icons/MoreVert';
|
|
91
93
|
|
|
92
94
|
const RegisterExistingButton = (props) => {
|
|
93
95
|
const { title, to } = props;
|
|
@@ -236,237 +238,22 @@ const TemplateWizardPage = (props) => {
|
|
|
236
238
|
namespace,
|
|
237
239
|
templateName,
|
|
238
240
|
onCreate,
|
|
241
|
+
components: props.components,
|
|
239
242
|
onError,
|
|
240
243
|
extensions: props.customFieldExtensions,
|
|
241
|
-
|
|
244
|
+
formProps: props.formProps,
|
|
242
245
|
layouts: props.layouts
|
|
243
246
|
}
|
|
244
247
|
)));
|
|
245
248
|
};
|
|
246
249
|
|
|
247
|
-
const useStyles$5 = makeStyles(() => ({
|
|
248
|
-
button: {
|
|
249
|
-
color: ({ fontColor }) => fontColor
|
|
250
|
-
}
|
|
251
|
-
}));
|
|
252
|
-
const ContextMenu = (props) => {
|
|
253
|
-
const {
|
|
254
|
-
cancelEnabled,
|
|
255
|
-
logsVisible,
|
|
256
|
-
buttonBarVisible,
|
|
257
|
-
onStartOver,
|
|
258
|
-
onToggleLogs,
|
|
259
|
-
onToggleButtonBar,
|
|
260
|
-
taskId
|
|
261
|
-
} = props;
|
|
262
|
-
const { getPageTheme } = useTheme();
|
|
263
|
-
const pageTheme = getPageTheme({ themeId: "website" });
|
|
264
|
-
const classes = useStyles$5({ fontColor: pageTheme.fontColor });
|
|
265
|
-
const scaffolderApi = useApi(scaffolderApiRef);
|
|
266
|
-
const [anchorEl, setAnchorEl] = useState();
|
|
267
|
-
const [{ status: cancelStatus }, { execute: cancel }] = useAsync(async () => {
|
|
268
|
-
if (taskId) {
|
|
269
|
-
await scaffolderApi.cancelTask(taskId);
|
|
270
|
-
}
|
|
271
|
-
});
|
|
272
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
|
|
273
|
-
IconButton$1,
|
|
274
|
-
{
|
|
275
|
-
"aria-label": "more",
|
|
276
|
-
"aria-controls": "long-menu",
|
|
277
|
-
"aria-haspopup": "true",
|
|
278
|
-
onClick: (event) => {
|
|
279
|
-
setAnchorEl(event.currentTarget);
|
|
280
|
-
},
|
|
281
|
-
"data-testid": "menu-button",
|
|
282
|
-
className: classes.button
|
|
283
|
-
},
|
|
284
|
-
/* @__PURE__ */ React.createElement(MoreVert, null)
|
|
285
|
-
), /* @__PURE__ */ React.createElement(
|
|
286
|
-
Popover,
|
|
287
|
-
{
|
|
288
|
-
open: Boolean(anchorEl),
|
|
289
|
-
onClose: () => setAnchorEl(void 0),
|
|
290
|
-
anchorEl,
|
|
291
|
-
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
292
|
-
transformOrigin: { vertical: "top", horizontal: "right" }
|
|
293
|
-
},
|
|
294
|
-
/* @__PURE__ */ React.createElement(MenuList, null, /* @__PURE__ */ React.createElement(MenuItem, { onClick: () => onToggleLogs == null ? void 0 : onToggleLogs(!logsVisible) }, /* @__PURE__ */ React.createElement(ListItemIcon, null, /* @__PURE__ */ React.createElement(Toc, { fontSize: "small" })), /* @__PURE__ */ React.createElement(ListItemText, { primary: logsVisible ? "Hide Logs" : "Show Logs" })), /* @__PURE__ */ React.createElement(MenuItem, { onClick: () => onToggleButtonBar == null ? void 0 : onToggleButtonBar(!buttonBarVisible) }, /* @__PURE__ */ React.createElement(ListItemIcon, null, /* @__PURE__ */ React.createElement(ControlPointIcon, { fontSize: "small" })), /* @__PURE__ */ React.createElement(
|
|
295
|
-
ListItemText,
|
|
296
|
-
{
|
|
297
|
-
primary: buttonBarVisible ? "Hide Button Bar" : "Show Button Bar"
|
|
298
|
-
}
|
|
299
|
-
)), /* @__PURE__ */ React.createElement(MenuItem, { onClick: onStartOver }, /* @__PURE__ */ React.createElement(ListItemIcon, null, /* @__PURE__ */ React.createElement(Retry, { fontSize: "small" })), /* @__PURE__ */ React.createElement(ListItemText, { primary: "Start Over" })), /* @__PURE__ */ React.createElement(
|
|
300
|
-
MenuItem,
|
|
301
|
-
{
|
|
302
|
-
onClick: cancel,
|
|
303
|
-
disabled: !cancelEnabled || cancelStatus !== "not-executed",
|
|
304
|
-
"data-testid": "cancel-task"
|
|
305
|
-
},
|
|
306
|
-
/* @__PURE__ */ React.createElement(ListItemIcon, null, /* @__PURE__ */ React.createElement(Cancel, { fontSize: "small" })),
|
|
307
|
-
/* @__PURE__ */ React.createElement(ListItemText, { primary: "Cancel" })
|
|
308
|
-
))
|
|
309
|
-
));
|
|
310
|
-
};
|
|
311
|
-
|
|
312
|
-
const useStyles$4 = makeStyles((theme) => ({
|
|
313
|
-
contentWrapper: {
|
|
314
|
-
display: "flex",
|
|
315
|
-
flexDirection: "column"
|
|
316
|
-
},
|
|
317
|
-
buttonBar: {
|
|
318
|
-
display: "flex",
|
|
319
|
-
flexDirection: "row",
|
|
320
|
-
justifyContent: "right"
|
|
321
|
-
},
|
|
322
|
-
cancelButton: {
|
|
323
|
-
marginRight: theme.spacing(1)
|
|
324
|
-
},
|
|
325
|
-
logsVisibilityButton: {
|
|
326
|
-
marginRight: theme.spacing(1)
|
|
327
|
-
}
|
|
328
|
-
}));
|
|
329
|
-
const OngoingTask = (props) => {
|
|
330
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
331
|
-
const { taskId } = useParams();
|
|
332
|
-
const templateRouteRef = useRouteRef(selectedTemplateRouteRef);
|
|
333
|
-
const navigate = useNavigate();
|
|
334
|
-
const scaffolderApi = useApi(scaffolderApiRef);
|
|
335
|
-
const taskStream = useTaskEventStream(taskId);
|
|
336
|
-
const classes = useStyles$4();
|
|
337
|
-
const steps = useMemo(
|
|
338
|
-
() => {
|
|
339
|
-
var _a2, _b2;
|
|
340
|
-
return (_b2 = (_a2 = taskStream.task) == null ? void 0 : _a2.spec.steps.map((step) => {
|
|
341
|
-
var _a3;
|
|
342
|
-
return {
|
|
343
|
-
...step,
|
|
344
|
-
...(_a3 = taskStream == null ? void 0 : taskStream.steps) == null ? void 0 : _a3[step.id]
|
|
345
|
-
};
|
|
346
|
-
})) != null ? _b2 : [];
|
|
347
|
-
},
|
|
348
|
-
[taskStream]
|
|
349
|
-
);
|
|
350
|
-
const [logsVisible, setLogVisibleState] = useState(false);
|
|
351
|
-
const [buttonBarVisible, setButtonBarVisibleState] = useState(true);
|
|
352
|
-
useEffect(() => {
|
|
353
|
-
if (taskStream.error) {
|
|
354
|
-
setLogVisibleState(true);
|
|
355
|
-
}
|
|
356
|
-
}, [taskStream.error]);
|
|
357
|
-
useEffect(() => {
|
|
358
|
-
if (taskStream.completed && !taskStream.error) {
|
|
359
|
-
setButtonBarVisibleState(false);
|
|
360
|
-
}
|
|
361
|
-
}, [taskStream.error, taskStream.completed]);
|
|
362
|
-
const activeStep = useMemo(() => {
|
|
363
|
-
for (let i = steps.length - 1; i >= 0; i--) {
|
|
364
|
-
if (steps[i].status !== "open") {
|
|
365
|
-
return i;
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
return 0;
|
|
369
|
-
}, [steps]);
|
|
370
|
-
const startOver = useCallback(() => {
|
|
371
|
-
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
372
|
-
const { namespace, name } = (_d2 = (_c2 = (_b2 = (_a2 = taskStream.task) == null ? void 0 : _a2.spec.templateInfo) == null ? void 0 : _b2.entity) == null ? void 0 : _c2.metadata) != null ? _d2 : {};
|
|
373
|
-
const formData = (_f2 = (_e2 = taskStream.task) == null ? void 0 : _e2.spec.parameters) != null ? _f2 : {};
|
|
374
|
-
if (!namespace || !name) {
|
|
375
|
-
return;
|
|
376
|
-
}
|
|
377
|
-
navigate({
|
|
378
|
-
pathname: templateRouteRef({
|
|
379
|
-
namespace,
|
|
380
|
-
templateName: name
|
|
381
|
-
}),
|
|
382
|
-
search: `?${qs.stringify({ formData: JSON.stringify(formData) })}`
|
|
383
|
-
});
|
|
384
|
-
}, [
|
|
385
|
-
navigate,
|
|
386
|
-
(_a = taskStream.task) == null ? void 0 : _a.spec.parameters,
|
|
387
|
-
(_d = (_c = (_b = taskStream.task) == null ? void 0 : _b.spec.templateInfo) == null ? void 0 : _c.entity) == null ? void 0 : _d.metadata,
|
|
388
|
-
templateRouteRef
|
|
389
|
-
]);
|
|
390
|
-
const [{ status: cancelStatus }, { execute: triggerCancel }] = useAsync(
|
|
391
|
-
async () => {
|
|
392
|
-
if (taskId) {
|
|
393
|
-
await scaffolderApi.cancelTask(taskId);
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
);
|
|
397
|
-
const Outputs = (_e = props.TemplateOutputsComponent) != null ? _e : DefaultTemplateOutputs;
|
|
398
|
-
const templateName = (_h = (_g = (_f = taskStream.task) == null ? void 0 : _f.spec.templateInfo) == null ? void 0 : _g.entity) == null ? void 0 : _h.metadata.name;
|
|
399
|
-
const cancelEnabled = !(taskStream.cancelled || taskStream.completed);
|
|
400
|
-
return /* @__PURE__ */ React.createElement(Page, { themeId: "website" }, /* @__PURE__ */ React.createElement(
|
|
401
|
-
Header,
|
|
402
|
-
{
|
|
403
|
-
pageTitleOverride: `Run of ${templateName}`,
|
|
404
|
-
title: /* @__PURE__ */ React.createElement("div", null, "Run of ", /* @__PURE__ */ React.createElement("code", null, templateName)),
|
|
405
|
-
subtitle: `Task ${taskId}`
|
|
406
|
-
},
|
|
407
|
-
/* @__PURE__ */ React.createElement(
|
|
408
|
-
ContextMenu,
|
|
409
|
-
{
|
|
410
|
-
cancelEnabled,
|
|
411
|
-
logsVisible,
|
|
412
|
-
buttonBarVisible,
|
|
413
|
-
onStartOver: startOver,
|
|
414
|
-
onToggleLogs: setLogVisibleState,
|
|
415
|
-
onToggleButtonBar: setButtonBarVisibleState,
|
|
416
|
-
taskId
|
|
417
|
-
}
|
|
418
|
-
)
|
|
419
|
-
), /* @__PURE__ */ React.createElement(Content, { className: classes.contentWrapper }, taskStream.error ? /* @__PURE__ */ React.createElement(Box, { paddingBottom: 2 }, /* @__PURE__ */ React.createElement(
|
|
420
|
-
ErrorPanel,
|
|
421
|
-
{
|
|
422
|
-
error: taskStream.error,
|
|
423
|
-
title: taskStream.error.message
|
|
424
|
-
}
|
|
425
|
-
)) : null, /* @__PURE__ */ React.createElement(Box, { paddingBottom: 2 }, /* @__PURE__ */ React.createElement(
|
|
426
|
-
TaskSteps,
|
|
427
|
-
{
|
|
428
|
-
steps,
|
|
429
|
-
activeStep,
|
|
430
|
-
isComplete: taskStream.completed,
|
|
431
|
-
isError: Boolean(taskStream.error)
|
|
432
|
-
}
|
|
433
|
-
)), /* @__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(
|
|
434
|
-
Button$1,
|
|
435
|
-
{
|
|
436
|
-
className: classes.cancelButton,
|
|
437
|
-
disabled: !cancelEnabled || cancelStatus !== "not-executed",
|
|
438
|
-
onClick: triggerCancel,
|
|
439
|
-
"data-testid": "cancel-button"
|
|
440
|
-
},
|
|
441
|
-
"Cancel"
|
|
442
|
-
), /* @__PURE__ */ React.createElement(
|
|
443
|
-
Button$1,
|
|
444
|
-
{
|
|
445
|
-
className: classes.logsVisibilityButton,
|
|
446
|
-
color: "primary",
|
|
447
|
-
variant: "outlined",
|
|
448
|
-
onClick: () => setLogVisibleState(!logsVisible)
|
|
449
|
-
},
|
|
450
|
-
logsVisible ? "Hide Logs" : "Show Logs"
|
|
451
|
-
), /* @__PURE__ */ React.createElement(
|
|
452
|
-
Button$1,
|
|
453
|
-
{
|
|
454
|
-
variant: "contained",
|
|
455
|
-
color: "primary",
|
|
456
|
-
disabled: cancelEnabled,
|
|
457
|
-
onClick: startOver
|
|
458
|
-
},
|
|
459
|
-
"Start Over"
|
|
460
|
-
))))) : 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));
|
|
461
|
-
};
|
|
462
|
-
|
|
463
250
|
var __defProp = Object.defineProperty;
|
|
464
251
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
465
252
|
var __publicField = (obj, key, value) => {
|
|
466
253
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
467
254
|
return value;
|
|
468
255
|
};
|
|
469
|
-
const useStyles$3 = makeStyles
|
|
256
|
+
const useStyles$3 = makeStyles({
|
|
470
257
|
containerWrapper: {
|
|
471
258
|
position: "relative",
|
|
472
259
|
width: "100%",
|
|
@@ -516,6 +303,11 @@ function TemplateEditorForm(props) {
|
|
|
516
303
|
const classes = useStyles$3();
|
|
517
304
|
const apiHolder = useApiHolder();
|
|
518
305
|
const [steps, setSteps] = useState();
|
|
306
|
+
const fields = useMemo(() => {
|
|
307
|
+
return Object.fromEntries(
|
|
308
|
+
fieldExtensions.map(({ name, component }) => [name, component])
|
|
309
|
+
);
|
|
310
|
+
}, [fieldExtensions]);
|
|
519
311
|
useDebounce(
|
|
520
312
|
() => {
|
|
521
313
|
try {
|
|
@@ -523,7 +315,7 @@ function TemplateEditorForm(props) {
|
|
|
523
315
|
setSteps(void 0);
|
|
524
316
|
return;
|
|
525
317
|
}
|
|
526
|
-
const parsed = yaml.
|
|
318
|
+
const parsed = yaml.parseAllDocuments(content).filter((c) => c).map((c) => c.toJSON())[0];
|
|
527
319
|
if (!isJsonObject(parsed)) {
|
|
528
320
|
setSteps(void 0);
|
|
529
321
|
return;
|
|
@@ -543,13 +335,19 @@ function TemplateEditorForm(props) {
|
|
|
543
335
|
setSteps(void 0);
|
|
544
336
|
return;
|
|
545
337
|
}
|
|
338
|
+
const fieldValidators = Object.fromEntries(
|
|
339
|
+
fieldExtensions.map(({ name, validation }) => [name, validation])
|
|
340
|
+
);
|
|
546
341
|
setErrorText();
|
|
547
342
|
setSteps(
|
|
548
343
|
parameters.flatMap(
|
|
549
344
|
(param) => isJsonObject(param) ? [
|
|
550
345
|
{
|
|
551
346
|
title: String(param.title),
|
|
552
|
-
schema: param
|
|
347
|
+
schema: param,
|
|
348
|
+
validate: createAsyncValidators(param, fieldValidators, {
|
|
349
|
+
apiHolder
|
|
350
|
+
})
|
|
553
351
|
}
|
|
554
352
|
] : []
|
|
555
353
|
)
|
|
@@ -569,11 +367,11 @@ function TemplateEditorForm(props) {
|
|
|
569
367
|
{
|
|
570
368
|
manifest: { steps, title: "Template Editor" },
|
|
571
369
|
extensions: fieldExtensions,
|
|
572
|
-
|
|
573
|
-
|
|
370
|
+
components: fields,
|
|
371
|
+
onCreate: async (options) => {
|
|
372
|
+
await (onDryRun == null ? void 0 : onDryRun(options));
|
|
574
373
|
},
|
|
575
|
-
layouts
|
|
576
|
-
components: { createButtonText: onDryRun && "Try It" }
|
|
374
|
+
layouts
|
|
577
375
|
}
|
|
578
376
|
))));
|
|
579
377
|
}
|
|
@@ -582,14 +380,14 @@ function TemplateEditorFormDirectoryEditorDryRun(props) {
|
|
|
582
380
|
const dryRun = useDryRun();
|
|
583
381
|
const directoryEditor = useDirectoryEditor();
|
|
584
382
|
const { selectedFile } = directoryEditor;
|
|
585
|
-
const handleDryRun = async (
|
|
383
|
+
const handleDryRun = async (data) => {
|
|
586
384
|
if (!selectedFile) {
|
|
587
385
|
return;
|
|
588
386
|
}
|
|
589
387
|
try {
|
|
590
388
|
await dryRun.execute({
|
|
591
389
|
templateContent: selectedFile.content,
|
|
592
|
-
values,
|
|
390
|
+
values: data,
|
|
593
391
|
files: directoryEditor.files
|
|
594
392
|
});
|
|
595
393
|
setErrorText();
|
|
@@ -612,7 +410,7 @@ function TemplateEditorFormDirectoryEditorDryRun(props) {
|
|
|
612
410
|
}
|
|
613
411
|
TemplateEditorForm.DirectoryEditorDryRun = TemplateEditorFormDirectoryEditorDryRun;
|
|
614
412
|
|
|
615
|
-
const useStyles$2 = makeStyles((theme) => ({
|
|
413
|
+
const useStyles$2 = makeStyles$1((theme) => ({
|
|
616
414
|
root: {
|
|
617
415
|
gridArea: "pageContent",
|
|
618
416
|
display: "grid",
|
|
@@ -738,7 +536,7 @@ const CustomFieldExplorer = ({
|
|
|
738
536
|
)));
|
|
739
537
|
};
|
|
740
538
|
|
|
741
|
-
const useStyles$1 = makeStyles({
|
|
539
|
+
const useStyles$1 = makeStyles$1({
|
|
742
540
|
// Reset and fix sizing to make sure scrolling behaves correctly
|
|
743
541
|
root: {
|
|
744
542
|
gridArea: "pageContent",
|
|
@@ -817,7 +615,7 @@ steps:
|
|
|
817
615
|
values:
|
|
818
616
|
name: \${{parameters.name}}
|
|
819
617
|
`;
|
|
820
|
-
const useStyles = makeStyles((theme) => ({
|
|
618
|
+
const useStyles = makeStyles$1((theme) => ({
|
|
821
619
|
root: {
|
|
822
620
|
gridArea: "pageContent",
|
|
823
621
|
display: "grid",
|
|
@@ -855,7 +653,7 @@ const TemplateFormPreviewer = ({
|
|
|
855
653
|
const [errorText, setErrorText] = useState();
|
|
856
654
|
const [templateOptions, setTemplateOptions] = useState([]);
|
|
857
655
|
const [templateYaml, setTemplateYaml] = useState(defaultPreviewTemplate);
|
|
858
|
-
const { loading } = useAsync
|
|
656
|
+
const { loading } = useAsync(
|
|
859
657
|
() => catalogApi.getEntities({
|
|
860
658
|
filter: { kind: "template" },
|
|
861
659
|
fields: [
|
|
@@ -982,10 +780,11 @@ const Router = (props) => {
|
|
|
982
780
|
const {
|
|
983
781
|
components: {
|
|
984
782
|
TemplateCardComponent,
|
|
985
|
-
TemplateOutputsComponent,
|
|
986
783
|
TaskPageComponent = OngoingTask,
|
|
987
|
-
|
|
988
|
-
|
|
784
|
+
ReviewStepComponent,
|
|
785
|
+
EXPERIMENTAL_TemplateOutputsComponent: TemplateOutputsComponent,
|
|
786
|
+
EXPERIMENTAL_TemplateListPageComponent: TemplateListPageComponent = TemplateListPage,
|
|
787
|
+
EXPERIMENTAL_TemplateWizardPageComponent: TemplateWizardPageComponent = TemplateWizardPage
|
|
989
788
|
} = {}
|
|
990
789
|
} = props;
|
|
991
790
|
const outlet = useOutlet() || props.children;
|
|
@@ -1022,7 +821,8 @@ const Router = (props) => {
|
|
|
1022
821
|
{
|
|
1023
822
|
customFieldExtensions: fieldExtensions,
|
|
1024
823
|
layouts: customLayouts,
|
|
1025
|
-
|
|
824
|
+
components: { ReviewStepComponent },
|
|
825
|
+
formProps: props.formProps
|
|
1026
826
|
}
|
|
1027
827
|
))
|
|
1028
828
|
}
|
|
@@ -1065,4 +865,4 @@ const Router = (props) => {
|
|
|
1065
865
|
};
|
|
1066
866
|
|
|
1067
867
|
export { Router };
|
|
1068
|
-
//# sourceMappingURL=index-
|
|
868
|
+
//# sourceMappingURL=index-52e5acc5.esm.js.map
|