@backstage/plugin-scaffolder-react 1.11.0-next.3 → 1.12.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,56 @@
1
1
  # @backstage/plugin-scaffolder-react
2
2
 
3
+ ## 1.12.0-next.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 4512f71: Add `ui:backstage.review.name` option for custom item names on scaffolder review page, and also add support for rendering the `title` property instead of the key name.
8
+
9
+ ### Patch Changes
10
+
11
+ - 3ebb64f: - Fix secret widget field not displaying as required.
12
+ - Fix secret widget not able to be required inside nested objects.
13
+ - Fix secret widget not able to be disabled.
14
+ - Support `minLength` and `maxLength` properties for secret widget.
15
+ - 8dd6ef6: Fix an issue where keys with duplicate final key parts are not all displayed in the `ReviewState`. Change the way the keys are formatted to include the full schema path, separated by `>`.
16
+ - 9a0672a: Scaffolder review page shows static amount of asterisks for secret fields.
17
+ - Updated dependencies
18
+ - @backstage/plugin-catalog-react@1.12.4-next.0
19
+ - @backstage/catalog-client@1.6.6
20
+ - @backstage/catalog-model@1.6.0
21
+ - @backstage/core-components@0.14.10
22
+ - @backstage/core-plugin-api@1.9.3
23
+ - @backstage/theme@0.5.6
24
+ - @backstage/types@1.1.1
25
+ - @backstage/version-bridge@1.0.8
26
+ - @backstage/plugin-permission-react@0.4.25
27
+ - @backstage/plugin-scaffolder-common@1.5.5
28
+
29
+ ## 1.11.0
30
+
31
+ ### Minor Changes
32
+
33
+ - 8839381: Add scaffolder option to display object items in separate rows on review page
34
+
35
+ ### Patch Changes
36
+
37
+ - 072c00c: Fixed a bug in `DefaultTableOutputs` where output elements overlapped on smaller screen sizes
38
+ - 46e5e55: Change scaffolder widgets to use `TextField` component for more flexibility in theme overrides.
39
+ - d0e95a7: Add ability to customise form fields in the UI by exposing `uiSchema` and `formContext` in `FormProps`
40
+ - 4670f06: support `ajv-errors` for scaffolder validation to allow for customizing the error messages
41
+ - 04759f2: Fix null check in `isJsonObject` utility function for scaffolder review state component
42
+ - Updated dependencies
43
+ - @backstage/plugin-catalog-react@1.12.3
44
+ - @backstage/core-components@0.14.10
45
+ - @backstage/catalog-model@1.6.0
46
+ - @backstage/catalog-client@1.6.6
47
+ - @backstage/core-plugin-api@1.9.3
48
+ - @backstage/theme@0.5.6
49
+ - @backstage/types@1.1.1
50
+ - @backstage/version-bridge@1.0.8
51
+ - @backstage/plugin-permission-react@0.4.25
52
+ - @backstage/plugin-scaffolder-common@1.5.5
53
+
3
54
  ## 1.11.0-next.3
4
55
 
5
56
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder-react__alpha",
3
- "version": "1.11.0-next.3",
3
+ "version": "1.12.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
@@ -264,7 +264,7 @@ declare const ScaffolderField: (props: PropsWithChildren<ScaffolderFieldProps>)
264
264
  * Secret Widget for overriding the default password input widget
265
265
  * @alpha
266
266
  */
267
- declare const SecretWidget: (props: Pick<WidgetProps, 'name' | 'onChange' | 'schema'>) => React__default.JSX.Element;
267
+ declare const SecretWidget: (props: Pick<WidgetProps, 'name' | 'onChange' | 'schema' | 'required' | 'disabled'>) => React__default.JSX.Element;
268
268
 
269
269
  /**
270
270
  * Takes a step from a Backstage Template Manifest and converts it to a JSON Schema and UI Schema for rjsf
@@ -1,5 +1,4 @@
1
- import InputLabel from '@material-ui/core/InputLabel';
2
- import Input from '@material-ui/core/Input';
1
+ import TextField from '@material-ui/core/TextField';
3
2
  import React from 'react';
4
3
  import FormHelperText from '@material-ui/core/FormHelperText';
5
4
  import { MarkdownContent } from '@backstage/core-components';
@@ -10,10 +9,11 @@ const PasswordWidget = (props) => {
10
9
  onChange,
11
10
  schema: { title }
12
11
  } = props;
13
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(InputLabel, { htmlFor: title }, title), /* @__PURE__ */ React.createElement(
14
- Input,
12
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
13
+ TextField,
15
14
  {
16
15
  id: title,
16
+ label: title,
17
17
  "aria-describedby": title,
18
18
  onChange: (e) => {
19
19
  onChange(e.target.value);
@@ -1 +1 @@
1
- {"version":3,"file":"PasswordWidget.esm.js","sources":["../../../../src/next/components/PasswordWidget/PasswordWidget.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { WidgetProps } from '@rjsf/utils';\nimport InputLabel from '@material-ui/core/InputLabel';\nimport Input from '@material-ui/core/Input';\nimport React from 'react';\nimport FormHelperText from '@material-ui/core/FormHelperText';\nimport { MarkdownContent } from '@backstage/core-components';\n\nexport const PasswordWidget = (\n props: Pick<WidgetProps, 'onChange' | 'schema' | 'value'>,\n) => {\n const {\n value,\n onChange,\n schema: { title },\n } = props;\n\n return (\n <>\n <InputLabel htmlFor={title}>{title}</InputLabel>\n <Input\n id={title}\n aria-describedby={title}\n onChange={e => {\n onChange(e.target.value);\n }}\n value={value}\n autoComplete=\"off\"\n />\n <FormHelperText error>\n <MarkdownContent\n content=\"This widget is insecure. Please use [`ui:field: Secret`](https://backstage.io/docs/features/software-templates/writing-templates/#using-secrets) instead of\n `ui:widget: password`\"\n />\n </FormHelperText>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;AAuBa,MAAA,cAAA,GAAiB,CAC5B,KACG,KAAA;AACH,EAAM,MAAA;AAAA,IACJ,KAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAA,EAAQ,EAAE,KAAM,EAAA;AAAA,GACd,GAAA,KAAA,CAAA;AAEJ,EAAA,iFAEK,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,OAAS,EAAA,KAAA,EAAA,EAAQ,KAAM,CACnC,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,EAAI,EAAA,KAAA;AAAA,MACJ,kBAAkB,EAAA,KAAA;AAAA,MAClB,UAAU,CAAK,CAAA,KAAA;AACb,QAAS,QAAA,CAAA,CAAA,CAAE,OAAO,KAAK,CAAA,CAAA;AAAA,OACzB;AAAA,MACA,KAAA;AAAA,MACA,YAAa,EAAA,KAAA;AAAA,KAAA;AAAA,GAEf,kBAAA,KAAA,CAAA,aAAA,CAAC,cAAe,EAAA,EAAA,KAAA,EAAK,IACnB,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,eAAA;AAAA,IAAA;AAAA,MACC,OAAQ,EAAA,8LAAA;AAAA,KAAA;AAAA,GAGZ,CACF,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"PasswordWidget.esm.js","sources":["../../../../src/next/components/PasswordWidget/PasswordWidget.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { WidgetProps } from '@rjsf/utils';\nimport TextField from '@material-ui/core/TextField';\nimport React from 'react';\nimport FormHelperText from '@material-ui/core/FormHelperText';\nimport { MarkdownContent } from '@backstage/core-components';\n\nexport const PasswordWidget = (\n props: Pick<WidgetProps, 'onChange' | 'schema' | 'value'>,\n) => {\n const {\n value,\n onChange,\n schema: { title },\n } = props;\n\n return (\n <>\n <TextField\n id={title}\n label={title}\n aria-describedby={title}\n onChange={e => {\n onChange(e.target.value);\n }}\n value={value}\n autoComplete=\"off\"\n />\n <FormHelperText error>\n <MarkdownContent\n content=\"This widget is insecure. Please use [`ui:field: Secret`](https://backstage.io/docs/features/software-templates/writing-templates/#using-secrets) instead of\n `ui:widget: password`\"\n />\n </FormHelperText>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;AAsBa,MAAA,cAAA,GAAiB,CAC5B,KACG,KAAA;AACH,EAAM,MAAA;AAAA,IACJ,KAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAA,EAAQ,EAAE,KAAM,EAAA;AAAA,GACd,GAAA,KAAA,CAAA;AAEJ,EAAA,uBAEI,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACC,EAAI,EAAA,KAAA;AAAA,MACJ,KAAO,EAAA,KAAA;AAAA,MACP,kBAAkB,EAAA,KAAA;AAAA,MAClB,UAAU,CAAK,CAAA,KAAA;AACb,QAAS,QAAA,CAAA,CAAA,CAAE,OAAO,KAAK,CAAA,CAAA;AAAA,OACzB;AAAA,MACA,KAAA;AAAA,MACA,YAAa,EAAA,KAAA;AAAA,KAAA;AAAA,GAEf,kBAAA,KAAA,CAAA,aAAA,CAAC,cAAe,EAAA,EAAA,KAAA,EAAK,IACnB,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,eAAA;AAAA,IAAA;AAAA,MACC,OAAQ,EAAA,8LAAA;AAAA,KAAA;AAAA,GAGZ,CACF,CAAA,CAAA;AAEJ;;;;"}
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { StructuredMetadataTable } from '@backstage/core-components';
3
3
  import { Draft07 } from 'json-schema-library';
4
- import { getLastKey, isJsonObject } from './util.esm.js';
4
+ import { isJsonObject, formatKey } from './util.esm.js';
5
5
 
6
6
  function processSchema(key, value, schema, formState) {
7
7
  const parsedSchema = new Draft07(schema.mergedSchema);
@@ -9,23 +9,24 @@ function processSchema(key, value, schema, formState) {
9
9
  pointer: `#/${key}`,
10
10
  data: formState
11
11
  });
12
+ const name = definitionInSchema?.["ui:backstage"]?.review?.name ?? definitionInSchema?.title ?? key;
12
13
  if (definitionInSchema) {
13
14
  const backstageReviewOptions = definitionInSchema["ui:backstage"]?.review;
14
15
  if (backstageReviewOptions) {
15
16
  if (backstageReviewOptions.mask) {
16
- return [[getLastKey(key), backstageReviewOptions.mask]];
17
+ return [[name, backstageReviewOptions.mask]];
17
18
  }
18
19
  if (backstageReviewOptions.show === false) {
19
20
  return [];
20
21
  }
21
22
  }
22
- if (definitionInSchema["ui:widget"] === "password") {
23
- return [[getLastKey(key), "******"]];
23
+ if (definitionInSchema["ui:widget"] === "password" || definitionInSchema["ui:field"]?.toLocaleLowerCase("en-us") === "secret") {
24
+ return [[name, "******"]];
24
25
  }
25
26
  if (definitionInSchema.enum && definitionInSchema.enumNames) {
26
27
  return [
27
28
  [
28
- getLastKey(key),
29
+ name,
29
30
  definitionInSchema.enumNames[definitionInSchema.enum.indexOf(value)] || value
30
31
  ]
31
32
  ];
@@ -36,7 +37,7 @@ function processSchema(key, value, schema, formState) {
36
37
  );
37
38
  }
38
39
  }
39
- return [[getLastKey(key), value]];
40
+ return [[name, value]];
40
41
  }
41
42
  const ReviewState = (props) => {
42
43
  const reviewData = Object.fromEntries(
@@ -47,7 +48,10 @@ const ReviewState = (props) => {
47
48
  return [[key, value]];
48
49
  }).filter((prop) => prop.length > 0)
49
50
  );
50
- return /* @__PURE__ */ React.createElement(StructuredMetadataTable, { metadata: reviewData });
51
+ const options = {
52
+ titleFormat: formatKey
53
+ };
54
+ return /* @__PURE__ */ React.createElement(StructuredMetadataTable, { metadata: reviewData, options });
51
55
  };
52
56
 
53
57
  export { ReviewState };
@@ -1 +1 @@
1
- {"version":3,"file":"ReviewState.esm.js","sources":["../../../../src/next/components/ReviewState/ReviewState.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\nimport { StructuredMetadataTable } from '@backstage/core-components';\nimport { JsonObject, JsonValue } from '@backstage/types';\nimport { Draft07 as JSONSchema } from 'json-schema-library';\nimport { ParsedTemplateSchema } from '../../hooks/useTemplateSchema';\nimport { isJsonObject, getLastKey } from './util';\n\n/**\n * The props for the {@link ReviewState} component.\n * @alpha\n */\nexport type ReviewStateProps = {\n schemas: ParsedTemplateSchema[];\n formState: JsonObject;\n};\n\nfunction processSchema(\n key: string,\n value: JsonValue | undefined,\n schema: ParsedTemplateSchema,\n formState: JsonObject,\n): [string, JsonValue | undefined][] {\n const parsedSchema = new JSONSchema(schema.mergedSchema);\n const definitionInSchema = parsedSchema.getSchema({\n pointer: `#/${key}`,\n data: formState,\n });\n\n if (definitionInSchema) {\n const backstageReviewOptions = definitionInSchema['ui:backstage']?.review;\n if (backstageReviewOptions) {\n if (backstageReviewOptions.mask) {\n return [[getLastKey(key), backstageReviewOptions.mask]];\n }\n if (backstageReviewOptions.show === false) {\n return [];\n }\n }\n\n if (definitionInSchema['ui:widget'] === 'password') {\n return [[getLastKey(key), '******']];\n }\n\n if (definitionInSchema.enum && definitionInSchema.enumNames) {\n return [\n [\n getLastKey(key),\n definitionInSchema.enumNames[\n definitionInSchema.enum.indexOf(value)\n ] || value,\n ],\n ];\n }\n\n if (backstageReviewOptions?.explode !== false && isJsonObject(value)) {\n // Recurse nested objects\n return Object.entries(value).flatMap(([nestedKey, nestedValue]) =>\n processSchema(`${key}/${nestedKey}`, nestedValue, schema, formState),\n );\n }\n }\n\n return [[getLastKey(key), value]];\n}\n\n/**\n * The component used by the {@link Stepper} to render the review step.\n * @alpha\n */\nexport const ReviewState = (props: ReviewStateProps) => {\n const reviewData = Object.fromEntries(\n Object.entries(props.formState)\n .flatMap(([key, value]) => {\n for (const step of props.schemas) {\n return processSchema(key, value, step, props.formState);\n }\n return [[key, value]];\n })\n .filter(prop => prop.length > 0),\n );\n return <StructuredMetadataTable metadata={reviewData} />;\n};\n"],"names":["JSONSchema"],"mappings":";;;;;AA+BA,SAAS,aACP,CAAA,GAAA,EACA,KACA,EAAA,MAAA,EACA,SACmC,EAAA;AACnC,EAAA,MAAM,YAAe,GAAA,IAAIA,OAAW,CAAA,MAAA,CAAO,YAAY,CAAA,CAAA;AACvD,EAAM,MAAA,kBAAA,GAAqB,aAAa,SAAU,CAAA;AAAA,IAChD,OAAA,EAAS,KAAK,GAAG,CAAA,CAAA;AAAA,IACjB,IAAM,EAAA,SAAA;AAAA,GACP,CAAA,CAAA;AAED,EAAA,IAAI,kBAAoB,EAAA;AACtB,IAAM,MAAA,sBAAA,GAAyB,kBAAmB,CAAA,cAAc,CAAG,EAAA,MAAA,CAAA;AACnE,IAAA,IAAI,sBAAwB,EAAA;AAC1B,MAAA,IAAI,uBAAuB,IAAM,EAAA;AAC/B,QAAA,OAAO,CAAC,CAAC,UAAA,CAAW,GAAG,CAAG,EAAA,sBAAA,CAAuB,IAAI,CAAC,CAAA,CAAA;AAAA,OACxD;AACA,MAAI,IAAA,sBAAA,CAAuB,SAAS,KAAO,EAAA;AACzC,QAAA,OAAO,EAAC,CAAA;AAAA,OACV;AAAA,KACF;AAEA,IAAI,IAAA,kBAAA,CAAmB,WAAW,CAAA,KAAM,UAAY,EAAA;AAClD,MAAA,OAAO,CAAC,CAAC,UAAA,CAAW,GAAG,C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IAAA,KAAA,IAAA,CAAK,SAAS,CAAC,CAAA;AAAA,GACnC,CAAA;AACA,EAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,uBAAwB,EAAA,EAAA,QAAA,EAAU,UAAY,EAAA,CAAA,CAAA;AACxD;;;;"}
1
+ {"version":3,"file":"ReviewState.esm.js","sources":["../../../../src/next/components/ReviewState/ReviewState.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\nimport { StructuredMetadataTable } from '@backstage/core-components';\nimport { JsonObject, JsonValue } from '@backstage/types';\nimport { Draft07 as JSONSchema } from 'json-schema-library';\nimport { ParsedTemplateSchema } from '../../hooks/useTemplateSchema';\nimport { isJsonObject, formatKey } from './util';\n\n/**\n * The props for the {@link ReviewState} component.\n * @alpha\n */\nexport type ReviewStateProps = {\n schemas: ParsedTemplateSchema[];\n formState: JsonObject;\n};\n\nfunction processSchema(\n key: string,\n value: JsonValue | undefined,\n schema: ParsedTemplateSchema,\n formState: JsonObject,\n): [string, JsonValue | undefined][] {\n const parsedSchema = new JSONSchema(schema.mergedSchema);\n const definitionInSchema = parsedSchema.getSchema({\n pointer: `#/${key}`,\n data: formState,\n });\n\n const name =\n definitionInSchema?.['ui:backstage']?.review?.name ??\n definitionInSchema?.title ??\n key;\n\n if (definitionInSchema) {\n const backstageReviewOptions = definitionInSchema['ui:backstage']?.review;\n if (backstageReviewOptions) {\n if (backstageReviewOptions.mask) {\n return [[name, backstageReviewOptions.mask]];\n }\n if (backstageReviewOptions.show === false) {\n return [];\n }\n }\n\n if (\n definitionInSchema['ui:widget'] === 'password' ||\n definitionInSchema['ui:field']?.toLocaleLowerCase('en-us') === 'secret'\n ) {\n return [[name, '******']];\n }\n\n if (definitionInSchema.enum && definitionInSchema.enumNames) {\n return [\n [\n name,\n definitionInSchema.enumNames[\n definitionInSchema.enum.indexOf(value)\n ] || value,\n ],\n ];\n }\n\n if (backstageReviewOptions?.explode !== false && isJsonObject(value)) {\n // Recurse nested objects\n return Object.entries(value).flatMap(([nestedKey, nestedValue]) =>\n processSchema(`${key}/${nestedKey}`, nestedValue, schema, formState),\n );\n }\n }\n\n return [[name, value]];\n}\n\n/**\n * The component used by the {@link Stepper} to render the review step.\n * @alpha\n */\nexport const ReviewState = (props: ReviewStateProps) => {\n const reviewData = Object.fromEntries(\n Object.entries(props.formState)\n .flatMap(([key, value]) => {\n for (const step of props.schemas) {\n return processSchema(key, value, step, props.formState);\n }\n return [[key, value]];\n })\n .filter(prop => prop.length > 0),\n );\n const options = {\n titleFormat: formatKey,\n };\n return <StructuredMetadataTable metadata={reviewData} options={options} />;\n};\n"],"names":["JSONSchema"],"mappings":";;;;;AA+BA,SAAS,aACP,CAAA,GAAA,EACA,KACA,EAAA,MAAA,EACA,SACmC,EAAA;AACnC,EAAA,MAAM,YAAe,GAAA,IAAIA,OAAW,CAAA,MAAA,CAAO,YAAY,CAAA,CAAA;AACvD,EAAM,MAAA,kBAAA,GAAqB,aAAa,SAAU,CAAA;AAAA,IAChD,OAAA,EAAS,KAAK,GAAG,CAAA,CAAA;AAAA,IACjB,IAAM,EAAA,SAAA;AAAA,GACP,CAAA,CAAA;AAED,EAAA,MAAM,OACJ,kBAAqB,GAAA,cAAc,GAAG,MAAQ,EAAA,IAAA,IAC9C,oBAAoB,KACpB,IAAA,GAAA,CAAA;AAEF,EAAA,IAAI,kBAAoB,EAAA;AACtB,IAAM,MAAA,sBAAA,GAAyB,kBAAmB,CAAA,cAAc,CAAG,EAAA,MAAA,CAAA;AACnE,IAAA,IAAI,sBAAwB,EAAA;AAC1B,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AAA,CAAO,OAAQ,CAAA,KAAA,CAAM,SAAS,CAAA,CAC3B,QAAQ,CAAC,CAAC,GAAK,EAAA,KAAK,CAAM,KAAA;AACzB,MAAW,KAAA,MAAA,IAAA,IAAQ,MAAM,OAAS,EAAA;AAChC,QAAA,OAAO,aAAc,CAAA,GAAA,EAAK,KAAO,EAAA,IAAA,EAAM,MAAM,SAAS,CAAA,CAAA;AAAA,OACxD;AACA,MAAA,OAAO,CAAC,CAAC,GAAK,EAAA,KAAK,CAAC,CAAA,CAAA;AAAA,KACrB,CACA,CAAA,MAAA,CAAO,CAAQ,IAAA,KAAA,IAAA,CAAK,SAAS,CAAC,CAAA;AAAA,GACnC,CAAA;AACA,EAAA,MAAM,OAAU,GAAA;AAAA,IACd,WAAa,EAAA,SAAA;AAAA,GACf,CAAA;AACA,EAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,uBAAA,EAAA,EAAwB,QAAU,EAAA,UAAA,EAAY,OAAkB,EAAA,CAAA,CAAA;AAC1E;;;;"}
@@ -1,10 +1,12 @@
1
+ import { startCase } from 'lodash';
2
+
1
3
  function isJsonObject(value) {
2
4
  return typeof value === "object" && value !== null && !Array.isArray(value);
3
5
  }
4
- function getLastKey(key) {
6
+ function formatKey(key) {
5
7
  const parts = key.split("/");
6
- return parts[parts.length - 1];
8
+ return parts.filter(Boolean).map((part) => startCase(part)).join(" > ");
7
9
  }
8
10
 
9
- export { getLastKey, isJsonObject };
11
+ export { formatKey, isJsonObject };
10
12
  //# sourceMappingURL=util.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"util.esm.js","sources":["../../../../src/next/components/ReviewState/util.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JsonObject, JsonValue } from '@backstage/types';\n\nexport function isJsonObject(value?: JsonValue): value is JsonObject {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n// Helper function to get the last part of the key\nexport function getLastKey(key: string): string {\n const parts = key.split('/');\n return parts[parts.length - 1];\n}\n"],"names":[],"mappings":"AAkBO,SAAS,aAAa,KAAwC,EAAA;AACnE,EAAO,OAAA,OAAO,UAAU,QAAY,IAAA,KAAA,KAAU,QAAQ,CAAC,KAAA,CAAM,QAAQ,KAAK,CAAA,CAAA;AAC5E,CAAA;AAGO,SAAS,WAAW,GAAqB,EAAA;AAC9C,EAAM,MAAA,KAAA,GAAQ,GAAI,CAAA,KAAA,CAAM,GAAG,CAAA,CAAA;AAC3B,EAAO,OAAA,KAAA,CAAM,KAAM,CAAA,MAAA,GAAS,CAAC,CAAA,CAAA;AAC/B;;;;"}
1
+ {"version":3,"file":"util.esm.js","sources":["../../../../src/next/components/ReviewState/util.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JsonObject, JsonValue } from '@backstage/types';\nimport { startCase } from 'lodash';\n\nexport function isJsonObject(value?: JsonValue): value is JsonObject {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n// Helper function to format a key into a human-readable string\nexport function formatKey(key: string): string {\n const parts = key.split('/');\n return parts\n .filter(Boolean)\n .map(part => startCase(part))\n .join(' > ');\n}\n"],"names":[],"mappings":";;AAmBO,SAAS,aAAa,KAAwC,EAAA;AACnE,EAAO,OAAA,OAAO,UAAU,QAAY,IAAA,KAAA,KAAU,QAAQ,CAAC,KAAA,CAAM,QAAQ,KAAK,CAAA,CAAA;AAC5E,CAAA;AAGO,SAAS,UAAU,GAAqB,EAAA;AAC7C,EAAM,MAAA,KAAA,GAAQ,GAAI,CAAA,KAAA,CAAM,GAAG,CAAA,CAAA;AAC3B,EAAO,OAAA,KAAA,CACJ,MAAO,CAAA,OAAO,CACd,CAAA,GAAA,CAAI,CAAQ,IAAA,KAAA,SAAA,CAAU,IAAI,CAAC,CAC3B,CAAA,IAAA,CAAK,KAAK,CAAA,CAAA;AACf;;;;"}
@@ -1,6 +1,5 @@
1
1
  import { useTemplateSecrets } from '@backstage/plugin-scaffolder-react';
2
- import InputLabel from '@material-ui/core/InputLabel';
3
- import Input from '@material-ui/core/Input';
2
+ import TextField from '@material-ui/core/TextField';
4
3
  import React from 'react';
5
4
 
6
5
  const SecretWidget = (props) => {
@@ -8,22 +7,31 @@ const SecretWidget = (props) => {
8
7
  const {
9
8
  name,
10
9
  onChange,
11
- schema: { title }
10
+ schema: { title, minLength, maxLength },
11
+ required,
12
+ disabled
12
13
  } = props;
13
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(InputLabel, { htmlFor: title }, title), /* @__PURE__ */ React.createElement(
14
- Input,
14
+ return /* @__PURE__ */ React.createElement(
15
+ TextField,
15
16
  {
16
17
  id: title,
18
+ label: title,
17
19
  "aria-describedby": title,
18
20
  onChange: (e) => {
19
- onChange(Array(e.target?.value.length).fill("*").join(""));
20
- setSecrets({ [name]: e.target?.value });
21
+ onChange(Array(e.target.value.length).fill("*").join(""));
22
+ setSecrets({ [name]: e.target.value });
21
23
  },
22
24
  value: secrets[name] ?? "",
23
25
  type: "password",
24
- autoComplete: "off"
26
+ autoComplete: "off",
27
+ required,
28
+ disabled,
29
+ inputProps: {
30
+ minLength,
31
+ maxLength
32
+ }
25
33
  }
26
- ));
34
+ );
27
35
  };
28
36
 
29
37
  export { SecretWidget };
@@ -1 +1 @@
1
- {"version":3,"file":"SecretWidget.esm.js","sources":["../../../../src/next/components/SecretWidget/SecretWidget.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { WidgetProps } from '@rjsf/utils';\nimport { useTemplateSecrets } from '@backstage/plugin-scaffolder-react';\nimport InputLabel from '@material-ui/core/InputLabel';\nimport Input from '@material-ui/core/Input';\nimport React from 'react';\n\n/**\n * Secret Widget for overriding the default password input widget\n * @alpha\n */\nexport const SecretWidget = (\n props: Pick<WidgetProps, 'name' | 'onChange' | 'schema'>,\n) => {\n const { setSecrets, secrets } = useTemplateSecrets();\n const {\n name,\n onChange,\n schema: { title },\n } = props;\n\n return (\n <>\n <InputLabel htmlFor={title}>{title}</InputLabel>\n <Input\n id={title}\n aria-describedby={title}\n onChange={e => {\n onChange(Array(e.target?.value.length).fill('*').join(''));\n setSecrets({ [name]: e.target?.value });\n }}\n value={secrets[name] ?? ''}\n type=\"password\"\n autoComplete=\"off\"\n />\n </>\n );\n};\n"],"names":[],"mappings":";;;;;AA0Ba,MAAA,YAAA,GAAe,CAC1B,KACG,KAAA;AACH,EAAA,MAAM,EAAE,UAAA,EAAY,OAAQ,EAAA,GAAI,kBAAmB,EAAA,CAAA;AACnD,EAAM,MAAA;AAAA,IACJ,IAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAA,EAAQ,EAAE,KAAM,EAAA;AAAA,GACd,GAAA,KAAA,CAAA;AAEJ,EAAA,iFAEK,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,OAAS,EAAA,KAAA,EAAA,EAAQ,KAAM,CACnC,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,EAAI,EAAA,KAAA;AAAA,MACJ,kBAAkB,EAAA,KAAA;AAAA,MAClB,UAAU,CAAK,CAAA,KAAA;AACb,QAAS,QAAA,CAAA,KAAA,CAAM,CAAE,CAAA,MAAA,EAAQ,KAAM,CAAA,MAAM,CAAE,CAAA,IAAA,CAAK,GAAG,CAAA,CAAE,IAAK,CAAA,EAAE,CAAC,CAAA,CAAA;AACzD,QAAA,UAAA,CAAW,EAAE,CAAC,IAAI,GAAG,CAAE,CAAA,MAAA,EAAQ,OAAO,CAAA,CAAA;AAAA,OACxC;AAAA,MACA,KAAA,EAAO,OAAQ,CAAA,IAAI,CAAK,IAAA,EAAA;AAAA,MACxB,IAAK,EAAA,UAAA;AAAA,MACL,YAAa,EAAA,KAAA;AAAA,KAAA;AAAA,GAEjB,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"SecretWidget.esm.js","sources":["../../../../src/next/components/SecretWidget/SecretWidget.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { WidgetProps } from '@rjsf/utils';\nimport { useTemplateSecrets } from '@backstage/plugin-scaffolder-react';\nimport TextField from '@material-ui/core/TextField';\nimport React from 'react';\n\n/**\n * Secret Widget for overriding the default password input widget\n * @alpha\n */\nexport const SecretWidget = (\n props: Pick<\n WidgetProps,\n 'name' | 'onChange' | 'schema' | 'required' | 'disabled'\n >,\n) => {\n const { setSecrets, secrets } = useTemplateSecrets();\n const {\n name,\n onChange,\n schema: { title, minLength, maxLength },\n required,\n disabled,\n } = props;\n\n return (\n <TextField\n id={title}\n label={title}\n aria-describedby={title}\n onChange={e => {\n onChange(Array(e.target.value.length).fill('*').join(''));\n setSecrets({ [name]: e.target.value });\n }}\n value={secrets[name] ?? ''}\n type=\"password\"\n autoComplete=\"off\"\n required={required}\n disabled={disabled}\n inputProps={{\n minLength,\n maxLength,\n }}\n />\n );\n};\n"],"names":[],"mappings":";;;;AAyBa,MAAA,YAAA,GAAe,CAC1B,KAIG,KAAA;AACH,EAAA,MAAM,EAAE,UAAA,EAAY,OAAQ,EAAA,GAAI,kBAAmB,EAAA,CAAA;AACnD,EAAM,MAAA;AAAA,IACJ,IAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAQ,EAAA,EAAE,KAAO,EAAA,SAAA,EAAW,SAAU,EAAA;AAAA,IACtC,QAAA;AAAA,IACA,QAAA;AAAA,GACE,GAAA,KAAA,CAAA;AAEJ,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACC,EAAI,EAAA,KAAA;AAAA,MACJ,KAAO,EAAA,KAAA;AAAA,MACP,kBAAkB,EAAA,KAAA;AAAA,MAClB,UAAU,CAAK,CAAA,KAAA;AACb,QAAS,QAAA,CAAA,KAAA,CAAM,CAAE,CAAA,MAAA,CAAO,KAAM,CAAA,MAAM,CAAE,CAAA,IAAA,CAAK,GAAG,CAAA,CAAE,IAAK,CAAA,EAAE,CAAC,CAAA,CAAA;AACxD,QAAA,UAAA,CAAW,EAAE,CAAC,IAAI,GAAG,CAAE,CAAA,MAAA,CAAO,OAAO,CAAA,CAAA;AAAA,OACvC;AAAA,MACA,KAAA,EAAO,OAAQ,CAAA,IAAI,CAAK,IAAA,EAAA;AAAA,MACxB,IAAK,EAAA,UAAA;AAAA,MACL,YAAa,EAAA,KAAA;AAAA,MACb,QAAA;AAAA,MACA,QAAA;AAAA,MACA,UAAY,EAAA;AAAA,QACV,SAAA;AAAA,QACA,SAAA;AAAA,OACF;AAAA,KAAA;AAAA,GACF,CAAA;AAEJ;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder-react",
3
- "version": "1.11.0-next.3",
3
+ "version": "1.12.0-next.0",
4
4
  "description": "A frontend library that helps other Backstage plugins interact with the Scaffolder",
5
5
  "backstage": {
6
6
  "role": "web-library",
@@ -57,13 +57,13 @@
57
57
  "test": "backstage-cli package test"
58
58
  },
59
59
  "dependencies": {
60
- "@backstage/catalog-client": "^1.6.6-next.0",
61
- "@backstage/catalog-model": "^1.6.0-next.0",
62
- "@backstage/core-components": "^0.14.10-next.0",
60
+ "@backstage/catalog-client": "^1.6.6",
61
+ "@backstage/catalog-model": "^1.6.0",
62
+ "@backstage/core-components": "^0.14.10",
63
63
  "@backstage/core-plugin-api": "^1.9.3",
64
- "@backstage/plugin-catalog-react": "^1.12.3-next.3",
65
- "@backstage/plugin-permission-react": "^0.4.25-next.1",
66
- "@backstage/plugin-scaffolder-common": "^1.5.5-next.2",
64
+ "@backstage/plugin-catalog-react": "^1.12.4-next.0",
65
+ "@backstage/plugin-permission-react": "^0.4.25",
66
+ "@backstage/plugin-scaffolder-common": "^1.5.5",
67
67
  "@backstage/theme": "^0.5.6",
68
68
  "@backstage/types": "^1.1.1",
69
69
  "@backstage/version-bridge": "^1.0.8",
@@ -93,12 +93,12 @@
93
93
  "zod-to-json-schema": "^3.20.4"
94
94
  },
95
95
  "devDependencies": {
96
- "@backstage/cli": "^0.27.0-next.4",
97
- "@backstage/core-app-api": "^1.14.2-next.0",
98
- "@backstage/plugin-catalog": "^1.22.0-next.3",
99
- "@backstage/plugin-catalog-common": "^1.0.26-next.2",
100
- "@backstage/plugin-permission-common": "^0.8.1-next.1",
101
- "@backstage/test-utils": "^1.5.10-next.2",
96
+ "@backstage/cli": "^0.27.1-next.0",
97
+ "@backstage/core-app-api": "^1.14.2",
98
+ "@backstage/plugin-catalog": "^1.22.1-next.0",
99
+ "@backstage/plugin-catalog-common": "^1.0.26",
100
+ "@backstage/plugin-permission-common": "^0.8.1",
101
+ "@backstage/test-utils": "^1.6.0-next.0",
102
102
  "@testing-library/dom": "^10.0.0",
103
103
  "@testing-library/jest-dom": "^6.0.0",
104
104
  "@testing-library/react": "^15.0.0",