@backstage/plugin-scaffolder-react 1.7.1 → 1.8.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,52 @@
1
1
  # @backstage/plugin-scaffolder-react
2
2
 
3
+ ## 1.8.0-next.1
4
+
5
+ ### Minor Changes
6
+
7
+ - b07ec70: Use more distinguishable icons for link (`Link`) and text output (`Description`).
8
+
9
+ ### Patch Changes
10
+
11
+ - 3f60ad5: fix for: converting circular structure to JSON error
12
+ - 31f0a0a: Added `ScaffolderPageContextMenu` to `ActionsPage`, `ListTaskPage`, and `TemplateEditorPage` so that you can more easily navigate between these pages
13
+ - 82affc7: Fix issue where `ui:schema` was replaced with an empty object if `dependencies` is defined
14
+ - Updated dependencies
15
+ - @backstage/core-components@0.14.0-next.0
16
+ - @backstage/catalog-model@1.4.4-next.0
17
+ - @backstage/catalog-client@1.6.0-next.1
18
+ - @backstage/core-plugin-api@1.8.3-next.0
19
+ - @backstage/plugin-catalog-react@1.9.4-next.1
20
+ - @backstage/theme@0.5.0
21
+ - @backstage/types@1.1.1
22
+ - @backstage/version-bridge@1.0.7
23
+ - @backstage/plugin-scaffolder-common@1.5.0-next.1
24
+
25
+ ## 1.8.0-next.0
26
+
27
+ ### Minor Changes
28
+
29
+ - c56f1a2: Remove the old legacy exports from `/alpha`
30
+ - 11b9a08: Introduced the first version of recoverable tasks.
31
+
32
+ ### Patch Changes
33
+
34
+ - 0b0c6b6: Allow defining default output text to be shown
35
+ - 6a74ffd: Updated dependency `@rjsf/utils` to `5.16.1`.
36
+ Updated dependency `@rjsf/core` to `5.16.1`.
37
+ Updated dependency `@rjsf/material-ui` to `5.16.1`.
38
+ Updated dependency `@rjsf/validator-ajv8` to `5.16.1`.
39
+ - Updated dependencies
40
+ - @backstage/plugin-catalog-react@1.9.4-next.0
41
+ - @backstage/catalog-client@1.6.0-next.0
42
+ - @backstage/plugin-scaffolder-common@1.5.0-next.0
43
+ - @backstage/core-components@0.13.10
44
+ - @backstage/catalog-model@1.4.3
45
+ - @backstage/core-plugin-api@1.8.2
46
+ - @backstage/theme@0.5.0
47
+ - @backstage/types@1.1.1
48
+ - @backstage/version-bridge@1.0.7
49
+
3
50
  ## 1.7.1
4
51
 
5
52
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder-react",
3
- "version": "1.7.1",
3
+ "version": "1.8.0-next.1",
4
4
  "main": "../dist/alpha.esm.js",
5
5
  "module": "../dist/alpha.esm.js",
6
6
  "types": "../dist/alpha.d.ts"
package/dist/alpha.d.ts CHANGED
@@ -4,8 +4,8 @@ import * as React from 'react';
4
4
  import React__default, { ComponentType, ReactNode, PropsWithChildren, ReactElement } from 'react';
5
5
  import { TemplatePresentationV1beta3, TemplateEntityV1beta3, TaskStep } from '@backstage/plugin-scaffolder-common';
6
6
  import { UiSchema, FieldValidation } from '@rjsf/utils';
7
- import { TemplateParameterSchema, FieldExtensionOptions, FormProps, ReviewStepProps, LayoutOptions, CustomFieldValidator, TemplateGroupFilter, ScaffolderTaskOutput, ScaffolderRJSFFormProps, ScaffolderStep, CustomFieldExtensionSchema, ScaffolderRJSFFieldProps, FieldExtensionComponent } from '@backstage/plugin-scaffolder-react';
8
- import { ApiHolder, IconComponent, Extension } from '@backstage/core-plugin-api';
7
+ import { TemplateParameterSchema, FieldExtensionOptions, FormProps, ReviewStepProps, LayoutOptions, CustomFieldValidator, TemplateGroupFilter, ScaffolderTaskOutput, ScaffolderRJSFFormProps, ScaffolderStep } from '@backstage/plugin-scaffolder-react';
8
+ import { ApiHolder, IconComponent } from '@backstage/core-plugin-api';
9
9
 
10
10
  /**
11
11
  * This is the parsed template schema that is returned from the {@link useTemplateSchema} hook.
@@ -223,6 +223,7 @@ type ScaffolderPageContextMenuProps = {
223
223
  onEditorClicked?: () => void;
224
224
  onActionsClicked?: () => void;
225
225
  onTasksClicked?: () => void;
226
+ onCreateClicked?: () => void;
226
227
  };
227
228
  /**
228
229
  * @alpha
@@ -285,43 +286,4 @@ declare const useTemplateParameterSchema: (templateRef: string) => {
285
286
  */
286
287
  declare const useFilteredSchemaProperties: (manifest: TemplateParameterSchema | undefined) => TemplateParameterSchema | undefined;
287
288
 
288
- /**
289
- * Field validation type for Custom Field Extensions.
290
- *
291
- * @alpha
292
- */
293
- type LegacyCustomFieldValidator<TFieldReturnValue> = (data: TFieldReturnValue, field: FieldValidation, context: {
294
- apiHolder: ApiHolder;
295
- }) => void | Promise<void>;
296
- /**
297
- * Type for the Custom Field Extension with the
298
- * name and components and validation function.
299
- *
300
- * @alpha
301
- */
302
- type LegacyFieldExtensionOptions<TFieldReturnValue = unknown, TInputProps = unknown> = {
303
- name: string;
304
- component: (props: LegacyFieldExtensionComponentProps<TFieldReturnValue, TInputProps>) => JSX.Element | null;
305
- validation?: LegacyCustomFieldValidator<TFieldReturnValue>;
306
- schema?: CustomFieldExtensionSchema;
307
- };
308
- /**
309
- * Type for field extensions and being able to type
310
- * incoming props easier.
311
- *
312
- * @alpha
313
- */
314
- interface LegacyFieldExtensionComponentProps<TFieldReturnValue, TUiOptions = unknown> extends ScaffolderRJSFFieldProps<TFieldReturnValue> {
315
- uiSchema: ScaffolderRJSFFieldProps['uiSchema'] & {
316
- 'ui:options'?: TUiOptions;
317
- };
318
- }
319
-
320
- /**
321
- * Method for creating field extensions that can be used in the scaffolder
322
- * frontend form.
323
- * @alpha
324
- */
325
- declare function createLegacyScaffolderFieldExtension<TReturnValue = unknown, TInputProps = unknown>(options: LegacyFieldExtensionOptions<TReturnValue, TInputProps>): Extension<FieldExtensionComponent<TReturnValue, TInputProps>>;
326
-
327
- export { DefaultTemplateOutputs, EmbeddableWorkflow, Form, FormValidation, LegacyCustomFieldValidator, LegacyFieldExtensionComponentProps, LegacyFieldExtensionOptions, ParsedTemplateSchema, ReviewState, ReviewStateProps, ScaffolderField, ScaffolderFieldProps, ScaffolderPageContextMenu, ScaffolderPageContextMenuProps, Stepper, StepperProps, TaskLogStream, TaskSteps, TaskStepsProps, TemplateCard, TemplateCardProps, TemplateCategoryPicker, TemplateGroup, TemplateGroupProps, TemplateGroups, TemplateGroupsProps, Workflow, WorkflowProps, createAsyncValidators, createFieldValidation, createLegacyScaffolderFieldExtension, extractSchemaFromStep, useFilteredSchemaProperties, useFormDataFromQuery, useTemplateParameterSchema, useTemplateSchema };
289
+ export { DefaultTemplateOutputs, EmbeddableWorkflow, Form, FormValidation, ParsedTemplateSchema, ReviewState, ReviewStateProps, ScaffolderField, ScaffolderFieldProps, ScaffolderPageContextMenu, ScaffolderPageContextMenuProps, Stepper, StepperProps, TaskLogStream, TaskSteps, TaskStepsProps, TemplateCard, TemplateCardProps, TemplateCategoryPicker, TemplateGroup, TemplateGroupProps, TemplateGroups, TemplateGroupsProps, Workflow, WorkflowProps, createAsyncValidators, createFieldValidation, extractSchemaFromStep, useFilteredSchemaProperties, useFormDataFromQuery, useTemplateParameterSchema, useTemplateSchema };
package/dist/alpha.esm.js CHANGED
@@ -1,12 +1,13 @@
1
- import { useApi, featureFlagsApiRef, useAnalytics, useApiHolder, useApp, errorApiRef, useRouteRef, alertApiRef, attachComponentData } from '@backstage/core-plugin-api';
1
+ import { useApi, featureFlagsApiRef, useAnalytics, useApiHolder, useApp, errorApiRef, useRouteRef, alertApiRef } from '@backstage/core-plugin-api';
2
2
  import { makeStyles, FormControl, Typography, createStyles, Paper, List, ListItem, ListItemIcon, ListItemText, LinearProgress, Stepper as Stepper$1, Step, StepLabel, Button, useTheme, Card, CardContent, Grid, Box, Divider, Chip, CardActions, CircularProgress, StepButton, FormControlLabel, Checkbox, TextField } from '@material-ui/core';
3
3
  import React, { useState, useMemo, useCallback, useEffect } from 'react';
4
4
  import { Draft07 } from 'json-schema-library';
5
+ import { parse, stringify } from 'flatted';
5
6
  import { StructuredMetadataTable, MarkdownContent, ItemCardHeader, Link, UserIcon, Content, ItemCardGrid, ContentHeader, Progress, InfoCard, LogViewer } from '@backstage/core-components';
6
7
  import validator from '@rjsf/validator-ajv8';
7
8
  import qs from 'qs';
8
9
  import useAsync from 'react-use/lib/useAsync';
9
- import { s as scaffolderApiRef, S as SecretsContextProvider, a as FIELD_EXTENSION_KEY } from './esm/ref-6fdfc121.esm.js';
10
+ import { s as scaffolderApiRef, S as SecretsContextProvider } from './esm/ref-e2ee478c.esm.js';
10
11
  import cloneDeep from 'lodash/cloneDeep';
11
12
  import { withTheme } from '@rjsf/core';
12
13
  import { getUiOptions, getTemplate } from '@rjsf/utils';
@@ -16,7 +17,8 @@ import { RELATION_OWNED_BY, stringifyEntityRef, parseEntityRef } from '@backstag
16
17
  import { FavoriteEntity, getEntityRelations, EntityRefLinks, useEntityList, entityRouteRef, useEntityTypeFilter } from '@backstage/plugin-catalog-react';
17
18
  import LanguageIcon from '@material-ui/icons/Language';
18
19
  import { isTemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';
19
- import WebIcon from '@material-ui/icons/Web';
20
+ import LinkIcon from '@material-ui/icons/Link';
21
+ import DescriptionIcon from '@material-ui/icons/Description';
20
22
  import RemoveCircleOutline from '@material-ui/icons/RemoveCircleOutline';
21
23
  import PanoramaFishEyeIcon from '@material-ui/icons/PanoramaFishEye';
22
24
  import classNames from 'classnames';
@@ -38,7 +40,7 @@ import ListItemText$1 from '@material-ui/core/ListItemText';
38
40
  import MenuItem from '@material-ui/core/MenuItem';
39
41
  import MenuList from '@material-ui/core/MenuList';
40
42
  import Popover from '@material-ui/core/Popover';
41
- import Description from '@material-ui/icons/Description';
43
+ import CreateComponentIcon from '@material-ui/icons/AddCircleOutline';
42
44
  import Edit from '@material-ui/icons/Edit';
43
45
  import List$1 from '@material-ui/icons/List';
44
46
  import MoreVert from '@material-ui/icons/MoreVert';
@@ -79,9 +81,11 @@ function extractUiSchema(schema, uiSchema) {
79
81
  if (!isObject$1(schemaNode)) {
80
82
  continue;
81
83
  }
82
- const innerUiSchema = {};
83
- uiSchema[propName] = innerUiSchema;
84
- extractUiSchema(schemaNode, innerUiSchema);
84
+ if (!isObject$1(uiSchema[propName])) {
85
+ const innerUiSchema = {};
86
+ uiSchema[propName] = innerUiSchema;
87
+ }
88
+ extractUiSchema(schemaNode, uiSchema[propName]);
85
89
  }
86
90
  }
87
91
  if (isObject$1(items)) {
@@ -131,7 +135,7 @@ function extractUiSchema(schema, uiSchema) {
131
135
  }
132
136
  const extractSchemaFromStep = (inputStep) => {
133
137
  const uiSchema = {};
134
- const returnSchema = JSON.parse(JSON.stringify(inputStep));
138
+ const returnSchema = parse(stringify(inputStep));
135
139
  extractUiSchema(returnSchema, uiSchema);
136
140
  return { uiSchema, schema: returnSchema };
137
141
  };
@@ -1053,7 +1057,7 @@ const LinkOutputs = (props) => {
1053
1057
  const entityRoute = useRouteRef(entityRouteRef);
1054
1058
  const iconResolver = (key) => {
1055
1059
  var _a;
1056
- return (_a = app.getSystemIcon(key)) != null ? _a : WebIcon;
1060
+ return (_a = app.getSystemIcon(key)) != null ? _a : LinkIcon;
1057
1061
  };
1058
1062
  return /* @__PURE__ */ React.createElement(React.Fragment, null, links.filter(({ url, entityRef }) => url || entityRef).map(({ url, entityRef, title, icon }) => {
1059
1063
  if (entityRef) {
@@ -1077,7 +1081,7 @@ const TextOutputs = (props) => {
1077
1081
  const app = useApp();
1078
1082
  const iconResolver = (key) => {
1079
1083
  var _a;
1080
- return (_a = app.getSystemIcon(key)) != null ? _a : WebIcon;
1084
+ return (_a = app.getSystemIcon(key)) != null ? _a : DescriptionIcon;
1081
1085
  };
1082
1086
  return /* @__PURE__ */ React.createElement(React.Fragment, null, text.filter(({ content }) => content !== void 0).map(({ title, icon }, i) => {
1083
1087
  const Icon = iconResolver(icon);
@@ -1101,11 +1105,19 @@ const TextOutputs = (props) => {
1101
1105
  };
1102
1106
 
1103
1107
  const DefaultTemplateOutputs = (props) => {
1104
- var _a, _b, _c;
1108
+ var _a, _b;
1105
1109
  const { output } = props;
1106
1110
  const [textOutputIndex, setTextOutputIndex] = useState(
1107
- ((_a = output == null ? void 0 : output.text) == null ? void 0 : _a.length) ? 0 : void 0
1111
+ void 0
1108
1112
  );
1113
+ useEffect(() => {
1114
+ if (textOutputIndex === void 0 && (output == null ? void 0 : output.text)) {
1115
+ const defaultIndex = output.text.findIndex(
1116
+ (t) => t.default
1117
+ );
1118
+ setTextOutputIndex(defaultIndex >= 0 ? defaultIndex : 0);
1119
+ }
1120
+ }, [textOutputIndex, output]);
1109
1121
  const textOutput = useMemo(
1110
1122
  () => {
1111
1123
  var _a2;
@@ -1126,11 +1138,11 @@ const DefaultTemplateOutputs = (props) => {
1126
1138
  ), /* @__PURE__ */ React.createElement(LinkOutputs, { output })))), textOutput ? /* @__PURE__ */ React.createElement(Box, { paddingBottom: 2 }, /* @__PURE__ */ React.createElement(
1127
1139
  InfoCard,
1128
1140
  {
1129
- title: (_b = textOutput.title) != null ? _b : "Text Output",
1141
+ title: (_a = textOutput.title) != null ? _a : "Text Output",
1130
1142
  noPadding: true,
1131
1143
  titleTypographyProps: { component: "h2" }
1132
1144
  },
1133
- /* @__PURE__ */ React.createElement(Box, { padding: 2, height: "100%" }, /* @__PURE__ */ React.createElement(MarkdownContent, { content: (_c = textOutput.content) != null ? _c : "" }))
1145
+ /* @__PURE__ */ React.createElement(Box, { padding: 2, height: "100%" }, /* @__PURE__ */ React.createElement(MarkdownContent, { content: (_b = textOutput.content) != null ? _b : "" }))
1134
1146
  )) : null);
1135
1147
  };
1136
1148
 
@@ -1342,7 +1354,7 @@ const useStyles = makeStyles$1((theme) => ({
1342
1354
  }
1343
1355
  }));
1344
1356
  function ScaffolderPageContextMenu(props) {
1345
- const { onEditorClicked, onActionsClicked, onTasksClicked } = props;
1357
+ const { onEditorClicked, onActionsClicked, onTasksClicked, onCreateClicked } = props;
1346
1358
  const classes = useStyles();
1347
1359
  const [anchorEl, setAnchorEl] = useState();
1348
1360
  if (!onEditorClicked && !onActionsClicked) {
@@ -1379,23 +1391,9 @@ function ScaffolderPageContextMenu(props) {
1379
1391
  anchorOrigin: { vertical: "bottom", horizontal: "right" },
1380
1392
  transformOrigin: { vertical: "top", horizontal: "right" }
1381
1393
  },
1382
- /* @__PURE__ */ React.createElement(MenuList, null, onEditorClicked && /* @__PURE__ */ React.createElement(MenuItem, { onClick: onEditorClicked }, /* @__PURE__ */ React.createElement(ListItemIcon$1, null, /* @__PURE__ */ React.createElement(Edit, { fontSize: "small" })), /* @__PURE__ */ React.createElement(ListItemText$1, { primary: "Template Editor" })), onActionsClicked && /* @__PURE__ */ React.createElement(MenuItem, { onClick: onActionsClicked }, /* @__PURE__ */ React.createElement(ListItemIcon$1, null, /* @__PURE__ */ React.createElement(Description, { fontSize: "small" })), /* @__PURE__ */ React.createElement(ListItemText$1, { primary: "Installed Actions" })), onTasksClicked && /* @__PURE__ */ React.createElement(MenuItem, { onClick: onTasksClicked }, /* @__PURE__ */ React.createElement(ListItemIcon$1, null, /* @__PURE__ */ React.createElement(List$1, { fontSize: "small" })), /* @__PURE__ */ React.createElement(ListItemText$1, { primary: "Task List" })))
1394
+ /* @__PURE__ */ React.createElement(MenuList, null, onCreateClicked && /* @__PURE__ */ React.createElement(MenuItem, { onClick: onCreateClicked }, /* @__PURE__ */ React.createElement(ListItemIcon$1, null, /* @__PURE__ */ React.createElement(CreateComponentIcon, { fontSize: "small" })), /* @__PURE__ */ React.createElement(ListItemText$1, { primary: "Create" })), onEditorClicked && /* @__PURE__ */ React.createElement(MenuItem, { onClick: onEditorClicked }, /* @__PURE__ */ React.createElement(ListItemIcon$1, null, /* @__PURE__ */ React.createElement(Edit, { fontSize: "small" })), /* @__PURE__ */ React.createElement(ListItemText$1, { primary: "Template Editor" })), onActionsClicked && /* @__PURE__ */ React.createElement(MenuItem, { onClick: onActionsClicked }, /* @__PURE__ */ React.createElement(ListItemIcon$1, null, /* @__PURE__ */ React.createElement(DescriptionIcon, { fontSize: "small" })), /* @__PURE__ */ React.createElement(ListItemText$1, { primary: "Installed Actions" })), onTasksClicked && /* @__PURE__ */ React.createElement(MenuItem, { onClick: onTasksClicked }, /* @__PURE__ */ React.createElement(ListItemIcon$1, null, /* @__PURE__ */ React.createElement(List$1, { fontSize: "small" })), /* @__PURE__ */ React.createElement(ListItemText$1, { primary: "Task List" })))
1383
1395
  ));
1384
1396
  }
1385
1397
 
1386
- function createLegacyScaffolderFieldExtension(options) {
1387
- return {
1388
- expose() {
1389
- const FieldExtensionDataHolder = () => null;
1390
- attachComponentData(
1391
- FieldExtensionDataHolder,
1392
- FIELD_EXTENSION_KEY,
1393
- options
1394
- );
1395
- return FieldExtensionDataHolder;
1396
- }
1397
- };
1398
- }
1399
-
1400
- export { DefaultTemplateOutputs, EmbeddableWorkflow, Form, ReviewState, ScaffolderField, ScaffolderPageContextMenu, Stepper, TaskLogStream, TaskSteps, TemplateCard, TemplateCategoryPicker, TemplateGroup, TemplateGroups, Workflow, createAsyncValidators, createFieldValidation, createLegacyScaffolderFieldExtension, extractSchemaFromStep, useFilteredSchemaProperties, useFormDataFromQuery, useTemplateParameterSchema, useTemplateSchema };
1398
+ export { DefaultTemplateOutputs, EmbeddableWorkflow, Form, ReviewState, ScaffolderField, ScaffolderPageContextMenu, Stepper, TaskLogStream, TaskSteps, TemplateCard, TemplateCategoryPicker, TemplateGroup, TemplateGroups, Workflow, createAsyncValidators, createFieldValidation, extractSchemaFromStep, useFilteredSchemaProperties, useFormDataFromQuery, useTemplateParameterSchema, useTemplateSchema };
1401
1399
  //# sourceMappingURL=alpha.esm.js.map