@backstage/plugin-scaffolder-react 1.7.1-next.2 → 1.8.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 CHANGED
@@ -1,5 +1,53 @@
1
1
  # @backstage/plugin-scaffolder-react
2
2
 
3
+ ## 1.8.0-next.0
4
+
5
+ ### Minor Changes
6
+
7
+ - c56f1a2: Remove the old legacy exports from `/alpha`
8
+ - 11b9a08: Introduced the first version of recoverable tasks.
9
+
10
+ ### Patch Changes
11
+
12
+ - 0b0c6b6: Allow defining default output text to be shown
13
+ - 6a74ffd: Updated dependency `@rjsf/utils` to `5.16.1`.
14
+ Updated dependency `@rjsf/core` to `5.16.1`.
15
+ Updated dependency `@rjsf/material-ui` to `5.16.1`.
16
+ Updated dependency `@rjsf/validator-ajv8` to `5.16.1`.
17
+ - Updated dependencies
18
+ - @backstage/plugin-catalog-react@1.9.4-next.0
19
+ - @backstage/catalog-client@1.6.0-next.0
20
+ - @backstage/plugin-scaffolder-common@1.5.0-next.0
21
+ - @backstage/core-components@0.13.10
22
+ - @backstage/catalog-model@1.4.3
23
+ - @backstage/core-plugin-api@1.8.2
24
+ - @backstage/theme@0.5.0
25
+ - @backstage/types@1.1.1
26
+ - @backstage/version-bridge@1.0.7
27
+
28
+ ## 1.7.1
29
+
30
+ ### Patch Changes
31
+
32
+ - c28f281: Scaffolder form now shows a list of errors at the top of the form.
33
+ - 0b9ce2b: Fix for a step with no properties
34
+ - 98ac5ab: Updated dependency `@rjsf/utils` to `5.15.1`.
35
+ Updated dependency `@rjsf/core` to `5.15.1`.
36
+ Updated dependency `@rjsf/material-ui` to `5.15.1`.
37
+ Updated dependency `@rjsf/validator-ajv8` to `5.15.1`.
38
+ - 4016f21: Remove some unused dependencies
39
+ - d16f85f: Show first scaffolder output text by default
40
+ - Updated dependencies
41
+ - @backstage/core-components@0.13.10
42
+ - @backstage/plugin-scaffolder-common@1.4.5
43
+ - @backstage/core-plugin-api@1.8.2
44
+ - @backstage/catalog-client@1.5.2
45
+ - @backstage/plugin-catalog-react@1.9.3
46
+ - @backstage/catalog-model@1.4.3
47
+ - @backstage/theme@0.5.0
48
+ - @backstage/types@1.1.1
49
+ - @backstage/version-bridge@1.0.7
50
+
3
51
  ## 1.7.1-next.2
4
52
 
5
53
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder-react",
3
- "version": "1.7.1-next.2",
3
+ "version": "1.8.0-next.0",
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.
@@ -285,43 +285,4 @@ declare const useTemplateParameterSchema: (templateRef: string) => {
285
285
  */
286
286
  declare const useFilteredSchemaProperties: (manifest: TemplateParameterSchema | undefined) => TemplateParameterSchema | undefined;
287
287
 
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 };
288
+ 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,4 +1,4 @@
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';
@@ -6,7 +6,7 @@ import { StructuredMetadataTable, MarkdownContent, ItemCardHeader, Link, UserIco
6
6
  import validator from '@rjsf/validator-ajv8';
7
7
  import qs from 'qs';
8
8
  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';
9
+ import { s as scaffolderApiRef, S as SecretsContextProvider } from './esm/ref-e2ee478c.esm.js';
10
10
  import cloneDeep from 'lodash/cloneDeep';
11
11
  import { withTheme } from '@rjsf/core';
12
12
  import { getUiOptions, getTemplate } from '@rjsf/utils';
@@ -283,7 +283,7 @@ const useTemplateSchema = (manifest) => {
283
283
  const stepFeatureFlag = (_a = step.uiSchema["ui:backstage"]) == null ? void 0 : _a.featureFlag;
284
284
  return stepFeatureFlag ? featureFlags.isActive(stepFeatureFlag) : true;
285
285
  }).map((step) => {
286
- var _a, _b, _c;
286
+ var _a, _b, _c, _d;
287
287
  const strippedSchema = {
288
288
  ...step,
289
289
  schema: {
@@ -292,9 +292,9 @@ const useTemplateSchema = (manifest) => {
292
292
  title: void 0
293
293
  }
294
294
  };
295
- if ((_a = step.schema) == null ? void 0 : _a.properties) {
295
+ if (((_a = step.schema) == null ? void 0 : _a.properties) || !((_b = step.schema) == null ? void 0 : _b.dependencies)) {
296
296
  strippedSchema.schema.properties = Object.fromEntries(
297
- Object.entries((_c = (_b = step.schema) == null ? void 0 : _b.properties) != null ? _c : []).filter(
297
+ Object.entries((_d = (_c = step.schema) == null ? void 0 : _c.properties) != null ? _d : {}).filter(
298
298
  ([key]) => {
299
299
  var _a2, _b2;
300
300
  const stepFeatureFlag = (_b2 = (_a2 = step.uiSchema[key]) == null ? void 0 : _a2["ui:backstage"]) == null ? void 0 : _b2.featureFlag;
@@ -1088,7 +1088,11 @@ const TextOutputs = (props) => {
1088
1088
  startIcon: /* @__PURE__ */ React.createElement(Icon, null),
1089
1089
  component: "div",
1090
1090
  color: "primary",
1091
- onClick: () => setIndex == null ? void 0 : setIndex(index !== i ? i : void 0),
1091
+ onClick: () => {
1092
+ if (index !== i) {
1093
+ setIndex == null ? void 0 : setIndex(i);
1094
+ }
1095
+ },
1092
1096
  variant: index === i ? "outlined" : void 0
1093
1097
  },
1094
1098
  title
@@ -1098,25 +1102,36 @@ const TextOutputs = (props) => {
1098
1102
 
1099
1103
  const DefaultTemplateOutputs = (props) => {
1100
1104
  var _a, _b;
1101
- const [textOutputIndex, setTextOutputIndex] = useState();
1105
+ const { output } = props;
1106
+ const [textOutputIndex, setTextOutputIndex] = useState(
1107
+ void 0
1108
+ );
1109
+ useEffect(() => {
1110
+ if (textOutputIndex === void 0 && (output == null ? void 0 : output.text)) {
1111
+ const defaultIndex = output.text.findIndex(
1112
+ (t) => t.default
1113
+ );
1114
+ setTextOutputIndex(defaultIndex >= 0 ? defaultIndex : 0);
1115
+ }
1116
+ }, [textOutputIndex, output]);
1102
1117
  const textOutput = useMemo(
1103
1118
  () => {
1104
- var _a2, _b2;
1105
- return textOutputIndex !== void 0 ? (_b2 = (_a2 = props.output) == null ? void 0 : _a2.text) == null ? void 0 : _b2[textOutputIndex] : null;
1119
+ var _a2;
1120
+ return textOutputIndex !== void 0 ? (_a2 = output == null ? void 0 : output.text) == null ? void 0 : _a2[textOutputIndex] : null;
1106
1121
  },
1107
- [props.output, textOutputIndex]
1122
+ [output, textOutputIndex]
1108
1123
  );
1109
- if (!props.output) {
1124
+ if (!output) {
1110
1125
  return null;
1111
1126
  }
1112
1127
  return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Box, { paddingBottom: 2 }, /* @__PURE__ */ React.createElement(Paper, null, /* @__PURE__ */ React.createElement(Box, { padding: 2, justifyContent: "center", display: "flex", gridGap: 16 }, /* @__PURE__ */ React.createElement(
1113
1128
  TextOutputs,
1114
1129
  {
1115
- output: props.output,
1130
+ output,
1116
1131
  index: textOutputIndex,
1117
1132
  setIndex: setTextOutputIndex
1118
1133
  }
1119
- ), /* @__PURE__ */ React.createElement(LinkOutputs, { output: props.output })))), textOutput ? /* @__PURE__ */ React.createElement(Box, { paddingBottom: 2 }, /* @__PURE__ */ React.createElement(
1134
+ ), /* @__PURE__ */ React.createElement(LinkOutputs, { output })))), textOutput ? /* @__PURE__ */ React.createElement(Box, { paddingBottom: 2 }, /* @__PURE__ */ React.createElement(
1120
1135
  InfoCard,
1121
1136
  {
1122
1137
  title: (_a = textOutput.title) != null ? _a : "Text Output",
@@ -1376,19 +1391,5 @@ function ScaffolderPageContextMenu(props) {
1376
1391
  ));
1377
1392
  }
1378
1393
 
1379
- function createLegacyScaffolderFieldExtension(options) {
1380
- return {
1381
- expose() {
1382
- const FieldExtensionDataHolder = () => null;
1383
- attachComponentData(
1384
- FieldExtensionDataHolder,
1385
- FIELD_EXTENSION_KEY,
1386
- options
1387
- );
1388
- return FieldExtensionDataHolder;
1389
- }
1390
- };
1391
- }
1392
-
1393
- export { DefaultTemplateOutputs, EmbeddableWorkflow, Form, ReviewState, ScaffolderField, ScaffolderPageContextMenu, Stepper, TaskLogStream, TaskSteps, TemplateCard, TemplateCategoryPicker, TemplateGroup, TemplateGroups, Workflow, createAsyncValidators, createFieldValidation, createLegacyScaffolderFieldExtension, extractSchemaFromStep, useFilteredSchemaProperties, useFormDataFromQuery, useTemplateParameterSchema, useTemplateSchema };
1394
+ export { DefaultTemplateOutputs, EmbeddableWorkflow, Form, ReviewState, ScaffolderField, ScaffolderPageContextMenu, Stepper, TaskLogStream, TaskSteps, TemplateCard, TemplateCategoryPicker, TemplateGroup, TemplateGroups, Workflow, createAsyncValidators, createFieldValidation, extractSchemaFromStep, useFilteredSchemaProperties, useFormDataFromQuery, useTemplateParameterSchema, useTemplateSchema };
1394
1395
  //# sourceMappingURL=alpha.esm.js.map