@backstage/plugin-scaffolder 1.26.0-next.0 → 1.26.0-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/alpha/package.json +1 -1
  3. package/dist/alpha/components/TemplateEditorPage/CustomFieldExplorer.esm.js +61 -29
  4. package/dist/alpha/components/TemplateEditorPage/CustomFieldExplorer.esm.js.map +1 -1
  5. package/dist/alpha/components/TemplateEditorPage/CustomFieldPlaygroud.esm.js +36 -13
  6. package/dist/alpha/components/TemplateEditorPage/CustomFieldPlaygroud.esm.js.map +1 -1
  7. package/dist/alpha/components/TemplateEditorPage/CustomFieldsPage.esm.js +6 -15
  8. package/dist/alpha/components/TemplateEditorPage/CustomFieldsPage.esm.js.map +1 -1
  9. package/dist/alpha/components/TemplateEditorPage/DirectoryEditorContext.esm.js +4 -3
  10. package/dist/alpha/components/TemplateEditorPage/DirectoryEditorContext.esm.js.map +1 -1
  11. package/dist/alpha/components/TemplateEditorPage/TemplateEditor.esm.js +35 -80
  12. package/dist/alpha/components/TemplateEditorPage/TemplateEditor.esm.js.map +1 -1
  13. package/dist/alpha/components/TemplateEditorPage/TemplateEditorBrowser.esm.js +9 -6
  14. package/dist/alpha/components/TemplateEditorPage/TemplateEditorBrowser.esm.js.map +1 -1
  15. package/dist/alpha/components/TemplateEditorPage/TemplateEditorForm.esm.js +5 -2
  16. package/dist/alpha/components/TemplateEditorPage/TemplateEditorForm.esm.js.map +1 -1
  17. package/dist/alpha/components/TemplateEditorPage/TemplateEditorIntro.esm.js +108 -89
  18. package/dist/alpha/components/TemplateEditorPage/TemplateEditorIntro.esm.js.map +1 -1
  19. package/dist/alpha/components/TemplateEditorPage/TemplateEditorLayout.esm.js +94 -0
  20. package/dist/alpha/components/TemplateEditorPage/TemplateEditorLayout.esm.js.map +1 -0
  21. package/dist/alpha/components/TemplateEditorPage/TemplateEditorPage.esm.js +23 -43
  22. package/dist/alpha/components/TemplateEditorPage/TemplateEditorPage.esm.js.map +1 -1
  23. package/dist/alpha/components/TemplateEditorPage/TemplateEditorTextArea.esm.js +10 -20
  24. package/dist/alpha/components/TemplateEditorPage/TemplateEditorTextArea.esm.js.map +1 -1
  25. package/dist/alpha/components/TemplateEditorPage/TemplateEditorToolbar.esm.js +42 -14
  26. package/dist/alpha/components/TemplateEditorPage/TemplateEditorToolbar.esm.js.map +1 -1
  27. package/dist/alpha/components/TemplateEditorPage/TemplateEditorToolbarFileMenu.esm.js +73 -0
  28. package/dist/alpha/components/TemplateEditorPage/TemplateEditorToolbarFileMenu.esm.js.map +1 -0
  29. package/dist/alpha/components/TemplateEditorPage/TemplateEditorToolbarTemplatesMenu.esm.js +84 -0
  30. package/dist/alpha/components/TemplateEditorPage/TemplateEditorToolbarTemplatesMenu.esm.js.map +1 -0
  31. package/dist/alpha/components/TemplateEditorPage/TemplateFormPage.esm.js +3 -1
  32. package/dist/alpha/components/TemplateEditorPage/TemplateFormPage.esm.js.map +1 -1
  33. package/dist/alpha/components/TemplateEditorPage/TemplateFormPreviewer.esm.js +58 -95
  34. package/dist/alpha/components/TemplateEditorPage/TemplateFormPreviewer.esm.js.map +1 -1
  35. package/dist/alpha/components/TemplateEditorPage/TemplateIntroPage.esm.js +54 -0
  36. package/dist/alpha/components/TemplateEditorPage/TemplateIntroPage.esm.js.map +1 -0
  37. package/dist/alpha/components/TemplateEditorPage/useTemplateDirectory.esm.js +33 -0
  38. package/dist/alpha/components/TemplateEditorPage/useTemplateDirectory.esm.js.map +1 -0
  39. package/dist/alpha/components/TemplateListPage/RegisterExistingButton.esm.js +1 -1
  40. package/dist/alpha/components/TemplateListPage/RegisterExistingButton.esm.js.map +1 -1
  41. package/dist/alpha.d.ts +24 -5
  42. package/dist/api.esm.js +5 -3
  43. package/dist/api.esm.js.map +1 -1
  44. package/dist/components/ActionsPage/ActionsPage.esm.js +42 -8
  45. package/dist/components/ActionsPage/ActionsPage.esm.js.map +1 -1
  46. package/dist/components/ListTasksPage/ListTasksPage.esm.js +17 -3
  47. package/dist/components/ListTasksPage/ListTasksPage.esm.js.map +1 -1
  48. package/dist/components/Router/Router.esm.js +4 -4
  49. package/dist/components/Router/Router.esm.js.map +1 -1
  50. package/dist/components/fields/EntityPicker/EntityPicker.esm.js +1 -1
  51. package/dist/components/fields/EntityPicker/EntityPicker.esm.js.map +1 -1
  52. package/dist/components/fields/MultiEntityPicker/MultiEntityPicker.esm.js +1 -0
  53. package/dist/components/fields/MultiEntityPicker/MultiEntityPicker.esm.js.map +1 -1
  54. package/dist/index.d.ts +3 -0
  55. package/dist/lib/filesystem/WebFileSystemAccess.esm.js +1 -13
  56. package/dist/lib/filesystem/WebFileSystemAccess.esm.js.map +1 -1
  57. package/dist/lib/filesystem/WebFileSystemStore.esm.js +15 -0
  58. package/dist/lib/filesystem/WebFileSystemStore.esm.js.map +1 -0
  59. package/dist/lib/filesystem/createExampleTemplate.esm.js +1 -0
  60. package/dist/lib/filesystem/createExampleTemplate.esm.js.map +1 -1
  61. package/dist/translation.esm.js +39 -4
  62. package/dist/translation.esm.js.map +1 -1
  63. package/package.json +33 -24
  64. package/dist/alpha/components/TemplateEditorPage/TemplatePage.esm.js +0 -52
  65. package/dist/alpha/components/TemplateEditorPage/TemplatePage.esm.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"MultiEntityPicker.esm.js","sources":["../../../../src/components/fields/MultiEntityPicker/MultiEntityPicker.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 {\n type EntityFilterQuery,\n CATALOG_FILTER_EXISTS,\n} from '@backstage/catalog-client';\nimport {\n Entity,\n parseEntityRef,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport { useApi } from '@backstage/core-plugin-api';\nimport {\n catalogApiRef,\n entityPresentationApiRef,\n EntityDisplayName,\n EntityRefPresentationSnapshot,\n} from '@backstage/plugin-catalog-react';\nimport TextField from '@material-ui/core/TextField';\nimport FormControl from '@material-ui/core/FormControl';\nimport Autocomplete, {\n AutocompleteChangeReason,\n} from '@material-ui/lab/Autocomplete';\nimport React, { useCallback, useEffect, useState } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport { FieldValidation } from '@rjsf/utils';\nimport {\n MultiEntityPickerFilterQueryValue,\n MultiEntityPickerProps,\n MultiEntityPickerUiOptions,\n MultiEntityPickerFilterQuery,\n} from './schema';\nimport { VirtualizedListbox } from '../VirtualizedListbox';\n\nexport { MultiEntityPickerSchema } from './schema';\n\n/**\n * The underlying component that is rendered in the form for the `MultiEntityPicker`\n * field extension.\n */\nexport const MultiEntityPicker = (props: MultiEntityPickerProps) => {\n const {\n onChange,\n schema: { title = 'Entity', description = 'An entity from the catalog' },\n required,\n uiSchema,\n rawErrors,\n formData,\n idSchema,\n } = props;\n const catalogFilter = buildCatalogFilter(uiSchema);\n const defaultKind = uiSchema['ui:options']?.defaultKind;\n const defaultNamespace =\n uiSchema['ui:options']?.defaultNamespace || undefined;\n const [noOfItemsSelected, setNoOfItemsSelected] = useState(0);\n\n const catalogApi = useApi(catalogApiRef);\n const entityPresentationApi = useApi(entityPresentationApiRef);\n const { value: entities, loading } = useAsync(async () => {\n const { items } = await catalogApi.getEntities(\n catalogFilter ? { filter: catalogFilter } : undefined,\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 return { entities: items, entityRefToPresentation };\n });\n const allowArbitraryValues =\n uiSchema['ui:options']?.allowArbitraryValues ?? true;\n\n // if not specified, maxItems defaults to undefined\n const maxItems = props.schema.maxItems;\n\n const onSelect = useCallback(\n (_: any, refs: (string | Entity)[], reason: AutocompleteChangeReason) => {\n const values = refs\n .map(ref => {\n if (typeof ref !== 'string') {\n // if ref does not exist: pass 'undefined' to trigger validation for required value\n return ref ? stringifyEntityRef(ref as Entity) : undefined;\n }\n if (reason === 'blur' || reason === 'create-option') {\n // Add in default namespace, etc.\n let entityRef = ref;\n try {\n // Attempt to parse the entity ref into it's full form.\n entityRef = stringifyEntityRef(\n parseEntityRef(ref as string, {\n defaultKind,\n defaultNamespace,\n }),\n );\n } catch (err) {\n // If the passed in value isn't an entity ref, do nothing.\n }\n\n // We need to check against formData here as that's the previous value for this field.\n if (formData?.includes(ref) || allowArbitraryValues) {\n return entityRef;\n }\n }\n\n return undefined;\n })\n .filter(ref => ref !== undefined) as string[];\n\n setNoOfItemsSelected(values.length);\n onChange(values);\n },\n [onChange, formData, defaultKind, defaultNamespace, allowArbitraryValues],\n );\n\n useEffect(() => {\n if (entities?.entities?.length === 1) {\n onChange([stringifyEntityRef(entities?.entities[0])]);\n }\n }, [entities, onChange]);\n\n return (\n <FormControl\n margin=\"normal\"\n required={required}\n error={rawErrors?.length > 0 && !formData}\n >\n <Autocomplete\n multiple\n filterSelectedOptions\n disabled={entities?.entities?.length === 1}\n id={idSchema?.$id}\n loading={loading}\n onChange={onSelect}\n options={entities?.entities || []}\n renderOption={option => <EntityDisplayName entityRef={option} />}\n getOptionLabel={option =>\n // option can be a string due to freeSolo.\n typeof option === 'string'\n ? option\n : entities?.entityRefToPresentation.get(stringifyEntityRef(option))\n ?.entityRef!\n }\n getOptionDisabled={_options =>\n maxItems ? noOfItemsSelected >= maxItems : false\n }\n autoSelect\n freeSolo={allowArbitraryValues}\n renderInput={params => (\n <TextField\n {...params}\n label={title}\n margin=\"dense\"\n helperText={description}\n FormHelperTextProps={{\n margin: 'dense',\n style: { marginLeft: 0 },\n }}\n variant=\"outlined\"\n required={required}\n InputProps={{\n ...params.InputProps,\n required: formData?.length === 0 && required,\n }}\n />\n )}\n ListboxComponent={VirtualizedListbox}\n />\n </FormControl>\n );\n};\n\nexport const validateMultiEntityPickerValidation = (\n values: string[],\n validation: FieldValidation,\n) => {\n values.forEach(value => {\n try {\n parseEntityRef(value);\n } catch {\n validation.addError(`${value} is not a valid entity ref`);\n }\n });\n};\n\n/**\n * Converts a special `{exists: true}` value to the `CATALOG_FILTER_EXISTS` symbol.\n *\n * @param value - The value to convert.\n * @returns The converted value.\n */\nfunction convertOpsValues(\n value: Exclude<MultiEntityPickerFilterQueryValue, Array<any>>,\n): string | symbol {\n if (typeof value === 'object' && value.exists) {\n return CATALOG_FILTER_EXISTS;\n }\n return value?.toString();\n}\n\n/**\n * Converts schema filters to entity filter query, replacing `{exists:true}` values\n * with the constant `CATALOG_FILTER_EXISTS`.\n *\n * @param schemaFilters - An object containing schema filters with keys as filter names\n * and values as filter values.\n * @returns An object with the same keys as the input object, but with `{exists:true}` values\n * transformed to `CATALOG_FILTER_EXISTS` symbol.\n */\nfunction convertSchemaFiltersToQuery(\n schemaFilters: MultiEntityPickerFilterQuery,\n): Exclude<EntityFilterQuery, Array<any>> {\n const query: EntityFilterQuery = {};\n\n for (const [key, value] of Object.entries(schemaFilters)) {\n if (Array.isArray(value)) {\n query[key] = value;\n } else {\n query[key] = convertOpsValues(value);\n }\n }\n\n return query;\n}\n\n/**\n * Builds an `EntityFilterQuery` based on the `uiSchema` passed in.\n * If `catalogFilter` is specified in the `uiSchema`, it is converted to a `EntityFilterQuery`.\n *\n * @param uiSchema The `uiSchema` of an `EntityPicker` component.\n * @returns An `EntityFilterQuery` based on the `uiSchema`, or `undefined` if `catalogFilter` is not specified in the `uiSchema`.\n */\nfunction buildCatalogFilter(\n uiSchema: MultiEntityPickerProps['uiSchema'],\n): EntityFilterQuery | undefined {\n const catalogFilter: MultiEntityPickerUiOptions['catalogFilter'] | undefined =\n uiSchema['ui:options']?.catalogFilter;\n\n if (!catalogFilter) {\n return undefined;\n }\n\n if (Array.isArray(catalogFilter)) {\n return catalogFilter.map(convertSchemaFiltersToQuery);\n }\n\n return convertSchemaFiltersToQuery(catalogFilter);\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAqDa,MAAA,iBAAA,GAAoB,CAAC,KAAkC,KAAA;AAClE,EAAM,MAAA;AAAA,IACJ,QAAA;AAAA,IACA,MAAQ,EAAA,EAAE,KAAQ,GAAA,QAAA,EAAU,cAAc,4BAA6B,EAAA;AAAA,IACvE,QAAA;AAAA,IACA,QAAA;AAAA,IACA,SAAA;AAAA,IACA,QAAA;AAAA,IACA,QAAA;AAAA,GACE,GAAA,KAAA,CAAA;AACJ,EAAM,MAAA,aAAA,GAAgB,mBAAmB,QAAQ,CAAA,CAAA;AACjD,EAAM,MAAA,WAAA,GAAc,QAAS,CAAA,YAAY,CAAG,EAAA,WAAA,CAAA;AAC5C,EAAA,MAAM,gBACJ,GAAA,QAAA,CAAS,YAAY,CAAA,EAAG,gBAAoB,IAAA,KAAA,CAAA,CAAA;AAC9C,EAAA,MAAM,CAAC,iBAAA,EAAmB,oBAAoB,CAAA,GAAI,SAAS,CAAC,CAAA,CAAA;AAE5D,EAAM,MAAA,UAAA,GAAa,OAAO,aAAa,CAAA,CAAA;AACvC,EAAM,MAAA,qBAAA,GAAwB,OAAO,wBAAwB,CAAA,CAAA;AAC7D,EAAA,MAAM,EAAE,KAAO,EAAA,QAAA,EAAU,OAAQ,EAAA,GAAI,SAAS,YAAY;AACxD,IAAA,MAAM,EAAE,KAAA,EAAU,GAAA,MAAM,UAAW,CAAA,WAAA;AAAA,MACjC,aAAgB,GAAA,EAAE,MAAQ,EAAA,aAAA,EAAkB,GAAA,KAAA,CAAA;AAAA,KAC9C,CAAA;AACA,IAAA,MAAM,0BAA0B,IAAI,GAAA;AAAA,MAIlC,MAAM,OAAQ,CAA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GACD,CAAA,CAAA;AACH,EAAA;AAQA,SAAS,iBACP,KACiB,EAAA;AACjB,EAAA,IAAI,OAAO,KAAA,KAAU,QAAY,IAAA,KAAA,CAAM,MAAQ,EAAA;AAC7C,IAAO,OAAA,qBAAA,CAAA;AAAA,GACT;AACA,EAAA,OAAO,OAAO,QAAS,EAAA,CAAA;AACzB,CAAA;AAWA,SAAS,4BACP,aACwC,EAAA;AACxC,EAAA,MAAM,QAA2B,EAAC,CAAA;AAElC,EAAA,KAAA,MAAW,CAAC,GAAK,EAAA,KAAK,KAAK,MAAO,CAAA,OAAA,CAAQ,aAAa,CAAG,EAAA;AACxD,IAAI,IAAA,KAAA,CAAM,OAAQ,CAAA,KAAK,CAAG,EAAA;AACxB,MAAA,KAAA,CAAM,GAAG,CAAI,GAAA,KAAA,CAAA;AAAA,KACR,MAAA;AACL,MAAM,KAAA,CAAA,GAAG,CAAI,GAAA,gBAAA,CAAiB,KAAK,CAAA,CAAA;AAAA,KACrC;AAAA,GACF;AAEA,EAAO,OAAA,KAAA,CAAA;AACT,CAAA;AASA,SAAS,mBACP,QAC+B,EAAA;AAC/B,EAAM,MAAA,aAAA,GACJ,QAAS,CAAA,YAAY,CAAG,EAAA,aAAA,CAAA;AAE1B,EAAA,IAAI,CAAC,aAAe,EAAA;AAClB,IAAO,OAAA,KAAA,CAAA,CAAA;AAAA,GACT;AAEA,EAAI,IAAA,KAAA,CAAM,OAAQ,CAAA,aAAa,CAAG,EAAA;AAChC,IAAO,OAAA,aAAA,CAAc,IAAI,2BAA2B,CAAA,CAAA;AAAA,GACtD;AAEA,EAAA,OAAO,4BAA4B,aAAa,CAAA,CAAA;AAClD;;;;"}
1
+ {"version":3,"file":"MultiEntityPicker.esm.js","sources":["../../../../src/components/fields/MultiEntityPicker/MultiEntityPicker.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 {\n type EntityFilterQuery,\n CATALOG_FILTER_EXISTS,\n} from '@backstage/catalog-client';\nimport {\n Entity,\n parseEntityRef,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport { useApi } from '@backstage/core-plugin-api';\nimport {\n catalogApiRef,\n entityPresentationApiRef,\n EntityDisplayName,\n EntityRefPresentationSnapshot,\n} from '@backstage/plugin-catalog-react';\nimport TextField from '@material-ui/core/TextField';\nimport FormControl from '@material-ui/core/FormControl';\nimport Autocomplete, {\n AutocompleteChangeReason,\n} from '@material-ui/lab/Autocomplete';\nimport React, { useCallback, useEffect, useState } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport { FieldValidation } from '@rjsf/utils';\nimport {\n MultiEntityPickerFilterQueryValue,\n MultiEntityPickerProps,\n MultiEntityPickerUiOptions,\n MultiEntityPickerFilterQuery,\n} from './schema';\nimport { VirtualizedListbox } from '../VirtualizedListbox';\n\nexport { MultiEntityPickerSchema } from './schema';\n\n/**\n * The underlying component that is rendered in the form for the `MultiEntityPicker`\n * field extension.\n */\nexport const MultiEntityPicker = (props: MultiEntityPickerProps) => {\n const {\n onChange,\n schema: { title = 'Entity', description = 'An entity from the catalog' },\n required,\n uiSchema,\n rawErrors,\n formData,\n idSchema,\n } = props;\n const catalogFilter = buildCatalogFilter(uiSchema);\n const defaultKind = uiSchema['ui:options']?.defaultKind;\n const defaultNamespace =\n uiSchema['ui:options']?.defaultNamespace || undefined;\n const [noOfItemsSelected, setNoOfItemsSelected] = useState(0);\n\n const catalogApi = useApi(catalogApiRef);\n const entityPresentationApi = useApi(entityPresentationApiRef);\n const { value: entities, loading } = useAsync(async () => {\n const { items } = await catalogApi.getEntities(\n catalogFilter ? { filter: catalogFilter } : undefined,\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 return { entities: items, entityRefToPresentation };\n });\n const allowArbitraryValues =\n uiSchema['ui:options']?.allowArbitraryValues ?? true;\n\n // if not specified, maxItems defaults to undefined\n const maxItems = props.schema.maxItems;\n\n const onSelect = useCallback(\n (_: any, refs: (string | Entity)[], reason: AutocompleteChangeReason) => {\n const values = refs\n .map(ref => {\n if (typeof ref !== 'string') {\n // if ref does not exist: pass 'undefined' to trigger validation for required value\n return ref ? stringifyEntityRef(ref as Entity) : undefined;\n }\n if (reason === 'blur' || reason === 'create-option') {\n // Add in default namespace, etc.\n let entityRef = ref;\n try {\n // Attempt to parse the entity ref into it's full form.\n entityRef = stringifyEntityRef(\n parseEntityRef(ref as string, {\n defaultKind,\n defaultNamespace,\n }),\n );\n } catch (err) {\n // If the passed in value isn't an entity ref, do nothing.\n }\n\n // We need to check against formData here as that's the previous value for this field.\n if (formData?.includes(ref) || allowArbitraryValues) {\n return entityRef;\n }\n }\n\n return undefined;\n })\n .filter(ref => ref !== undefined) as string[];\n\n setNoOfItemsSelected(values.length);\n onChange(values);\n },\n [onChange, formData, defaultKind, defaultNamespace, allowArbitraryValues],\n );\n\n useEffect(() => {\n if (entities?.entities?.length === 1) {\n onChange([stringifyEntityRef(entities?.entities[0])]);\n }\n }, [entities, onChange]);\n\n return (\n <FormControl\n margin=\"normal\"\n required={required}\n error={rawErrors?.length > 0 && !formData}\n >\n <Autocomplete\n multiple\n filterSelectedOptions\n disabled={entities?.entities?.length === 1}\n id={idSchema?.$id}\n defaultValue={formData}\n loading={loading}\n onChange={onSelect}\n options={entities?.entities || []}\n renderOption={option => <EntityDisplayName entityRef={option} />}\n getOptionLabel={option =>\n // option can be a string due to freeSolo.\n typeof option === 'string'\n ? option\n : entities?.entityRefToPresentation.get(stringifyEntityRef(option))\n ?.entityRef!\n }\n getOptionDisabled={_options =>\n maxItems ? noOfItemsSelected >= maxItems : false\n }\n autoSelect\n freeSolo={allowArbitraryValues}\n renderInput={params => (\n <TextField\n {...params}\n label={title}\n margin=\"dense\"\n helperText={description}\n FormHelperTextProps={{\n margin: 'dense',\n style: { marginLeft: 0 },\n }}\n variant=\"outlined\"\n required={required}\n InputProps={{\n ...params.InputProps,\n required: formData?.length === 0 && required,\n }}\n />\n )}\n ListboxComponent={VirtualizedListbox}\n />\n </FormControl>\n );\n};\n\nexport const validateMultiEntityPickerValidation = (\n values: string[],\n validation: FieldValidation,\n) => {\n values.forEach(value => {\n try {\n parseEntityRef(value);\n } catch {\n validation.addError(`${value} is not a valid entity ref`);\n }\n });\n};\n\n/**\n * Converts a special `{exists: true}` value to the `CATALOG_FILTER_EXISTS` symbol.\n *\n * @param value - The value to convert.\n * @returns The converted value.\n */\nfunction convertOpsValues(\n value: Exclude<MultiEntityPickerFilterQueryValue, Array<any>>,\n): string | symbol {\n if (typeof value === 'object' && value.exists) {\n return CATALOG_FILTER_EXISTS;\n }\n return value?.toString();\n}\n\n/**\n * Converts schema filters to entity filter query, replacing `{exists:true}` values\n * with the constant `CATALOG_FILTER_EXISTS`.\n *\n * @param schemaFilters - An object containing schema filters with keys as filter names\n * and values as filter values.\n * @returns An object with the same keys as the input object, but with `{exists:true}` values\n * transformed to `CATALOG_FILTER_EXISTS` symbol.\n */\nfunction convertSchemaFiltersToQuery(\n schemaFilters: MultiEntityPickerFilterQuery,\n): Exclude<EntityFilterQuery, Array<any>> {\n const query: EntityFilterQuery = {};\n\n for (const [key, value] of Object.entries(schemaFilters)) {\n if (Array.isArray(value)) {\n query[key] = value;\n } else {\n query[key] = convertOpsValues(value);\n }\n }\n\n return query;\n}\n\n/**\n * Builds an `EntityFilterQuery` based on the `uiSchema` passed in.\n * If `catalogFilter` is specified in the `uiSchema`, it is converted to a `EntityFilterQuery`.\n *\n * @param uiSchema The `uiSchema` of an `EntityPicker` component.\n * @returns An `EntityFilterQuery` based on the `uiSchema`, or `undefined` if `catalogFilter` is not specified in the `uiSchema`.\n */\nfunction buildCatalogFilter(\n uiSchema: MultiEntityPickerProps['uiSchema'],\n): EntityFilterQuery | undefined {\n const catalogFilter: MultiEntityPickerUiOptions['catalogFilter'] | undefined =\n uiSchema['ui:options']?.catalogFilter;\n\n if (!catalogFilter) {\n return undefined;\n }\n\n if (Array.isArray(catalogFilter)) {\n return catalogFilter.map(convertSchemaFiltersToQuery);\n }\n\n return convertSchemaFiltersToQuery(catalogFilter);\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAqDa,MAAA,iBAAA,GAAoB,CAAC,KAAkC,KAAA;AAClE,EAAM,MAAA;AAAA,IACJ,QAAA;AAAA,IACA,MAAQ,EAAA,EAAE,KAAQ,GAAA,QAAA,EAAU,cAAc,4BAA6B,EAAA;AAAA,IACvE,QAAA;AAAA,IACA,QAAA;AAAA,IACA,SAAA;AAAA,IACA,QAAA;AAAA,IACA,QAAA;AAAA,GACE,GAAA,KAAA,CAAA;AACJ,EAAM,MAAA,aAAA,GAAgB,mBAAmB,QAAQ,CAAA,CAAA;AACjD,EAAM,MAAA,WAAA,GAAc,QAAS,CAAA,YAAY,CAAG,EAAA,WAAA,CAAA;AAC5C,EAAA,MAAM,gBACJ,GAAA,QAAA,CAAS,YAAY,CAAA,EAAG,gBAAoB,IAAA,KAAA,CAAA,CAAA;AAC9C,EAAA,MAAM,CAAC,iBAAA,EAAmB,oBAAoB,CAAA,GAAI,SAAS,CAAC,CAAA,CAAA;AAE5D,EAAM,MAAA,UAAA,GAAa,OAAO,aAAa,CAAA,CAAA;AACvC,EAAM,MAAA,qBAAA,GAAwB,OAAO,wBAAwB,CAAA,CAAA;AAC7D,EAAA,MAAM,EAAE,KAAO,EAAA,QAAA,EAAU,OAAQ,EAAA,GAAI,SAAS,YAAY;AACxD,IAAA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EAAA,OAAO,4BAA4B,aAAa,CAAA,CAAA;AAClD;;;;"}
package/dist/index.d.ts CHANGED
@@ -33,8 +33,11 @@ declare class ScaffolderClient implements ScaffolderApi$1 {
33
33
  });
34
34
  listTasks(options: {
35
35
  filterByOwnership: 'owned' | 'all';
36
+ limit?: number;
37
+ offset?: number;
36
38
  }): Promise<{
37
39
  tasks: ScaffolderTask$1[];
40
+ totalTasks?: number;
38
41
  }>;
39
42
  getIntegrationsList(options: ScaffolderGetIntegrationsListOptions$1): Promise<ScaffolderGetIntegrationsListResponse$1>;
40
43
  getTemplateParameterSchema(templateRef: string): Promise<TemplateParameterSchema$1>;
@@ -1,5 +1,3 @@
1
- import { get, set } from 'idb-keyval';
2
-
3
1
  const showDirectoryPicker = window.showDirectoryPicker;
4
2
  class WebFileAccess {
5
3
  constructor(path, handle) {
@@ -74,16 +72,6 @@ class WebFileSystemAccess {
74
72
  constructor() {
75
73
  }
76
74
  }
77
- class WebFileSystemStore {
78
- static key = "scalfolder-template-editor-directory";
79
- static async getDirectory() {
80
- const directory = await get(WebFileSystemStore.key);
81
- return directory.handle;
82
- }
83
- static async setDirectory(directory) {
84
- return set(WebFileSystemStore.key, directory);
85
- }
86
- }
87
75
 
88
- export { WebFileSystemAccess, WebFileSystemStore };
76
+ export { WebDirectoryAccess, WebFileSystemAccess };
89
77
  //# sourceMappingURL=WebFileSystemAccess.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"WebFileSystemAccess.esm.js","sources":["../../../src/lib/filesystem/WebFileSystemAccess.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 { get, set } from 'idb-keyval';\nimport { TemplateDirectoryAccess, TemplateFileAccess } from './types';\n\ntype WritableFileHandle = FileSystemFileHandle & {\n createWritable(): Promise<{\n write(data: string | Blob | BufferSource): Promise<void>;\n close(): Promise<void>;\n }>;\n};\n\n// A nicer type than the one from the TS lib\ninterface IterableDirectoryHandle extends FileSystemDirectoryHandle {\n values(): AsyncIterable<\n | ({ kind: 'file' } & WritableFileHandle)\n | ({ kind: 'directory' } & IterableDirectoryHandle)\n >;\n}\n\nconst showDirectoryPicker = (window as any).showDirectoryPicker as\n | (() => Promise<IterableDirectoryHandle>)\n | undefined;\n\nclass WebFileAccess implements TemplateFileAccess {\n constructor(\n readonly path: string,\n private readonly handle: WritableFileHandle,\n ) {}\n\n file(): Promise<File> {\n return this.handle.getFile();\n }\n\n async save(data: string | Blob | BufferSource): Promise<void> {\n const writable = await this.handle.createWritable();\n await writable.write(data);\n await writable.close();\n }\n}\n\nclass WebDirectoryAccess implements TemplateDirectoryAccess {\n constructor(private readonly handle: IterableDirectoryHandle) {}\n\n async listFiles(): Promise<TemplateFileAccess[]> {\n const content = [];\n for await (const entry of this.listDirectoryContents(this.handle)) {\n content.push(entry);\n }\n return content;\n }\n\n private async *listDirectoryContents(\n dirHandle: IterableDirectoryHandle,\n basePath: string[] = [],\n ): AsyncIterable<TemplateFileAccess> {\n for await (const handle of dirHandle.values()) {\n if (handle.kind === 'file') {\n yield new WebFileAccess([...basePath, handle.name].join('/'), handle);\n } else if (handle.kind === 'directory') {\n // Skip git storage directory\n if (handle.name === '.git') {\n continue;\n }\n yield* this.listDirectoryContents(handle, [...basePath, handle.name]);\n }\n }\n }\n\n async createFile(options: { name: string; data: string }): Promise<void> {\n const { name, data } = options;\n let file: FileSystemFileHandle;\n\n // Current create template does not require support for nested directories\n if (name.includes('/')) {\n const [dir, path] = name.split('/');\n const handle = await this.handle.getDirectoryHandle(dir, {\n create: true,\n });\n file = await handle.getFileHandle(path, { create: true });\n } else {\n file = await this.handle.getFileHandle(name, {\n create: true,\n });\n }\n const writable = await file.createWritable();\n await writable.write(data);\n await writable.close();\n }\n}\n\n/** @internal */\nexport class WebFileSystemAccess {\n static isSupported(): boolean {\n return Boolean(showDirectoryPicker);\n }\n\n static fromHandle(handle: IterableDirectoryHandle) {\n return new WebDirectoryAccess(handle);\n }\n\n static async requestDirectoryAccess(): Promise<TemplateDirectoryAccess> {\n if (!showDirectoryPicker) {\n throw new Error('File system access is not supported');\n }\n const handle = await showDirectoryPicker();\n return new WebDirectoryAccess(handle);\n }\n\n private constructor() {}\n}\n\nexport class WebFileSystemStore {\n private static readonly key = 'scalfolder-template-editor-directory';\n\n static async getDirectory(): Promise<IterableDirectoryHandle | undefined> {\n const directory = await get(WebFileSystemStore.key);\n return directory.handle;\n }\n\n static async setDirectory(directory: TemplateDirectoryAccess | undefined) {\n return set(WebFileSystemStore.key, directory);\n }\n}\n"],"names":[],"mappings":";;AAkCA,MAAM,sBAAuB,MAAe,CAAA,mBAAA,CAAA;AAI5C,MAAM,aAA4C,CAAA;AAAA,EAChD,WAAA,CACW,MACQ,MACjB,EAAA;AAFS,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA,CAAA;AACQ,IAAA,IAAA,CAAA,MAAA,GAAA,MAAA,CAAA;AAAA,GAChB;AAAA,EAEH,IAAsB,GAAA;AACpB,IAAO,OAAA,IAAA,CAAK,OAAO,OAAQ,EAAA,CAAA;AAAA,GAC7B;AAAA,EAEA,MAAM,KAAK,IAAmD,EAAA;AAC5D,IAAA,MAAM,QAAW,GAAA,MAAM,IAAK,CAAA,MAAA,CAAO,cAAe,EAAA,CAAA;AAClD,IAAM,MAAA,QAAA,CAAS,MAAM,IAAI,CAAA,CAAA;AACzB,IAAA,MAAM,SAAS,KAAM,EAAA,CAAA;AAAA,GACvB;AACF,CAAA;AAEA,MAAM,kBAAsD,CAAA;AAAA,EAC1D,YAA6B,MAAiC,EAAA;AAAjC,IAAA,IAAA,CAAA,MAA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A,CAAA;AAClD,IAAA,OAAO,SAAU,CAAA,MAAA,CAAA;AAAA,GACnB;AAAA,EAEA,aAAa,aAAa,SAAgD,EAAA;AACxE,IAAO,OAAA,GAAA,CAAI,kBAAmB,CAAA,GAAA,EAAK,SAAS,CAAA,CAAA;AAAA,GAC9C;AACF;;;;"}
1
+ {"version":3,"file":"WebFileSystemAccess.esm.js","sources":["../../../src/lib/filesystem/WebFileSystemAccess.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 { TemplateDirectoryAccess, TemplateFileAccess } from './types';\n\ntype WritableFileHandle = FileSystemFileHandle & {\n createWritable(): Promise<{\n write(data: string | Blob | BufferSource): Promise<void>;\n close(): Promise<void>;\n }>;\n};\n\n// A nicer type than the one from the TS lib\nexport interface IterableDirectoryHandle extends FileSystemDirectoryHandle {\n values(): AsyncIterable<\n | ({ kind: 'file' } & WritableFileHandle)\n | ({ kind: 'directory' } & IterableDirectoryHandle)\n >;\n}\n\nconst showDirectoryPicker = (window as any).showDirectoryPicker as\n | (() => Promise<IterableDirectoryHandle>)\n | undefined;\n\nclass WebFileAccess implements TemplateFileAccess {\n constructor(\n readonly path: string,\n private readonly handle: WritableFileHandle,\n ) {}\n\n file(): Promise<File> {\n return this.handle.getFile();\n }\n\n async save(data: string | Blob | BufferSource): Promise<void> {\n const writable = await this.handle.createWritable();\n await writable.write(data);\n await writable.close();\n }\n}\n\n/** @internal */\nexport class WebDirectoryAccess implements TemplateDirectoryAccess {\n constructor(private readonly handle: IterableDirectoryHandle) {}\n\n async listFiles(): Promise<TemplateFileAccess[]> {\n const content = [];\n for await (const entry of this.listDirectoryContents(this.handle)) {\n content.push(entry);\n }\n return content;\n }\n\n private async *listDirectoryContents(\n dirHandle: IterableDirectoryHandle,\n basePath: string[] = [],\n ): AsyncIterable<TemplateFileAccess> {\n for await (const handle of dirHandle.values()) {\n if (handle.kind === 'file') {\n yield new WebFileAccess([...basePath, handle.name].join('/'), handle);\n } else if (handle.kind === 'directory') {\n // Skip git storage directory\n if (handle.name === '.git') {\n continue;\n }\n yield* this.listDirectoryContents(handle, [...basePath, handle.name]);\n }\n }\n }\n\n async createFile(options: { name: string; data: string }): Promise<void> {\n const { name, data } = options;\n let file: FileSystemFileHandle;\n\n // Current create template does not require support for nested directories\n if (name.includes('/')) {\n const [dir, path] = name.split('/');\n const handle = await this.handle.getDirectoryHandle(dir, {\n create: true,\n });\n file = await handle.getFileHandle(path, { create: true });\n } else {\n file = await this.handle.getFileHandle(name, {\n create: true,\n });\n }\n const writable = await file.createWritable();\n await writable.write(data);\n await writable.close();\n }\n}\n\n/** @internal */\nexport class WebFileSystemAccess {\n static isSupported(): boolean {\n return Boolean(showDirectoryPicker);\n }\n\n static fromHandle(handle: IterableDirectoryHandle) {\n return new WebDirectoryAccess(handle);\n }\n\n static async requestDirectoryAccess(): Promise<TemplateDirectoryAccess> {\n if (!showDirectoryPicker) {\n throw new Error('File system access is not supported');\n }\n const handle = await showDirectoryPicker();\n return new WebDirectoryAccess(handle);\n }\n\n private constructor() {}\n}\n"],"names":[],"mappings":"AAiCA,MAAM,sBAAuB,MAAe,CAAA,mBAAA,CAAA;AAI5C,MAAM,aAA4C,CAAA;AAAA,EAChD,WAAA,CACW,MACQ,MACjB,EAAA;AAFS,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA,CAAA;AACQ,IAAA,IAAA,CAAA,MAAA,GAAA,MAAA,CAAA;AAAA,GAChB;AAAA,EAEH,IAAsB,GAAA;AACpB,IAAO,OAAA,IAAA,CAAK,OAAO,OAAQ,EAAA,CAAA;A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M,MAAA,MAAA,GAAS,MAAM,mBAAoB,EAAA,CAAA;AACzC,IAAO,OAAA,IAAI,mBAAmB,MAAM,CAAA,CAAA;AAAA,GACtC;AAAA,EAEQ,WAAc,GAAA;AAAA,GAAC;AACzB;;;;"}
@@ -0,0 +1,15 @@
1
+ import { get, set } from 'idb-keyval';
2
+
3
+ class WebFileSystemStore {
4
+ static key = "scalfolder-template-editor-directory";
5
+ static async getDirectory() {
6
+ const directory = await get(WebFileSystemStore.key);
7
+ return directory.handle;
8
+ }
9
+ static async setDirectory(directory) {
10
+ return set(WebFileSystemStore.key, directory);
11
+ }
12
+ }
13
+
14
+ export { WebFileSystemStore };
15
+ //# sourceMappingURL=WebFileSystemStore.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebFileSystemStore.esm.js","sources":["../../../src/lib/filesystem/WebFileSystemStore.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { get, set } from 'idb-keyval';\nimport { TemplateDirectoryAccess } from './types';\nimport { IterableDirectoryHandle } from './WebFileSystemAccess';\n\nexport class WebFileSystemStore {\n private static readonly key = 'scalfolder-template-editor-directory';\n\n static async getDirectory(): Promise<IterableDirectoryHandle | undefined> {\n const directory = await get(WebFileSystemStore.key);\n return directory.handle;\n }\n\n static async setDirectory(directory: TemplateDirectoryAccess | undefined) {\n return set(WebFileSystemStore.key, directory);\n }\n}\n"],"names":[],"mappings":";;AAoBO,MAAM,kBAAmB,CAAA;AAAA,EAC9B,OAAwB,GAAM,GAAA,sCAAA,CAAA;AAAA,EAE9B,aAAa,YAA6D,GAAA;AACxE,IAAA,MAAM,SAAY,GAAA,MAAM,GAAI,CAAA,kBAAA,CAAmB,GAAG,CAAA,CAAA;AAClD,IAAA,OAAO,SAAU,CAAA,MAAA,CAAA;AAAA,GACnB;AAAA,EAEA,aAAa,aAAa,SAAgD,EAAA;AACxE,IAAO,OAAA,GAAA,CAAI,kBAAmB,CAAA,GAAA,EAAK,SAAS,CAAA,CAAA;AAAA,GAC9C;AACF;;;;"}
@@ -70,6 +70,7 @@ async function createExampleTemplate(directory) {
70
70
  for (const [name, data] of Object.entries(files)) {
71
71
  await directory.createFile({ name, data });
72
72
  }
73
+ return directory;
73
74
  }
74
75
 
75
76
  export { createExampleTemplate };
@@ -1 +1 @@
1
- {"version":3,"file":"createExampleTemplate.esm.js","sources":["../../../src/lib/filesystem/createExampleTemplate.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { TemplateDirectoryAccess } from './types';\n\nconst files = {\n 'template.yaml': `\napiVersion: scaffolder.backstage.io/v1beta3\n# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-template\nkind: Template\nmetadata:\n name: generated-example-template\n title: Scaffolder Example Template\n description: An example template for the scaffolder\nspec:\n owner: user:guest\n type: service\n # These parameters are used to generate the input form in the frontend, and are\n # used to gather input data for the execution of the template.\n parameters:\n - title: Fill in some steps\n required:\n - name\n properties:\n name:\n title: Name\n type: string\n description: Unique name of the component\n owner:\n title: Owner\n type: string\n description: Owner of the component\n ui:field: OwnerPicker\n ui:options:\n catalogFilter:\n kind: Group\n - title: Choose a location\n required:\n - repoUrl\n properties:\n repoUrl:\n title: Repository Location\n type: string\n ui:field: RepoUrlPicker\n ui:options:\n allowedHosts:\n - github.com\n steps:\n - id: fetch-base\n name: Fetch Base\n action: fetch:template\n input:\n url: ./skeleton\n values:\n name: \\${{parameters.name}}\n owner: \\${{parameters.owner}}\n destination: \\${{ parameters.repoUrl | parseRepoUrl }}`,\n 'skeleton/README.md': `# This service is named \\${{values.name}}!`,\n 'skeleton/catalog-info.yaml': `apiVersion: backstage.io/v1alpha1\nkind: Component\nmetadata:\n name: \\${{values.component_id | dump}}\n {%- if values.description %}\n description: \\${{values.description | dump}}\n {%- endif %}\n annotations:\n github.com/project-slug: \\${{values.destination.owner + \"/\" + values.destination.repo}}\n backstage.io/techdocs-ref: dir:.\nspec:\n type: service\n lifecycle: experimental\n owner: \\${{values.owner | dump}}`,\n};\n\nexport async function createExampleTemplate(\n directory: TemplateDirectoryAccess,\n) {\n for (const [name, data] of Object.entries(files)) {\n await directory.createFile({ name, data });\n }\n}\n"],"names":[],"mappings":"AAkBA,MAAM,KAAQ,GAAA;AAAA,EACZ,eAAiB,EAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gEAAA,CAAA;AAAA,EAmDjB,oBAAsB,EAAA,CAAA,0CAAA,CAAA;AAAA,EACtB,4BAA8B,EAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kCAAA,CAAA;AAchC,CAAA,CAAA;AAEA,eAAsB,sBACpB,SACA,EAAA;AACA,EAAA,KAAA,MAAW,CAAC,IAAM,EAAA,IAAI,KAAK,MAAO,CAAA,OAAA,CAAQ,KAAK,CAAG,EAAA;AAChD,IAAA,MAAM,SAAU,CAAA,UAAA,CAAW,EAAE,IAAA,EAAM,MAAM,CAAA,CAAA;AAAA,GAC3C;AACF;;;;"}
1
+ {"version":3,"file":"createExampleTemplate.esm.js","sources":["../../../src/lib/filesystem/createExampleTemplate.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { TemplateDirectoryAccess } from './types';\n\nconst files = {\n 'template.yaml': `\napiVersion: scaffolder.backstage.io/v1beta3\n# https://backstage.io/docs/features/software-catalog/descriptor-format#kind-template\nkind: Template\nmetadata:\n name: generated-example-template\n title: Scaffolder Example Template\n description: An example template for the scaffolder\nspec:\n owner: user:guest\n type: service\n # These parameters are used to generate the input form in the frontend, and are\n # used to gather input data for the execution of the template.\n parameters:\n - title: Fill in some steps\n required:\n - name\n properties:\n name:\n title: Name\n type: string\n description: Unique name of the component\n owner:\n title: Owner\n type: string\n description: Owner of the component\n ui:field: OwnerPicker\n ui:options:\n catalogFilter:\n kind: Group\n - title: Choose a location\n required:\n - repoUrl\n properties:\n repoUrl:\n title: Repository Location\n type: string\n ui:field: RepoUrlPicker\n ui:options:\n allowedHosts:\n - github.com\n steps:\n - id: fetch-base\n name: Fetch Base\n action: fetch:template\n input:\n url: ./skeleton\n values:\n name: \\${{parameters.name}}\n owner: \\${{parameters.owner}}\n destination: \\${{ parameters.repoUrl | parseRepoUrl }}`,\n 'skeleton/README.md': `# This service is named \\${{values.name}}!`,\n 'skeleton/catalog-info.yaml': `apiVersion: backstage.io/v1alpha1\nkind: Component\nmetadata:\n name: \\${{values.component_id | dump}}\n {%- if values.description %}\n description: \\${{values.description | dump}}\n {%- endif %}\n annotations:\n github.com/project-slug: \\${{values.destination.owner + \"/\" + values.destination.repo}}\n backstage.io/techdocs-ref: dir:.\nspec:\n type: service\n lifecycle: experimental\n owner: \\${{values.owner | dump}}`,\n};\n\nexport async function createExampleTemplate(\n directory: TemplateDirectoryAccess,\n) {\n for (const [name, data] of Object.entries(files)) {\n await directory.createFile({ name, data });\n }\n return directory;\n}\n"],"names":[],"mappings":"AAkBA,MAAM,KAAQ,GAAA;AAAA,EACZ,eAAiB,EAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gEAAA,CAAA;AAAA,EAmDjB,oBAAsB,EAAA,CAAA,0CAAA,CAAA;AAAA,EACtB,4BAA8B,EAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kCAAA,CAAA;AAchC,CAAA,CAAA;AAEA,eAAsB,sBACpB,SACA,EAAA;AACA,EAAA,KAAA,MAAW,CAAC,IAAM,EAAA,IAAI,KAAK,MAAO,CAAA,OAAA,CAAQ,KAAK,CAAG,EAAA;AAChD,IAAA,MAAM,SAAU,CAAA,UAAA,CAAW,EAAE,IAAA,EAAM,MAAM,CAAA,CAAA;AAAA,GAC3C;AACA,EAAO,OAAA,SAAA,CAAA;AACT;;;;"}
@@ -12,6 +12,7 @@ const scaffolderTranslationRef = createTranslationRef({
12
12
  title: "No information to display",
13
13
  description: "There are no actions installed or there was an issue communicating with backend."
14
14
  },
15
+ searchFieldPlaceholder: "Search for an action",
15
16
  tableCell: {
16
17
  name: "Name",
17
18
  title: "Title",
@@ -172,9 +173,17 @@ const scaffolderTranslationRef = createTranslationRef({
172
173
  templateTypePicker: {
173
174
  title: "Categories"
174
175
  },
176
+ templateIntroPage: {
177
+ title: "Manage Templates",
178
+ subtitle: "Edit, preview, and try out templates, forms, and custom fields"
179
+ },
175
180
  templateFormPage: {
176
- title: "Template Form Playground",
177
- subtitle: "Edit, preview, and try out templates and template forms"
181
+ title: "Template Editor",
182
+ subtitle: "Edit, preview, and try out templates forms"
183
+ },
184
+ templateCustomFieldPage: {
185
+ title: "Custom Field Explorer",
186
+ subtitle: "Edit, preview, and try out custom fields"
178
187
  },
179
188
  templateEditorPage: {
180
189
  title: "Template Editor",
@@ -229,7 +238,7 @@ const scaffolderTranslationRef = createTranslationRef({
229
238
  unsupportedTooltip: "Only supported in some Chromium-based browsers"
230
239
  },
231
240
  formEditor: {
232
- title: "Edit Template Form",
241
+ title: "Template Form Playground",
233
242
  description: "Preview and edit a template form, either using a sample template or by loading a template from the catalog."
234
243
  },
235
244
  fieldExplorer: {
@@ -239,7 +248,8 @@ const scaffolderTranslationRef = createTranslationRef({
239
248
  },
240
249
  templateEditorTextArea: {
241
250
  saveIconTooltip: "Save file",
242
- refreshIconTooltip: "Reload file"
251
+ refreshIconTooltip: "Reload file",
252
+ emptyStateParagraph: "Please select an action on the file menu."
243
253
  },
244
254
  templateFormPreviewer: {
245
255
  title: "Load Existing Template"
@@ -268,6 +278,31 @@ const scaffolderTranslationRef = createTranslationRef({
268
278
  pageContextMenu: {
269
279
  editConfigurationTitle: "Edit Configuration"
270
280
  }
281
+ },
282
+ templateEditorToolbar: {
283
+ customFieldExplorerTooltip: "Custom Fields Explorer",
284
+ installedActionsDocumentationTooltip: "Installed Actions Documentation",
285
+ addToCatalogButton: "Publish",
286
+ addToCatalogDialogTitle: "Publish changes",
287
+ addToCatalogDialogContent: {
288
+ stepsIntroduction: "Follow the instructions below to create or update a template:",
289
+ stepsListItems: "Save the template files in a local directory\nCreate a pull request to a new or existing git repository\nIf the template already exists, the changes will be reflected in the software catalog once the pull request gets merged\nBut if you are creating a new template, follow the documentation linked below to register the new template repository in software catalog"
290
+ },
291
+ addToCatalogDialogActions: {
292
+ documentationButton: "Go to the documentation",
293
+ documentationUrl: "https://backstage.io/docs/features/software-templates/adding-templates/"
294
+ }
295
+ },
296
+ templateEditorToolbarFileMenu: {
297
+ button: "File",
298
+ options: {
299
+ openDirectory: "Open template directory",
300
+ createDirectory: "Create template directory",
301
+ closeEditor: "Close template editor"
302
+ }
303
+ },
304
+ templateEditorToolbarTemplatesMenu: {
305
+ button: "Templates"
271
306
  }
272
307
  }
273
308
  });
@@ -1 +1 @@
1
- {"version":3,"file":"translation.esm.js","sources":["../src/translation.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 { createTranslationRef } from '@backstage/core-plugin-api/alpha';\n\n/** @alpha */\nexport const scaffolderTranslationRef = createTranslationRef({\n id: 'scaffolder',\n messages: {\n actionsPage: {\n title: 'Installed actions',\n pageTitle: 'Create a New Component',\n subtitle: 'This is the collection of all installed actions',\n content: {\n emptyState: {\n title: 'No information to display',\n description:\n 'There are no actions installed or there was an issue communicating with backend.',\n },\n tableCell: {\n name: 'Name',\n title: 'Title',\n description: 'Description',\n type: 'Type',\n },\n noRowsDescription: 'No schema defined',\n },\n action: {\n input: 'Input',\n output: 'Output',\n examples: 'Examples',\n },\n },\n fields: {\n entityNamePicker: {\n title: 'Name',\n description: 'Unique name of the component',\n },\n entityPicker: {\n title: 'Entity',\n description: 'An entity from the catalog',\n },\n entityTagsPicker: {\n title: 'Tags',\n description:\n \"Add any relevant tags, hit 'Enter' to add new tags. Valid format: [a-z0-9+#] separated by [-], at most 63 characters\",\n },\n myGroupsPicker: {\n title: 'Entity',\n description: 'An entity from the catalog',\n },\n ownedEntityPicker: {\n title: 'Entity',\n description: 'An entity from the catalog',\n },\n ownerPicker: {\n title: 'Owner',\n description: 'The owner of the component',\n },\n azureRepoPicker: {\n organization: {\n title: 'Organization',\n description: 'The Organization that this repo will belong to',\n },\n project: {\n title: 'Project',\n description: 'The Project that this repo will belong to',\n },\n },\n bitbucketRepoPicker: {\n workspaces: {\n title: 'Allowed Workspaces',\n inputTitle: 'Workspaces',\n description: 'The Workspace that this repo will belong to',\n },\n project: {\n title: 'Allowed Projects',\n inputTitle: 'Projects',\n description: 'The Project that this repo will belong to',\n },\n },\n gerritRepoPicker: {\n owner: {\n title: 'Owner',\n description: 'The owner of the project (optional)',\n },\n parent: {\n title: 'Parent',\n description: 'The project parent that the repo will belong to',\n },\n },\n giteaRepoPicker: {\n owner: {\n title: 'Owner Available',\n inputTitle: 'Owner',\n description:\n 'Gitea namespace where this repository will belong to. It can be the name of organization, group, subgroup, user, or the project.',\n },\n },\n githubRepoPicker: {\n owner: {\n title: 'Owner Available',\n inputTitle: 'Owner',\n description:\n 'The organization, user or project that this repo will belong to',\n },\n },\n gitlabRepoPicker: {\n owner: {\n title: 'Owner Available',\n inputTitle: 'Owner',\n description:\n 'GitLab namespace where this repository will belong to. It can be the name of organization, group, subgroup, user, or the project.',\n },\n },\n repoUrlPicker: {\n host: {\n title: 'Host',\n description: 'The host where the repository will be created',\n },\n repository: {\n title: 'Repositories Available',\n inputTitle: 'Repository',\n description: 'The name of the repository',\n },\n },\n },\n listTaskPage: {\n title: 'List template tasks',\n pageTitle: 'Templates Tasks',\n subtitle: 'All tasks that have been started',\n content: {\n emptyState: {\n title: 'No information to display',\n description:\n 'There are no tasks or there was an issue communicating with backend.',\n },\n tableTitle: 'Tasks',\n tableCell: {\n taskID: 'Task ID',\n template: 'Template',\n created: 'Created',\n owner: 'Owner',\n status: 'Status',\n },\n },\n },\n ownerListPicker: {\n title: 'Task Owner',\n options: {\n owned: 'Owned',\n all: 'All',\n },\n },\n ongoingTask: {\n title: 'Run of',\n pageTitle: {\n hasTemplateName: 'Run of {{templateName}}',\n noTemplateName: 'Scaffolder Run',\n },\n subtitle: 'Task {{taskId}}',\n cancelButtonTitle: 'Cancel',\n retryButtonTitle: 'Retry',\n startOverButtonTitle: 'Start Over',\n hideLogsButtonTitle: 'Hide Logs',\n showLogsButtonTitle: 'Show Logs',\n contextMenu: {\n hideLogs: 'Hide Logs',\n showLogs: 'Show Logs',\n hideButtonBar: 'Hide Button Bar',\n retry: 'Retry',\n showButtonBar: 'Show Button Bar',\n startOver: 'Start Over',\n cancel: 'Cancel',\n },\n },\n templateEditorForm: {\n stepper: {\n emptyText: 'There are no spec parameters in the template to preview.',\n },\n },\n templateTypePicker: {\n title: 'Categories',\n },\n templateFormPage: {\n title: 'Template Form Playground',\n subtitle: 'Edit, preview, and try out templates and template forms',\n },\n templateEditorPage: {\n title: 'Template Editor',\n subtitle: 'Edit, preview, and try out templates and template forms',\n dryRunResults: {\n title: 'Dry-run results',\n },\n dryRunResultsList: {\n title: 'Result {{resultId}}',\n downloadButtonTitle: 'Download as .zip',\n deleteButtonTitle: 'Delete result',\n },\n dryRunResultsView: {\n tab: {\n files: 'Files',\n log: 'Log',\n output: 'Output',\n },\n },\n taskStatusStepper: {\n skippedStepTitle: 'Skipped',\n },\n customFieldExplorer: {\n selectFieldLabel: 'Choose Custom Field Extension',\n fieldForm: {\n title: 'Field Options',\n applyButtonTitle: 'Apply',\n },\n fieldPreview: {\n title: 'Field Preview',\n },\n preview: {\n title: 'Template Spec',\n },\n },\n templateEditorBrowser: {\n closeConfirmMessage: 'Are you sure? Unsaved changes will be lost',\n saveIconTooltip: 'Save all files',\n reloadIconTooltip: 'Reload directory',\n closeIconTooltip: 'Close directory',\n },\n templateEditorIntro: {\n title: 'Get started by choosing one of the options below',\n loadLocal: {\n title: 'Load Template Directory',\n description:\n 'Load a local template directory, allowing you to both edit and try executing your own template.',\n unsupportedTooltip: 'Only supported in some Chromium-based browsers',\n },\n createLocal: {\n title: 'Create New Template',\n description:\n 'Create a local template directory, allowing you to both edit and try executing your own template.',\n unsupportedTooltip: 'Only supported in some Chromium-based browsers',\n },\n formEditor: {\n title: 'Edit Template Form',\n description:\n 'Preview and edit a template form, either using a sample template or by loading a template from the catalog.',\n },\n fieldExplorer: {\n title: 'Custom Field Explorer',\n description:\n 'View and play around with available installed custom field extensions.',\n },\n },\n templateEditorTextArea: {\n saveIconTooltip: 'Save file',\n refreshIconTooltip: 'Reload file',\n },\n templateFormPreviewer: {\n title: 'Load Existing Template',\n },\n },\n templateListPage: {\n title: 'Create a new component',\n subtitle:\n 'Create new software components using standard templates in your organization',\n pageTitle: 'Create a new component',\n templateGroups: {\n defaultTitle: 'Templates',\n otherTitle: 'Other Templates',\n },\n contentHeader: {\n registerExistingButtonTitle: 'Register Existing Component',\n supportButtonTitle:\n 'Create new software components using standard templates. Different templates create different kinds of components (services, websites, documentation, ...).',\n },\n additionalLinksForEntity: {\n viewTechDocsTitle: 'View TechDocs',\n },\n },\n templateWizardPage: {\n title: 'Create a new component',\n subtitle:\n 'Create new software components using standard templates in your organization',\n pageTitle: 'Create a new component',\n pageContextMenu: {\n editConfigurationTitle: 'Edit Configuration',\n },\n },\n },\n});\n"],"names":[],"mappings":";;AAkBO,MAAM,2BAA2B,oBAAqB,CAAA;AAAA,EAC3D,EAAI,EAAA,YAAA;AAAA,EACJ,QAAU,EAAA;AAAA,IACR,WAAa,EAAA;AAAA,MACX,KAAO,EAAA,mBAAA;AAAA,MACP,SAAW,EAAA,wBAAA;AAAA,MACX,QAA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EAAA,wBAAA;AAAA,MACX,eAAiB,EAAA;AAAA,QACf,sBAAwB,EAAA,oBAAA;AAAA,OAC1B;AAAA,KACF;AAAA,GACF;AACF,CAAC;;;;"}
1
+ {"version":3,"file":"translation.esm.js","sources":["../src/translation.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 { createTranslationRef } from '@backstage/core-plugin-api/alpha';\n\n/** @alpha */\nexport const scaffolderTranslationRef = createTranslationRef({\n id: 'scaffolder',\n messages: {\n actionsPage: {\n title: 'Installed actions',\n pageTitle: 'Create a New Component',\n subtitle: 'This is the collection of all installed actions',\n content: {\n emptyState: {\n title: 'No information to display',\n description:\n 'There are no actions installed or there was an issue communicating with backend.',\n },\n searchFieldPlaceholder: 'Search for an action',\n tableCell: {\n name: 'Name',\n title: 'Title',\n description: 'Description',\n type: 'Type',\n },\n noRowsDescription: 'No schema defined',\n },\n action: {\n input: 'Input',\n output: 'Output',\n examples: 'Examples',\n },\n },\n fields: {\n entityNamePicker: {\n title: 'Name',\n description: 'Unique name of the component',\n },\n entityPicker: {\n title: 'Entity',\n description: 'An entity from the catalog',\n },\n entityTagsPicker: {\n title: 'Tags',\n description:\n \"Add any relevant tags, hit 'Enter' to add new tags. Valid format: [a-z0-9+#] separated by [-], at most 63 characters\",\n },\n myGroupsPicker: {\n title: 'Entity',\n description: 'An entity from the catalog',\n },\n ownedEntityPicker: {\n title: 'Entity',\n description: 'An entity from the catalog',\n },\n ownerPicker: {\n title: 'Owner',\n description: 'The owner of the component',\n },\n azureRepoPicker: {\n organization: {\n title: 'Organization',\n description: 'The Organization that this repo will belong to',\n },\n project: {\n title: 'Project',\n description: 'The Project that this repo will belong to',\n },\n },\n bitbucketRepoPicker: {\n workspaces: {\n title: 'Allowed Workspaces',\n inputTitle: 'Workspaces',\n description: 'The Workspace that this repo will belong to',\n },\n project: {\n title: 'Allowed Projects',\n inputTitle: 'Projects',\n description: 'The Project that this repo will belong to',\n },\n },\n gerritRepoPicker: {\n owner: {\n title: 'Owner',\n description: 'The owner of the project (optional)',\n },\n parent: {\n title: 'Parent',\n description: 'The project parent that the repo will belong to',\n },\n },\n giteaRepoPicker: {\n owner: {\n title: 'Owner Available',\n inputTitle: 'Owner',\n description:\n 'Gitea namespace where this repository will belong to. It can be the name of organization, group, subgroup, user, or the project.',\n },\n },\n githubRepoPicker: {\n owner: {\n title: 'Owner Available',\n inputTitle: 'Owner',\n description:\n 'The organization, user or project that this repo will belong to',\n },\n },\n gitlabRepoPicker: {\n owner: {\n title: 'Owner Available',\n inputTitle: 'Owner',\n description:\n 'GitLab namespace where this repository will belong to. It can be the name of organization, group, subgroup, user, or the project.',\n },\n },\n repoUrlPicker: {\n host: {\n title: 'Host',\n description: 'The host where the repository will be created',\n },\n repository: {\n title: 'Repositories Available',\n inputTitle: 'Repository',\n description: 'The name of the repository',\n },\n },\n },\n listTaskPage: {\n title: 'List template tasks',\n pageTitle: 'Templates Tasks',\n subtitle: 'All tasks that have been started',\n content: {\n emptyState: {\n title: 'No information to display',\n description:\n 'There are no tasks or there was an issue communicating with backend.',\n },\n tableTitle: 'Tasks',\n tableCell: {\n taskID: 'Task ID',\n template: 'Template',\n created: 'Created',\n owner: 'Owner',\n status: 'Status',\n },\n },\n },\n ownerListPicker: {\n title: 'Task Owner',\n options: {\n owned: 'Owned',\n all: 'All',\n },\n },\n ongoingTask: {\n title: 'Run of',\n pageTitle: {\n hasTemplateName: 'Run of {{templateName}}',\n noTemplateName: 'Scaffolder Run',\n },\n subtitle: 'Task {{taskId}}',\n cancelButtonTitle: 'Cancel',\n retryButtonTitle: 'Retry',\n startOverButtonTitle: 'Start Over',\n hideLogsButtonTitle: 'Hide Logs',\n showLogsButtonTitle: 'Show Logs',\n contextMenu: {\n hideLogs: 'Hide Logs',\n showLogs: 'Show Logs',\n hideButtonBar: 'Hide Button Bar',\n retry: 'Retry',\n showButtonBar: 'Show Button Bar',\n startOver: 'Start Over',\n cancel: 'Cancel',\n },\n },\n templateEditorForm: {\n stepper: {\n emptyText: 'There are no spec parameters in the template to preview.',\n },\n },\n templateTypePicker: {\n title: 'Categories',\n },\n templateIntroPage: {\n title: 'Manage Templates',\n subtitle:\n 'Edit, preview, and try out templates, forms, and custom fields',\n },\n templateFormPage: {\n title: 'Template Editor',\n subtitle: 'Edit, preview, and try out templates forms',\n },\n templateCustomFieldPage: {\n title: 'Custom Field Explorer',\n subtitle: 'Edit, preview, and try out custom fields',\n },\n templateEditorPage: {\n title: 'Template Editor',\n subtitle: 'Edit, preview, and try out templates and template forms',\n dryRunResults: {\n title: 'Dry-run results',\n },\n dryRunResultsList: {\n title: 'Result {{resultId}}',\n downloadButtonTitle: 'Download as .zip',\n deleteButtonTitle: 'Delete result',\n },\n dryRunResultsView: {\n tab: {\n files: 'Files',\n log: 'Log',\n output: 'Output',\n },\n },\n taskStatusStepper: {\n skippedStepTitle: 'Skipped',\n },\n customFieldExplorer: {\n selectFieldLabel: 'Choose Custom Field Extension',\n fieldForm: {\n title: 'Field Options',\n applyButtonTitle: 'Apply',\n },\n fieldPreview: {\n title: 'Field Preview',\n },\n preview: {\n title: 'Template Spec',\n },\n },\n templateEditorBrowser: {\n closeConfirmMessage: 'Are you sure? Unsaved changes will be lost',\n saveIconTooltip: 'Save all files',\n reloadIconTooltip: 'Reload directory',\n closeIconTooltip: 'Close directory',\n },\n templateEditorIntro: {\n title: 'Get started by choosing one of the options below',\n loadLocal: {\n title: 'Load Template Directory',\n description:\n 'Load a local template directory, allowing you to both edit and try executing your own template.',\n unsupportedTooltip: 'Only supported in some Chromium-based browsers',\n },\n createLocal: {\n title: 'Create New Template',\n description:\n 'Create a local template directory, allowing you to both edit and try executing your own template.',\n unsupportedTooltip: 'Only supported in some Chromium-based browsers',\n },\n formEditor: {\n title: 'Template Form Playground',\n description:\n 'Preview and edit a template form, either using a sample template or by loading a template from the catalog.',\n },\n fieldExplorer: {\n title: 'Custom Field Explorer',\n description:\n 'View and play around with available installed custom field extensions.',\n },\n },\n templateEditorTextArea: {\n saveIconTooltip: 'Save file',\n refreshIconTooltip: 'Reload file',\n emptyStateParagraph: 'Please select an action on the file menu.',\n },\n templateFormPreviewer: {\n title: 'Load Existing Template',\n },\n },\n templateListPage: {\n title: 'Create a new component',\n subtitle:\n 'Create new software components using standard templates in your organization',\n pageTitle: 'Create a new component',\n templateGroups: {\n defaultTitle: 'Templates',\n otherTitle: 'Other Templates',\n },\n contentHeader: {\n registerExistingButtonTitle: 'Register Existing Component',\n supportButtonTitle:\n 'Create new software components using standard templates. Different templates create different kinds of components (services, websites, documentation, ...).',\n },\n additionalLinksForEntity: {\n viewTechDocsTitle: 'View TechDocs',\n },\n },\n templateWizardPage: {\n title: 'Create a new component',\n subtitle:\n 'Create new software components using standard templates in your organization',\n pageTitle: 'Create a new component',\n pageContextMenu: {\n editConfigurationTitle: 'Edit Configuration',\n },\n },\n templateEditorToolbar: {\n customFieldExplorerTooltip: 'Custom Fields Explorer',\n installedActionsDocumentationTooltip: 'Installed Actions Documentation',\n addToCatalogButton: 'Publish',\n addToCatalogDialogTitle: 'Publish changes',\n addToCatalogDialogContent: {\n stepsIntroduction:\n 'Follow the instructions below to create or update a template:',\n stepsListItems:\n 'Save the template files in a local directory\\nCreate a pull request to a new or existing git repository\\nIf the template already exists, the changes will be reflected in the software catalog once the pull request gets merged\\nBut if you are creating a new template, follow the documentation linked below to register the new template repository in software catalog',\n },\n addToCatalogDialogActions: {\n documentationButton: 'Go to the documentation',\n documentationUrl:\n 'https://backstage.io/docs/features/software-templates/adding-templates/',\n },\n },\n templateEditorToolbarFileMenu: {\n button: 'File',\n options: {\n openDirectory: 'Open template directory',\n createDirectory: 'Create template directory',\n closeEditor: 'Close template editor',\n },\n },\n templateEditorToolbarTemplatesMenu: {\n button: 'Templates',\n },\n },\n});\n"],"names":[],"mappings":";;AAkBO,MAAM,2BAA2B,oBAAqB,CAAA;AAAA,EAC3D,EAAI,EAAA,YAAA;AAAA,EACJ,QAAU,EAAA;AAAA,IACR,WAAa,EAAA;AAAA,MACX,KAAO,EAAA,mBAAA;AAAA,MACP,SAAW,EAAA,wBAAA;AAAA,MACX,QAAU,EAAA,iDAAA;AAAA,MACV,OAAS,EAAA;AAAA,QACP,UAAY,EAAA;AAAA,UACV,KAAO,EAAA,2BAAA;AAAA,UACP,WACE,EAAA,kFAAA;AAAA,SACJ;AAAA,QACA,sBAAwB,EAAA,sBAAA;AAAA,QACxB,SAAW,EAAA;AAAA,UACT,IAAM,EAAA,MAAA;AAAA,UACN,KAAO,EAAA,OAAA;AAAA,UACP,WAAa,EAAA,aAAA;AAAA,UACb,IAAM,EAAA,MAAA;AAAA,SACR;AAAA,QACA,iBAAmB,EAAA,mBAAA;AAAA,OACrB;AAAA,MACA,MAAQ,EAAA;AAAA,QACN,KAAO,EAAA,OAAA;AAAA,QACP,MAAQ,EAAA,QAAA;AAAA,QACR,QAAU,EAAA,UAAA;AAAA,OACZ;AAAA,KACF;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,gBAAkB,EAAA;AAAA,QAChB,KAAO,EAAA,MAAA;AAAA,QACP,WAAa,EAAA,8BAAA;AAAA,OACf;AAAA,MACA,YAAc,EAAA;AAAA,QACZ,KAAO,EAAA,QAAA;AAAA,QACP,WAAa,EAAA,4BAAA;AAAA,OACf;AAAA,MACA,gBAAkB,EAAA;AAAA,QAChB,KAAO,EAAA,MAAA;AAAA,QACP,WACE,EAAA,sHAAA;AAAA,OACJ;AAAA,MACA,cAAgB,EAAA;AAAA,QACd,KAAO,EAAA,QAAA;AAAA,QACP,WAAa,EAAA,4BAAA;AAAA,OACf;AAAA,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AA,OACf;AAAA,KACF;AAAA,IACA,kCAAoC,EAAA;AAAA,MAClC,MAAQ,EAAA,WAAA;AAAA,KACV;AAAA,GACF;AACF,CAAC;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder",
3
- "version": "1.26.0-next.0",
3
+ "version": "1.26.0-next.2",
4
4
  "description": "The Backstage plugin that helps you create new things",
5
5
  "backstage": {
6
6
  "role": "frontend-plugin",
@@ -58,21 +58,21 @@
58
58
  "test": "backstage-cli package test"
59
59
  },
60
60
  "dependencies": {
61
- "@backstage/catalog-client": "^1.7.0",
62
- "@backstage/catalog-model": "^1.7.0",
63
- "@backstage/core-compat-api": "^0.3.1-next.0",
64
- "@backstage/core-components": "^0.15.1-next.0",
65
- "@backstage/core-plugin-api": "^1.10.0-next.0",
66
- "@backstage/errors": "^1.2.4",
67
- "@backstage/frontend-plugin-api": "^0.9.0-next.0",
68
- "@backstage/integration": "^1.15.0",
69
- "@backstage/integration-react": "^1.1.32-next.0",
70
- "@backstage/plugin-catalog-common": "^1.1.0",
71
- "@backstage/plugin-catalog-react": "^1.13.1-next.0",
72
- "@backstage/plugin-permission-react": "^0.4.27-next.0",
73
- "@backstage/plugin-scaffolder-common": "^1.5.6",
74
- "@backstage/plugin-scaffolder-react": "^1.13.0-next.0",
75
- "@backstage/types": "^1.1.1",
61
+ "@backstage/catalog-client": "1.7.1-next.0",
62
+ "@backstage/catalog-model": "1.7.0",
63
+ "@backstage/core-compat-api": "0.3.1-next.2",
64
+ "@backstage/core-components": "0.15.1-next.2",
65
+ "@backstage/core-plugin-api": "1.10.0-next.1",
66
+ "@backstage/errors": "1.2.4",
67
+ "@backstage/frontend-plugin-api": "0.9.0-next.2",
68
+ "@backstage/integration": "1.15.1-next.1",
69
+ "@backstage/integration-react": "1.2.0-next.2",
70
+ "@backstage/plugin-catalog-common": "1.1.0",
71
+ "@backstage/plugin-catalog-react": "1.14.0-next.2",
72
+ "@backstage/plugin-permission-react": "0.4.27-next.1",
73
+ "@backstage/plugin-scaffolder-common": "1.5.6",
74
+ "@backstage/plugin-scaffolder-react": "1.13.0-next.2",
75
+ "@backstage/types": "1.1.1",
76
76
  "@codemirror/language": "^6.0.0",
77
77
  "@codemirror/legacy-modes": "^6.1.0",
78
78
  "@codemirror/view": "^6.0.0",
@@ -85,10 +85,9 @@
85
85
  "@rjsf/material-ui": "5.21.1",
86
86
  "@rjsf/utils": "5.21.1",
87
87
  "@rjsf/validator-ajv8": "5.21.1",
88
- "@types/react": "^16.13.1 || ^17.0.0 || ^18.0.0",
89
88
  "@uiw/react-codemirror": "^4.9.3",
90
89
  "classnames": "^2.2.6",
91
- "git-url-parse": "^14.0.0",
90
+ "git-url-parse": "^15.0.0",
92
91
  "humanize-duration": "^3.25.1",
93
92
  "idb-keyval": "5.0.2",
94
93
  "json-schema": "^0.4.0",
@@ -106,27 +105,37 @@
106
105
  "zod-to-json-schema": "^3.20.4"
107
106
  },
108
107
  "devDependencies": {
109
- "@backstage/cli": "^0.28.0-next.0",
110
- "@backstage/core-app-api": "^1.15.1-next.0",
111
- "@backstage/dev-utils": "^1.1.1-next.0",
112
- "@backstage/plugin-catalog": "^1.24.0-next.0",
113
- "@backstage/plugin-permission-common": "^0.8.1",
114
- "@backstage/test-utils": "^1.6.1-next.0",
108
+ "@backstage/cli": "0.28.0-next.2",
109
+ "@backstage/core-app-api": "1.15.1-next.1",
110
+ "@backstage/dev-utils": "1.1.2-next.2",
111
+ "@backstage/plugin-catalog": "1.24.0-next.2",
112
+ "@backstage/plugin-permission-common": "0.8.1",
113
+ "@backstage/test-utils": "1.6.1-next.2",
115
114
  "@testing-library/dom": "^10.0.0",
116
115
  "@testing-library/jest-dom": "^6.0.0",
117
116
  "@testing-library/react": "^16.0.0",
118
117
  "@testing-library/user-event": "^14.0.0",
119
118
  "@types/humanize-duration": "^3.18.1",
120
119
  "@types/json-schema": "^7.0.9",
120
+ "@types/react": "^18.0.0",
121
121
  "@types/react-resizable": "^3.0.8",
122
122
  "@types/react-window": "^1.8.8",
123
123
  "msw": "^1.0.0",
124
+ "react": "^18.0.2",
125
+ "react-dom": "^18.0.2",
126
+ "react-router-dom": "^6.3.0",
124
127
  "swr": "^2.0.0"
125
128
  },
126
129
  "peerDependencies": {
130
+ "@types/react": "^16.13.1 || ^17.0.0 || ^18.0.0",
127
131
  "react": "^16.13.1 || ^17.0.0 || ^18.0.0",
128
132
  "react-dom": "^16.13.1 || ^17.0.0 || ^18.0.0",
129
133
  "react-router-dom": "6.0.0-beta.0 || ^6.3.0"
130
134
  },
135
+ "peerDependenciesMeta": {
136
+ "@types/react": {
137
+ "optional": true
138
+ }
139
+ },
131
140
  "module": "./dist/index.esm.js"
132
141
  }
@@ -1,52 +0,0 @@
1
- import React, { useCallback } from 'react';
2
- import useAsyncRetry from 'react-use/esm/useAsyncRetry';
3
- import { Page, Header, Content, Progress } from '@backstage/core-components';
4
- import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
5
- import { scaffolderTranslationRef } from '../../../translation.esm.js';
6
- import { WebFileSystemStore, WebFileSystemAccess } from '../../../lib/filesystem/WebFileSystemAccess.esm.js';
7
- import { TemplateEditor } from './TemplateEditor.esm.js';
8
- import { makeStyles } from '@material-ui/core/styles';
9
-
10
- const useStyles = makeStyles(
11
- {
12
- content: {
13
- padding: 0
14
- }
15
- },
16
- { name: "ScaffolderTemplateEditorToolbar" }
17
- );
18
- function TemplatePage(props) {
19
- const classes = useStyles();
20
- const { t } = useTranslationRef(scaffolderTranslationRef);
21
- const { value, loading, retry } = useAsyncRetry(async () => {
22
- const directory = await WebFileSystemStore.getDirectory();
23
- if (!directory) return void 0;
24
- return WebFileSystemAccess.fromHandle(directory);
25
- }, []);
26
- const handleLoadDirectory = useCallback(() => {
27
- WebFileSystemAccess.requestDirectoryAccess().then(WebFileSystemStore.setDirectory).then(retry);
28
- }, [retry]);
29
- const handleCloseDirectory = useCallback(() => {
30
- WebFileSystemStore.setDirectory(void 0).then(retry);
31
- }, [retry]);
32
- return /* @__PURE__ */ React.createElement(Page, { themeId: "home" }, /* @__PURE__ */ React.createElement(
33
- Header,
34
- {
35
- title: t("templateEditorPage.title"),
36
- subtitle: t("templateEditorPage.subtitle")
37
- }
38
- ), /* @__PURE__ */ React.createElement(Content, { className: classes.content }, loading ? /* @__PURE__ */ React.createElement(Progress, null) : /* @__PURE__ */ React.createElement(
39
- TemplateEditor,
40
- {
41
- directory: value,
42
- layouts: props.layouts,
43
- formProps: props.formProps,
44
- fieldExtensions: props.fieldExtensions,
45
- onClose: handleCloseDirectory,
46
- onLoad: handleLoadDirectory
47
- }
48
- )));
49
- }
50
-
51
- export { TemplatePage };
52
- //# sourceMappingURL=TemplatePage.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TemplatePage.esm.js","sources":["../../../../src/alpha/components/TemplateEditorPage/TemplatePage.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 React, { useCallback } from 'react';\nimport useAsyncRetry from 'react-use/esm/useAsyncRetry';\n\nimport { Page, Header, Content, Progress } from '@backstage/core-components';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport {\n FormProps,\n FieldExtensionOptions,\n type LayoutOptions,\n} from '@backstage/plugin-scaffolder-react';\n\nimport { scaffolderTranslationRef } from '../../../translation';\nimport {\n WebFileSystemAccess,\n WebFileSystemStore,\n} from '../../../lib/filesystem';\nimport { TemplateEditor } from './TemplateEditor';\n\nimport { makeStyles } from '@material-ui/core/styles';\n\nconst useStyles = makeStyles(\n {\n content: {\n padding: 0,\n },\n },\n { name: 'ScaffolderTemplateEditorToolbar' },\n);\n\ninterface TemplatePageProps {\n defaultPreviewTemplate?: string;\n fieldExtensions?: FieldExtensionOptions<any, any>[];\n layouts?: LayoutOptions[];\n formProps?: FormProps;\n}\n\nexport function TemplatePage(props: TemplatePageProps) {\n const classes = useStyles();\n const { t } = useTranslationRef(scaffolderTranslationRef);\n\n const { value, loading, retry } = useAsyncRetry(async () => {\n const directory = await WebFileSystemStore.getDirectory();\n if (!directory) return undefined;\n return WebFileSystemAccess.fromHandle(directory);\n }, []);\n\n const handleLoadDirectory = useCallback(() => {\n WebFileSystemAccess.requestDirectoryAccess()\n .then(WebFileSystemStore.setDirectory)\n .then(retry);\n }, [retry]);\n\n const handleCloseDirectory = useCallback(() => {\n WebFileSystemStore.setDirectory(undefined).then(retry);\n }, [retry]);\n\n return (\n <Page themeId=\"home\">\n <Header\n title={t('templateEditorPage.title')}\n subtitle={t('templateEditorPage.subtitle')}\n />\n <Content className={classes.content}>\n {loading ? (\n <Progress />\n ) : (\n <TemplateEditor\n directory={value}\n layouts={props.layouts}\n formProps={props.formProps}\n fieldExtensions={props.fieldExtensions}\n onClose={handleCloseDirectory}\n onLoad={handleLoadDirectory}\n />\n )}\n </Content>\n </Page>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;AAoCA,MAAM,SAAY,GAAA,UAAA;AAAA,EAChB;AAAA,IACE,OAAS,EAAA;AAAA,MACP,OAAS,EAAA,CAAA;AAAA,KACX;AAAA,GACF;AAAA,EACA,EAAE,MAAM,iCAAkC,EAAA;AAC5C,CAAA,CAAA;AASO,SAAS,aAAa,KAA0B,EAAA;AACrD,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAC1B,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,wBAAwB,CAAA,CAAA;AAExD,EAAA,MAAM,EAAE,KAAO,EAAA,OAAA,EAAS,KAAM,EAAA,GAAI,cAAc,YAAY;AAC1D,IAAM,MA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