@backstage/plugin-scaffolder 1.11.0-next.0 → 1.11.0-next.2

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.
@@ -1,14 +1,14 @@
1
- import React, { useState, useCallback, Fragment, createContext, useEffect, useContext, useRef, useMemo, Component, Children } from 'react';
1
+ import React, { useState, useCallback, createContext, useEffect, useContext, useRef, useMemo, Component, Children } from 'react';
2
2
  import { useNavigate, Navigate, useOutlet, Routes, Route } from 'react-router-dom';
3
- import { ItemCardHeader, MarkdownContent, Button, Link, ContentHeader, Progress, WarningPanel, Content, ItemCardGrid, Page, Header, CreateButton, SupportButton, StructuredMetadataTable, InfoCard, ErrorPage, CodeSnippet, ErrorPanel, LogViewer, StatusError, StatusOK, StatusPending, Lifecycle, EmptyState, Table as Table$1 } from '@backstage/core-components';
3
+ import { ItemCardHeader, MarkdownContent, Button, Link, ContentHeader, Progress, WarningPanel, Content, ItemCardGrid, Page, Header, CreateButton, SupportButton, StructuredMetadataTable, InfoCard, ErrorPanel, LogViewer } from '@backstage/core-components';
4
4
  import { useApp, useRouteRef, useApi, useRouteRefParams, useAnalytics, errorApiRef, featureFlagsApiRef, useApiHolder, AnalyticsContext, alertApiRef } from '@backstage/core-plugin-api';
5
- import { getEntityRelations, getEntitySourceLocation, FavoriteEntity, EntityRefLinks, useEntityList, EntityListProvider, CatalogFilterLayout, EntitySearchBar, EntityKindPicker, UserListPicker, EntityTagPicker, catalogApiRef, humanizeEntityRef, EntityRefLink } from '@backstage/plugin-catalog-react';
5
+ import { getEntityRelations, getEntitySourceLocation, FavoriteEntity, EntityRefLinks, useEntityList, EntityListProvider, CatalogFilterLayout, EntitySearchBar, EntityKindPicker, UserListPicker, EntityTagPicker, catalogApiRef, humanizeEntityRef } from '@backstage/plugin-catalog-react';
6
6
  import { RELATION_OWNED_BY, parseEntityRef, stringifyEntityRef, DEFAULT_NAMESPACE } from '@backstage/catalog-model';
7
- import { makeStyles, useTheme, Card, CardMedia, CardContent, Box, Typography, Chip, CardActions, Tooltip, IconButton, Paper, Button as Button$1, Stepper, Step, StepLabel, StepContent, LinearProgress, Accordion, AccordionSummary, AccordionDetails, Grid, TableContainer, Table, TableHead, TableRow, TableCell, TableBody, FormControl, InputLabel, Select, MenuItem as MenuItem$1, CardHeader, Divider as Divider$1, List as List$2, ListItemIcon as ListItemIcon$1, ListItemText as ListItemText$1 } from '@material-ui/core';
7
+ import { makeStyles, useTheme, Card, CardMedia, CardContent, Box, Typography, Chip, CardActions, Tooltip, IconButton, Paper, Button as Button$1, Stepper, Step, StepLabel, StepContent, LinearProgress, FormControl, InputLabel, Select, MenuItem as MenuItem$1, CardHeader, Divider as Divider$1 } from '@material-ui/core';
8
8
  import { scmIntegrationsApiRef, ScmIntegrationIcon } from '@backstage/integration-react';
9
9
  import LanguageIcon from '@material-ui/icons/Language';
10
10
  import WarningIcon from '@material-ui/icons/Warning';
11
- import { s as selectedTemplateRouteRef, v as viewTechDocRouteRef, e as editRouteRef, a as actionsRouteRef, b as scaffolderListTaskRouteRef, r as registerComponentRouteRef, T as TemplateTypePicker, c as scaffolderTaskRouteRef, d as rootRouteRef, f as TaskStatusStepper, g as TaskPageLinks, l as legacySelectedTemplateRouteRef, h as TaskPage } from './index-42d9f897.esm.js';
11
+ import { s as selectedTemplateRouteRef, v as viewTechDocRouteRef, e as editRouteRef, a as actionsRouteRef, b as scaffolderListTaskRouteRef, r as registerComponentRouteRef, T as TemplateTypePicker, c as scaffolderTaskRouteRef, d as rootRouteRef, f as TaskStatusStepper, g as TaskPageLinks, l as legacySelectedTemplateRouteRef, A as ActionsPage, h as TaskPage } from './index-02b0e824.esm.js';
12
12
  import { catalogEntityCreatePermission } from '@backstage/plugin-catalog-common';
13
13
  import { usePermission } from '@backstage/plugin-permission-react';
14
14
  import IconButton$1 from '@material-ui/core/IconButton';
@@ -28,8 +28,6 @@ import { extractSchemaFromStep, useTemplateSecrets, scaffolderApiRef, useCustomF
28
28
  import { withTheme } from '@rjsf/core';
29
29
  import { Theme } from '@rjsf/material-ui';
30
30
  import cloneDeep from 'lodash/cloneDeep';
31
- import classNames from 'classnames';
32
- import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
33
31
  import { StreamLanguage } from '@codemirror/language';
34
32
  import { yaml as yaml$1 } from '@codemirror/legacy-modes/mode/yaml';
35
33
  import CloseIcon from '@material-ui/icons/Close';
@@ -43,9 +41,9 @@ import CardContent$1 from '@material-ui/core/CardContent';
43
41
  import Tooltip$1 from '@material-ui/core/Tooltip';
44
42
  import Typography$1 from '@material-ui/core/Typography';
45
43
  import InfoOutlinedIcon from '@material-ui/icons/InfoOutlined';
46
- import Accordion$1 from '@material-ui/core/Accordion';
47
- import AccordionDetails$1 from '@material-ui/core/AccordionDetails';
48
- import AccordionSummary$1 from '@material-ui/core/AccordionSummary';
44
+ import Accordion from '@material-ui/core/Accordion';
45
+ import AccordionDetails from '@material-ui/core/AccordionDetails';
46
+ import AccordionSummary from '@material-ui/core/AccordionSummary';
49
47
  import Divider from '@material-ui/core/Divider';
50
48
  import ExpandMoreIcon$1 from '@material-ui/icons/ExpandLess';
51
49
  import List$1 from '@material-ui/core/List';
@@ -58,16 +56,14 @@ import Box$1 from '@material-ui/core/Box';
58
56
  import Tab from '@material-ui/core/Tab';
59
57
  import Tabs from '@material-ui/core/Tabs';
60
58
  import TreeView from '@material-ui/lab/TreeView';
59
+ import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
61
60
  import ChevronRightIcon from '@material-ui/icons/ChevronRight';
62
61
  import TreeItem from '@material-ui/lab/TreeItem';
62
+ import classNames from 'classnames';
63
63
  import RefreshIcon from '@material-ui/icons/Refresh';
64
64
  import SaveIcon from '@material-ui/icons/Save';
65
65
  import { showPanel } from '@codemirror/view';
66
- import { D as DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS } from './default-35e63cd4.esm.js';
67
- import SettingsIcon from '@material-ui/icons/Settings';
68
- import AllIcon from '@material-ui/icons/FontDownload';
69
- import { DateTime, Interval } from 'luxon';
70
- import humanizeDuration from 'humanize-duration';
66
+ import { D as DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS, L as ListTasksPage } from './ListTasksPage-6e377096.esm.js';
71
67
  import '@backstage/errors';
72
68
  import 'zen-observable';
73
69
  import '@material-ui/core/FormControl';
@@ -85,15 +81,25 @@ import '@material-ui/icons/CheckBoxOutlineBlank';
85
81
  import '@material-ui/core/Button';
86
82
  import '@material-ui/core/useMediaQuery';
87
83
  import '@material-ui/icons/AddCircleOutline';
84
+ import 'use-immer';
85
+ import '@material-ui/icons/RemoveCircleOutline';
86
+ import '@material-ui/icons/PanoramaFishEye';
87
+ import '@material-ui/icons/CheckCircleOutline';
88
+ import '@material-ui/icons/ErrorOutline';
89
+ import 'react-use/lib/useInterval';
90
+ import 'luxon';
91
+ import 'humanize-duration';
92
+ import '@material-ui/icons/Repeat';
93
+ import '@material-ui/icons/Toc';
94
+ import '@material-ui/icons/Settings';
95
+ import '@material-ui/icons/FontDownload';
88
96
  import '@material-ui/core/Grid';
89
97
  import '@material-ui/core/Step';
90
98
  import '@material-ui/core/StepLabel';
91
99
  import '@material-ui/core/Stepper';
92
100
  import '@material-ui/icons/FiberManualRecord';
93
- import 'react-use/lib/useInterval';
94
- import 'use-immer';
95
101
 
96
- const useStyles$f = makeStyles((theme) => ({
102
+ const useStyles$d = makeStyles((theme) => ({
97
103
  cardHeader: {
98
104
  position: "relative"
99
105
  },
@@ -183,7 +189,7 @@ const TemplateCard = ({ template, deprecated }) => {
183
189
  );
184
190
  const themeId = backstageTheme.getPageTheme({ themeId: templateProps.type }) ? templateProps.type : "other";
185
191
  const theme = backstageTheme.getPageTheme({ themeId });
186
- const classes = useStyles$f({ backgroundImage: theme.backgroundImage });
192
+ const classes = useStyles$d({ backgroundImage: theme.backgroundImage });
187
193
  const { name, namespace } = parseEntityRef(stringifyEntityRef(template));
188
194
  const href = templateRoute({ templateName: name, namespace });
189
195
  const viewTechDoc = useRouteRef(viewTechDocRouteRef);
@@ -295,13 +301,13 @@ const TemplateList = ({
295
301
  )))));
296
302
  };
297
303
 
298
- const useStyles$e = makeStyles$1({
304
+ const useStyles$c = makeStyles$1({
299
305
  button: {
300
306
  color: "white"
301
307
  }
302
308
  });
303
309
  function ScaffolderPageContextMenu(props) {
304
- const classes = useStyles$e();
310
+ const classes = useStyles$c();
305
311
  const [anchorEl, setAnchorEl] = useState();
306
312
  const editLink = useRouteRef(editRouteRef);
307
313
  const actionsLink = useRouteRef(actionsRouteRef);
@@ -511,31 +517,32 @@ var fieldOverrides = /*#__PURE__*/Object.freeze({
511
517
 
512
518
  function getReviewData(formData, uiSchemas) {
513
519
  const reviewData = {};
514
- for (const key in formData) {
515
- if (formData.hasOwnProperty(key)) {
516
- const uiSchema = uiSchemas.find((us) => us.name === key);
517
- if (!uiSchema) {
518
- reviewData[key] = formData[key];
519
- continue;
520
- }
521
- if (uiSchema["ui:widget"] === "password") {
522
- reviewData[key] = "******";
523
- continue;
524
- }
525
- if (!uiSchema["ui:backstage"] || !uiSchema["ui:backstage"].review) {
526
- reviewData[key] = formData[key];
527
- continue;
528
- }
529
- const review = uiSchema["ui:backstage"].review;
530
- if (review.mask) {
531
- reviewData[key] = review.mask;
532
- continue;
533
- }
534
- if (!review.show) {
535
- continue;
536
- }
520
+ const orderedReviewProperties = new Set(
521
+ uiSchemas.map((us) => us.name).concat(Object.getOwnPropertyNames(formData))
522
+ );
523
+ for (const key of orderedReviewProperties) {
524
+ const uiSchema = uiSchemas.find((us) => us.name === key);
525
+ if (!uiSchema) {
526
+ reviewData[key] = formData[key];
527
+ continue;
528
+ }
529
+ if (uiSchema["ui:widget"] === "password") {
530
+ reviewData[key] = "******";
531
+ continue;
532
+ }
533
+ if (!uiSchema["ui:backstage"] || !uiSchema["ui:backstage"].review) {
537
534
  reviewData[key] = formData[key];
535
+ continue;
536
+ }
537
+ const review = uiSchema["ui:backstage"].review;
538
+ if (review.mask) {
539
+ reviewData[key] = review.mask;
540
+ continue;
538
541
  }
542
+ if (!review.show) {
543
+ continue;
544
+ }
545
+ reviewData[key] = formData[key];
539
546
  }
540
547
  return reviewData;
541
548
  }
@@ -566,7 +573,12 @@ const ReviewStep = (props) => {
566
573
  StructuredMetadataTable,
567
574
  {
568
575
  dense: true,
569
- metadata: getReviewData(formData, getUiSchemasFromSteps(steps))
576
+ metadata: getReviewData(
577
+ formData,
578
+ getUiSchemasFromSteps(
579
+ steps.map(({ mergedSchema }) => ({ schema: mergedSchema }))
580
+ )
581
+ )
570
582
  }
571
583
  ), /* @__PURE__ */ React.createElement(Box, { mb: 4 }), /* @__PURE__ */ React.createElement(Button$1, { onClick: handleBack, disabled: disableButtons }, "Back"), /* @__PURE__ */ React.createElement(Button$1, { onClick: handleReset, disabled: disableButtons }, "Reset"), /* @__PURE__ */ React.createElement(
572
584
  Button$1,
@@ -863,103 +875,6 @@ const TemplatePage = ({
863
875
  ))));
864
876
  };
865
877
 
866
- const useStyles$d = makeStyles((theme) => ({
867
- code: {
868
- fontFamily: "Menlo, monospace",
869
- padding: theme.spacing(1),
870
- backgroundColor: theme.palette.type === "dark" ? theme.palette.grey[700] : theme.palette.grey[300],
871
- display: "inline-block",
872
- borderRadius: 5,
873
- border: `1px solid ${theme.palette.grey[500]}`,
874
- position: "relative"
875
- },
876
- codeRequired: {
877
- "&::after": {
878
- position: "absolute",
879
- content: '"*"',
880
- top: 0,
881
- right: theme.spacing(0.5),
882
- fontWeight: "bolder",
883
- color: theme.palette.error.light
884
- }
885
- }
886
- }));
887
- const ExamplesTable = (props) => {
888
- return /* @__PURE__ */ React.createElement(Grid, { container: true }, props.examples.map((example, index) => {
889
- return /* @__PURE__ */ React.createElement(Fragment, { key: `example-${index}` }, /* @__PURE__ */ React.createElement(Grid, { item: true, lg: 3 }, /* @__PURE__ */ React.createElement(Box, { padding: 4 }, /* @__PURE__ */ React.createElement(Typography, null, example.description))), /* @__PURE__ */ React.createElement(Grid, { item: true, lg: 9 }, /* @__PURE__ */ React.createElement(Box, { padding: 1 }, /* @__PURE__ */ React.createElement(
890
- CodeSnippet,
891
- {
892
- text: example.example,
893
- showLineNumbers: true,
894
- showCopyCodeButton: true,
895
- language: "yaml"
896
- }
897
- ))));
898
- }));
899
- };
900
- const ActionsPage = () => {
901
- const api = useApi(scaffolderApiRef);
902
- const classes = useStyles$d();
903
- const { loading, value, error } = useAsync(async () => {
904
- return api.listActions();
905
- });
906
- if (loading) {
907
- return /* @__PURE__ */ React.createElement(Progress, null);
908
- }
909
- if (error) {
910
- return /* @__PURE__ */ React.createElement(
911
- ErrorPage,
912
- {
913
- statusMessage: "Failed to load installed actions",
914
- status: "500"
915
- }
916
- );
917
- }
918
- const formatRows = (input) => {
919
- const properties = input.properties;
920
- if (!properties) {
921
- return void 0;
922
- }
923
- return Object.entries(properties).map((entry) => {
924
- var _a;
925
- const [key] = entry;
926
- const props = entry[1];
927
- const codeClassname = classNames(classes.code, {
928
- [classes.codeRequired]: (_a = input.required) == null ? void 0 : _a.includes(key)
929
- });
930
- return /* @__PURE__ */ React.createElement(TableRow, { key }, /* @__PURE__ */ React.createElement(TableCell, null, /* @__PURE__ */ React.createElement("div", { className: codeClassname }, key)), /* @__PURE__ */ React.createElement(TableCell, null, props.title), /* @__PURE__ */ React.createElement(TableCell, null, props.description), /* @__PURE__ */ React.createElement(TableCell, null, /* @__PURE__ */ React.createElement(React.Fragment, null, [props.type].flat().map((type) => /* @__PURE__ */ React.createElement(Chip, { label: type, key: type })))));
931
- });
932
- };
933
- const renderTable = (input) => {
934
- if (!input.properties) {
935
- return void 0;
936
- }
937
- return /* @__PURE__ */ React.createElement(TableContainer, { component: Paper }, /* @__PURE__ */ React.createElement(Table, { size: "small" }, /* @__PURE__ */ React.createElement(TableHead, null, /* @__PURE__ */ React.createElement(TableRow, null, /* @__PURE__ */ React.createElement(TableCell, null, "Name"), /* @__PURE__ */ React.createElement(TableCell, null, "Title"), /* @__PURE__ */ React.createElement(TableCell, null, "Description"), /* @__PURE__ */ React.createElement(TableCell, null, "Type"))), /* @__PURE__ */ React.createElement(TableBody, null, formatRows(input))));
938
- };
939
- const renderTables = (name, input) => {
940
- if (!input) {
941
- return void 0;
942
- }
943
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Typography, { variant: "h6" }, name), input.map((i, index) => /* @__PURE__ */ React.createElement("div", { key: index }, renderTable(i))));
944
- };
945
- const items = value == null ? void 0 : value.map((action) => {
946
- var _a, _b, _c, _d;
947
- if (action.id.startsWith("legacy:")) {
948
- return void 0;
949
- }
950
- const oneOf = renderTables("oneOf", (_b = (_a = action.schema) == null ? void 0 : _a.input) == null ? void 0 : _b.oneOf);
951
- return /* @__PURE__ */ React.createElement(Box, { pb: 4, key: action.id }, /* @__PURE__ */ React.createElement(Typography, { variant: "h4", className: classes.code }, action.id), action.description && /* @__PURE__ */ React.createElement(MarkdownContent, { content: action.description }), ((_c = action.schema) == null ? void 0 : _c.input) && /* @__PURE__ */ React.createElement(Box, { pb: 2 }, /* @__PURE__ */ React.createElement(Typography, { variant: "h5" }, "Input"), renderTable(action.schema.input), oneOf), ((_d = action.schema) == null ? void 0 : _d.output) && /* @__PURE__ */ React.createElement(Box, { pb: 2 }, /* @__PURE__ */ React.createElement(Typography, { variant: "h5" }, "Output"), renderTable(action.schema.output)), action.examples && /* @__PURE__ */ React.createElement(Accordion, null, /* @__PURE__ */ React.createElement(AccordionSummary, { expandIcon: /* @__PURE__ */ React.createElement(ExpandMoreIcon, null) }, /* @__PURE__ */ React.createElement(Typography, { variant: "h5" }, "Examples")), /* @__PURE__ */ React.createElement(AccordionDetails, null, /* @__PURE__ */ React.createElement(Box, { pb: 2 }, /* @__PURE__ */ React.createElement(ExamplesTable, { examples: action.examples })))));
952
- });
953
- return /* @__PURE__ */ React.createElement(Page, { themeId: "home" }, /* @__PURE__ */ React.createElement(
954
- Header,
955
- {
956
- pageTitleOverride: "Create a New Component",
957
- title: "Installed actions",
958
- subtitle: "This is the collection of all installed actions"
959
- }
960
- ), /* @__PURE__ */ React.createElement(Content, null, items));
961
- };
962
-
963
878
  const showDirectoryPicker = window.showDirectoryPicker;
964
879
  class WebFileAccess {
965
880
  constructor(path, handle) {
@@ -1291,7 +1206,7 @@ function useDryRun() {
1291
1206
  return value;
1292
1207
  }
1293
1208
 
1294
- const useStyles$c = makeStyles$1({
1209
+ const useStyles$b = makeStyles$1({
1295
1210
  containerWrapper: {
1296
1211
  position: "relative",
1297
1212
  width: "100%",
@@ -1340,7 +1255,7 @@ function TemplateEditorForm(props) {
1340
1255
  fieldExtensions = [],
1341
1256
  layouts = []
1342
1257
  } = props;
1343
- const classes = useStyles$c();
1258
+ const classes = useStyles$b();
1344
1259
  const apiHolder = useApiHolder();
1345
1260
  const [steps, setSteps] = useState();
1346
1261
  const fields = useMemo(() => {
@@ -1455,7 +1370,7 @@ function TemplateEditorFormDirectoryEditorDryRun(props) {
1455
1370
  TemplateEditorForm.DirectoryEditorDryRun = TemplateEditorFormDirectoryEditorDryRun;
1456
1371
 
1457
1372
  const Form = withTheme(Theme);
1458
- const useStyles$b = makeStyles((theme) => ({
1373
+ const useStyles$a = makeStyles((theme) => ({
1459
1374
  root: {
1460
1375
  gridArea: "pageContent",
1461
1376
  display: "grid",
@@ -1485,7 +1400,7 @@ const CustomFieldExplorer = ({
1485
1400
  onClose
1486
1401
  }) => {
1487
1402
  var _a, _b;
1488
- const classes = useStyles$b();
1403
+ const classes = useStyles$a();
1489
1404
  const fieldOptions = customFieldExtensions.filter((field) => !!field.schema);
1490
1405
  const [selectedField, setSelectedField] = useState(fieldOptions[0]);
1491
1406
  const [fieldFormState, setFieldFormState] = useState({});
@@ -1585,7 +1500,7 @@ const CustomFieldExplorer = ({
1585
1500
  )));
1586
1501
  };
1587
1502
 
1588
- const useStyles$a = makeStyles$1((theme) => ({
1503
+ const useStyles$9 = makeStyles$1((theme) => ({
1589
1504
  introText: {
1590
1505
  textAlign: "center",
1591
1506
  marginTop: theme.spacing(2)
@@ -1603,7 +1518,7 @@ const useStyles$a = makeStyles$1((theme) => ({
1603
1518
  }
1604
1519
  }));
1605
1520
  function TemplateEditorIntro(props) {
1606
- const classes = useStyles$a();
1521
+ const classes = useStyles$9();
1607
1522
  const supportsLoad = WebFileSystemAccess.isSupported();
1608
1523
  const cardLoadLocal = /* @__PURE__ */ React.createElement(Card$1, { className: classes.card, elevation: 4 }, /* @__PURE__ */ React.createElement(
1609
1524
  CardActionArea,
@@ -1665,7 +1580,7 @@ function TemplateEditorIntro(props) {
1665
1580
  ));
1666
1581
  }
1667
1582
 
1668
- const useStyles$9 = makeStyles$1((theme) => ({
1583
+ const useStyles$8 = makeStyles$1((theme) => ({
1669
1584
  root: {
1670
1585
  overflowY: "auto",
1671
1586
  background: theme.palette.background.default
@@ -1682,7 +1597,7 @@ const useStyles$9 = makeStyles$1((theme) => ({
1682
1597
  }
1683
1598
  }));
1684
1599
  function DryRunResultsList() {
1685
- const classes = useStyles$9();
1600
+ const classes = useStyles$8();
1686
1601
  const dryRun = useDryRun();
1687
1602
  return /* @__PURE__ */ React.createElement(List$1, { className: classes.root, dense: true }, dryRun.results.map((result) => {
1688
1603
  var _a;
@@ -1716,7 +1631,7 @@ function DryRunResultsList() {
1716
1631
  }));
1717
1632
  }
1718
1633
 
1719
- const useStyles$8 = makeStyles$1({
1634
+ const useStyles$7 = makeStyles$1({
1720
1635
  root: {
1721
1636
  whiteSpace: "nowrap",
1722
1637
  overflowY: "auto"
@@ -1775,7 +1690,7 @@ function FileTreeItem({ entry }) {
1775
1690
  return /* @__PURE__ */ React.createElement(TreeItem, { nodeId: entry.path, label: entry.name }, entry.children.map((child) => /* @__PURE__ */ React.createElement(FileTreeItem, { key: child.path, entry: child })));
1776
1691
  }
1777
1692
  function FileBrowser(props) {
1778
- const classes = useStyles$8();
1693
+ const classes = useStyles$7();
1779
1694
  const fileTree = useMemo(
1780
1695
  () => parseFileEntires(props.filePaths),
1781
1696
  [props.filePaths]
@@ -1797,7 +1712,7 @@ function FileBrowser(props) {
1797
1712
  );
1798
1713
  }
1799
1714
 
1800
- const useStyles$7 = makeStyles$1((theme) => ({
1715
+ const useStyles$6 = makeStyles$1((theme) => ({
1801
1716
  root: {
1802
1717
  display: "grid",
1803
1718
  gridTemplateColumns: "280px auto 3fr",
@@ -1813,7 +1728,7 @@ const useStyles$7 = makeStyles$1((theme) => ({
1813
1728
  }
1814
1729
  }));
1815
1730
  function DryRunResultsSplitView(props) {
1816
- const classes = useStyles$7();
1731
+ const classes = useStyles$6();
1817
1732
  const childArray = Children.toArray(props.children);
1818
1733
  if (childArray.length !== 2) {
1819
1734
  throw new Error("must have exactly 2 children");
@@ -1821,7 +1736,7 @@ function DryRunResultsSplitView(props) {
1821
1736
  return /* @__PURE__ */ React.createElement("div", { className: classes.root }, /* @__PURE__ */ React.createElement("div", { className: classNames(classes.child, classes.firstChild) }, childArray[0]), /* @__PURE__ */ React.createElement(Divider, { orientation: "horizontal" }), /* @__PURE__ */ React.createElement("div", { className: classes.child }, childArray[1]));
1822
1737
  }
1823
1738
 
1824
- const useStyles$6 = makeStyles$1({
1739
+ const useStyles$5 = makeStyles$1({
1825
1740
  root: {
1826
1741
  display: "flex",
1827
1742
  flexFlow: "column nowrap"
@@ -1847,7 +1762,7 @@ const useStyles$6 = makeStyles$1({
1847
1762
  }
1848
1763
  });
1849
1764
  function FilesContent() {
1850
- const classes = useStyles$6();
1765
+ const classes = useStyles$5();
1851
1766
  const { selectedResult } = useDryRun();
1852
1767
  const [selectedPath, setSelectedPath] = useState("");
1853
1768
  const selectedFile = selectedResult == null ? void 0 : selectedResult.directoryContents.find(
@@ -1923,7 +1838,7 @@ function LogContent() {
1923
1838
  }
1924
1839
  function OutputContent() {
1925
1840
  var _a, _b;
1926
- const classes = useStyles$6();
1841
+ const classes = useStyles$5();
1927
1842
  const { selectedResult } = useDryRun();
1928
1843
  if (!selectedResult) {
1929
1844
  return null;
@@ -1941,14 +1856,14 @@ function OutputContent() {
1941
1856
  ));
1942
1857
  }
1943
1858
  function DryRunResultsView() {
1944
- const classes = useStyles$6();
1859
+ const classes = useStyles$5();
1945
1860
  const [selectedTab, setSelectedTab] = useState(
1946
1861
  "files"
1947
1862
  );
1948
1863
  return /* @__PURE__ */ React.createElement("div", { className: classes.root }, /* @__PURE__ */ React.createElement(Tabs, { value: selectedTab, onChange: (_, v) => setSelectedTab(v) }, /* @__PURE__ */ React.createElement(Tab, { value: "files", label: "Files" }), /* @__PURE__ */ React.createElement(Tab, { value: "log", label: "Log" }), /* @__PURE__ */ React.createElement(Tab, { value: "output", label: "Output" })), /* @__PURE__ */ React.createElement(Divider, null), /* @__PURE__ */ React.createElement("div", { className: classes.contentWrapper }, /* @__PURE__ */ React.createElement("div", { className: classes.content }, selectedTab === "files" && /* @__PURE__ */ React.createElement(FilesContent, null), selectedTab === "log" && /* @__PURE__ */ React.createElement(LogContent, null), selectedTab === "output" && /* @__PURE__ */ React.createElement(OutputContent, null))));
1949
1864
  }
1950
1865
 
1951
- const useStyles$5 = makeStyles$1((theme) => ({
1866
+ const useStyles$4 = makeStyles$1((theme) => ({
1952
1867
  header: {
1953
1868
  height: 48,
1954
1869
  minHeight: 0,
@@ -1967,7 +1882,7 @@ const useStyles$5 = makeStyles$1((theme) => ({
1967
1882
  }
1968
1883
  }));
1969
1884
  function DryRunResults() {
1970
- const classes = useStyles$5();
1885
+ const classes = useStyles$4();
1971
1886
  const dryRun = useDryRun();
1972
1887
  const [expanded, setExpanded] = useState(false);
1973
1888
  const [hidden, setHidden] = useState(true);
@@ -1982,7 +1897,7 @@ function DryRunResults() {
1982
1897
  }
1983
1898
  }, [prevResultsLength, resultsLength]);
1984
1899
  return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
1985
- Accordion$1,
1900
+ Accordion,
1986
1901
  {
1987
1902
  variant: "outlined",
1988
1903
  expanded,
@@ -1991,7 +1906,7 @@ function DryRunResults() {
1991
1906
  onTransitionEnd: () => resultsLength === 0 && setHidden(true)
1992
1907
  },
1993
1908
  /* @__PURE__ */ React.createElement(
1994
- AccordionSummary$1,
1909
+ AccordionSummary,
1995
1910
  {
1996
1911
  className: classes.header,
1997
1912
  expandIcon: /* @__PURE__ */ React.createElement(ExpandMoreIcon$1, null)
@@ -1999,11 +1914,11 @@ function DryRunResults() {
1999
1914
  /* @__PURE__ */ React.createElement(Typography$1, null, "Dry-run results")
2000
1915
  ),
2001
1916
  /* @__PURE__ */ React.createElement(Divider, { orientation: "horizontal" }),
2002
- /* @__PURE__ */ React.createElement(AccordionDetails$1, { className: classes.content }, /* @__PURE__ */ React.createElement(DryRunResultsList, null), /* @__PURE__ */ React.createElement(Divider, { orientation: "horizontal" }), /* @__PURE__ */ React.createElement(DryRunResultsView, null))
1917
+ /* @__PURE__ */ React.createElement(AccordionDetails, { className: classes.content }, /* @__PURE__ */ React.createElement(DryRunResultsList, null), /* @__PURE__ */ React.createElement(Divider, { orientation: "horizontal" }), /* @__PURE__ */ React.createElement(DryRunResultsView, null))
2003
1918
  ));
2004
1919
  }
2005
1920
 
2006
- const useStyles$4 = makeStyles((theme) => ({
1921
+ const useStyles$3 = makeStyles((theme) => ({
2007
1922
  button: {
2008
1923
  padding: theme.spacing(1)
2009
1924
  },
@@ -2022,7 +1937,7 @@ const useStyles$4 = makeStyles((theme) => ({
2022
1937
  }));
2023
1938
  function TemplateEditorBrowser(props) {
2024
1939
  var _a, _b;
2025
- const classes = useStyles$4();
1940
+ const classes = useStyles$3();
2026
1941
  const directoryEditor = useDirectoryEditor();
2027
1942
  const changedFiles = directoryEditor.files.filter((file) => file.dirty);
2028
1943
  const handleClose = () => {
@@ -2064,7 +1979,7 @@ function TemplateEditorBrowser(props) {
2064
1979
  ));
2065
1980
  }
2066
1981
 
2067
- const useStyles$3 = makeStyles((theme) => ({
1982
+ const useStyles$2 = makeStyles((theme) => ({
2068
1983
  container: {
2069
1984
  position: "relative",
2070
1985
  width: "100%",
@@ -2093,7 +2008,7 @@ const useStyles$3 = makeStyles((theme) => ({
2093
2008
  }));
2094
2009
  function TemplateEditorTextArea(props) {
2095
2010
  const { errorText } = props;
2096
- const classes = useStyles$3();
2011
+ const classes = useStyles$2();
2097
2012
  const panelExtension = useMemo(() => {
2098
2013
  if (!errorText) {
2099
2014
  return showPanel.of(null);
@@ -2168,7 +2083,7 @@ function TemplateEditorDirectoryEditorTextArea(props) {
2168
2083
  }
2169
2084
  TemplateEditorTextArea.DirectoryEditor = TemplateEditorDirectoryEditorTextArea;
2170
2085
 
2171
- const useStyles$2 = makeStyles({
2086
+ const useStyles$1 = makeStyles({
2172
2087
  // Reset and fix sizing to make sure scrolling behaves correctly
2173
2088
  root: {
2174
2089
  gridArea: "pageContent",
@@ -2197,7 +2112,7 @@ const useStyles$2 = makeStyles({
2197
2112
  }
2198
2113
  });
2199
2114
  const TemplateEditor = (props) => {
2200
- const classes = useStyles$2();
2115
+ const classes = useStyles$1();
2201
2116
  const [errorText, setErrorText] = useState();
2202
2117
  return /* @__PURE__ */ React.createElement(DirectoryEditorProvider, { directory: props.directory }, /* @__PURE__ */ React.createElement(DryRunProvider, null, /* @__PURE__ */ React.createElement("main", { className: classes.root }, /* @__PURE__ */ React.createElement("section", { className: classes.browser }, /* @__PURE__ */ React.createElement(TemplateEditorBrowser, { onClose: props.onClose })), /* @__PURE__ */ React.createElement("section", { className: classes.editor }, /* @__PURE__ */ React.createElement(TemplateEditorTextArea.DirectoryEditor, { errorText })), /* @__PURE__ */ React.createElement("section", { className: classes.preview }, /* @__PURE__ */ React.createElement(
2203
2118
  TemplateEditorForm.DirectoryEditorDryRun,
@@ -2247,7 +2162,7 @@ steps:
2247
2162
  values:
2248
2163
  name: \${{parameters.name}}
2249
2164
  `;
2250
- const useStyles$1 = makeStyles((theme) => ({
2165
+ const useStyles = makeStyles((theme) => ({
2251
2166
  root: {
2252
2167
  gridArea: "pageContent",
2253
2168
  display: "grid",
@@ -2278,7 +2193,7 @@ const TemplateFormPreviewer = ({
2278
2193
  onClose,
2279
2194
  layouts = []
2280
2195
  }) => {
2281
- const classes = useStyles$1();
2196
+ const classes = useStyles();
2282
2197
  const alertApi = useApi(alertApiRef);
2283
2198
  const catalogApi = useApi(catalogApiRef);
2284
2199
  const [selectedTemplate, setSelectedTemplate] = useState("");
@@ -2410,216 +2325,6 @@ function TemplateEditorPage(props) {
2410
2325
  ), content);
2411
2326
  }
2412
2327
 
2413
- const useStyles = makeStyles(
2414
- (theme) => ({
2415
- root: {
2416
- backgroundColor: "rgba(0, 0, 0, .11)",
2417
- boxShadow: "none",
2418
- margin: theme.spacing(1, 0, 1, 0)
2419
- },
2420
- title: {
2421
- margin: theme.spacing(1, 0, 0, 1),
2422
- textTransform: "uppercase",
2423
- fontSize: 12,
2424
- fontWeight: "bold"
2425
- },
2426
- listIcon: {
2427
- minWidth: 30,
2428
- color: theme.palette.text.primary
2429
- },
2430
- menuItem: {
2431
- minHeight: theme.spacing(6)
2432
- },
2433
- groupWrapper: {
2434
- margin: theme.spacing(1, 1, 2, 1)
2435
- }
2436
- }),
2437
- {
2438
- name: "ScaffolderReactOwnerListPicker"
2439
- }
2440
- );
2441
- function getFilterGroups() {
2442
- return [
2443
- {
2444
- name: "Task Owner",
2445
- items: [
2446
- {
2447
- id: "owned",
2448
- label: "Owned",
2449
- icon: SettingsIcon
2450
- },
2451
- {
2452
- id: "all",
2453
- label: "All",
2454
- icon: AllIcon
2455
- }
2456
- ]
2457
- }
2458
- ];
2459
- }
2460
- const OwnerListPicker = (props) => {
2461
- const { filter, onSelectOwner } = props;
2462
- const classes = useStyles();
2463
- const filterGroups = getFilterGroups();
2464
- return /* @__PURE__ */ React.createElement(Card, { className: classes.root }, filterGroups.map((group) => /* @__PURE__ */ React.createElement(Fragment, { key: group.name }, /* @__PURE__ */ React.createElement(Typography, { variant: "subtitle2", className: classes.title }, group.name), /* @__PURE__ */ React.createElement(Card, { className: classes.groupWrapper }, /* @__PURE__ */ React.createElement(List$2, { disablePadding: true, dense: true }, group.items.map((item) => /* @__PURE__ */ React.createElement(
2465
- MenuItem$1,
2466
- {
2467
- key: item.id,
2468
- button: true,
2469
- divider: true,
2470
- onClick: () => onSelectOwner(item.id),
2471
- selected: item.id === filter,
2472
- className: classes.menuItem,
2473
- "data-testid": `owner-picker-${item.id}`
2474
- },
2475
- item.icon && /* @__PURE__ */ React.createElement(ListItemIcon$1, { className: classes.listIcon }, /* @__PURE__ */ React.createElement(item.icon, { fontSize: "small" })),
2476
- /* @__PURE__ */ React.createElement(ListItemText$1, null, /* @__PURE__ */ React.createElement(Typography, { variant: "body1" }, item.label))
2477
- )))))));
2478
- };
2479
-
2480
- const CreatedAtColumn = ({ createdAt }) => {
2481
- const createdAtTime = DateTime.fromISO(createdAt);
2482
- const formatted = Interval.fromDateTimes(createdAtTime, DateTime.local()).toDuration().valueOf();
2483
- return /* @__PURE__ */ React.createElement(Typography$1, { paragraph: true }, humanizeDuration(formatted, { round: true }), " ago");
2484
- };
2485
-
2486
- const OwnerEntityColumn = ({ entityRef }) => {
2487
- var _a, _b, _c;
2488
- const catalogApi = useApi(catalogApiRef);
2489
- const { value, loading, error } = useAsync(
2490
- () => catalogApi.getEntityByRef(entityRef || ""),
2491
- [catalogApi, entityRef]
2492
- );
2493
- if (!entityRef) {
2494
- return /* @__PURE__ */ React.createElement(Typography$1, { paragraph: true }, "Unknown");
2495
- }
2496
- if (loading || error) {
2497
- return null;
2498
- }
2499
- return /* @__PURE__ */ React.createElement(
2500
- EntityRefLink,
2501
- {
2502
- entityRef: parseEntityRef(entityRef),
2503
- title: (_c = (_b = (_a = value == null ? void 0 : value.spec) == null ? void 0 : _a.profile) == null ? void 0 : _b.displayName) != null ? _c : value == null ? void 0 : value.metadata.name
2504
- }
2505
- );
2506
- };
2507
-
2508
- const TaskStatusColumn = ({ status }) => {
2509
- switch (status) {
2510
- case "processing":
2511
- return /* @__PURE__ */ React.createElement(StatusPending, null, status);
2512
- case "completed":
2513
- return /* @__PURE__ */ React.createElement(StatusOK, null, status);
2514
- case "error":
2515
- default:
2516
- return /* @__PURE__ */ React.createElement(StatusError, null, status);
2517
- }
2518
- };
2519
-
2520
- const TemplateTitleColumn = ({ entityRef }) => {
2521
- const scaffolder = useApi(scaffolderApiRef);
2522
- const { value, loading, error } = useAsync(
2523
- () => scaffolder.getTemplateParameterSchema(entityRef || ""),
2524
- [scaffolder, entityRef]
2525
- );
2526
- if (loading || error || !entityRef) {
2527
- return null;
2528
- }
2529
- return /* @__PURE__ */ React.createElement(EntityRefLink, { entityRef: parseEntityRef(entityRef), title: value == null ? void 0 : value.title });
2530
- };
2531
-
2532
- const ListTaskPageContent = (props) => {
2533
- var _a;
2534
- const { initiallySelectedFilter = "owned" } = props;
2535
- const scaffolderApi = useApi(scaffolderApiRef);
2536
- const rootLink = useRouteRef(rootRouteRef);
2537
- const [ownerFilter, setOwnerFilter] = useState(initiallySelectedFilter);
2538
- const { value, loading, error } = useAsync(() => {
2539
- var _a2;
2540
- if (scaffolderApi.listTasks) {
2541
- return (_a2 = scaffolderApi.listTasks) == null ? void 0 : _a2.call(scaffolderApi, { filterByOwnership: ownerFilter });
2542
- }
2543
- console.warn(
2544
- "listTasks is not implemented in the scaffolderApi, please make sure to implement this method."
2545
- );
2546
- return Promise.resolve({ tasks: [] });
2547
- }, [scaffolderApi, ownerFilter]);
2548
- if (loading) {
2549
- return /* @__PURE__ */ React.createElement(Progress, null);
2550
- }
2551
- if (error) {
2552
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ErrorPanel, { error }), /* @__PURE__ */ React.createElement(
2553
- EmptyState,
2554
- {
2555
- missing: "info",
2556
- title: "No information to display",
2557
- description: "There is no Tasks or there was an issue communicating with backend."
2558
- }
2559
- ));
2560
- }
2561
- return /* @__PURE__ */ React.createElement(CatalogFilterLayout, null, /* @__PURE__ */ React.createElement(CatalogFilterLayout.Filters, null, /* @__PURE__ */ React.createElement(
2562
- OwnerListPicker,
2563
- {
2564
- filter: ownerFilter,
2565
- onSelectOwner: (id) => setOwnerFilter(id)
2566
- }
2567
- )), /* @__PURE__ */ React.createElement(CatalogFilterLayout.Content, null, /* @__PURE__ */ React.createElement(
2568
- Table$1,
2569
- {
2570
- data: (_a = value == null ? void 0 : value.tasks) != null ? _a : [],
2571
- title: "Tasks",
2572
- columns: [
2573
- {
2574
- title: "Task ID",
2575
- field: "id",
2576
- render: (row) => /* @__PURE__ */ React.createElement(Link, { to: `${rootLink()}/tasks/${row.id}` }, row.id)
2577
- },
2578
- {
2579
- title: "Template",
2580
- render: (row) => {
2581
- var _a2;
2582
- return /* @__PURE__ */ React.createElement(
2583
- TemplateTitleColumn,
2584
- {
2585
- entityRef: (_a2 = row.spec.templateInfo) == null ? void 0 : _a2.entityRef
2586
- }
2587
- );
2588
- }
2589
- },
2590
- {
2591
- title: "Created",
2592
- field: "createdAt",
2593
- render: (row) => /* @__PURE__ */ React.createElement(CreatedAtColumn, { createdAt: row.createdAt })
2594
- },
2595
- {
2596
- title: "Owner",
2597
- field: "createdBy",
2598
- render: (row) => {
2599
- var _a2, _b;
2600
- return /* @__PURE__ */ React.createElement(OwnerEntityColumn, { entityRef: (_b = (_a2 = row.spec) == null ? void 0 : _a2.user) == null ? void 0 : _b.ref });
2601
- }
2602
- },
2603
- {
2604
- title: "Status",
2605
- field: "status",
2606
- render: (row) => /* @__PURE__ */ React.createElement(TaskStatusColumn, { status: row.status })
2607
- }
2608
- ]
2609
- }
2610
- )));
2611
- };
2612
- const ListTasksPage = (props) => {
2613
- return /* @__PURE__ */ React.createElement(Page, { themeId: "home" }, /* @__PURE__ */ React.createElement(
2614
- Header,
2615
- {
2616
- pageTitleOverride: "Templates Tasks",
2617
- title: /* @__PURE__ */ React.createElement(React.Fragment, null, "List template tasks ", /* @__PURE__ */ React.createElement(Lifecycle, { shorthand: true, alpha: true })),
2618
- subtitle: "All tasks that have been started"
2619
- }
2620
- ), /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(ListTaskPageContent, { ...props })));
2621
- };
2622
-
2623
2328
  const Router = (props) => {
2624
2329
  const { groups, components = {}, defaultPreviewTemplate } = props;
2625
2330
  const { ReviewStepComponent, TemplateCardComponent, TaskPageComponent } = components;
@@ -2639,9 +2344,11 @@ const Router = (props) => {
2639
2344
  const { templateName } = useRouteRefParams(legacySelectedTemplateRouteRef);
2640
2345
  const newLink = useRouteRef(selectedTemplateRouteRef);
2641
2346
  useEffect(
2642
- () => // eslint-disable-next-line no-console
2643
- console.warn(
2644
- "The route /template/:templateName is deprecated, please use the new /template/:namespace/:templateName route instead"
2347
+ () => (
2348
+ // eslint-disable-next-line no-console
2349
+ console.warn(
2350
+ "The route /template/:templateName is deprecated, please use the new /template/:namespace/:templateName route instead"
2351
+ )
2645
2352
  ),
2646
2353
  []
2647
2354
  );
@@ -2704,4 +2411,4 @@ const Router = (props) => {
2704
2411
  };
2705
2412
 
2706
2413
  export { Router };
2707
- //# sourceMappingURL=Router-73a659c0.esm.js.map
2414
+ //# sourceMappingURL=Router-e878e04f.esm.js.map