@backstage/plugin-scaffolder 1.10.0-next.0 → 1.10.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,94 @@
1
1
  # @backstage/plugin-scaffolder
2
2
 
3
+ ## 1.10.0-next.2
4
+
5
+ ### Minor Changes
6
+
7
+ - b4955ed7b9: - **Deprecation** - Deprecated the following exports, please import them directly from `@backstage/plugin-scaffolder-react` instead
8
+
9
+ ```
10
+ createScaffolderFieldExtension
11
+ ScaffolderFieldExtensions
12
+ useTemplateSecrets
13
+ scaffolderApiRef
14
+ ScaffolderApi
15
+ ScaffolderUseTemplateSecrets
16
+ TemplateParameterSchema
17
+ CustomFieldExtensionSchema
18
+ CustomFieldValidator
19
+ FieldExtensionOptions
20
+ FieldExtensionComponentProps
21
+ FieldExtensionComponent
22
+ ListActionsResponse
23
+ LogEvent
24
+ ScaffolderDryRunOptions
25
+ ScaffolderDryRunResponse
26
+ ScaffolderGetIntegrationsListOptions
27
+ ScaffolderGetIntegrationsListResponse
28
+ ScaffolderOutputlink
29
+ ScaffolderScaffoldOptions
30
+ ScaffolderScaffoldResponse
31
+ ScaffolderStreamLogsOptions
32
+ ScaffolderTask
33
+ ScaffolderTaskOutput
34
+ ScaffolderTaskStatus
35
+ ```
36
+
37
+ - **Deprecation** - Deprecated the `rootRouteRef` export, this should now be used from `scaffolderPlugin.routes.root`
38
+
39
+ - The following `/alpha` types have removed from this package and moved to the `@backstage/plugin-scaffolder-react/alpha` package
40
+
41
+ ```
42
+ createNextScaffolderFieldExtension
43
+ FormProps
44
+ NextCustomFieldValidator
45
+ NextFieldExtensionComponentProps
46
+ NextFieldExtensionOptions
47
+ ```
48
+
49
+ ### Patch Changes
50
+
51
+ - 2fadff2a25: Render the scaffolder action description using the `MarkdownContent` component. This will allow the page to show richer content to describe scaffolder actions.
52
+ - 659c92a1dc: Updated dependency `use-immer` to `^0.8.0`.
53
+ - 489935d625: Show action example yaml on the scaffolder actions documentation page.
54
+ - b8269de9f1: Explicitly declaring children as optional props to facilitate react 18 changes
55
+ - Updated dependencies
56
+ - @backstage/plugin-scaffolder-react@1.0.0-next.0
57
+ - @backstage/core-plugin-api@1.3.0-next.1
58
+ - @backstage/catalog-client@1.3.0-next.2
59
+ - @backstage/plugin-catalog-react@1.2.4-next.2
60
+ - @backstage/plugin-permission-react@0.4.9-next.1
61
+ - @backstage/catalog-model@1.1.5-next.1
62
+ - @backstage/config@1.0.6-next.0
63
+ - @backstage/core-components@0.12.3-next.2
64
+ - @backstage/errors@1.1.4
65
+ - @backstage/integration@1.4.2-next.0
66
+ - @backstage/integration-react@1.1.9-next.2
67
+ - @backstage/theme@0.2.16
68
+ - @backstage/types@1.0.2
69
+ - @backstage/plugin-catalog-common@1.0.10-next.1
70
+ - @backstage/plugin-scaffolder-common@1.2.4-next.1
71
+
72
+ ## 1.10.0-next.1
73
+
74
+ ### Patch Changes
75
+
76
+ - Updated dependencies
77
+ - @backstage/config@1.0.6-next.0
78
+ - @backstage/catalog-client@1.3.0-next.1
79
+ - @backstage/catalog-model@1.1.5-next.1
80
+ - @backstage/core-components@0.12.3-next.1
81
+ - @backstage/core-plugin-api@1.2.1-next.0
82
+ - @backstage/errors@1.1.4
83
+ - @backstage/integration@1.4.2-next.0
84
+ - @backstage/integration-react@1.1.9-next.1
85
+ - @backstage/theme@0.2.16
86
+ - @backstage/types@1.0.2
87
+ - @backstage/plugin-catalog-common@1.0.10-next.1
88
+ - @backstage/plugin-catalog-react@1.2.4-next.1
89
+ - @backstage/plugin-permission-react@0.4.9-next.0
90
+ - @backstage/plugin-scaffolder-common@1.2.4-next.1
91
+
3
92
  ## 1.10.0-next.0
4
93
 
5
94
  ### Minor Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder",
3
- "version": "1.10.0-next.0",
3
+ "version": "1.10.0-next.2",
4
4
  "main": "../dist/index.esm.js",
5
5
  "types": "../dist/index.alpha.d.ts"
6
6
  }
@@ -1,14 +1,14 @@
1
- import React, { useState, useContext, useCallback, createContext, useEffect, useRef, useMemo, Component, Children, Fragment } from 'react';
1
+ import React, { useState, useCallback, Fragment, 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, 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, ErrorPage, CodeSnippet, ErrorPanel, LogViewer, StatusError, StatusOK, StatusPending, Lifecycle, EmptyState, Table as Table$1 } from '@backstage/core-components';
4
4
  import { useApp, useRouteRef, useApi, useRouteRefParams, useAnalytics, errorApiRef, featureFlagsApiRef, useApiHolder, AnalyticsContext, alertApiRef, useElementFilter } from '@backstage/core-plugin-api';
5
5
  import { getEntityRelations, getEntitySourceLocation, FavoriteEntity, EntityRefLinks, useEntityList, EntityListProvider, CatalogFilterLayout, EntitySearchBar, EntityKindPicker, UserListPicker, EntityTagPicker, catalogApiRef, humanizeEntityRef, EntityRefLink } from '@backstage/plugin-catalog-react';
6
- import { s as selectedTemplateRouteRef, v as viewTechDocRouteRef, e as editRouteRef, a as actionsRouteRef, b as scaffolderListTaskRouteRef, r as registerComponentRouteRef, T as TemplateTypePicker, S as SecretsContext, c as scaffolderApiRef, d as scaffolderTaskRouteRef, f as rootRouteRef, g as TaskStatusStepper, h as TaskPageLinks, F as FIELD_EXTENSION_WRAPPER_KEY, i as FIELD_EXTENSION_KEY, L as LAYOUTS_WRAPPER_KEY, j as LAYOUTS_KEY, l as legacySelectedTemplateRouteRef, k as SecretsContextProvider, m as TaskPage } from './index-7e25101d.esm.js';
7
6
  import { RELATION_OWNED_BY, parseEntityRef, stringifyEntityRef, DEFAULT_NAMESPACE } from '@backstage/catalog-model';
8
- import { makeStyles, useTheme, Card, CardMedia, CardContent, Box, Typography, Chip, CardActions, Tooltip, IconButton, Paper, Button as Button$1, Stepper, Step, StepLabel, StepContent, LinearProgress, 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, 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';
9
8
  import { scmIntegrationsApiRef, ScmIntegrationIcon } from '@backstage/integration-react';
10
9
  import LanguageIcon from '@material-ui/icons/Language';
11
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 LAYOUTS_WRAPPER_KEY, h as LAYOUTS_KEY, l as legacySelectedTemplateRouteRef, i as TaskPage } from './index-618869a2.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';
@@ -24,11 +24,12 @@ import List from '@material-ui/icons/List';
24
24
  import MoreVert from '@material-ui/icons/MoreVert';
25
25
  import qs from 'qs';
26
26
  import useAsync from 'react-use/lib/useAsync';
27
+ import { extractSchemaFromStep, useTemplateSecrets, scaffolderApiRef, useCustomFieldExtensions, SecretsContextProvider } from '@backstage/plugin-scaffolder-react';
27
28
  import { withTheme } from '@rjsf/core';
28
29
  import { Theme } from '@rjsf/material-ui';
29
30
  import cloneDeep from 'lodash/cloneDeep';
30
- import { e as extractSchemaFromStep, D as DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS } from './schema-bfff60e2.esm.js';
31
31
  import classNames from 'classnames';
32
+ import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
32
33
  import { StreamLanguage } from '@codemirror/language';
33
34
  import { yaml as yaml$1 } from '@codemirror/legacy-modes/mode/yaml';
34
35
  import CloseIcon from '@material-ui/icons/Close';
@@ -42,9 +43,9 @@ import CardContent$1 from '@material-ui/core/CardContent';
42
43
  import Tooltip$1 from '@material-ui/core/Tooltip';
43
44
  import Typography$1 from '@material-ui/core/Typography';
44
45
  import InfoOutlinedIcon from '@material-ui/icons/InfoOutlined';
45
- import Accordion from '@material-ui/core/Accordion';
46
- import AccordionDetails from '@material-ui/core/AccordionDetails';
47
- import AccordionSummary from '@material-ui/core/AccordionSummary';
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';
48
49
  import Divider from '@material-ui/core/Divider';
49
50
  import ExpandMoreIcon$1 from '@material-ui/icons/ExpandLess';
50
51
  import List$1 from '@material-ui/core/List';
@@ -57,12 +58,12 @@ import Box$1 from '@material-ui/core/Box';
57
58
  import Tab from '@material-ui/core/Tab';
58
59
  import Tabs from '@material-ui/core/Tabs';
59
60
  import TreeView from '@material-ui/lab/TreeView';
60
- import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
61
61
  import ChevronRightIcon from '@material-ui/icons/ChevronRight';
62
62
  import TreeItem from '@material-ui/lab/TreeItem';
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-b0a9b946.esm.js';
66
67
  import SettingsIcon from '@material-ui/icons/Settings';
67
68
  import AllIcon from '@material-ui/icons/FontDownload';
68
69
  import { DateTime, Interval } from 'luxon';
@@ -73,14 +74,17 @@ import '@material-ui/core/FormControl';
73
74
  import '@material-ui/lab/Autocomplete';
74
75
  import 'zod';
75
76
  import 'zod-to-json-schema';
76
- import 'react-use/lib/useEffectOnce';
77
- import '@material-ui/lab';
78
77
  import '@material-ui/core/FormHelperText';
79
78
  import '@material-ui/core/Input';
80
79
  import '@material-ui/core/InputLabel';
80
+ import 'react-use/lib/useEffectOnce';
81
+ import '@material-ui/lab';
81
82
  import 'lodash/capitalize';
82
83
  import '@material-ui/icons/CheckBox';
83
84
  import '@material-ui/icons/CheckBoxOutlineBlank';
85
+ import '@material-ui/core/Button';
86
+ import '@material-ui/core/useMediaQuery';
87
+ import '@material-ui/icons/AddCircleOutline';
84
88
  import '@material-ui/core/Grid';
85
89
  import '@material-ui/core/Step';
86
90
  import '@material-ui/core/StepLabel';
@@ -759,7 +763,7 @@ const TemplatePage = ({
759
763
  headerOptions
760
764
  }) => {
761
765
  const apiHolder = useApiHolder();
762
- const secretsContext = useContext(SecretsContext);
766
+ const secretsContext = useTemplateSecrets();
763
767
  const errorApi = useApi(errorApiRef);
764
768
  const scaffolderApi = useApi(scaffolderApiRef);
765
769
  const { templateName, namespace } = useRouteRefParams(
@@ -880,6 +884,19 @@ const useStyles$d = makeStyles((theme) => ({
880
884
  }
881
885
  }
882
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
+ };
883
900
  const ActionsPage = () => {
884
901
  const api = useApi(scaffolderApiRef);
885
902
  const classes = useStyles$d();
@@ -910,7 +927,7 @@ const ActionsPage = () => {
910
927
  const codeClassname = classNames(classes.code, {
911
928
  [classes.codeRequired]: (_a = input.required) == null ? void 0 : _a.includes(key)
912
929
  });
913
- 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 })))));
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 })))));
914
931
  });
915
932
  };
916
933
  const renderTable = (input) => {
@@ -931,7 +948,7 @@ const ActionsPage = () => {
931
948
  return void 0;
932
949
  }
933
950
  const oneOf = renderTables("oneOf", (_b = (_a = action.schema) == null ? void 0 : _a.input) == null ? void 0 : _b.oneOf);
934
- return /* @__PURE__ */ React.createElement(Box, { pb: 4, key: action.id }, /* @__PURE__ */ React.createElement(Typography, { variant: "h4", className: classes.code }, action.id), /* @__PURE__ */ React.createElement(Typography, null, 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)));
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 })))));
935
952
  });
936
953
  return /* @__PURE__ */ React.createElement(Page, { themeId: "home" }, /* @__PURE__ */ React.createElement(
937
954
  Header,
@@ -1965,7 +1982,7 @@ function DryRunResults() {
1965
1982
  }
1966
1983
  }, [prevResultsLength, resultsLength]);
1967
1984
  return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
1968
- Accordion,
1985
+ Accordion$1,
1969
1986
  {
1970
1987
  variant: "outlined",
1971
1988
  expanded,
@@ -1974,7 +1991,7 @@ function DryRunResults() {
1974
1991
  onTransitionEnd: () => resultsLength === 0 && setHidden(true)
1975
1992
  },
1976
1993
  /* @__PURE__ */ React.createElement(
1977
- AccordionSummary,
1994
+ AccordionSummary$1,
1978
1995
  {
1979
1996
  className: classes.header,
1980
1997
  expandIcon: /* @__PURE__ */ React.createElement(ExpandMoreIcon$1, null)
@@ -1982,7 +1999,7 @@ function DryRunResults() {
1982
1999
  /* @__PURE__ */ React.createElement(Typography$1, null, "Dry-run results")
1983
2000
  ),
1984
2001
  /* @__PURE__ */ React.createElement(Divider, { orientation: "horizontal" }),
1985
- /* @__PURE__ */ React.createElement(AccordionDetails, { className: classes.content }, /* @__PURE__ */ React.createElement(DryRunResultsList, null), /* @__PURE__ */ React.createElement(Divider, { orientation: "horizontal" }), /* @__PURE__ */ React.createElement(DryRunResultsView, null))
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))
1986
2003
  ));
1987
2004
  }
1988
2005
 
@@ -2152,6 +2169,7 @@ function TemplateEditorDirectoryEditorTextArea(props) {
2152
2169
  TemplateEditorTextArea.DirectoryEditor = TemplateEditorDirectoryEditorTextArea;
2153
2170
 
2154
2171
  const useStyles$2 = makeStyles({
2172
+ // Reset and fix sizing to make sure scrolling behaves correctly
2155
2173
  root: {
2156
2174
  gridArea: "pageContent",
2157
2175
  display: "grid",
@@ -2607,14 +2625,7 @@ const Router = (props) => {
2607
2625
  const { ReviewStepComponent, TemplateCardComponent, TaskPageComponent } = components;
2608
2626
  const outlet = useOutlet();
2609
2627
  const TaskPageElement = TaskPageComponent != null ? TaskPageComponent : TaskPage;
2610
- const customFieldExtensions = useElementFilter(
2611
- outlet,
2612
- (elements) => elements.selectByComponentData({
2613
- key: FIELD_EXTENSION_WRAPPER_KEY
2614
- }).findComponentData({
2615
- key: FIELD_EXTENSION_KEY
2616
- })
2617
- );
2628
+ const customFieldExtensions = useCustomFieldExtensions(outlet);
2618
2629
  const fieldExtensions = [
2619
2630
  ...customFieldExtensions,
2620
2631
  ...DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS.filter(
@@ -2635,7 +2646,8 @@ const Router = (props) => {
2635
2646
  const { templateName } = useRouteRefParams(legacySelectedTemplateRouteRef);
2636
2647
  const newLink = useRouteRef(selectedTemplateRouteRef);
2637
2648
  useEffect(
2638
- () => console.warn(
2649
+ () => // eslint-disable-next-line no-console
2650
+ console.warn(
2639
2651
  "The route /template/:templateName is deprecated, please use the new /template/:namespace/:templateName route instead"
2640
2652
  ),
2641
2653
  []
@@ -2699,4 +2711,4 @@ const Router = (props) => {
2699
2711
  };
2700
2712
 
2701
2713
  export { Router };
2702
- //# sourceMappingURL=Router-416b874d.esm.js.map
2714
+ //# sourceMappingURL=Router-c499b201.esm.js.map