@backstage/plugin-scaffolder 1.31.0-next.2 → 1.31.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.
Files changed (39) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/dist/alpha.d.ts +2 -0
  3. package/dist/components/fields/EntityNamePicker/schema.esm.js +4 -3
  4. package/dist/components/fields/EntityNamePicker/schema.esm.js.map +1 -1
  5. package/dist/components/fields/EntityPicker/EntityPicker.esm.js +1 -1
  6. package/dist/components/fields/EntityPicker/EntityPicker.esm.js.map +1 -1
  7. package/dist/components/fields/EntityPicker/schema.esm.js +10 -9
  8. package/dist/components/fields/EntityPicker/schema.esm.js.map +1 -1
  9. package/dist/components/fields/EntityTagsPicker/EntityTagsPicker.esm.js +44 -24
  10. package/dist/components/fields/EntityTagsPicker/EntityTagsPicker.esm.js.map +1 -1
  11. package/dist/components/fields/EntityTagsPicker/schema.esm.js +8 -7
  12. package/dist/components/fields/EntityTagsPicker/schema.esm.js.map +1 -1
  13. package/dist/components/fields/MultiEntityPicker/MultiEntityPicker.esm.js +15 -7
  14. package/dist/components/fields/MultiEntityPicker/MultiEntityPicker.esm.js.map +1 -1
  15. package/dist/components/fields/MultiEntityPicker/schema.esm.js +5 -5
  16. package/dist/components/fields/MultiEntityPicker/schema.esm.js.map +1 -1
  17. package/dist/components/fields/MyGroupsPicker/MyGroupsPicker.esm.js +10 -6
  18. package/dist/components/fields/MyGroupsPicker/MyGroupsPicker.esm.js.map +1 -1
  19. package/dist/components/fields/MyGroupsPicker/schema.esm.js +4 -9
  20. package/dist/components/fields/MyGroupsPicker/schema.esm.js.map +1 -1
  21. package/dist/components/fields/OwnedEntityPicker/OwnedEntityPicker.esm.js +25 -14
  22. package/dist/components/fields/OwnedEntityPicker/OwnedEntityPicker.esm.js.map +1 -1
  23. package/dist/components/fields/OwnedEntityPicker/schema.esm.js +2 -19
  24. package/dist/components/fields/OwnedEntityPicker/schema.esm.js.map +1 -1
  25. package/dist/components/fields/OwnerPicker/schema.esm.js +9 -8
  26. package/dist/components/fields/OwnerPicker/schema.esm.js.map +1 -1
  27. package/dist/components/fields/RepoBranchPicker/RepoBranchPicker.esm.js +3 -1
  28. package/dist/components/fields/RepoBranchPicker/RepoBranchPicker.esm.js.map +1 -1
  29. package/dist/components/fields/RepoBranchPicker/schema.esm.js +5 -6
  30. package/dist/components/fields/RepoBranchPicker/schema.esm.js.map +1 -1
  31. package/dist/components/fields/RepoUrlPicker/RepoUrlPicker.esm.js +3 -1
  32. package/dist/components/fields/RepoUrlPicker/RepoUrlPicker.esm.js.map +1 -1
  33. package/dist/components/fields/RepoUrlPicker/schema.esm.js.map +1 -1
  34. package/dist/components/fields/SecretInput/SecretInput.esm.js +3 -2
  35. package/dist/components/fields/SecretInput/SecretInput.esm.js.map +1 -1
  36. package/dist/index.d.ts +28 -34
  37. package/dist/translation.esm.js +4 -0
  38. package/dist/translation.esm.js.map +1 -1
  39. package/package.json +22 -22
@@ -2,7 +2,6 @@ import { jsx } from 'react/jsx-runtime';
2
2
  import { useEffect } from 'react';
3
3
  import { useApi, identityApiRef, errorApiRef } from '@backstage/core-plugin-api';
4
4
  import TextField from '@material-ui/core/TextField';
5
- import FormControl from '@material-ui/core/FormControl';
6
5
  export { MyGroupsPickerSchema } from './schema.esm.js';
7
6
  import Autocomplete, { createFilterOptions } from '@material-ui/lab/Autocomplete';
8
7
  import { catalogApiRef, entityPresentationApiRef, EntityDisplayName } from '@backstage/plugin-catalog-react';
@@ -12,6 +11,7 @@ import { stringifyEntityRef } from '@backstage/catalog-model';
12
11
  import { VirtualizedListbox } from '../VirtualizedListbox.esm.js';
13
12
  import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
14
13
  import { scaffolderTranslationRef } from '../../../translation.esm.js';
14
+ import { ScaffolderField } from '@backstage/plugin-scaffolder-react/alpha';
15
15
 
16
16
  const MyGroupsPicker = (props) => {
17
17
  const { t } = useTranslationRef(scaffolderTranslationRef);
@@ -23,12 +23,15 @@ const MyGroupsPicker = (props) => {
23
23
  required,
24
24
  rawErrors,
25
25
  onChange,
26
- formData
26
+ formData,
27
+ uiSchema,
28
+ errors
27
29
  } = props;
28
30
  const identityApi = useApi(identityApiRef);
29
31
  const catalogApi = useApi(catalogApiRef);
30
32
  const errorApi = useApi(errorApiRef);
31
33
  const entityPresentationApi = useApi(entityPresentationApiRef);
34
+ const isDisabled = uiSchema?.["ui:disabled"] ?? false;
32
35
  const { value: groups, loading } = useAsync(async () => {
33
36
  const { userEntityRef } = await identityApi.getBackstageIdentity();
34
37
  if (!userEntityRef) {
@@ -61,11 +64,13 @@ const MyGroupsPicker = (props) => {
61
64
  }
62
65
  }, [groups, onChange, selectedEntity, required]);
63
66
  return /* @__PURE__ */ jsx(
64
- FormControl,
67
+ ScaffolderField,
65
68
  {
66
- margin: "normal",
69
+ rawErrors,
70
+ rawDescription: uiSchema["ui:description"] ?? description,
67
71
  required,
68
- error: rawErrors?.length > 0,
72
+ disabled: isDisabled,
73
+ errors,
69
74
  children: /* @__PURE__ */ jsx(
70
75
  Autocomplete,
71
76
  {
@@ -83,7 +88,6 @@ const MyGroupsPicker = (props) => {
83
88
  ...params,
84
89
  label: title,
85
90
  margin: "dense",
86
- helperText: description,
87
91
  FormHelperTextProps: { margin: "dense", style: { marginLeft: 0 } },
88
92
  variant: "outlined",
89
93
  required,
@@ -1 +1 @@
1
- {"version":3,"file":"MyGroupsPicker.esm.js","sources":["../../../../src/components/fields/MyGroupsPicker/MyGroupsPicker.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 { ChangeEvent, useEffect } from 'react';\nimport {\n errorApiRef,\n identityApiRef,\n useApi,\n} from '@backstage/core-plugin-api';\nimport TextField from '@material-ui/core/TextField';\nimport FormControl from '@material-ui/core/FormControl';\nimport { MyGroupsPickerProps, MyGroupsPickerSchema } from './schema';\nimport Autocomplete, {\n createFilterOptions,\n} from '@material-ui/lab/Autocomplete';\nimport {\n catalogApiRef,\n EntityDisplayName,\n entityPresentationApiRef,\n EntityRefPresentationSnapshot,\n} from '@backstage/plugin-catalog-react';\nimport { NotFoundError } from '@backstage/errors';\nimport useAsync from 'react-use/esm/useAsync';\nimport { Entity, stringifyEntityRef } from '@backstage/catalog-model';\nimport { VirtualizedListbox } from '../VirtualizedListbox';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { scaffolderTranslationRef } from '../../../translation';\n\nexport { MyGroupsPickerSchema };\n\nexport const MyGroupsPicker = (props: MyGroupsPickerProps) => {\n const { t } = useTranslationRef(scaffolderTranslationRef);\n const {\n schema: {\n title = t('fields.myGroupsPicker.title'),\n description = t('fields.myGroupsPicker.description'),\n },\n required,\n rawErrors,\n onChange,\n formData,\n } = props;\n\n const identityApi = useApi(identityApiRef);\n const catalogApi = useApi(catalogApiRef);\n const errorApi = useApi(errorApiRef);\n const entityPresentationApi = useApi(entityPresentationApiRef);\n\n const { value: groups, loading } = useAsync(async () => {\n const { userEntityRef } = await identityApi.getBackstageIdentity();\n\n if (!userEntityRef) {\n errorApi.post(new NotFoundError('No user entity ref found'));\n return { catalogEntities: [], entityRefToPresentation: new Map() };\n }\n\n const { items } = await catalogApi.getEntities({\n filter: {\n kind: 'Group',\n ['relations.hasMember']: [userEntityRef],\n },\n });\n\n const entityRefToPresentation = new Map<\n string,\n EntityRefPresentationSnapshot\n >(\n await Promise.all(\n items.map(async item => {\n const presentation = await entityPresentationApi.forEntity(item)\n .promise;\n return [stringifyEntityRef(item), presentation] as [\n string,\n EntityRefPresentationSnapshot,\n ];\n }),\n ),\n );\n\n return { catalogEntities: items, entityRefToPresentation };\n });\n\n const updateChange = (_: ChangeEvent<{}>, value: Entity | null) => {\n onChange(value ? stringifyEntityRef(value) : '');\n };\n\n const selectedEntity =\n groups?.catalogEntities.find(e => stringifyEntityRef(e) === formData) ||\n null;\n\n useEffect(() => {\n if (required && groups?.catalogEntities.length === 1 && !selectedEntity) {\n onChange(stringifyEntityRef(groups.catalogEntities[0]));\n }\n }, [groups, onChange, selectedEntity, required]);\n\n return (\n <FormControl\n margin=\"normal\"\n required={required}\n error={rawErrors?.length > 0}\n >\n <Autocomplete\n disabled={required && groups?.catalogEntities.length === 1}\n id=\"OwnershipEntityRefPicker-dropdown\"\n options={groups?.catalogEntities || []}\n value={selectedEntity}\n loading={loading}\n onChange={updateChange}\n getOptionLabel={option =>\n groups?.entityRefToPresentation.get(stringifyEntityRef(option))\n ?.primaryTitle!\n }\n autoSelect\n renderInput={params => (\n <TextField\n {...params}\n label={title}\n margin=\"dense\"\n helperText={description}\n FormHelperTextProps={{ margin: 'dense', style: { marginLeft: 0 } }}\n variant=\"outlined\"\n required={required}\n InputProps={params.InputProps}\n />\n )}\n renderOption={option => <EntityDisplayName entityRef={option} />}\n filterOptions={createFilterOptions<Entity>({\n stringify: option =>\n groups?.entityRefToPresentation.get(stringifyEntityRef(option))\n ?.primaryTitle!,\n })}\n ListboxComponent={VirtualizedListbox}\n />\n </FormControl>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AA2Ca,MAAA,cAAA,GAAiB,CAAC,KAA+B,KAAA;AAC5D,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,wBAAwB,CAAA;AACxD,EAAM,MAAA;AAAA,IACJ,MAAQ,EAAA;AAAA,MACN,KAAA,GAAQ,EAAE,6BAA6B,CAAA;AAAA,MACvC,WAAA,GAAc,EAAE,mCAAmC;AAAA,KACrD;AAAA,IACA,QAAA;AAAA,IACA,SAAA;AAAA,IACA,QAAA;AAAA,IACA;A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,OAAA;AAAA,cACP,UAAY,EAAA,WAAA;AAAA,cACZ,mBAAA,EAAqB,EAAE,MAAQ,EAAA,OAAA,EAAS,OAAO,EAAE,UAAA,EAAY,GAAI,EAAA;AAAA,cACjE,OAAQ,EAAA,UAAA;AAAA,cACR,QAAA;AAAA,cACA,YAAY,MAAO,CAAA;AAAA;AAAA,WACrB;AAAA,UAEF,YAAc,EAAA,CAAA,MAAA,qBAAW,GAAA,CAAA,iBAAA,EAAA,EAAkB,WAAW,MAAQ,EAAA,CAAA;AAAA,UAC9D,eAAe,mBAA4B,CAAA;AAAA,YACzC,SAAA,EAAW,YACT,MAAQ,EAAA,uBAAA,CAAwB,IAAI,kBAAmB,CAAA,MAAM,CAAC,CAC1D,EAAA;AAAA,WACP,CAAA;AAAA,UACD,gBAAkB,EAAA;AAAA;AAAA;AACpB;AAAA,GACF;AAEJ;;;;"}
1
+ {"version":3,"file":"MyGroupsPicker.esm.js","sources":["../../../../src/components/fields/MyGroupsPicker/MyGroupsPicker.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 { ChangeEvent, useEffect } from 'react';\nimport {\n errorApiRef,\n identityApiRef,\n useApi,\n} from '@backstage/core-plugin-api';\nimport TextField from '@material-ui/core/TextField';\nimport { MyGroupsPickerProps, MyGroupsPickerSchema } from './schema';\nimport Autocomplete, {\n createFilterOptions,\n} from '@material-ui/lab/Autocomplete';\nimport {\n catalogApiRef,\n EntityDisplayName,\n entityPresentationApiRef,\n EntityRefPresentationSnapshot,\n} from '@backstage/plugin-catalog-react';\nimport { NotFoundError } from '@backstage/errors';\nimport useAsync from 'react-use/esm/useAsync';\nimport { Entity, stringifyEntityRef } from '@backstage/catalog-model';\nimport { VirtualizedListbox } from '../VirtualizedListbox';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { scaffolderTranslationRef } from '../../../translation';\nimport { ScaffolderField } from '@backstage/plugin-scaffolder-react/alpha';\n\nexport { MyGroupsPickerSchema };\n\nexport const MyGroupsPicker = (props: MyGroupsPickerProps) => {\n const { t } = useTranslationRef(scaffolderTranslationRef);\n const {\n schema: {\n title = t('fields.myGroupsPicker.title'),\n description = t('fields.myGroupsPicker.description'),\n },\n required,\n rawErrors,\n onChange,\n formData,\n uiSchema,\n errors,\n } = props;\n\n const identityApi = useApi(identityApiRef);\n const catalogApi = useApi(catalogApiRef);\n const errorApi = useApi(errorApiRef);\n const entityPresentationApi = useApi(entityPresentationApiRef);\n const isDisabled = uiSchema?.['ui:disabled'] ?? false;\n\n const { value: groups, loading } = useAsync(async () => {\n const { userEntityRef } = await identityApi.getBackstageIdentity();\n\n if (!userEntityRef) {\n errorApi.post(new NotFoundError('No user entity ref found'));\n return { catalogEntities: [], entityRefToPresentation: new Map() };\n }\n\n const { items } = await catalogApi.getEntities({\n filter: {\n kind: 'Group',\n ['relations.hasMember']: [userEntityRef],\n },\n });\n\n const entityRefToPresentation = new Map<\n string,\n EntityRefPresentationSnapshot\n >(\n await Promise.all(\n items.map(async item => {\n const presentation = await entityPresentationApi.forEntity(item)\n .promise;\n return [stringifyEntityRef(item), presentation] as [\n string,\n EntityRefPresentationSnapshot,\n ];\n }),\n ),\n );\n\n return { catalogEntities: items, entityRefToPresentation };\n });\n\n const updateChange = (_: ChangeEvent<{}>, value: Entity | null) => {\n onChange(value ? stringifyEntityRef(value) : '');\n };\n\n const selectedEntity =\n groups?.catalogEntities.find(e => stringifyEntityRef(e) === formData) ||\n null;\n\n useEffect(() => {\n if (required && groups?.catalogEntities.length === 1 && !selectedEntity) {\n onChange(stringifyEntityRef(groups.catalogEntities[0]));\n }\n }, [groups, onChange, selectedEntity, required]);\n\n return (\n <ScaffolderField\n rawErrors={rawErrors}\n rawDescription={uiSchema['ui:description'] ?? description}\n required={required}\n disabled={isDisabled}\n errors={errors}\n >\n <Autocomplete\n disabled={required && groups?.catalogEntities.length === 1}\n id=\"OwnershipEntityRefPicker-dropdown\"\n options={groups?.catalogEntities || []}\n value={selectedEntity}\n loading={loading}\n onChange={updateChange}\n getOptionLabel={option =>\n groups?.entityRefToPresentation.get(stringifyEntityRef(option))\n ?.primaryTitle!\n }\n autoSelect\n renderInput={params => (\n <TextField\n {...params}\n label={title}\n margin=\"dense\"\n FormHelperTextProps={{ margin: 'dense', style: { marginLeft: 0 } }}\n variant=\"outlined\"\n required={required}\n InputProps={params.InputProps}\n />\n )}\n renderOption={option => <EntityDisplayName entityRef={option} />}\n filterOptions={createFilterOptions<Entity>({\n stringify: option =>\n groups?.entityRefToPresentation.get(stringifyEntityRef(option))\n ?.primaryTitle!,\n })}\n ListboxComponent={VirtualizedListbox}\n />\n </ScaffolderField>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AA2Ca,MAAA,cAAA,GAAiB,CAAC,KAA+B,KAAA;AAC5D,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,wBAAwB,CAAA;AACxD,EAAM,MAAA;AAAA,IACJ,MAAQ,EAAA;AAAA,MACN,KAAA,GAAQ,EAAE,6BAA6B,CAAA;AAAA,MACvC,WAAA,GAAc,EAAE,mCAAmC;AAAA,KACrD;AAAA,IACA,QAAA;AAAA,IACA,SAAA;AAAA,IACA,QAAA;AAAA,IACA,QAAA;AAAA,IACA,QAAA;AAAA,IACA;AAAA,GACE,GAAA,KAAA;AAEJ,EAAM,MAAA,WAAA,GAAc,OAAO,cAAc,CAAA;AACzC,EAAM,MAAA,UAAA,GAAa,OAAO,aAAa,CAAA;AACvC,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA;AACnC,EAAM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AS,OAAO,EAAE,UAAA,EAAY,GAAI,EAAA;AAAA,cACjE,OAAQ,EAAA,UAAA;AAAA,cACR,QAAA;AAAA,cACA,YAAY,MAAO,CAAA;AAAA;AAAA,WACrB;AAAA,UAEF,YAAc,EAAA,CAAA,MAAA,qBAAW,GAAA,CAAA,iBAAA,EAAA,EAAkB,WAAW,MAAQ,EAAA,CAAA;AAAA,UAC9D,eAAe,mBAA4B,CAAA;AAAA,YACzC,SAAA,EAAW,YACT,MAAQ,EAAA,uBAAA,CAAwB,IAAI,kBAAmB,CAAA,MAAM,CAAC,CAC1D,EAAA;AAAA,WACP,CAAA;AAAA,UACD,gBAAkB,EAAA;AAAA;AAAA;AACpB;AAAA,GACF;AAEJ;;;;"}
@@ -1,13 +1,8 @@
1
- import { z } from 'zod';
2
- import { makeFieldSchemaFromZod } from '../utils.esm.js';
1
+ import { makeFieldSchema } from '@backstage/plugin-scaffolder-react';
3
2
 
4
- const MyGroupsPickerFieldSchema = makeFieldSchemaFromZod(
5
- z.string(),
6
- z.object({
7
- title: z.string().default("Group").describe("Group"),
8
- description: z.string().default("A group you are part of").describe("The group to which the entity belongs")
9
- })
10
- );
3
+ const MyGroupsPickerFieldSchema = makeFieldSchema({
4
+ output: (z) => z.string()
5
+ });
11
6
  const MyGroupsPickerSchema = MyGroupsPickerFieldSchema.schema;
12
7
 
13
8
  export { MyGroupsPickerFieldSchema, MyGroupsPickerSchema };
@@ -1 +1 @@
1
- {"version":3,"file":"schema.esm.js","sources":["../../../../src/components/fields/MyGroupsPicker/schema.ts"],"sourcesContent":["/*\n * Copyright 2023 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 { z } from 'zod';\nimport { makeFieldSchemaFromZod } from '../utils';\n\n/**\n * Field schema for the MyGroupsPicker.\n * @public\n */\n\nexport const MyGroupsPickerFieldSchema = makeFieldSchemaFromZod(\n z.string(),\n z.object({\n title: z.string().default('Group').describe('Group'),\n description: z\n .string()\n .default('A group you are part of')\n .describe('The group to which the entity belongs'),\n }),\n);\n\n/**\n * UI options for the MyGroupsPicker.\n * @public\n */\n\nexport type MyGroupsPickerUiOptions =\n typeof MyGroupsPickerFieldSchema.uiOptionsType;\n/**\n * Props for the MyGroupsPicker.\n * @public\n */\n\nexport type MyGroupsPickerProps = typeof MyGroupsPickerFieldSchema.type;\n\n/**\n * Schema for the MyGroupsPicker.\n * @public\n */\n\nexport const MyGroupsPickerSchema = MyGroupsPickerFieldSchema.schema;\n"],"names":[],"mappings":";;;AAwBO,MAAM,yBAA4B,GAAA,sBAAA;AAAA,EACvC,EAAE,MAAO,EAAA;AAAA,EACT,EAAE,MAAO,CAAA;AAAA,IACP,KAAA,EAAO,EAAE,MAAO,EAAA,CAAE,QAAQ,OAAO,CAAA,CAAE,SAAS,OAAO,CAAA;AAAA,IACnD,WAAA,EAAa,EACV,MAAO,EAAA,CACP,QAAQ,yBAAyB,CAAA,CACjC,SAAS,uCAAuC;AAAA,GACpD;AACH;AAqBO,MAAM,uBAAuB,yBAA0B,CAAA;;;;"}
1
+ {"version":3,"file":"schema.esm.js","sources":["../../../../src/components/fields/MyGroupsPicker/schema.ts"],"sourcesContent":["/*\n * Copyright 2023 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 { makeFieldSchema } from '@backstage/plugin-scaffolder-react';\n\n/**\n * Field schema for the MyGroupsPicker.\n * @public\n */\n\nexport const MyGroupsPickerFieldSchema = makeFieldSchema({\n output: z => z.string(),\n});\n\n/**\n * UI options for the MyGroupsPicker.\n * @public\n */\n\nexport type MyGroupsPickerUiOptions = NonNullable<\n (typeof MyGroupsPickerFieldSchema.TProps.uiSchema)['ui:options']\n>;\n\n/**\n * Props for the MyGroupsPicker.\n * @public\n */\nexport type MyGroupsPickerProps = typeof MyGroupsPickerFieldSchema.TProps;\n\n/**\n * Schema for the MyGroupsPicker.\n * @public\n */\nexport const MyGroupsPickerSchema = MyGroupsPickerFieldSchema.schema;\n"],"names":[],"mappings":";;AAuBO,MAAM,4BAA4B,eAAgB,CAAA;AAAA,EACvD,MAAA,EAAQ,CAAK,CAAA,KAAA,CAAA,CAAE,MAAO;AACxB,CAAC;AAqBM,MAAM,uBAAuB,yBAA0B,CAAA;;;;"}
@@ -7,6 +7,7 @@ import useAsync from 'react-use/esm/useAsync';
7
7
  import { EntityPicker } from '../EntityPicker/EntityPicker.esm.js';
8
8
  import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
9
9
  import { scaffolderTranslationRef } from '../../../translation.esm.js';
10
+ import { ScaffolderField } from '@backstage/plugin-scaffolder-react/alpha';
10
11
  export { OwnedEntityPickerSchema } from './schema.esm.js';
11
12
 
12
13
  const OwnedEntityPicker = (props) => {
@@ -26,23 +27,33 @@ const OwnedEntityPicker = (props) => {
26
27
  });
27
28
  if (loading)
28
29
  return /* @__PURE__ */ jsx(
29
- Autocomplete,
30
+ ScaffolderField,
30
31
  {
31
- loading,
32
- renderInput: (params) => /* @__PURE__ */ jsx(
33
- TextField,
32
+ rawDescription: uiSchema["ui:description"] ?? description,
33
+ required,
34
+ disabled: uiSchema["ui:disabled"],
35
+ children: /* @__PURE__ */ jsx(
36
+ Autocomplete,
34
37
  {
35
- ...params,
36
- label: title,
37
- margin: "dense",
38
- helperText: description,
39
- FormHelperTextProps: { margin: "dense", style: { marginLeft: 0 } },
40
- variant: "outlined",
41
- required,
42
- InputProps: params.InputProps
38
+ loading,
39
+ renderInput: (params) => /* @__PURE__ */ jsx(
40
+ TextField,
41
+ {
42
+ ...params,
43
+ label: title,
44
+ margin: "dense",
45
+ FormHelperTextProps: {
46
+ margin: "dense",
47
+ style: { marginLeft: 0 }
48
+ },
49
+ variant: "outlined",
50
+ required,
51
+ InputProps: params.InputProps
52
+ }
53
+ ),
54
+ options: []
43
55
  }
44
- ),
45
- options: []
56
+ )
46
57
  }
47
58
  );
48
59
  const entityPickerUISchema = buildEntityPickerUISchema(
@@ -1 +1 @@
1
- {"version":3,"file":"OwnedEntityPicker.esm.js","sources":["../../../../src/components/fields/OwnedEntityPicker/OwnedEntityPicker.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 { RELATION_OWNED_BY } from '@backstage/catalog-model';\nimport { identityApiRef, useApi } from '@backstage/core-plugin-api';\nimport TextField from '@material-ui/core/TextField';\nimport Autocomplete from '@material-ui/lab/Autocomplete';\nimport useAsync from 'react-use/esm/useAsync';\nimport { EntityPicker } from '../EntityPicker/EntityPicker';\n\nimport { OwnedEntityPickerProps } from './schema';\nimport { EntityPickerProps } from '../EntityPicker/schema';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { scaffolderTranslationRef } from '../../../translation';\n\nexport { OwnedEntityPickerSchema } from './schema';\n\n/**\n * The underlying component that is rendered in the form for the `OwnedEntityPicker`\n * field extension.\n *\n * @public\n */\nexport const OwnedEntityPicker = (props: OwnedEntityPickerProps) => {\n const { t } = useTranslationRef(scaffolderTranslationRef);\n const {\n schema: {\n title = t('fields.ownedEntityPicker.title'),\n description = t('fields.ownedEntityPicker.description'),\n },\n uiSchema,\n required,\n } = props;\n\n const identityApi = useApi(identityApiRef);\n const { loading, value: identityRefs } = useAsync(async () => {\n const identity = await identityApi.getBackstageIdentity();\n return identity.ownershipEntityRefs;\n });\n\n if (loading)\n return (\n <Autocomplete\n loading={loading}\n renderInput={params => (\n <TextField\n {...params}\n label={title}\n margin=\"dense\"\n helperText={description}\n FormHelperTextProps={{ margin: 'dense', style: { marginLeft: 0 } }}\n variant=\"outlined\"\n required={required}\n InputProps={params.InputProps}\n />\n )}\n options={[]}\n />\n );\n\n const entityPickerUISchema = buildEntityPickerUISchema(\n uiSchema,\n identityRefs,\n );\n\n return <EntityPicker {...props} uiSchema={entityPickerUISchema} />;\n};\n\n/**\n * Builds a `uiSchema` for an `EntityPicker` from a parent `OwnedEntityPicker`.\n * Migrates deprecated parameters such as `allowedKinds` to `catalogFilter` structure.\n *\n * @param uiSchema The `uiSchema` of an `OwnedEntityPicker` component.\n * @param identityRefs The user and group entities that the user claims ownership through.\n * @returns The `uiSchema` for an `EntityPicker` component.\n */\nfunction buildEntityPickerUISchema(\n uiSchema: OwnedEntityPickerProps['uiSchema'],\n identityRefs: string[] | undefined,\n): EntityPickerProps['uiSchema'] {\n // Note: This is typed to avoid es-lint rule TS2698\n const uiOptions: EntityPickerProps['uiSchema']['ui:options'] =\n uiSchema?.['ui:options'] || {};\n const { allowedKinds, ...extraOptions } = uiOptions;\n\n const catalogFilter = asArray(uiOptions.catalogFilter).map(e => ({\n ...e,\n ...(allowedKinds ? { kind: allowedKinds } : {}),\n [`relations.${RELATION_OWNED_BY}`]: identityRefs || [],\n }));\n\n return {\n 'ui:options': {\n ...extraOptions,\n catalogFilter,\n },\n };\n}\n\nfunction asArray(catalogFilter: any): any[] {\n if (catalogFilter) {\n return Array.isArray(catalogFilter) ? catalog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A,EAAA,EAAc,GAAG,KAAA,EAAO,UAAU,oBAAsB,EAAA,CAAA;AAClE;AAUA,SAAS,yBAAA,CACP,UACA,YAC+B,EAAA;AAE/B,EAAA,MAAM,SACJ,GAAA,QAAA,GAAW,YAAY,CAAA,IAAK,EAAC;AAC/B,EAAA,MAAM,EAAE,YAAA,EAAc,GAAG,YAAA,EAAiB,GAAA,SAAA;AAE1C,EAAA,MAAM,gBAAgB,OAAQ,CAAA,SAAA,CAAU,aAAa,CAAA,CAAE,IAAI,CAAM,CAAA,MAAA;AAAA,IAC/D,GAAG,CAAA;AAAA,IACH,GAAI,YAAe,GAAA,EAAE,IAAM,EAAA,YAAA,KAAiB,EAAC;AAAA,IAC7C,CAAC,CAAa,UAAA,EAAA,iBAAiB,CAAE,CAAA,GAAG,gBAAgB;AAAC,GACrD,CAAA,CAAA;AAEF,EAAO,OAAA;AAAA,IACL,YAAc,EAAA;AAAA,MACZ,GAAG,YAAA;AAAA,MACH;AAAA;AACF,GACF;AACF;AAEA,SAAS,QAAQ,aAA2B,EAAA;AAC1C,EAAA,IAAI,aAAe,EAAA;AACjB,IAAA,OAAO,MAAM,OAAQ,CAAA,aAAa,CAAI,GAAA,aAAA,GAAgB,CAAC,aAAa,CAAA;AAAA;AAEtE,EAAO,OAAA,CAAC,EAAE,CAAA;AACZ;;;;"}
1
+ {"version":3,"file":"OwnedEntityPicker.esm.js","sources":["../../../../src/components/fields/OwnedEntityPicker/OwnedEntityPicker.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 { RELATION_OWNED_BY } from '@backstage/catalog-model';\nimport { identityApiRef, useApi } from '@backstage/core-plugin-api';\nimport TextField from '@material-ui/core/TextField';\nimport Autocomplete from '@material-ui/lab/Autocomplete';\nimport useAsync from 'react-use/esm/useAsync';\nimport { EntityPicker } from '../EntityPicker/EntityPicker';\n\nimport { OwnedEntityPickerProps } from './schema';\nimport { EntityPickerProps } from '../EntityPicker/schema';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { scaffolderTranslationRef } from '../../../translation';\nimport { ScaffolderField } from '@backstage/plugin-scaffolder-react/alpha';\n\nexport { OwnedEntityPickerSchema } from './schema';\n\n/**\n * The underlying component that is rendered in the form for the `OwnedEntityPicker`\n * field extension.\n *\n * @public\n */\nexport const OwnedEntityPicker = (props: OwnedEntityPickerProps) => {\n const { t } = useTranslationRef(scaffolderTranslationRef);\n const {\n schema: {\n title = t('fields.ownedEntityPicker.title'),\n description = t('fields.ownedEntityPicker.description'),\n },\n uiSchema,\n required,\n } = props;\n\n const identityApi = useApi(identityApiRef);\n const { loading, value: identityRefs } = useAsync(async () => {\n const identity = await identityApi.getBackstageIdentity();\n return identity.ownershipEntityRefs;\n });\n\n if (loading)\n return (\n <ScaffolderField\n rawDescription={uiSchema['ui:description'] ?? description}\n required={required}\n disabled={uiSchema['ui:disabled']}\n >\n <Autocomplete\n loading={loading}\n renderInput={params => (\n <TextField\n {...params}\n label={title}\n margin=\"dense\"\n FormHelperTextProps={{\n margin: 'dense',\n style: { marginLeft: 0 },\n }}\n variant=\"outlined\"\n required={required}\n InputProps={params.InputProps}\n />\n )}\n options={[]}\n />\n </ScaffolderField>\n );\n\n const entityPickerUISchema = buildEntityPickerUISchema(\n uiSchema,\n identityRefs,\n );\n\n return <EntityPicker {...props} uiSchema={entityPickerUISchema} />;\n};\n\n/**\n * Builds a `uiSchema` for an `EntityPicker` from a parent `OwnedEntityPicker`.\n * Migrates deprecated parameters such as `allowedKinds` to `catalogFilter` structure.\n *\n * @param uiSchema The `uiSchema` of an `OwnedEntityPicker` component.\n * @param identityRefs The user and group entities that the user claims ownership through.\n * @returns The `uiSchema` for an `EntityPicker` component.\n */\nfunction buildEntityPickerUISchema(\n uiSchema: OwnedEntityPickerProps['uiSchema'],\n identityRefs: string[] | undefined,\n): EntityPickerProps['uiSchema'] {\n // Note: This is typed to avoid es-lint rule TS2698\n const uiOptions: EntityPickerProps['uiSchema']['ui:options'] =\n uiSchema?.['ui:options'] || {};\n const { allowedKinds, ...extraOptions } = uiOptions;\n\n const catalogFilter = asArray(uiOptions.catalogFilter).map(e => ({\n ...e,\n ...(allowedKinds ? { kind: allowedKinds } : {}),\n [`relations.${RELATION_OWNED_BY}`]: identityRefs || [],\n }));\n\n return {\n 'ui:options': {\n ...extraOptions,\n catalogFilter,\n },\n };\n}\n\nfunction asArray(catalogFilter: any): any[] {\n if (catalogFilter) {\n return Array.isArray(catalogFilter) ? catalogFilter : [catalogFilter];\n }\n return [{}];\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAoCa,MAAA,iBAAA,GAAoB,CAAC,KAAkC,KAAA;AAClE,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,wBAAwB,CAAA;AACxD,EAAM,MAAA;AAAA,IACJ,MAAQ,EAAA;AAAA,MACN,KAAA,GAAQ,EAAE,gCAAgC,CAAA;AAAA,MAC1C,WAAA,GAAc,EAAE,sCAAsC;AAAA,KACxD;AAAA,IACA,QAAA;AAAA,IACA;AAAA,GACE,GAAA,KAAA;AAEJ,EAAM,MAAA,WAAA,GAAc,OAAO,cAAc,CAAA;AACzC,EAAA,MAAM,EAAE,OAAS,EAAA,KAAA,EAAO,YAAa,EAAA,GAAI,SAAS,YAAY;AAC5D,IAAM,MAAA,QAAA,GAAW,MAAM,WAAA,CAAY,oBAAqB,EAAA;AACxD,IAAA,OAAO,QAAS,CAAA,mBAAA;AAAA,GACjB,CAAA;AAED,EAAI,IAAA,OAAA;AACF,IACE,uBAAA,GAAA;AAAA,MAAC,eAAA;AA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CAAA,GAAG,gBAAgB;AAAC,GACrD,CAAA,CAAA;AAEF,EAAO,OAAA;AAAA,IACL,YAAc,EAAA;AAAA,MACZ,GAAG,YAAA;AAAA,MACH;AAAA;AACF,GACF;AACF;AAEA,SAAS,QAAQ,aAA2B,EAAA;AAC1C,EAAA,IAAI,aAAe,EAAA;AACjB,IAAA,OAAO,MAAM,OAAQ,CAAA,aAAa,CAAI,GAAA,aAAA,GAAgB,CAAC,aAAa,CAAA;AAAA;AAEtE,EAAO,OAAA,CAAC,EAAE,CAAA;AACZ;;;;"}
@@ -1,23 +1,6 @@
1
- import { z } from 'zod';
2
- import { makeFieldSchemaFromZod } from '../utils.esm.js';
3
- import { entityQueryFilterExpressionSchema } from '../EntityPicker/schema.esm.js';
1
+ import { EntityPickerFieldSchema } from '../EntityPicker/schema.esm.js';
4
2
 
5
- const OwnedEntityPickerFieldSchema = makeFieldSchemaFromZod(
6
- z.string(),
7
- z.object({
8
- allowedKinds: z.array(z.string()).optional().describe(
9
- "DEPRECATED: Use `catalogFilter` instead. List of kinds of entities to derive options from"
10
- ),
11
- defaultKind: z.string().optional().describe(
12
- "The default entity kind. Options of this kind will not be prefixed."
13
- ),
14
- allowArbitraryValues: z.boolean().optional().describe("Whether to allow arbitrary user input. Defaults to true"),
15
- defaultNamespace: z.union([z.string(), z.literal(false)]).optional().describe(
16
- "The default namespace. Options with this namespace will not be prefixed."
17
- ),
18
- catalogFilter: z.array(entityQueryFilterExpressionSchema).or(entityQueryFilterExpressionSchema).optional().describe("List of key-value filter expression for entities")
19
- })
20
- );
3
+ const OwnedEntityPickerFieldSchema = EntityPickerFieldSchema;
21
4
  const OwnedEntityPickerSchema = OwnedEntityPickerFieldSchema.schema;
22
5
 
23
6
  export { OwnedEntityPickerFieldSchema, OwnedEntityPickerSchema };
@@ -1 +1 @@
1
- {"version":3,"file":"schema.esm.js","sources":["../../../../src/components/fields/OwnedEntityPicker/schema.ts"],"sourcesContent":["/*\n * Copyright 2021 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 { z } from 'zod';\nimport { makeFieldSchemaFromZod } from '../utils';\nimport { entityQueryFilterExpressionSchema } from '../EntityPicker/schema';\n\n/**\n * @public\n */\nexport const OwnedEntityPickerFieldSchema = makeFieldSchemaFromZod(\n z.string(),\n z.object({\n allowedKinds: z\n .array(z.string())\n .optional()\n .describe(\n 'DEPRECATED: Use `catalogFilter` instead. List of kinds of entities to derive options from',\n ),\n defaultKind: z\n .string()\n .optional()\n .describe(\n 'The default entity kind. Options of this kind will not be prefixed.',\n ),\n allowArbitraryValues: z\n .boolean()\n .optional()\n .describe('Whether to allow arbitrary user input. Defaults to true'),\n defaultNamespace: z\n .union([z.string(), z.literal(false)])\n .optional()\n .describe(\n 'The default namespace. Options with this namespace will not be prefixed.',\n ),\n catalogFilter: z\n .array(entityQueryFilterExpressionSchema)\n .or(entityQueryFilterExpressionSchema)\n .optional()\n .describe('List of key-value filter expression for entities'),\n }),\n);\n\n/**\n * The input props that can be specified under `ui:options` for the\n * `OwnedEntityPicker` field extension.\n *\n * @public\n */\nexport type OwnedEntityPickerUiOptions =\n typeof OwnedEntityPickerFieldSchema.uiOptionsType;\n\nexport type OwnedEntityPickerProps = typeof OwnedEntityPickerFieldSchema.type;\n\nexport const OwnedEntityPickerSchema = OwnedEntityPickerFieldSchema.schema;\n"],"names":[],"mappings":";;;;AAsBO,MAAM,4BAA+B,GAAA,sBAAA;AAAA,EAC1C,EAAE,MAAO,EAAA;AAAA,EACT,EAAE,MAAO,CAAA;AAAA,IACP,YAAA,EAAc,EACX,KAAM,CAAA,CAAA,CAAE,QAAQ,CAAA,CAChB,UACA,CAAA,QAAA;AAAA,MACC;AAAA,KACF;AAAA,IACF,WAAa,EAAA,CAAA,CACV,MAAO,EAAA,CACP,UACA,CAAA,QAAA;AAAA,MACC;AAAA,KACF;AAAA,IACF,sBAAsB,CACnB,CAAA,OAAA,GACA,QAAS,EAAA,CACT,SAAS,yDAAyD,CAAA;AAAA,IACrE,gBAAkB,EAAA,CAAA,CACf,KAAM,CAAA,CAAC,EAAE,MAAO,EAAA,EAAG,CAAE,CAAA,OAAA,CAAQ,KAAK,CAAC,CAAC,CAAA,CACpC,UACA,CAAA,QAAA;AAAA,MACC;AAAA,KACF;AAAA,IACF,aAAA,EAAe,CACZ,CAAA,KAAA,CAAM,iCAAiC,CAAA,CACvC,EAAG,CAAA,iCAAiC,CACpC,CAAA,QAAA,EACA,CAAA,QAAA,CAAS,kDAAkD;AAAA,GAC/D;AACH;AAaO,MAAM,0BAA0B,4BAA6B,CAAA;;;;"}
1
+ {"version":3,"file":"schema.esm.js","sources":["../../../../src/components/fields/OwnedEntityPicker/schema.ts"],"sourcesContent":["/*\n * Copyright 2021 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 { EntityPickerFieldSchema } from '../EntityPicker/schema';\n\n/**\n * @public\n */\nexport const OwnedEntityPickerFieldSchema = EntityPickerFieldSchema;\n\n/**\n * The input props that can be specified under `ui:options` for the\n * `OwnedEntityPicker` field extension.\n *\n * @public\n */\nexport type OwnedEntityPickerUiOptions = NonNullable<\n (typeof OwnedEntityPickerFieldSchema.TProps.uiSchema)['ui:options']\n>;\n\nexport type OwnedEntityPickerProps = typeof OwnedEntityPickerFieldSchema.TProps;\n\nexport const OwnedEntityPickerSchema = OwnedEntityPickerFieldSchema.schema;\n"],"names":[],"mappings":";;AAoBO,MAAM,4BAA+B,GAAA;AAcrC,MAAM,0BAA0B,4BAA6B,CAAA;;;;"}
@@ -1,10 +1,9 @@
1
- import { z } from 'zod';
2
- import { makeFieldSchemaFromZod } from '../utils.esm.js';
3
- import { entityQueryFilterExpressionSchema } from '../EntityPicker/schema.esm.js';
1
+ import { makeFieldSchema } from '@backstage/plugin-scaffolder-react';
2
+ import { createEntityQueryFilterExpressionSchema } from '../EntityPicker/schema.esm.js';
4
3
 
5
- const OwnerPickerFieldSchema = makeFieldSchemaFromZod(
6
- z.string(),
7
- z.object({
4
+ const OwnerPickerFieldSchema = makeFieldSchema({
5
+ output: (z) => z.string(),
6
+ uiOptions: (z) => z.object({
8
7
  /**
9
8
  * @deprecated Use `catalogFilter` instead.
10
9
  */
@@ -15,9 +14,11 @@ const OwnerPickerFieldSchema = makeFieldSchemaFromZod(
15
14
  defaultNamespace: z.union([z.string(), z.literal(false)]).optional().describe(
16
15
  "The default namespace. Options with this namespace will not be prefixed."
17
16
  ),
18
- catalogFilter: z.array(entityQueryFilterExpressionSchema).or(entityQueryFilterExpressionSchema).optional().describe("List of key-value filter expression for entities")
17
+ catalogFilter: ((t) => t.or(t.array()))(
18
+ createEntityQueryFilterExpressionSchema(z)
19
+ ).optional().describe("List of key-value filter expression for entities")
19
20
  })
20
- );
21
+ });
21
22
  const OwnerPickerSchema = OwnerPickerFieldSchema.schema;
22
23
 
23
24
  export { OwnerPickerFieldSchema, OwnerPickerSchema };
@@ -1 +1 @@
1
- {"version":3,"file":"schema.esm.js","sources":["../../../../src/components/fields/OwnerPicker/schema.ts"],"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 { z } from 'zod';\nimport { makeFieldSchemaFromZod } from '../utils';\nimport { entityQueryFilterExpressionSchema } from '../EntityPicker/schema';\n\n/**\n * @public\n */\nexport const OwnerPickerFieldSchema = makeFieldSchemaFromZod(\n z.string(),\n z.object({\n /**\n * @deprecated Use `catalogFilter` instead.\n */\n allowedKinds: z\n .array(z.string())\n .default(['Group', 'User'])\n .optional()\n .describe(\n 'DEPRECATED: Use `catalogFilter` instead. List of kinds of entities to derive options from. Defaults to Group and User',\n ),\n allowArbitraryValues: z\n .boolean()\n .optional()\n .describe('Whether to allow arbitrary user input. Defaults to true'),\n defaultNamespace: z\n .union([z.string(), z.literal(false)])\n .optional()\n .describe(\n 'The default namespace. Options with this namespace will not be prefixed.',\n ),\n catalogFilter: z\n .array(entityQueryFilterExpressionSchema)\n .or(entityQueryFilterExpressionSchema)\n .optional()\n .describe('List of key-value filter expression for entities'),\n }),\n);\n\n/**\n * The input props that can be specified under `ui:options` for the\n * `OwnerPicker` field extension.\n *\n * @public\n */\nexport type OwnerPickerUiOptions = typeof OwnerPickerFieldSchema.uiOptionsType;\n\nexport type OwnerPickerProps = typeof OwnerPickerFieldSchema.type;\n\nexport const OwnerPickerSchema = OwnerPickerFieldSchema.schema;\n"],"names":[],"mappings":";;;;AAsBO,MAAM,sBAAyB,GAAA,sBAAA;AAAA,EACpC,EAAE,MAAO,EAAA;AAAA,EACT,EAAE,MAAO,CAAA;AAAA;AAAA;AAAA;AAAA,IAIP,YAAc,EAAA,CAAA,CACX,KAAM,CAAA,CAAA,CAAE,QAAQ,CAAA,CAChB,OAAQ,CAAA,CAAC,OAAS,EAAA,MAAM,CAAC,CAAA,CACzB,UACA,CAAA,QAAA;AAAA,MACC;AAAA,KACF;AAAA,IACF,sBAAsB,CACnB,CAAA,OAAA,GACA,QAAS,EAAA,CACT,SAAS,yDAAyD,CAAA;AAAA,IACrE,gBAAkB,EAAA,CAAA,CACf,KAAM,CAAA,CAAC,EAAE,MAAO,EAAA,EAAG,CAAE,CAAA,OAAA,CAAQ,KAAK,CAAC,CAAC,CAAA,CACpC,UACA,CAAA,QAAA;AAAA,MACC;AAAA,KACF;AAAA,IACF,aAAA,EAAe,CACZ,CAAA,KAAA,CAAM,iCAAiC,CAAA,CACvC,EAAG,CAAA,iCAAiC,CACpC,CAAA,QAAA,EACA,CAAA,QAAA,CAAS,kDAAkD;AAAA,GAC/D;AACH;AAYO,MAAM,oBAAoB,sBAAuB,CAAA;;;;"}
1
+ {"version":3,"file":"schema.esm.js","sources":["../../../../src/components/fields/OwnerPicker/schema.ts"],"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 { makeFieldSchema } from '@backstage/plugin-scaffolder-react';\nimport { createEntityQueryFilterExpressionSchema } from '../EntityPicker/schema';\n\n/**\n * @public\n */\nexport const OwnerPickerFieldSchema = makeFieldSchema({\n output: z => z.string(),\n uiOptions: z =>\n z.object({\n /**\n * @deprecated Use `catalogFilter` instead.\n */\n allowedKinds: z\n .array(z.string())\n .default(['Group', 'User'])\n .optional()\n .describe(\n 'DEPRECATED: Use `catalogFilter` instead. List of kinds of entities to derive options from. Defaults to Group and User',\n ),\n allowArbitraryValues: z\n .boolean()\n .optional()\n .describe('Whether to allow arbitrary user input. Defaults to true'),\n defaultNamespace: z\n .union([z.string(), z.literal(false)])\n .optional()\n .describe(\n 'The default namespace. Options with this namespace will not be prefixed.',\n ),\n catalogFilter: (t => t.or(t.array()))(\n createEntityQueryFilterExpressionSchema(z),\n )\n .optional()\n .describe('List of key-value filter expression for entities'),\n }),\n});\n\n/**\n * The input props that can be specified under `ui:options` for the\n * `OwnerPicker` field extension.\n *\n * @public\n */\nexport type OwnerPickerUiOptions = NonNullable<\n (typeof OwnerPickerFieldSchema.TProps.uiSchema)['ui:options']\n>;\n\nexport type OwnerPickerProps = typeof OwnerPickerFieldSchema.TProps;\n\nexport const OwnerPickerSchema = OwnerPickerFieldSchema.schema;\n"],"names":[],"mappings":";;;AAqBO,MAAM,yBAAyB,eAAgB,CAAA;AAAA,EACpD,MAAA,EAAQ,CAAK,CAAA,KAAA,CAAA,CAAE,MAAO,EAAA;AAAA,EACtB,SAAA,EAAW,CACT,CAAA,KAAA,CAAA,CAAE,MAAO,CAAA;AAAA;AAAA;AAAA;AAAA,IAIP,YAAc,EAAA,CAAA,CACX,KAAM,CAAA,CAAA,CAAE,QAAQ,CAAA,CAChB,OAAQ,CAAA,CAAC,OAAS,EAAA,MAAM,CAAC,CAAA,CACzB,UACA,CAAA,QAAA;AAAA,MACC;AAAA,KACF;AAAA,IACF,sBAAsB,CACnB,CAAA,OAAA,GACA,QAAS,EAAA,CACT,SAAS,yDAAyD,CAAA;AAAA,IACrE,gBAAkB,EAAA,CAAA,CACf,KAAM,CAAA,CAAC,EAAE,MAAO,EAAA,EAAG,CAAE,CAAA,OAAA,CAAQ,KAAK,CAAC,CAAC,CAAA,CACpC,UACA,CAAA,QAAA;AAAA,MACC;AAAA,KACF;AAAA,IACF,gBAAgB,CAAK,CAAA,KAAA,CAAA,CAAE,EAAG,CAAA,CAAA,CAAE,OAAO,CAAA;AAAA,MACjC,wCAAwC,CAAC;AAAA,KAExC,CAAA,QAAA,EACA,CAAA,QAAA,CAAS,kDAAkD;AAAA,GAC/D;AACL,CAAC;AAcM,MAAM,oBAAoB,sBAAuB,CAAA;;;;"}
@@ -10,6 +10,7 @@ import Typography from '@material-ui/core/Typography';
10
10
  import { BitbucketRepoBranchPicker } from './BitbucketRepoBranchPicker.esm.js';
11
11
  import { DefaultRepoBranchPicker } from './DefaultRepoBranchPicker.esm.js';
12
12
  import { GitHubRepoBranchPicker } from './GitHubRepoBranchPicker.esm.js';
13
+ import { MarkdownContent } from '@backstage/core-components';
13
14
 
14
15
  const RepoBranchPicker = (props) => {
15
16
  const {
@@ -113,12 +114,13 @@ const RepoBranchPicker = (props) => {
113
114
  );
114
115
  }
115
116
  };
117
+ const description = uiSchema["ui:description"] ?? schema.description;
116
118
  return /* @__PURE__ */ jsxs(Fragment, { children: [
117
119
  schema.title && /* @__PURE__ */ jsxs(Box, { my: 1, children: [
118
120
  /* @__PURE__ */ jsx(Typography, { variant: "h5", children: schema.title }),
119
121
  /* @__PURE__ */ jsx(Divider, {})
120
122
  ] }),
121
- schema.description && /* @__PURE__ */ jsx(Typography, { variant: "body1", children: schema.description }),
123
+ description && /* @__PURE__ */ jsx(Typography, { variant: "body1", children: /* @__PURE__ */ jsx(MarkdownContent, { content: description }) }),
122
124
  renderRepoBranchPicker()
123
125
  ] });
124
126
  };
@@ -1 +1 @@
1
- {"version":3,"file":"RepoBranchPicker.esm.js","sources":["../../../../src/components/fields/RepoBranchPicker/RepoBranchPicker.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 { useApi } from '@backstage/core-plugin-api';\nimport {\n scmIntegrationsApiRef,\n scmAuthApiRef,\n} from '@backstage/integration-react';\nimport { useEffect, useState, useCallback } from 'react';\nimport useDebounce from 'react-use/esm/useDebounce';\nimport { useTemplateSecrets } from '@backstage/plugin-scaffolder-react';\nimport Box from '@material-ui/core/Box';\nimport Divider from '@material-ui/core/Divider';\nimport Typography from '@material-ui/core/Typography';\n\nimport { RepoBranchPickerProps } from './schema';\nimport { RepoBranchPickerState } from './types';\nimport { BitbucketRepoBranchPicker } from './BitbucketRepoBranchPicker';\nimport { DefaultRepoBranchPicker } from './DefaultRepoBranchPicker';\nimport { GitHubRepoBranchPicker } from './GitHubRepoBranchPicker';\n\n/**\n * The underlying component that is rendered in the form for the `RepoBranchPicker`\n * field extension.\n *\n * @public\n */\nexport const RepoBranchPicker = (props: RepoBranchPickerProps) => {\n const {\n uiSchema,\n onChange,\n rawErrors,\n formData,\n schema,\n formContext,\n required,\n } = props;\n const {\n formData: { repoUrl },\n } = formContext;\n\n const [state, setState] = useState<RepoBranchPickerState>({\n branch: formData || '',\n });\n const { host, branch } = state;\n\n const integrationApi = useApi(scmIntegrationsApiRef);\n const scmAuthApi = useApi(scmAuthApiRef);\n\n const { secrets, setSecrets } = useTemplateSecrets();\n\n useDebounce(\n async () => {\n const { requestUserCredentials } = uiSchema?.['ui:options'] ?? {};\n\n if (!requestUserCredentials || !host) {\n return;\n }\n\n // don't show login prompt if secret value is already in state\n if (secrets[requestUserCredentials.secretsKey]) {\n return;\n }\n\n // user has requested that we use the users credentials\n // so lets grab them using the scmAuthApi and pass through\n // any additional scopes from the ui:options\n const { token } = await scmAuthApi.getCredentials({\n url: `https://${host}`,\n additionalScope: {\n repoWrite: true,\n customScopes: requestUserCredentials.additionalScopes,\n },\n });\n\n // set the secret using the key provided in the ui:options for use\n // in the templating the manifest with ${{ secrets[secretsKey] }}\n setSecrets({ [requestUserCredentials.secretsKey]: token });\n },\n 500,\n [host, uiSchema],\n );\n\n useEffect(() => {\n if (repoUrl) {\n const url = new URL(`https://${repoUrl}`);\n\n setState(prevState => ({\n ...prevState,\n host: url.host,\n workspace: url.searchParams.get('workspace') || '',\n repository: url.searchParams.get('repo') || '',\n owner: url.searchParams.get('owner') || '',\n }));\n }\n }, [repoUrl]);\n\n useEffect(() => {\n onChange(branch);\n }, [branch, onChange]);\n\n const updateLocalState = useCallback(\n (newState: RepoBranchPickerState) => {\n setState(prevState => ({ ...prevState, ...newState }));\n },\n [setState],\n );\n\n const hostType = (host && integrationApi.byHost(host)?.type) ?? null;\n\n const renderRepoBranchPicker = () => {\n switch (hostType) {\n case 'bitbucket':\n return (\n <BitbucketRepoBranchPicker\n onChange={updateLocalState}\n state={state}\n rawErrors={rawErrors}\n accessToken={\n uiSchema?.['ui:options']?.requestUserCredentials?.secretsKey &&\n secrets[uiSchema['ui:options'].requestUserCredentials.secretsKey]\n }\n isDisabled={uiSchema?.['ui:disabled'] ?? false}\n required={required}\n />\n );\n case 'github':\n return (\n <GitHubRepoBranchPicker\n onChange={updateLocalState}\n state={state}\n rawErrors={rawErrors}\n accessToken={\n uiSchema?.['ui:options']?.requestUserCredentials?.secretsKey &&\n secrets[uiSchema['ui:options'].requestUserCredentials.secretsKey]\n }\n isDisabled={uiSchema?.['ui:disabled'] ?? false}\n required={required}\n />\n );\n default:\n return (\n <DefaultRepoBranchPicker\n onChange={updateLocalState}\n state={state}\n rawErrors={rawErrors}\n isDisabled={uiSchema?.['ui:disabled'] ?? false}\n required={required}\n />\n );\n }\n };\n\n return (\n <>\n {schema.title && (\n <Box my={1}>\n <Typography variant=\"h5\">{schema.title}</Typography>\n <Divider />\n </Box>\n )}\n {schema.description && (\n <Typography variant=\"body1\">{schema.description}</Typography>\n )}\n {renderRepoBranchPicker()}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;AAwCa,MAAA,gBAAA,GAAmB,CAAC,KAAiC,KAAA;AAChE,EAAM,MAAA;AAAA,IACJ,QAAA;AAAA,IACA,QAAA;AAAA,IACA,SAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAA;AAAA,IACA,WAAA;AAAA,IACA;AAAA,GACE,GAAA,KAAA;AACJ,EAAM,MAAA;AAAA,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J,KAAK,QAAA;AACH,QACE,uBAAA,GAAA;AAAA,UAAC,sBAAA;AAAA,UAAA;AAAA,YACC,QAAU,EAAA,gBAAA;AAAA,YACV,KAAA;AAAA,YACA,SAAA;AAAA,YACA,WAAA,EACE,QAAW,GAAA,YAAY,CAAG,EAAA,sBAAA,EAAwB,UAClD,IAAA,OAAA,CAAQ,QAAS,CAAA,YAAY,CAAE,CAAA,sBAAA,CAAuB,UAAU,CAAA;AAAA,YAElE,UAAA,EAAY,QAAW,GAAA,aAAa,CAAK,IAAA,KAAA;AAAA,YACzC;AAAA;AAAA,SACF;AAAA,MAEJ;AACE,QACE,uBAAA,GAAA;AAAA,UAAC,uBAAA;AAAA,UAAA;AAAA,YACC,QAAU,EAAA,gBAAA;AAAA,YACV,KAAA;AAAA,YACA,SAAA;AAAA,YACA,UAAA,EAAY,QAAW,GAAA,aAAa,CAAK,IAAA,KAAA;AAAA,YACzC;AAAA;AAAA,SACF;AAAA;AAEN,GACF;AAEA,EAAA,uBAEK,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,IAAA,MAAA,CAAO,KACN,oBAAA,IAAA,CAAC,GAAI,EAAA,EAAA,EAAA,EAAI,CACP,EAAA,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,IAAM,EAAA,QAAA,EAAA,MAAA,CAAO,KAAM,EAAA,CAAA;AAAA,0BACtC,OAAQ,EAAA,EAAA;AAAA,KACX,EAAA,CAAA;AAAA,IAED,OAAO,WACN,oBAAA,GAAA,CAAC,cAAW,OAAQ,EAAA,OAAA,EAAS,iBAAO,WAAY,EAAA,CAAA;AAAA,IAEjD,sBAAuB;AAAA,GAC1B,EAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"RepoBranchPicker.esm.js","sources":["../../../../src/components/fields/RepoBranchPicker/RepoBranchPicker.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 { useApi } from '@backstage/core-plugin-api';\nimport {\n scmIntegrationsApiRef,\n scmAuthApiRef,\n} from '@backstage/integration-react';\nimport { useEffect, useState, useCallback } from 'react';\nimport useDebounce from 'react-use/esm/useDebounce';\nimport { useTemplateSecrets } from '@backstage/plugin-scaffolder-react';\nimport Box from '@material-ui/core/Box';\nimport Divider from '@material-ui/core/Divider';\nimport Typography from '@material-ui/core/Typography';\n\nimport { RepoBranchPickerProps } from './schema';\nimport { RepoBranchPickerState } from './types';\nimport { BitbucketRepoBranchPicker } from './BitbucketRepoBranchPicker';\nimport { DefaultRepoBranchPicker } from './DefaultRepoBranchPicker';\nimport { GitHubRepoBranchPicker } from './GitHubRepoBranchPicker';\nimport { MarkdownContent } from '@backstage/core-components';\n\n/**\n * The underlying component that is rendered in the form for the `RepoBranchPicker`\n * field extension.\n *\n * @public\n */\nexport const RepoBranchPicker = (props: RepoBranchPickerProps) => {\n const {\n uiSchema,\n onChange,\n rawErrors,\n formData,\n schema,\n formContext,\n required,\n } = props;\n const {\n formData: { repoUrl },\n } = formContext;\n\n const [state, setState] = useState<RepoBranchPickerState>({\n branch: formData || '',\n });\n const { host, branch } = state;\n\n const integrationApi = useApi(scmIntegrationsApiRef);\n const scmAuthApi = useApi(scmAuthApiRef);\n\n const { secrets, setSecrets } = useTemplateSecrets();\n\n useDebounce(\n async () => {\n const { requestUserCredentials } = uiSchema?.['ui:options'] ?? {};\n\n if (!requestUserCredentials || !host) {\n return;\n }\n\n // don't show login prompt if secret value is already in state\n if (secrets[requestUserCredentials.secretsKey]) {\n return;\n }\n\n // user has requested that we use the users credentials\n // so lets grab them using the scmAuthApi and pass through\n // any additional scopes from the ui:options\n const { token } = await scmAuthApi.getCredentials({\n url: `https://${host}`,\n additionalScope: {\n repoWrite: true,\n customScopes: requestUserCredentials.additionalScopes,\n },\n });\n\n // set the secret using the key provided in the ui:options for use\n // in the templating the manifest with ${{ secrets[secretsKey] }}\n setSecrets({ [requestUserCredentials.secretsKey]: token });\n },\n 500,\n [host, uiSchema],\n );\n\n useEffect(() => {\n if (repoUrl) {\n const url = new URL(`https://${repoUrl}`);\n\n setState(prevState => ({\n ...prevState,\n host: url.host,\n workspace: url.searchParams.get('workspace') || '',\n repository: url.searchParams.get('repo') || '',\n owner: url.searchParams.get('owner') || '',\n }));\n }\n }, [repoUrl]);\n\n useEffect(() => {\n onChange(branch);\n }, [branch, onChange]);\n\n const updateLocalState = useCallback(\n (newState: RepoBranchPickerState) => {\n setState(prevState => ({ ...prevState, ...newState }));\n },\n [setState],\n );\n\n const hostType = (host && integrationApi.byHost(host)?.type) ?? null;\n\n const renderRepoBranchPicker = () => {\n switch (hostType) {\n case 'bitbucket':\n return (\n <BitbucketRepoBranchPicker\n onChange={updateLocalState}\n state={state}\n rawErrors={rawErrors}\n accessToken={\n uiSchema?.['ui:options']?.requestUserCredentials?.secretsKey &&\n secrets[uiSchema['ui:options'].requestUserCredentials.secretsKey]\n }\n isDisabled={uiSchema?.['ui:disabled'] ?? false}\n required={required}\n />\n );\n case 'github':\n return (\n <GitHubRepoBranchPicker\n onChange={updateLocalState}\n state={state}\n rawErrors={rawErrors}\n accessToken={\n uiSchema?.['ui:options']?.requestUserCredentials?.secretsKey &&\n secrets[uiSchema['ui:options'].requestUserCredentials.secretsKey]\n }\n isDisabled={uiSchema?.['ui:disabled'] ?? false}\n required={required}\n />\n );\n default:\n return (\n <DefaultRepoBranchPicker\n onChange={updateLocalState}\n state={state}\n rawErrors={rawErrors}\n isDisabled={uiSchema?.['ui:disabled'] ?? false}\n required={required}\n />\n );\n }\n };\n\n const description = uiSchema['ui:description'] ?? schema.description;\n\n return (\n <>\n {schema.title && (\n <Box my={1}>\n <Typography variant=\"h5\">{schema.title}</Typography>\n <Divider />\n </Box>\n )}\n {description && (\n <Typography variant=\"body1\">\n <MarkdownContent content={description} />\n </Typography>\n )}\n {renderRepoBranchPicker()}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAyCa,MAAA,gBAAA,GAAmB,CAAC,KAAiC,KAAA;AAChE,EAAM,MAAA;AAAA,IACJ,QAAA;AAAA,IACA,QAAA;AAAA,IACA,SAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAA;AAAA,IACA,WAAA;AAAA,IACA;AAAA,GACE,GAAA,KAAA;AACJ,EAAM,MAAA;AAAA,IACJ,QAAA,EAAU,EAAE,OAAQ;AAAA,GAClB,GAAA,WAAA;AAEJ,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,QAAgC,CAAA;AAAA,IACxD,QAAQ,QAAY,IAAA;AAAA,GACrB,CAAA;AACD,EAAM,MAAA,EAAE,IAAM,EAAA,MAAA,EAAW,GAAA,KAAA;AAEzB,EAAM,MAAA,cAAA,GAAiB,OAAO,qBAAqB,CAAA;AACnD,EAAM,MAAA,UAAA,GAAa,OAAO,aAAa,CAAA;AAEvC,EAAA,MAAM,EAAE,OAAA,EAAS,UAAW,EAAA,GAAI,kBAAmB,EAAA;AAEnD,EAAA,WAAA;AAAA,IACE,YAAY;AACV,MAAA,MAAM,EAAE,sBAAuB,EAAA,GAAI,QAAW,GAAA,YAAY,KAAK,EAAC;AAEhE,MAAI,IAAA,CAAC,sBAA0B,IAAA,CAAC,IAAM,EAAA;AACpC,QAAA;AAAA;AAIF,MAAI,IAAA,OAAA,CAAQ,sBAAuB,CAAA,UAAU,CAAG,EAAA;AAC9C,QAAA;AAAA;AAMF,MAAA,MAAM,EAAE,KAAA,EAAU,GAAA,MAAM,WAAW,cAAe,CAAA;AAAA,QAChD,GAAA,EAAK,WAAW,IAAI,CAAA,C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AA,IAAA,CAAC,GAAI,EAAA,EAAA,EAAA,EAAI,CACP,EAAA,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,IAAM,EAAA,QAAA,EAAA,MAAA,CAAO,KAAM,EAAA,CAAA;AAAA,0BACtC,OAAQ,EAAA,EAAA;AAAA,KACX,EAAA,CAAA;AAAA,IAED,WAAA,wBACE,UAAW,EAAA,EAAA,OAAA,EAAQ,SAClB,QAAC,kBAAA,GAAA,CAAA,eAAA,EAAA,EAAgB,OAAS,EAAA,WAAA,EAAa,CACzC,EAAA,CAAA;AAAA,IAED,sBAAuB;AAAA,GAC1B,EAAA,CAAA;AAEJ;;;;"}
@@ -1,9 +1,8 @@
1
- import { z } from 'zod';
2
- import { makeFieldSchemaFromZod } from '../utils.esm.js';
1
+ import { makeFieldSchema } from '@backstage/plugin-scaffolder-react';
3
2
 
4
- const RepoBranchPickerFieldSchema = makeFieldSchemaFromZod(
5
- z.string(),
6
- z.object({
3
+ const RepoBranchPickerFieldSchema = makeFieldSchema({
4
+ output: (z) => z.string(),
5
+ uiOptions: (z) => z.object({
7
6
  requestUserCredentials: z.object({
8
7
  secretsKey: z.string().describe(
9
8
  "Key used within the template secrets context to store the credential"
@@ -20,7 +19,7 @@ const RepoBranchPickerFieldSchema = makeFieldSchemaFromZod(
20
19
  "If defined will request user credentials to auth against the given SCM platform"
21
20
  )
22
21
  })
23
- );
22
+ });
24
23
  const RepoBranchPickerSchema = RepoBranchPickerFieldSchema.schema;
25
24
 
26
25
  export { RepoBranchPickerFieldSchema, RepoBranchPickerSchema };
@@ -1 +1 @@
1
- {"version":3,"file":"schema.esm.js","sources":["../../../../src/components/fields/RepoBranchPicker/schema.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 */\nimport { z } from 'zod';\nimport { makeFieldSchemaFromZod } from '../utils';\n\n/**\n * @public\n */\nexport const RepoBranchPickerFieldSchema = makeFieldSchemaFromZod(\n z.string(),\n z.object({\n requestUserCredentials: z\n .object({\n secretsKey: z\n .string()\n .describe(\n 'Key used within the template secrets context to store the credential',\n ),\n additionalScopes: z\n .object({\n gitea: z\n .array(z.string())\n .optional()\n .describe('Additional Gitea scopes to request'),\n gerrit: z\n .array(z.string())\n .optional()\n .describe('Additional Gerrit scopes to request'),\n github: z\n .array(z.string())\n .optional()\n .describe('Additional GitHub scopes to request'),\n gitlab: z\n .array(z.string())\n .optional()\n .describe('Additional GitLab scopes to request'),\n bitbucket: z\n .array(z.string())\n .optional()\n .describe('Additional BitBucket scopes to request'),\n azure: z\n .array(z.string())\n .optional()\n .describe('Additional Azure scopes to request'),\n })\n .optional()\n .describe('Additional permission scopes to request'),\n })\n .optional()\n .describe(\n 'If defined will request user credentials to auth against the given SCM platform',\n ),\n }),\n);\n\n/**\n * The input props that can be specified under `ui:options` for the\n * `RepoBranchPicker` field extension.\n *\n * @public\n */\nexport type RepoBranchPickerUiOptions =\n typeof RepoBranchPickerFieldSchema.uiOptionsType;\n\nexport type RepoBranchPickerProps = typeof RepoBranchPickerFieldSchema.type;\n\n// This has been duplicated from /plugins/scaffolder/src/components/fields/RepoUrlPicker/schema.ts\n// NOTE: There is a bug with this failing validation in the custom field explorer due\n// to https://github.com/rjsf-team/react-jsonschema-form/issues/675 even if\n// requestUserCredentials is not defined\nexport const RepoBranchPickerSchema = RepoBranchPickerFieldSchema.schema;\n"],"names":[],"mappings":";;;AAqBO,MAAM,2BAA8B,GAAA,sBAAA;AAAA,EACzC,EAAE,MAAO,EAAA;AAAA,EACT,EAAE,MAAO,CAAA;AAAA,IACP,sBAAA,EAAwB,EACrB,MAAO,CAAA;AAAA,MACN,UAAA,EAAY,CACT,CAAA,MAAA,EACA,CAAA,QAAA;AAAA,QACC;AAAA,OACF;AAAA,MACF,gBAAA,EAAkB,EACf,MAAO,CAAA;AAAA,QACN,KAAA,EAAO,CACJ,CAAA,KAAA,CAAM,CAAE,CAAA,MAAA,EAAQ,CAChB,CAAA,QAAA,EACA,CAAA,QAAA,CAAS,oCAAoC,CAAA;AAAA,QAChD,MAAA,EAAQ,CACL,CAAA,KAAA,CAAM,CAAE,CAAA,MAAA,EAAQ,CAChB,CAAA,QAAA,EACA,CAAA,QAAA,CAAS,qCAAqC,CAAA;AAAA,QACjD,MAAA,EAAQ,CACL,CAAA,KAAA,CAAM,CAAE,CAAA,MAAA,EAAQ,CAChB,CAAA,QAAA,EACA,CAAA,QAAA,CAAS,qCAAqC,CAAA;AAAA,QACjD,MAAA,EAAQ,CACL,CAAA,KAAA,CAAM,CAAE,CAAA,MAAA,EAAQ,CAChB,CAAA,QAAA,EACA,CAAA,QAAA,CAAS,qCAAqC,CAAA;AAAA,QACjD,SAAA,EAAW,CACR,CAAA,KAAA,CAAM,CAAE,CAAA,MAAA,EAAQ,CAChB,CAAA,QAAA,EACA,CAAA,QAAA,CAAS,wCAAwC,CAAA;AAAA,QACpD,KAAA,EAAO,CACJ,CAAA,KAAA,CAAM,CAAE,CAAA,MAAA,EAAQ,CAChB,CAAA,QAAA,EACA,CAAA,QAAA,CAAS,oCAAoC;AAAA,OACjD,CAAA,CACA,QAAS,EAAA,CACT,SAAS,yCAAyC;AAAA,KACtD,CACA,CAAA,QAAA,EACA,CAAA,QAAA;AAAA,MACC;AAAA;AACF,GACH;AACH;AAiBO,MAAM,yBAAyB,2BAA4B,CAAA;;;;"}
1
+ {"version":3,"file":"schema.esm.js","sources":["../../../../src/components/fields/RepoBranchPicker/schema.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 */\nimport { makeFieldSchema } from '@backstage/plugin-scaffolder-react';\n\n/**\n * @public\n */\nexport const RepoBranchPickerFieldSchema = makeFieldSchema({\n output: z => z.string(),\n uiOptions: z =>\n z.object({\n requestUserCredentials: z\n .object({\n secretsKey: z\n .string()\n .describe(\n 'Key used within the template secrets context to store the credential',\n ),\n additionalScopes: z\n .object({\n gitea: z\n .array(z.string())\n .optional()\n .describe('Additional Gitea scopes to request'),\n gerrit: z\n .array(z.string())\n .optional()\n .describe('Additional Gerrit scopes to request'),\n github: z\n .array(z.string())\n .optional()\n .describe('Additional GitHub scopes to request'),\n gitlab: z\n .array(z.string())\n .optional()\n .describe('Additional GitLab scopes to request'),\n bitbucket: z\n .array(z.string())\n .optional()\n .describe('Additional BitBucket scopes to request'),\n azure: z\n .array(z.string())\n .optional()\n .describe('Additional Azure scopes to request'),\n })\n .optional()\n .describe('Additional permission scopes to request'),\n })\n .optional()\n .describe(\n 'If defined will request user credentials to auth against the given SCM platform',\n ),\n }),\n});\n\n/**\n * The input props that can be specified under `ui:options` for the\n * `RepoBranchPicker` field extension.\n *\n * @public\n */\nexport type RepoBranchPickerUiOptions = NonNullable<\n (typeof RepoBranchPickerFieldSchema.TProps.uiSchema)['ui:options']\n>;\n\nexport type RepoBranchPickerProps = typeof RepoBranchPickerFieldSchema.TProps;\n\n// This has been duplicated from /plugins/scaffolder/src/components/fields/RepoUrlPicker/schema.ts\n// NOTE: There is a bug with this failing validation in the custom field explorer due\n// to https://github.com/rjsf-team/react-jsonschema-form/issues/675 even if\n// requestUserCredentials is not defined\nexport const RepoBranchPickerSchema = RepoBranchPickerFieldSchema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AA;AACF,GACH;AACL,CAAC;AAkBM,MAAM,yBAAyB,2BAA4B,CAAA;;;;"}
@@ -16,6 +16,7 @@ import { GitlabRepoPicker } from './GitlabRepoPicker.esm.js';
16
16
  import { RepoUrlPickerHost } from './RepoUrlPickerHost.esm.js';
17
17
  import { RepoUrlPickerRepoName } from './RepoUrlPickerRepoName.esm.js';
18
18
  import { parseRepoPickerUrl, serializeRepoPickerUrl } from './utils.esm.js';
19
+ import { MarkdownContent } from '@backstage/core-components';
19
20
  export { RepoUrlPickerSchema } from './schema.esm.js';
20
21
 
21
22
  const RepoUrlPicker = (props) => {
@@ -115,12 +116,13 @@ const RepoUrlPicker = (props) => {
115
116
  [state, uiSchema]
116
117
  );
117
118
  const hostType = (state.host && integrationApi.byHost(state.host)?.type) ?? null;
119
+ const description = uiSchema["ui:description"] ?? schema.description;
118
120
  return /* @__PURE__ */ jsxs(Fragment, { children: [
119
121
  schema.title && /* @__PURE__ */ jsxs(Box, { my: 1, children: [
120
122
  /* @__PURE__ */ jsx(Typography, { variant: "h5", children: schema.title }),
121
123
  /* @__PURE__ */ jsx(Divider, {})
122
124
  ] }),
123
- schema.description && /* @__PURE__ */ jsx(Typography, { variant: "body1", children: schema.description }),
125
+ description && /* @__PURE__ */ jsx(Typography, { variant: "body1", children: /* @__PURE__ */ jsx(MarkdownContent, { content: description }) }),
124
126
  /* @__PURE__ */ jsx(
125
127
  RepoUrlPickerHost,
126
128
  {
@@ -1 +1 @@
1
- {"version":3,"file":"RepoUrlPicker.esm.js","sources":["../../../../src/components/fields/RepoUrlPicker/RepoUrlPicker.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 { useApi } from '@backstage/core-plugin-api';\nimport {\n scmAuthApiRef,\n scmIntegrationsApiRef,\n} from '@backstage/integration-react';\nimport { useTemplateSecrets } from '@backstage/plugin-scaffolder-react';\nimport Box from '@material-ui/core/Box';\nimport Divider from '@material-ui/core/Divider';\nimport Typography from '@material-ui/core/Typography';\nimport { useCallback, useEffect, useMemo, useState } from 'react';\nimport useDebounce from 'react-use/esm/useDebounce';\nimport { AzureRepoPicker } from './AzureRepoPicker';\nimport { BitbucketRepoPicker } from './BitbucketRepoPicker';\nimport { GerritRepoPicker } from './GerritRepoPicker';\nimport { GiteaRepoPicker } from './GiteaRepoPicker';\nimport { GithubRepoPicker } from './GithubRepoPicker';\nimport { GitlabRepoPicker } from './GitlabRepoPicker';\nimport { RepoUrlPickerHost } from './RepoUrlPickerHost';\nimport { RepoUrlPickerRepoName } from './RepoUrlPickerRepoName';\nimport { RepoUrlPickerFieldSchema } from './schema';\nimport { RepoUrlPickerState } from './types';\nimport { parseRepoPickerUrl, serializeRepoPickerUrl } from './utils';\n\nexport { RepoUrlPickerSchema } from './schema';\n\n/**\n * The underlying component that is rendered in the form for the `RepoUrlPicker`\n * field extension.\n *\n * @public\n */\nexport const RepoUrlPicker = (\n props: typeof RepoUrlPickerFieldSchema.TProps,\n) => {\n const { uiSchema, onChange, rawErrors, formData, schema } = props;\n const [state, setState] = useState<RepoUrlPickerState>(\n parseRepoPickerUrl(formData),\n );\n const [credentialsHost, setCredentialsHost] = useState<string | undefined>(\n undefined,\n );\n const integrationApi = useApi(scmIntegrationsApiRef);\n const scmAuthApi = useApi(scmAuthApiRef);\n const { secrets, setSecrets } = useTemplateSecrets();\n const allowedHosts = useMemo(\n () => uiSchema?.['ui:options']?.allowedHosts ?? [],\n [uiSchema],\n );\n const allowedOrganizations = useMemo(\n () => uiSchema?.['ui:options']?.allowedOrganizations ?? [],\n [uiSchema],\n );\n const allowedOwners = useMemo(\n () => uiSchema?.['ui:options']?.allowedOwners ?? [],\n [uiSchema],\n );\n const allowedProjects = useMemo(\n () => uiSchema?.['ui:options']?.allowedProjects ?? [],\n [uiSchema],\n );\n const allowedRepos = useMemo(\n () => uiSchema?.['ui:options']?.allowedRepos ?? [],\n [uiSchema],\n );\n const isDisabled = useMemo(\n () => uiSchema?.['ui:disabled'] ?? false,\n [uiSchema],\n );\n const { owner, organization, project, repoName } = state;\n\n useEffect(() => {\n onChange(serializeRepoPickerUrl(state));\n }, [state, onChange]);\n\n /* we deal with calling the repo setting here instead of in each components for ease */\n useEffect(() => {\n if (allowedOrganizations.length > 0 && !organization) {\n setState(prevState => ({\n ...prevState,\n organization: allowedOrganizations[0],\n }));\n }\n }, [setState, allowedOrganizations, organization]);\n\n useEffect(() => {\n if (allowedOwners.length > 0 && !owner) {\n setState(prevState => ({\n ...prevState,\n owner: allowedOwners[0],\n }));\n }\n }, [setState, allowedOwners, owner]);\n\n useEffect(() => {\n if (allowedProjects.length > 0 && !project) {\n setState(prevState => ({\n ...prevState,\n project: allowedProjects[0],\n }));\n }\n }, [setState, allowedProjects, project]);\n\n useEffect(() => {\n if (allowedRepos.length > 0 && !repoName) {\n setState(prevState => ({ ...prevState, repoName: allowedRepos[0] }));\n }\n }, [setState, allowedRepos, repoName]);\n\n const updateLocalState = useCallback(\n (newState: RepoUrlPickerState) => {\n setState(prevState => ({ ...prevState, ...newState }));\n },\n [setState],\n );\n\n useDebounce(\n async () => {\n const { requestUserCredentials } = uiSchema?.['ui:options'] ?? {};\n\n if (!requestUserCredentials || !state.host) {\n return;\n }\n\n // don't show login prompt if secret value is already in state for selected host\n if (\n secrets[requestUserCredentials.secretsKey] &&\n credentialsHost === state.host\n ) {\n return;\n }\n\n // user has requested that we use the users credentials\n // so lets grab them using the scmAuthApi and pass through\n // any additional scopes from the ui:options\n const { token } = await scmAuthApi.getCredentials({\n url: `https://${state.host}`,\n additionalScope: {\n repoWrite: true,\n customScopes: requestUserCredentials.additionalScopes,\n },\n });\n\n // set the secret using the key provided in the ui:options for use\n // in the templating the manifest with ${{ secrets[secretsKey] }}\n setSecrets({ [requestUserCredentials.secretsKey]: token });\n setCredentialsHost(state.host);\n },\n 500,\n [state, uiSchema],\n );\n\n const hostType =\n (state.host && integrationApi.byHost(state.host)?.type) ?? null;\n return (\n <>\n {schema.title && (\n <Box my={1}>\n <Typography variant=\"h5\">{schema.title}</Typography>\n <Divider />\n </Box>\n )}\n {schema.description && (\n <Typography variant=\"body1\">{schema.description}</Typography>\n )}\n <RepoUrlPickerHost\n host={state.host}\n hosts={allowedHosts}\n onChange={host => setState(prevState => ({ ...prevState, host }))}\n rawErrors={rawErrors}\n isDisabled={isDisabled}\n />\n {hostType === 'github' && (\n <GithubRepoPicker\n allowedOwners={allowedOwners}\n onChange={updateLocalState}\n rawErrors={rawErrors}\n state={state}\n isDisabled={isDisabled}\n accessToken={\n uiSchema?.['ui:options']?.requestUserCredentials?.secretsKey &&\n secrets[uiSchema['ui:options'].requestUserCredentials.secretsKey]\n }\n />\n )}\n {hostType === 'gitea' && (\n <GiteaRepoPicker\n allowedOwners={allowedOwners}\n allowedRepos={allowedRepos}\n rawErrors={rawErrors}\n state={state}\n isDisabled={isDisabled}\n onChange={updateLocalState}\n />\n )}\n {hostType === 'gitlab' && (\n <GitlabRepoPicker\n allowedOwners={allowedOwners}\n rawErrors={rawErrors}\n state={state}\n onChange={updateLocalState}\n isDisabled={isDisabled}\n accessToken={\n uiSchema?.['ui:options']?.requestUserCredentials?.secretsKey &&\n secrets[uiSchema['ui:options'].requestUserCredentials.secretsKey]\n }\n />\n )}\n {hostType === 'bitbucket' && (\n <BitbucketRepoPicker\n allowedOwners={allowedOwners}\n allowedProjects={allowedProjects}\n rawErrors={rawErrors}\n state={state}\n onChange={updateLocalState}\n isDisabled={isDisabled}\n accessToken={\n uiSchema?.['ui:options']?.requestUserCredentials?.secretsKey &&\n secrets[uiSchema['ui:options'].requestUserCredentials.secretsKey]\n }\n />\n )}\n {hostType === 'azure' && (\n <AzureRepoPicker\n allowedOrganizations={allowedOrganizations}\n allowedProject={allowedProjects}\n rawErrors={rawErrors}\n state={state}\n isDisabled={isDisabled}\n onChange={updateLocalState}\n />\n )}\n {hostType === 'gerrit' && (\n <GerritRepoPicker\n rawErrors={rawErrors}\n state={state}\n onChange={updateLocalState}\n isDisabled={isDisabled}\n />\n )}\n <RepoUrlPickerRepoName\n repoName={state.repoName}\n allowedRepos={allowedRepos}\n onChange={repo =>\n setState(prevState => ({\n ...prevState,\n repoName: repo.id || repo.name,\n }))\n }\n isDisabled={isDisabled}\n rawErrors={rawErrors}\n availableRepos={state.availableRepos}\n />\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AA8Ca,MAAA,aAAA,GAAgB,CAC3B,KACG,KAAA;AACH,EAAA,MAAM,EAAE,QAAU,EAAA,QAAA,EAAU,SAAW,EAAA,QAAA,EAAU,QAAW,GAAA,KAAA;AAC5D,EAAM,MAAA,CAAC,KAAO,EAAA,QAAQ,CAAI,GAAA,QAAA;AAAA,IACxB,mBAAmB,QAAQ;AAAA,GAC7B;AACA,EAAM,MAAA,CAAC,eAAiB,EAAA,kBAAkB,CAAI,GAAA,QAAA;AAAA,IAC5C,KAAA;AAAA,GACF;AACA,EAAM,MAAA,cAAA,GAAiB,OAAO,qBAAqB,CAAA;AACnD,EAAM,MAAA,UAAA,GAAa,OAAO,aAAa,CAAA;AACvC,EAAA,MAAM,EAAE,OAAA,EAAS,UAAW,EAAA,GAAI,kBAAmB,EAAA;AACnD,EAAA,MAAM,YAAe,GAAA,OAAA;AAAA,IACnB,MAAM,QAAA,GAAW,YAAY,CAAA,EAAG,gBAAgB,EAAC;AAAA,IACjD,CAAC,QAAQ;AAAA,GACX;AACA,EAAA,MAAM,oBAAuB,GAAA,OAAA;AAAA,IAC3B,MAAM,QAAA,GAAW,YAAY,CAAA,EAAG,wBAAwB,EAAC;AAAA,IACzD,CAAC,QAAQ;AAAA,GAC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A,MAAA;AAAA,QACC,oBAAA;AAAA,QACA,cAAgB,EAAA,eAAA;AAAA,QAChB,SAAA;AAAA,QACA,KAAA;AAAA,QACA,UAAA;AAAA,QACA,QAAU,EAAA;AAAA;AAAA,KACZ;AAAA,IAED,aAAa,QACZ,oBAAA,GAAA;AAAA,MAAC,gBAAA;AAAA,MAAA;AAAA,QACC,SAAA;AAAA,QACA,KAAA;AAAA,QACA,QAAU,EAAA,gBAAA;AAAA,QACV;AAAA;AAAA,KACF;AAAA,oBAEF,GAAA;AAAA,MAAC,qBAAA;AAAA,MAAA;AAAA,QACC,UAAU,KAAM,CAAA,QAAA;AAAA,QAChB,YAAA;AAAA,QACA,QAAA,EAAU,CACR,IAAA,KAAA,QAAA,CAAS,CAAc,SAAA,MAAA;AAAA,UACrB,GAAG,SAAA;AAAA,UACH,QAAA,EAAU,IAAK,CAAA,EAAA,IAAM,IAAK,CAAA;AAAA,SAC1B,CAAA,CAAA;AAAA,QAEJ,UAAA;AAAA,QACA,SAAA;AAAA,QACA,gBAAgB,KAAM,CAAA;AAAA;AAAA;AACxB,GACF,EAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"RepoUrlPicker.esm.js","sources":["../../../../src/components/fields/RepoUrlPicker/RepoUrlPicker.tsx"],"sourcesContent":["/*\n * Copyright 2021 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 { useApi } from '@backstage/core-plugin-api';\nimport {\n scmAuthApiRef,\n scmIntegrationsApiRef,\n} from '@backstage/integration-react';\nimport { useTemplateSecrets } from '@backstage/plugin-scaffolder-react';\nimport Box from '@material-ui/core/Box';\nimport Divider from '@material-ui/core/Divider';\nimport Typography from '@material-ui/core/Typography';\nimport { useCallback, useEffect, useMemo, useState } from 'react';\nimport useDebounce from 'react-use/esm/useDebounce';\nimport { AzureRepoPicker } from './AzureRepoPicker';\nimport { BitbucketRepoPicker } from './BitbucketRepoPicker';\nimport { GerritRepoPicker } from './GerritRepoPicker';\nimport { GiteaRepoPicker } from './GiteaRepoPicker';\nimport { GithubRepoPicker } from './GithubRepoPicker';\nimport { GitlabRepoPicker } from './GitlabRepoPicker';\nimport { RepoUrlPickerHost } from './RepoUrlPickerHost';\nimport { RepoUrlPickerRepoName } from './RepoUrlPickerRepoName';\nimport { RepoUrlPickerFieldSchema } from './schema';\nimport { RepoUrlPickerState } from './types';\nimport { parseRepoPickerUrl, serializeRepoPickerUrl } from './utils';\nimport { MarkdownContent } from '@backstage/core-components';\n\nexport { RepoUrlPickerSchema } from './schema';\n\n/**\n * The underlying component that is rendered in the form for the `RepoUrlPicker`\n * field extension.\n *\n * @public\n */\nexport const RepoUrlPicker = (\n props: typeof RepoUrlPickerFieldSchema.TProps,\n) => {\n const { uiSchema, onChange, rawErrors, formData, schema } = props;\n const [state, setState] = useState<RepoUrlPickerState>(\n parseRepoPickerUrl(formData),\n );\n const [credentialsHost, setCredentialsHost] = useState<string | undefined>(\n undefined,\n );\n const integrationApi = useApi(scmIntegrationsApiRef);\n const scmAuthApi = useApi(scmAuthApiRef);\n const { secrets, setSecrets } = useTemplateSecrets();\n const allowedHosts = useMemo(\n () => uiSchema?.['ui:options']?.allowedHosts ?? [],\n [uiSchema],\n );\n const allowedOrganizations = useMemo(\n () => uiSchema?.['ui:options']?.allowedOrganizations ?? [],\n [uiSchema],\n );\n const allowedOwners = useMemo(\n () => uiSchema?.['ui:options']?.allowedOwners ?? [],\n [uiSchema],\n );\n const allowedProjects = useMemo(\n () => uiSchema?.['ui:options']?.allowedProjects ?? [],\n [uiSchema],\n );\n const allowedRepos = useMemo(\n () => uiSchema?.['ui:options']?.allowedRepos ?? [],\n [uiSchema],\n );\n const isDisabled = useMemo(\n () => uiSchema?.['ui:disabled'] ?? false,\n [uiSchema],\n );\n const { owner, organization, project, repoName } = state;\n\n useEffect(() => {\n onChange(serializeRepoPickerUrl(state));\n }, [state, onChange]);\n\n /* we deal with calling the repo setting here instead of in each components for ease */\n useEffect(() => {\n if (allowedOrganizations.length > 0 && !organization) {\n setState(prevState => ({\n ...prevState,\n organization: allowedOrganizations[0],\n }));\n }\n }, [setState, allowedOrganizations, organization]);\n\n useEffect(() => {\n if (allowedOwners.length > 0 && !owner) {\n setState(prevState => ({\n ...prevState,\n owner: allowedOwners[0],\n }));\n }\n }, [setState, allowedOwners, owner]);\n\n useEffect(() => {\n if (allowedProjects.length > 0 && !project) {\n setState(prevState => ({\n ...prevState,\n project: allowedProjects[0],\n }));\n }\n }, [setState, allowedProjects, project]);\n\n useEffect(() => {\n if (allowedRepos.length > 0 && !repoName) {\n setState(prevState => ({ ...prevState, repoName: allowedRepos[0] }));\n }\n }, [setState, allowedRepos, repoName]);\n\n const updateLocalState = useCallback(\n (newState: RepoUrlPickerState) => {\n setState(prevState => ({ ...prevState, ...newState }));\n },\n [setState],\n );\n\n useDebounce(\n async () => {\n const { requestUserCredentials } = uiSchema?.['ui:options'] ?? {};\n\n if (!requestUserCredentials || !state.host) {\n return;\n }\n\n // don't show login prompt if secret value is already in state for selected host\n if (\n secrets[requestUserCredentials.secretsKey] &&\n credentialsHost === state.host\n ) {\n return;\n }\n\n // user has requested that we use the users credentials\n // so lets grab them using the scmAuthApi and pass through\n // any additional scopes from the ui:options\n const { token } = await scmAuthApi.getCredentials({\n url: `https://${state.host}`,\n additionalScope: {\n repoWrite: true,\n customScopes: requestUserCredentials.additionalScopes,\n },\n });\n\n // set the secret using the key provided in the ui:options for use\n // in the templating the manifest with ${{ secrets[secretsKey] }}\n setSecrets({ [requestUserCredentials.secretsKey]: token });\n setCredentialsHost(state.host);\n },\n 500,\n [state, uiSchema],\n );\n\n const hostType =\n (state.host && integrationApi.byHost(state.host)?.type) ?? null;\n\n const description = uiSchema['ui:description'] ?? schema.description;\n\n return (\n <>\n {schema.title && (\n <Box my={1}>\n <Typography variant=\"h5\">{schema.title}</Typography>\n <Divider />\n </Box>\n )}\n {description && (\n <Typography variant=\"body1\">\n <MarkdownContent content={description} />\n </Typography>\n )}\n <RepoUrlPickerHost\n host={state.host}\n hosts={allowedHosts}\n onChange={host => setState(prevState => ({ ...prevState, host }))}\n rawErrors={rawErrors}\n isDisabled={isDisabled}\n />\n {hostType === 'github' && (\n <GithubRepoPicker\n allowedOwners={allowedOwners}\n onChange={updateLocalState}\n rawErrors={rawErrors}\n state={state}\n isDisabled={isDisabled}\n accessToken={\n uiSchema?.['ui:options']?.requestUserCredentials?.secretsKey &&\n secrets[uiSchema['ui:options'].requestUserCredentials.secretsKey]\n }\n />\n )}\n {hostType === 'gitea' && (\n <GiteaRepoPicker\n allowedOwners={allowedOwners}\n allowedRepos={allowedRepos}\n rawErrors={rawErrors}\n state={state}\n isDisabled={isDisabled}\n onChange={updateLocalState}\n />\n )}\n {hostType === 'gitlab' && (\n <GitlabRepoPicker\n allowedOwners={allowedOwners}\n rawErrors={rawErrors}\n state={state}\n onChange={updateLocalState}\n isDisabled={isDisabled}\n accessToken={\n uiSchema?.['ui:options']?.requestUserCredentials?.secretsKey &&\n secrets[uiSchema['ui:options'].requestUserCredentials.secretsKey]\n }\n />\n )}\n {hostType === 'bitbucket' && (\n <BitbucketRepoPicker\n allowedOwners={allowedOwners}\n allowedProjects={allowedProjects}\n rawErrors={rawErrors}\n state={state}\n onChange={updateLocalState}\n isDisabled={isDisabled}\n accessToken={\n uiSchema?.['ui:options']?.requestUserCredentials?.secretsKey &&\n secrets[uiSchema['ui:options'].requestUserCredentials.secretsKey]\n }\n />\n )}\n {hostType === 'azure' && (\n <AzureRepoPicker\n allowedOrganizations={allowedOrganizations}\n allowedProject={allowedProjects}\n rawErrors={rawErrors}\n state={state}\n isDisabled={isDisabled}\n onChange={updateLocalState}\n />\n )}\n {hostType === 'gerrit' && (\n <GerritRepoPicker\n rawErrors={rawErrors}\n state={state}\n onChange={updateLocalState}\n isDisabled={isDisabled}\n />\n )}\n <RepoUrlPickerRepoName\n repoName={state.repoName}\n allowedRepos={allowedRepos}\n onChange={repo =>\n setState(prevState => ({\n ...prevState,\n repoName: repo.id || repo.name,\n }))\n }\n isDisabled={isDisabled}\n rawErrors={rawErrors}\n availableRepos={state.availableRepos}\n />\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AA+Ca,MAAA,aAAA,GAAgB,CAC3B,KACG,KAAA;AACH,EAAA,MAAM,EAAE,QAAU,EAAA,QAAA,EAAU,SAAW,EAAA,QAAA,EAAU,QAAW,GAAA,KAAA;AAC5D,EAAM,MAAA,CAAC,KAAO,EAAA,QAAQ,CAAI,GAAA,QAAA;AAAA,IACxB,mBAAmB,QAAQ;AAAA,GAC7B;AACA,EAAM,MAAA,CAAC,eAAiB,EAAA,kBAAkB,CAAI,GAAA,QAAA;AAAA,IAC5C,KAAA;AAAA,GACF;AACA,EAAM,MAAA,cAAA,GAAiB,OAAO,qBAAqB,CAAA;AACnD,EAAM,MAAA,UAAA,GAAa,OAAO,aAAa,CAAA;AACvC,EAAA,MAAM,EAAE,OAAA,EAAS,UAAW,EAAA,GAAI,kBAAmB,EAAA;AACnD,EAAA,MAAM,YAAe,GAAA,OAAA;AAAA,IACnB,MAAM,QAAA,GAAW,YAAY,CAAA,EAAG,gBAAgB,EAAC;AAAA,IACjD,CAAC,QAAQ;AAAA,GACX;AACA,EAAA,MAAM,oBAAuB,GAAA,OAAA;AAAA,IAC3B,MAAM,QAAA,GAAW,YAAY,CAAA,EAAG,wBAAwB,EAAC;AAAA,IACzD,CAAC,QAAQ;AAAA,GACX;AACA,EAAA,MAAM,aAAgB,GAAA,OAAA;AAAA,IACpB,MAAM,QAAA,GAAW,YAAY,CAAA,EAAG,iBAAiB,EAAC;AAAA,IAClD,CAAC,QAAQ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A;AAAA,MAAA;AAAA,QACC,oBAAA;AAAA,QACA,cAAgB,EAAA,eAAA;AAAA,QAChB,SAAA;AAAA,QACA,KAAA;AAAA,QACA,UAAA;AAAA,QACA,QAAU,EAAA;AAAA;AAAA,KACZ;AAAA,IAED,aAAa,QACZ,oBAAA,GAAA;AAAA,MAAC,gBAAA;AAAA,MAAA;AAAA,QACC,SAAA;AAAA,QACA,KAAA;AAAA,QACA,QAAU,EAAA,gBAAA;AAAA,QACV;AAAA;AAAA,KACF;AAAA,oBAEF,GAAA;AAAA,MAAC,qBAAA;AAAA,MAAA;AAAA,QACC,UAAU,KAAM,CAAA,QAAA;AAAA,QAChB,YAAA;AAAA,QACA,QAAA,EAAU,CACR,IAAA,KAAA,QAAA,CAAS,CAAc,SAAA,MAAA;AAAA,UACrB,GAAG,SAAA;AAAA,UACH,QAAA,EAAU,IAAK,CAAA,EAAA,IAAM,IAAK,CAAA;AAAA,SAC1B,CAAA,CAAA;AAAA,QAEJ,UAAA;AAAA,QACA,SAAA;AAAA,QACA,gBAAgB,KAAM,CAAA;AAAA;AAAA;AACxB,GACF,EAAA,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"schema.esm.js","sources":["../../../../src/components/fields/RepoUrlPicker/schema.ts"],"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 */\n\nimport { makeFieldSchema } from '@backstage/plugin-scaffolder-react';\n\n/**\n * @public\n */\nexport const RepoUrlPickerFieldSchema = makeFieldSchema({\n output: z => z.string(),\n uiOptions: z =>\n z.object({\n allowedHosts: z\n .array(z.string())\n .optional()\n .describe('List of allowed SCM platform hosts'),\n allowedOrganizations: z\n .array(z.string())\n .optional()\n .describe('List of allowed organizations in the given SCM platform'),\n allowedOwners: z\n .array(z.string())\n .optional()\n .describe('List of allowed owners in the given SCM platform'),\n allowedProjects: z\n .array(z.string())\n .optional()\n .describe('List of allowed projects in the given SCM platform'),\n allowedRepos: z\n .array(z.string())\n .optional()\n .describe('List of allowed repos in the given SCM platform'),\n requestUserCredentials: z\n .object({\n secretsKey: z\n .string()\n .describe(\n 'Key used within the template secrets context to store the credential',\n ),\n additionalScopes: z\n .object({\n gitea: z\n .array(z.string())\n .optional()\n .describe('Additional Gitea scopes to request'),\n gerrit: z\n .array(z.string())\n .optional()\n .describe('Additional Gerrit scopes to request'),\n github: z\n .array(z.string())\n .optional()\n .describe('Additional GitHub scopes to request'),\n gitlab: z\n .array(z.string())\n .optional()\n .describe('Additional GitLab scopes to request'),\n bitbucket: z\n .array(z.string())\n .optional()\n .describe('Additional BitBucket scopes to request'),\n azure: z\n .array(z.string())\n .optional()\n .describe('Additional Azure scopes to request'),\n })\n .optional()\n .describe('Additional permission scopes to request'),\n })\n .optional()\n .describe(\n 'If defined will request user credentials to auth against the given SCM platform',\n ),\n }),\n});\n\n/**\n * The input props that can be specified under `ui:options` for the\n * `RepoUrlPicker` field extension.\n *\n * @public\n * @deprecated this will be removed as it's no longer used\n */\nexport type RepoUrlPickerUiOptions =\n typeof RepoUrlPickerFieldSchema.uiOptionsType;\n\nexport type RepoUrlPickerProps = typeof RepoUrlPickerFieldSchema.type;\n\n// This has been duplicated to /plugins/scaffolder/src/components/fields/RepoBranchPicker/schema.ts\n// NOTE: There is a bug with this failing validation in the custom field explorer due\n// to https://github.com/rjsf-team/react-jsonschema-form/issues/675 even if\n// requestUserCredentials is not defined\nexport const RepoUrlPickerSchema = RepoUrlPickerFieldSchema.schema;\n"],"names":[],"mappings":";;AAqBO,MAAM,2BAA2B,eAAgB,CAAA;AAAA,EACtD,MAAA,EAAQ,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,MAAA,EAAQ,CAChB,CAAA,QAAA,EACA,CAAA,QAAA,CAAS,qCAAqC,CAAA;AAAA,QACjD,MAAA,EAAQ,CACL,CAAA,KAAA,CAAM,CAAE,CAAA,MAAA,EAAQ,CAChB,CAAA,QAAA,EACA,CAAA,QAAA,CAAS,qCAAqC,CAAA;AAAA,QACjD,SAAA,EAAW,CACR,CAAA,KAAA,CAAM,CAAE,CAAA,MAAA,EAAQ,CAChB,CAAA,QAAA,EACA,CAAA,QAAA,CAAS,wCAAwC,CAAA;AAAA,QACpD,KAAA,EAAO,CACJ,CAAA,KAAA,CAAM,CAAE,CAAA,MAAA,EAAQ,CAChB,CAAA,QAAA,EACA,CAAA,QAAA,CAAS,oCAAoC;AAAA,OACjD,CAAA,CACA,QAAS,EAAA,CACT,SAAS,yCAAyC;AAAA,KACtD,CACA,CAAA,QAAA,EACA,CAAA,QAAA;AAAA,MACC;AAAA;AACF,GACH;AACL,CAAC;AAkBM,MAAM,sBAAsB,wBAAyB,CAAA;;;;"}
1
+ {"version":3,"file":"schema.esm.js","sources":["../../../../src/components/fields/RepoUrlPicker/schema.ts"],"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 */\n\nimport { makeFieldSchema } from '@backstage/plugin-scaffolder-react';\n\n/**\n * @public\n */\nexport const RepoUrlPickerFieldSchema = makeFieldSchema({\n output: z => z.string(),\n uiOptions: z =>\n z.object({\n allowedHosts: z\n .array(z.string())\n .optional()\n .describe('List of allowed SCM platform hosts'),\n allowedOrganizations: z\n .array(z.string())\n .optional()\n .describe('List of allowed organizations in the given SCM platform'),\n allowedOwners: z\n .array(z.string())\n .optional()\n .describe('List of allowed owners in the given SCM platform'),\n allowedProjects: z\n .array(z.string())\n .optional()\n .describe('List of allowed projects in the given SCM platform'),\n allowedRepos: z\n .array(z.string())\n .optional()\n .describe('List of allowed repos in the given SCM platform'),\n requestUserCredentials: z\n .object({\n secretsKey: z\n .string()\n .describe(\n 'Key used within the template secrets context to store the credential',\n ),\n additionalScopes: z\n .object({\n gitea: z\n .array(z.string())\n .optional()\n .describe('Additional Gitea scopes to request'),\n gerrit: z\n .array(z.string())\n .optional()\n .describe('Additional Gerrit scopes to request'),\n github: z\n .array(z.string())\n .optional()\n .describe('Additional GitHub scopes to request'),\n gitlab: z\n .array(z.string())\n .optional()\n .describe('Additional GitLab scopes to request'),\n bitbucket: z\n .array(z.string())\n .optional()\n .describe('Additional BitBucket scopes to request'),\n azure: z\n .array(z.string())\n .optional()\n .describe('Additional Azure scopes to request'),\n })\n .optional()\n .describe('Additional permission scopes to request'),\n })\n .optional()\n .describe(\n 'If defined will request user credentials to auth against the given SCM platform',\n ),\n }),\n});\n\n/**\n * The input props that can be specified under `ui:options` for the\n * `RepoUrlPicker` field extension.\n *\n * @public\n * @deprecated this will be removed as it's no longer used\n */\nexport type RepoUrlPickerUiOptions = NonNullable<\n (typeof RepoUrlPickerFieldSchema.TProps.uiSchema)['ui:options']\n>;\n\nexport type RepoUrlPickerProps = typeof RepoUrlPickerFieldSchema.TProps;\n\n// This has been duplicated to /plugins/scaffolder/src/components/fields/RepoBranchPicker/schema.ts\n// NOTE: There is a bug with this failing validation in the custom field explorer due\n// to https://github.com/rjsf-team/react-jsonschema-form/issues/675 even if\n// requestUserCredentials is not defined\nexport const RepoUrlPickerSchema = RepoUrlPickerFieldSchema.schema;\n"],"names":[],"mappings":";;AAqBO,MAAM,2BAA2B,eAAgB,CAAA;AAAA,EACtD,MAAA,EAAQ,CAAK,CAAA,KAAA,CAAA,CAAE,MAAO,EAAA;AAAA,EACtB,SAAA,EAAW,CACT,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AAA,QACjD,MAAA,EAAQ,CACL,CAAA,KAAA,CAAM,CAAE,CAAA,MAAA,EAAQ,CAChB,CAAA,QAAA,EACA,CAAA,QAAA,CAAS,qCAAqC,CAAA;AAAA,QACjD,SAAA,EAAW,CACR,CAAA,KAAA,CAAM,CAAE,CAAA,MAAA,EAAQ,CAChB,CAAA,QAAA,EACA,CAAA,QAAA,CAAS,wCAAwC,CAAA;AAAA,QACpD,KAAA,EAAO,CACJ,CAAA,KAAA,CAAM,CAAE,CAAA,MAAA,EAAQ,CAChB,CAAA,QAAA,EACA,CAAA,QAAA,CAAS,oCAAoC;AAAA,OACjD,CAAA,CACA,QAAS,EAAA,CACT,SAAS,yCAAyC;AAAA,KACtD,CACA,CAAA,QAAA,EACA,CAAA,QAAA;AAAA,MACC;AAAA;AACF,GACH;AACL,CAAC;AAmBM,MAAM,sBAAsB,wBAAyB,CAAA;;;;"}
@@ -7,13 +7,14 @@ const SecretInput = (props) => {
7
7
  rawErrors,
8
8
  disabled,
9
9
  errors,
10
- required
10
+ required,
11
+ uiSchema
11
12
  } = props;
12
13
  return /* @__PURE__ */ jsx(
13
14
  ScaffolderField,
14
15
  {
15
16
  rawErrors,
16
- rawDescription: description,
17
+ rawDescription: uiSchema["ui:description"] ?? description,
17
18
  disabled,
18
19
  errors,
19
20
  required,
@@ -1 +1 @@
1
- {"version":3,"file":"SecretInput.esm.js","sources":["../../../../src/components/fields/SecretInput/SecretInput.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 { ScaffolderRJSFFieldProps } from '@backstage/plugin-scaffolder-react';\nimport {\n ScaffolderField,\n SecretWidget,\n} from '@backstage/plugin-scaffolder-react/alpha';\n\nexport const SecretInput = (props: ScaffolderRJSFFieldProps) => {\n const {\n schema: { description },\n rawErrors,\n disabled,\n errors,\n required,\n } = props;\n\n return (\n <ScaffolderField\n rawErrors={rawErrors}\n rawDescription={description}\n disabled={disabled}\n errors={errors}\n required={required}\n >\n <SecretWidget {...props} />\n </ScaffolderField>\n );\n};\n"],"names":[],"mappings":";;;AAqBa,MAAA,WAAA,GAAc,CAAC,KAAoC,KAAA;AAC9D,EAAM,MAAA;AAAA,IACJ,MAAA,EAAQ,EAAE,WAAY,EAAA;AAAA,IACtB,SAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAA;AAAA,IACA;AAAA,GACE,GAAA,KAAA;AAEJ,EACE,uBAAA,GAAA;AAAA,IAAC,eAAA;AAAA,IAAA;AAAA,MACC,SAAA;AAAA,MACA,cAAgB,EAAA,WAAA;AAAA,MAChB,QAAA;AAAA,MACA,MAAA;AAAA,MACA,QAAA;AAAA,MAEA,QAAA,kBAAA,GAAA,CAAC,YAAc,EAAA,EAAA,GAAG,KAAO,EAAA;AAAA;AAAA,GAC3B;AAEJ;;;;"}
1
+ {"version":3,"file":"SecretInput.esm.js","sources":["../../../../src/components/fields/SecretInput/SecretInput.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 { ScaffolderRJSFFieldProps } from '@backstage/plugin-scaffolder-react';\nimport {\n ScaffolderField,\n SecretWidget,\n} from '@backstage/plugin-scaffolder-react/alpha';\n\nexport const SecretInput = (props: ScaffolderRJSFFieldProps) => {\n const {\n schema: { description },\n rawErrors,\n disabled,\n errors,\n required,\n uiSchema,\n } = props;\n\n return (\n <ScaffolderField\n rawErrors={rawErrors}\n rawDescription={uiSchema['ui:description'] ?? description}\n disabled={disabled}\n errors={errors}\n required={required}\n >\n <SecretWidget {...props} />\n </ScaffolderField>\n );\n};\n"],"names":[],"mappings":";;;AAqBa,MAAA,WAAA,GAAc,CAAC,KAAoC,KAAA;AAC9D,EAAM,MAAA;AAAA,IACJ,MAAA,EAAQ,EAAE,WAAY,EAAA;AAAA,IACtB,SAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAA;AAAA,IACA,QAAA;AAAA,IACA;AAAA,GACE,GAAA,KAAA;AAEJ,EACE,uBAAA,GAAA;AAAA,IAAC,eAAA;AAAA,IAAA;AAAA,MACC,SAAA;AAAA,MACA,cAAA,EAAgB,QAAS,CAAA,gBAAgB,CAAK,IAAA,WAAA;AAAA,MAC9C,QAAA;AAAA,MACA,MAAA;AAAA,MACA,QAAA;AAAA,MAEA,QAAA,kBAAA,GAAA,CAAC,YAAc,EAAA,EAAA,GAAG,KAAO,EAAA;AAAA;AAAA,GAC3B;AAEJ;;;;"}