@backstage/plugin-scaffolder 1.25.0-next.0 → 1.25.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.
- package/CHANGELOG.md +54 -0
- package/alpha/package.json +1 -1
- package/dist/alpha.d.ts +13 -5
- package/dist/alpha.esm.js.map +1 -1
- package/dist/components/Router/Router.esm.js +2 -1
- package/dist/components/Router/Router.esm.js.map +1 -1
- package/dist/components/fields/OwnedEntityPicker/OwnedEntityPicker.esm.js +2 -1
- package/dist/components/fields/OwnedEntityPicker/OwnedEntityPicker.esm.js.map +1 -1
- package/dist/next/TemplateEditorPage/CustomFieldExplorer.esm.js +25 -22
- package/dist/next/TemplateEditorPage/CustomFieldExplorer.esm.js.map +1 -1
- package/dist/next/TemplateEditorPage/TemplateEditor.esm.js +29 -25
- package/dist/next/TemplateEditorPage/TemplateEditor.esm.js.map +1 -1
- package/dist/next/TemplateEditorPage/TemplateEditorForm.esm.js +4 -2
- package/dist/next/TemplateEditorPage/TemplateEditorForm.esm.js.map +1 -1
- package/dist/next/TemplateEditorPage/TemplateEditorPage.esm.js +4 -2
- package/dist/next/TemplateEditorPage/TemplateEditorPage.esm.js.map +1 -1
- package/dist/next/TemplateEditorPage/TemplateFormPreviewer.esm.js +29 -24
- package/dist/next/TemplateEditorPage/TemplateFormPreviewer.esm.js.map +1 -1
- package/dist/next/TemplateListPage/TemplateListPage.esm.js +1 -1
- package/dist/next/TemplateListPage/TemplateListPage.esm.js.map +1 -1
- package/dist/translation.esm.js +0 -1
- package/dist/translation.esm.js.map +1 -1
- package/package.json +21 -21
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,59 @@
|
|
|
1
1
|
# @backstage/plugin-scaffolder
|
|
2
2
|
|
|
3
|
+
## 1.25.0-next.2
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 860ad3a: Expose styles for TemplateEditor, TemplateFormPreviewer and CustomFieldExplorer
|
|
8
|
+
- 4baad34: Added support for `omitExtraData` and `liveOmit` for rjsf in the scaffolder
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- b0a5c9f: The `ui:options` for `OwnedEntityPicker` field are now passed to `EntityPicker`. This allows you to use any `ui:options` which `EntityPicker` accepts in the `OwnedEntityPicker` field including `allowArbitraryValues` and `defaultNamespace`.
|
|
13
|
+
- 836127c: Updated dependency `@testing-library/react` to `^16.0.0`.
|
|
14
|
+
- fa9d8da: Updated dependency `@rjsf/utils` to `5.20.1`.
|
|
15
|
+
Updated dependency `@rjsf/core` to `5.20.1`.
|
|
16
|
+
Updated dependency `@rjsf/material-ui` to `5.20.1`.
|
|
17
|
+
Updated dependency `@rjsf/validator-ajv8` to `5.20.1`.
|
|
18
|
+
- 0944334: Removed duplicated titles on Scaffolder `TemplateListPage` component
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
- @backstage/core-components@0.14.11-next.1
|
|
21
|
+
- @backstage/plugin-catalog-react@1.13.0-next.2
|
|
22
|
+
- @backstage/integration-react@1.1.31-next.0
|
|
23
|
+
- @backstage/plugin-scaffolder-react@1.12.0-next.2
|
|
24
|
+
- @backstage/catalog-client@1.7.0-next.1
|
|
25
|
+
- @backstage/integration@1.15.0-next.0
|
|
26
|
+
- @backstage/core-compat-api@0.3.0-next.2
|
|
27
|
+
- @backstage/core-plugin-api@1.9.4-next.0
|
|
28
|
+
- @backstage/frontend-plugin-api@0.8.0-next.2
|
|
29
|
+
- @backstage/plugin-permission-react@0.4.26-next.0
|
|
30
|
+
- @backstage/catalog-model@1.6.0
|
|
31
|
+
- @backstage/errors@1.2.4
|
|
32
|
+
- @backstage/types@1.1.1
|
|
33
|
+
- @backstage/plugin-catalog-common@1.0.26
|
|
34
|
+
- @backstage/plugin-scaffolder-common@1.5.5
|
|
35
|
+
|
|
36
|
+
## 1.25.0-next.1
|
|
37
|
+
|
|
38
|
+
### Patch Changes
|
|
39
|
+
|
|
40
|
+
- Updated dependencies
|
|
41
|
+
- @backstage/frontend-plugin-api@0.8.0-next.1
|
|
42
|
+
- @backstage/core-compat-api@0.3.0-next.1
|
|
43
|
+
- @backstage/catalog-client@1.6.7-next.0
|
|
44
|
+
- @backstage/core-components@0.14.11-next.0
|
|
45
|
+
- @backstage/plugin-scaffolder-react@1.12.0-next.1
|
|
46
|
+
- @backstage/plugin-catalog-react@1.12.4-next.1
|
|
47
|
+
- @backstage/catalog-model@1.6.0
|
|
48
|
+
- @backstage/core-plugin-api@1.9.3
|
|
49
|
+
- @backstage/errors@1.2.4
|
|
50
|
+
- @backstage/integration@1.14.0
|
|
51
|
+
- @backstage/integration-react@1.1.30
|
|
52
|
+
- @backstage/types@1.1.1
|
|
53
|
+
- @backstage/plugin-catalog-common@1.0.26
|
|
54
|
+
- @backstage/plugin-permission-react@0.4.25
|
|
55
|
+
- @backstage/plugin-scaffolder-common@1.5.5
|
|
56
|
+
|
|
3
57
|
## 1.25.0-next.0
|
|
4
58
|
|
|
5
59
|
### Minor Changes
|
package/alpha/package.json
CHANGED
package/dist/alpha.d.ts
CHANGED
|
@@ -6,6 +6,15 @@ import { TemplateGroupFilter, FieldExtensionOptions, ReviewStepProps, LayoutOpti
|
|
|
6
6
|
import { FormProps as FormProps$2 } from '@rjsf/core';
|
|
7
7
|
import * as _backstage_core_plugin_api_alpha from '@backstage/core-plugin-api/alpha';
|
|
8
8
|
|
|
9
|
+
/** @public */
|
|
10
|
+
type ScaffolderCustomFieldExplorerClassKey = 'root' | 'controls' | 'fieldForm' | 'preview';
|
|
11
|
+
|
|
12
|
+
/** @public */
|
|
13
|
+
type ScaffolderTemplateEditorClassKey = 'root' | 'browser' | 'editor' | 'preview' | 'results';
|
|
14
|
+
|
|
15
|
+
/** @public */
|
|
16
|
+
type ScaffolderTemplateFormPreviewerClassKey = 'root' | 'controls' | 'textArea' | 'preview';
|
|
17
|
+
|
|
9
18
|
/**
|
|
10
19
|
* @alpha
|
|
11
20
|
*/
|
|
@@ -152,10 +161,10 @@ declare const scaffolderTranslationRef: _backstage_core_plugin_api_alpha.Transla
|
|
|
152
161
|
readonly "templateEditorPage.dryRunResultsView.tab.log": "Log";
|
|
153
162
|
readonly "templateEditorPage.dryRunResultsView.tab.files": "Files";
|
|
154
163
|
readonly "templateEditorPage.taskStatusStepper.skippedStepTitle": "Skipped";
|
|
155
|
-
readonly "templateEditorPage.customFieldExplorer.
|
|
164
|
+
readonly "templateEditorPage.customFieldExplorer.preview.title": "Example Template Spec";
|
|
156
165
|
readonly "templateEditorPage.customFieldExplorer.fieldForm.title": "Field Options";
|
|
157
166
|
readonly "templateEditorPage.customFieldExplorer.fieldForm.applyButtonTitle": "Apply";
|
|
158
|
-
readonly "templateEditorPage.customFieldExplorer.
|
|
167
|
+
readonly "templateEditorPage.customFieldExplorer.selectFieldLabel": "Choose Custom Field Extension";
|
|
159
168
|
readonly "templateEditorPage.templateEditorBrowser.closeConfirmMessage": "Are you sure? Unsaved changes will be lost";
|
|
160
169
|
readonly "templateEditorPage.templateEditorBrowser.saveIconTooltip": "Save all files";
|
|
161
170
|
readonly "templateEditorPage.templateEditorBrowser.reloadIconTooltip": "Reload directory";
|
|
@@ -176,7 +185,6 @@ declare const scaffolderTranslationRef: _backstage_core_plugin_api_alpha.Transla
|
|
|
176
185
|
readonly "templateListPage.pageTitle": "Create a new component";
|
|
177
186
|
readonly "templateListPage.templateGroups.defaultTitle": "Templates";
|
|
178
187
|
readonly "templateListPage.templateGroups.otherTitle": "Other Templates";
|
|
179
|
-
readonly "templateListPage.contentHeader.title": "Available Templates";
|
|
180
188
|
readonly "templateListPage.contentHeader.registerExistingButtonTitle": "Register Existing Component";
|
|
181
189
|
readonly "templateListPage.contentHeader.supportButtonTitle": "Create new software components using standard templates. Different templates create different kinds of components (services, websites, documentation, ...).";
|
|
182
190
|
readonly "templateListPage.additionalLinksForEntity.viewTechDocsTitle": "View TechDocs";
|
|
@@ -187,7 +195,7 @@ declare const scaffolderTranslationRef: _backstage_core_plugin_api_alpha.Transla
|
|
|
187
195
|
}>;
|
|
188
196
|
|
|
189
197
|
/** @alpha */
|
|
190
|
-
declare const _default: _backstage_frontend_plugin_api.
|
|
198
|
+
declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
|
|
191
199
|
root: _backstage_frontend_plugin_api.RouteRef<undefined>;
|
|
192
200
|
selectedTemplate: _backstage_frontend_plugin_api.SubRouteRef<_backstage_core_plugin_api.PathParams<"/templates/:namespace/:templateName">>;
|
|
193
201
|
ongoingTask: _backstage_frontend_plugin_api.SubRouteRef<_backstage_core_plugin_api.PathParams<"/tasks/:taskId">>;
|
|
@@ -241,4 +249,4 @@ declare const _default: _backstage_frontend_plugin_api.BackstagePlugin<{
|
|
|
241
249
|
}>;
|
|
242
250
|
}>;
|
|
243
251
|
|
|
244
|
-
export { type FormProps, type TemplateListPageProps, type TemplateWizardPageProps, _default as default, scaffolderTranslationRef };
|
|
252
|
+
export { type FormProps, type ScaffolderCustomFieldExplorerClassKey, type ScaffolderTemplateEditorClassKey, type ScaffolderTemplateFormPreviewerClassKey, type TemplateListPageProps, type TemplateWizardPageProps, _default as default, scaffolderTranslationRef };
|
package/dist/alpha.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alpha.esm.js","sources":["../src/alpha.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 React from 'react';\nimport {\n createApiFactory,\n createFrontendPlugin,\n discoveryApiRef,\n fetchApiRef,\n identityApiRef,\n ApiBlueprint,\n PageBlueprint,\n NavItemBlueprint,\n} from '@backstage/frontend-plugin-api';\nimport CreateComponentIcon from '@material-ui/icons/AddCircleOutline';\nimport {\n compatWrapper,\n convertLegacyRouteRef,\n convertLegacyRouteRefs,\n} from '@backstage/core-compat-api';\nimport { scmIntegrationsApiRef } from '@backstage/integration-react';\nimport { scaffolderApiRef } from '@backstage/plugin-scaffolder-react';\nimport { ScaffolderClient } from './api';\nimport {\n registerComponentRouteRef,\n rootRouteRef,\n viewTechDocRouteRef,\n selectedTemplateRouteRef,\n scaffolderTaskRouteRef,\n scaffolderListTaskRouteRef,\n actionsRouteRef,\n editRouteRef,\n} from './routes';\n\nexport {\n type FormProps,\n type TemplateListPageProps,\n type TemplateWizardPageProps,\n} from './next';\n\nexport { scaffolderTranslationRef } from './translation';\n\nconst scaffolderApi = ApiBlueprint.make({\n params: {\n factory: createApiFactory({\n api: scaffolderApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n scmIntegrationsApi: scmIntegrationsApiRef,\n fetchApi: fetchApiRef,\n identityApi: identityApiRef,\n },\n factory: ({ discoveryApi, scmIntegrationsApi, fetchApi, identityApi }) =>\n new ScaffolderClient({\n discoveryApi,\n scmIntegrationsApi,\n fetchApi,\n identityApi,\n }),\n }),\n },\n});\n\nconst scaffolderPage = PageBlueprint.make({\n params: {\n routeRef: convertLegacyRouteRef(rootRouteRef),\n defaultPath: '/create',\n loader: () =>\n import('./components/Router').then(m => compatWrapper(<m.Router />)),\n },\n});\n\nconst scaffolderNavItem = NavItemBlueprint.make({\n params: {\n routeRef: convertLegacyRouteRef(rootRouteRef),\n title: 'Create...',\n icon: CreateComponentIcon,\n },\n});\n\n/** @alpha */\nexport default createFrontendPlugin({\n id: 'scaffolder',\n routes: convertLegacyRouteRefs({\n root: rootRouteRef,\n selectedTemplate: selectedTemplateRouteRef,\n ongoingTask: scaffolderTaskRouteRef,\n actions: actionsRouteRef,\n listTasks: scaffolderListTaskRouteRef,\n edit: editRouteRef,\n }),\n externalRoutes: convertLegacyRouteRefs({\n registerComponent: registerComponentRouteRef,\n viewTechDoc: viewTechDocRouteRef,\n }),\n extensions: [scaffolderApi, scaffolderPage, scaffolderNavItem],\n});\n"],"names":[],"mappings":";;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"alpha.esm.js","sources":["../src/alpha.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 React from 'react';\nimport {\n createApiFactory,\n createFrontendPlugin,\n discoveryApiRef,\n fetchApiRef,\n identityApiRef,\n ApiBlueprint,\n PageBlueprint,\n NavItemBlueprint,\n} from '@backstage/frontend-plugin-api';\nimport CreateComponentIcon from '@material-ui/icons/AddCircleOutline';\nimport {\n compatWrapper,\n convertLegacyRouteRef,\n convertLegacyRouteRefs,\n} from '@backstage/core-compat-api';\nimport { scmIntegrationsApiRef } from '@backstage/integration-react';\nimport { scaffolderApiRef } from '@backstage/plugin-scaffolder-react';\nimport { ScaffolderClient } from './api';\nimport {\n registerComponentRouteRef,\n rootRouteRef,\n viewTechDocRouteRef,\n selectedTemplateRouteRef,\n scaffolderTaskRouteRef,\n scaffolderListTaskRouteRef,\n actionsRouteRef,\n editRouteRef,\n} from './routes';\n\nexport {\n type FormProps,\n type TemplateListPageProps,\n type TemplateWizardPageProps,\n type ScaffolderCustomFieldExplorerClassKey,\n type ScaffolderTemplateEditorClassKey,\n type ScaffolderTemplateFormPreviewerClassKey,\n} from './next';\n\nexport { scaffolderTranslationRef } from './translation';\n\nconst scaffolderApi = ApiBlueprint.make({\n params: {\n factory: createApiFactory({\n api: scaffolderApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n scmIntegrationsApi: scmIntegrationsApiRef,\n fetchApi: fetchApiRef,\n identityApi: identityApiRef,\n },\n factory: ({ discoveryApi, scmIntegrationsApi, fetchApi, identityApi }) =>\n new ScaffolderClient({\n discoveryApi,\n scmIntegrationsApi,\n fetchApi,\n identityApi,\n }),\n }),\n },\n});\n\nconst scaffolderPage = PageBlueprint.make({\n params: {\n routeRef: convertLegacyRouteRef(rootRouteRef),\n defaultPath: '/create',\n loader: () =>\n import('./components/Router').then(m => compatWrapper(<m.Router />)),\n },\n});\n\nconst scaffolderNavItem = NavItemBlueprint.make({\n params: {\n routeRef: convertLegacyRouteRef(rootRouteRef),\n title: 'Create...',\n icon: CreateComponentIcon,\n },\n});\n\n/** @alpha */\nexport default createFrontendPlugin({\n id: 'scaffolder',\n routes: convertLegacyRouteRefs({\n root: rootRouteRef,\n selectedTemplate: selectedTemplateRouteRef,\n ongoingTask: scaffolderTaskRouteRef,\n actions: actionsRouteRef,\n listTasks: scaffolderListTaskRouteRef,\n edit: editRouteRef,\n }),\n externalRoutes: convertLegacyRouteRefs({\n registerComponent: registerComponentRouteRef,\n viewTechDoc: viewTechDocRouteRef,\n }),\n extensions: [scaffolderApi, scaffolderPage, scaffolderNavItem],\n});\n"],"names":[],"mappings":";;;;;;;;;;AA0DA,MAAM,aAAA,GAAgB,aAAa,IAAK,CAAA;AAAA,EACtC,MAAQ,EAAA;AAAA,IACN,SAAS,gBAAiB,CAAA;AAAA,MACxB,GAAK,EAAA,gBAAA;AAAA,MACL,IAAM,EAAA;AAAA,QACJ,YAAc,EAAA,eAAA;AAAA,QACd,kBAAoB,EAAA,qBAAA;AAAA,QACpB,QAAU,EAAA,WAAA;AAAA,QACV,WAAa,EAAA,cAAA;AAAA,OACf;AAAA,MACA,OAAA,EAAS,CAAC,EAAE,YAAA,EAAc,oBAAoB,QAAU,EAAA,WAAA,EACtD,KAAA,IAAI,gBAAiB,CAAA;AAAA,QACnB,YAAA;AAAA,QACA,kBAAA;AAAA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tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { PropsWithChildren } from 'react';\nimport { Routes, Route, useOutlet } from 'react-router-dom';\n\nimport {\n FieldExtensionOptions,\n FormProps,\n ReviewStepProps,\n TemplateGroupFilter,\n} from '@backstage/plugin-scaffolder-react';\nimport {\n ScaffolderTaskOutput,\n SecretsContextProvider,\n useCustomFieldExtensions,\n useCustomLayouts,\n} from '@backstage/plugin-scaffolder-react';\n\nimport { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport { DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS } from '../../extensions/default';\n\nimport {\n actionsRouteRef,\n editRouteRef,\n scaffolderListTaskRouteRef,\n scaffolderTaskRouteRef,\n selectedTemplateRouteRef,\n} from '../../routes';\nimport { ErrorPage } from '@backstage/core-components';\n\nimport { ActionsPage } from '../../components/ActionsPage';\nimport { ListTasksPage } from '../../components/ListTasksPage';\n\nimport {\n TemplateListPageProps,\n TemplateWizardPageProps,\n} from '@backstage/plugin-scaffolder/alpha';\nimport { TemplateListPage, TemplateWizardPage } from '../../next';\nimport { OngoingTask } from '../OngoingTask';\nimport { TemplateEditorPage } from '../../next/TemplateEditorPage';\n\n/**\n * The Props for the Scaffolder Router\n *\n * @public\n */\nexport type RouterProps = {\n components?: {\n ReviewStepComponent?: React.ComponentType<ReviewStepProps>;\n TemplateCardComponent?: React.ComponentType<{\n template: TemplateEntityV1beta3;\n }>;\n TaskPageComponent?: React.ComponentType<PropsWithChildren<{}>>;\n EXPERIMENTAL_TemplateOutputsComponent?: React.ComponentType<{\n output?: ScaffolderTaskOutput;\n }>;\n EXPERIMENTAL_TemplateListPageComponent?: React.ComponentType<TemplateListPageProps>;\n EXPERIMENTAL_TemplateWizardPageComponent?: React.ComponentType<TemplateWizardPageProps>;\n };\n groups?: TemplateGroupFilter[];\n templateFilter?: (entity: TemplateEntityV1beta3) => boolean;\n headerOptions?: {\n pageTitleOverride?: string;\n title?: string;\n subtitle?: string;\n };\n defaultPreviewTemplate?: string;\n formProps?: FormProps;\n contextMenu?: {\n /** Whether to show a link to the template editor */\n editor?: boolean;\n /** Whether to show a link to the actions documentation */\n actions?: boolean;\n /** Whether to show a link to the tasks page */\n tasks?: boolean;\n };\n};\n\n/**\n * The Scaffolder Router\n *\n * @public\n */\nexport const Router = (props: PropsWithChildren<RouterProps>) => {\n const {\n components: {\n TemplateCardComponent,\n TaskPageComponent = OngoingTask,\n ReviewStepComponent,\n EXPERIMENTAL_TemplateOutputsComponent: TemplateOutputsComponent,\n EXPERIMENTAL_TemplateListPageComponent:\n TemplateListPageComponent = TemplateListPage,\n EXPERIMENTAL_TemplateWizardPageComponent:\n TemplateWizardPageComponent = TemplateWizardPage,\n } = {},\n } = props;\n const outlet = useOutlet() || props.children;\n const customFieldExtensions =\n useCustomFieldExtensions<FieldExtensionOptions>(outlet);\n\n const fieldExtensions = [\n ...customFieldExtensions,\n ...DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS.filter(\n ({ name }) =>\n !customFieldExtensions.some(\n customFieldExtension => customFieldExtension.name === name,\n ),\n ),\n ] as FieldExtensionOptions[];\n\n const customLayouts = useCustomLayouts(outlet);\n\n return (\n <Routes>\n <Route\n path=\"/\"\n element={\n <TemplateListPageComponent\n TemplateCardComponent={TemplateCardComponent}\n contextMenu={props.contextMenu}\n groups={props.groups}\n templateFilter={props.templateFilter}\n headerOptions={props.headerOptions}\n />\n }\n />\n <Route\n path={selectedTemplateRouteRef.path}\n element={\n <SecretsContextProvider>\n <TemplateWizardPageComponent\n headerOptions={props.headerOptions}\n customFieldExtensions={fieldExtensions}\n layouts={customLayouts}\n components={{ ReviewStepComponent }}\n formProps={props.formProps}\n />\n </SecretsContextProvider>\n }\n />\n <Route\n path={scaffolderTaskRouteRef.path}\n element={\n <TaskPageComponent\n TemplateOutputsComponent={TemplateOutputsComponent}\n />\n }\n />\n <Route\n path={editRouteRef.path}\n element={\n <SecretsContextProvider>\n <TemplateEditorPage\n customFieldExtensions={fieldExtensions}\n layouts={customLayouts}\n />\n </SecretsContextProvider>\n }\n />\n\n <Route path={actionsRouteRef.path} element={<ActionsPage />} />\n <Route\n path={scaffolderListTaskRouteRef.path}\n element={<ListTasksPage />}\n />\n <Route\n path=\"*\"\n element={<ErrorPage status=\"404\" statusMessage=\"Page not found\" />}\n />\n </Routes>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;AAgGa,MAAA,MAAA,GAAS,CAAC,KAA0C,KAAA;AAC/D,EAAM,MAAA;AAAA,IACJ,UAAY,EAAA;AAAA,MACV,qBAAA;AAAA,MACA,iBAAoB,GAAA,WAAA;AAAA,MACpB,mBAAA;AAAA,MACA,qCAAuC,EAAA,wBAAA;AAAA,MACvC,wCACE,yBAA4B,GAAA,gBAAA;AAAA,MAC9B,0CACE,2BAA8B,GAAA,kBAAA;AAAA,QAC9B,EAAC;AAAA,GACH,GAAA,KAAA,CAAA;AACJ,EAAM,MAAA,MAAA,GAAS,SAAU,EAAA,IAAK,KAAM,CAAA,QAAA,CAAA;AACpC,EAAM,MAAA,qBAAA,GACJ,yBAAgD,MAAM,CAAA,CAAA;AAExD,EAAA,MAAM,eAAkB,GAAA;AAAA,IACtB,GAAG,qBAAA;AAAA,IACH,GAAG,mCAAoC,CAAA,MAAA;AAAA,MACrC,CAAC,EAAE,IAAK,EAAA,KACN,CAAC,qBAAsB,CAAA,IAAA;AAAA,QACrB,CAAA,oBAAA,KAAwB,qBAAqB,IAAS,KAAA,IAAA;AAAA,OACxD;AAAA,KACJ;AAAA,GACF,CAAA;AAEA,EA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,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,kBAAA;AAAA,QAAA;AAAA,UACC,qBAAuB,EAAA,eAAA;AAAA,UACvB,OAAS,EAAA,aAAA;AAAA,SAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"Router.esm.js","sources":["../../../src/components/Router/Router.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { PropsWithChildren } from 'react';\nimport { Routes, Route, useOutlet } from 'react-router-dom';\n\nimport {\n FieldExtensionOptions,\n FormProps,\n ReviewStepProps,\n TemplateGroupFilter,\n} from '@backstage/plugin-scaffolder-react';\nimport {\n ScaffolderTaskOutput,\n SecretsContextProvider,\n useCustomFieldExtensions,\n useCustomLayouts,\n} from '@backstage/plugin-scaffolder-react';\n\nimport { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport { DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS } from '../../extensions/default';\n\nimport {\n actionsRouteRef,\n editRouteRef,\n scaffolderListTaskRouteRef,\n scaffolderTaskRouteRef,\n selectedTemplateRouteRef,\n} from '../../routes';\nimport { ErrorPage } from '@backstage/core-components';\n\nimport { ActionsPage } from '../../components/ActionsPage';\nimport { ListTasksPage } from '../../components/ListTasksPage';\n\nimport {\n TemplateListPageProps,\n TemplateWizardPageProps,\n} from '@backstage/plugin-scaffolder/alpha';\nimport { TemplateListPage, TemplateWizardPage } from '../../next';\nimport { OngoingTask } from '../OngoingTask';\nimport { TemplateEditorPage } from '../../next/TemplateEditorPage';\n\n/**\n * The Props for the Scaffolder Router\n *\n * @public\n */\nexport type RouterProps = {\n components?: {\n ReviewStepComponent?: React.ComponentType<ReviewStepProps>;\n TemplateCardComponent?: React.ComponentType<{\n template: TemplateEntityV1beta3;\n }>;\n TaskPageComponent?: React.ComponentType<PropsWithChildren<{}>>;\n EXPERIMENTAL_TemplateOutputsComponent?: React.ComponentType<{\n output?: ScaffolderTaskOutput;\n }>;\n EXPERIMENTAL_TemplateListPageComponent?: React.ComponentType<TemplateListPageProps>;\n EXPERIMENTAL_TemplateWizardPageComponent?: React.ComponentType<TemplateWizardPageProps>;\n };\n groups?: TemplateGroupFilter[];\n templateFilter?: (entity: TemplateEntityV1beta3) => boolean;\n headerOptions?: {\n pageTitleOverride?: string;\n title?: string;\n subtitle?: string;\n };\n defaultPreviewTemplate?: string;\n formProps?: FormProps;\n contextMenu?: {\n /** Whether to show a link to the template editor */\n editor?: boolean;\n /** Whether to show a link to the actions documentation */\n actions?: boolean;\n /** Whether to show a link to the tasks page */\n tasks?: boolean;\n };\n};\n\n/**\n * The Scaffolder Router\n *\n * @public\n */\nexport const Router = (props: PropsWithChildren<RouterProps>) => {\n const {\n components: {\n TemplateCardComponent,\n TaskPageComponent = OngoingTask,\n ReviewStepComponent,\n EXPERIMENTAL_TemplateOutputsComponent: TemplateOutputsComponent,\n EXPERIMENTAL_TemplateListPageComponent:\n TemplateListPageComponent = TemplateListPage,\n EXPERIMENTAL_TemplateWizardPageComponent:\n TemplateWizardPageComponent = TemplateWizardPage,\n } = {},\n } = props;\n const outlet = useOutlet() || props.children;\n const customFieldExtensions =\n useCustomFieldExtensions<FieldExtensionOptions>(outlet);\n\n const fieldExtensions = [\n ...customFieldExtensions,\n ...DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS.filter(\n ({ name }) =>\n !customFieldExtensions.some(\n customFieldExtension => customFieldExtension.name === name,\n ),\n ),\n ] as FieldExtensionOptions[];\n\n const customLayouts = useCustomLayouts(outlet);\n\n return (\n <Routes>\n <Route\n path=\"/\"\n element={\n <TemplateListPageComponent\n TemplateCardComponent={TemplateCardComponent}\n contextMenu={props.contextMenu}\n groups={props.groups}\n templateFilter={props.templateFilter}\n headerOptions={props.headerOptions}\n />\n }\n />\n <Route\n path={selectedTemplateRouteRef.path}\n element={\n <SecretsContextProvider>\n <TemplateWizardPageComponent\n headerOptions={props.headerOptions}\n customFieldExtensions={fieldExtensions}\n layouts={customLayouts}\n components={{ ReviewStepComponent }}\n formProps={props.formProps}\n />\n </SecretsContextProvider>\n }\n />\n <Route\n path={scaffolderTaskRouteRef.path}\n element={\n <TaskPageComponent\n TemplateOutputsComponent={TemplateOutputsComponent}\n />\n }\n />\n <Route\n path={editRouteRef.path}\n element={\n <SecretsContextProvider>\n <TemplateEditorPage\n customFieldExtensions={fieldExtensions}\n layouts={customLayouts}\n formProps={props.formProps}\n />\n </SecretsContextProvider>\n }\n />\n\n <Route path={actionsRouteRef.path} element={<ActionsPage />} />\n <Route\n path={scaffolderListTaskRouteRef.path}\n element={<ListTasksPage />}\n />\n <Route\n path=\"*\"\n element={<ErrorPage status=\"404\" statusMessage=\"Page not found\" />}\n />\n </Routes>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;AAgGa,MAAA,MAAA,GAAS,CAAC,KAA0C,KAAA;AAC/D,EAAM,MAAA;AAAA,IACJ,UAAY,EAAA;AAAA,MACV,qBAAA;AAAA,MACA,iBAAoB,GAAA,WAAA;AAAA,MACpB,mBAAA;AAAA,MACA,qCAAuC,EAAA,wBAAA;AAAA,MACvC,wCACE,yBAA4B,GAAA,gBAAA;AAAA,MAC9B,0CACE,2BAA8B,GAAA,kBAAA;AAAA,QAC9B,EAAC;AAAA,GACH,GAAA,KAAA,CAAA;AACJ,EAAM,MAAA,MAAA,GAAS,SAAU,EAAA,IAAK,KAAM,CAAA,QAAA,CAAA;AACpC,EAAM,MAAA,qBAAA,GACJ,yBAAgD,MAAM,CAAA,CAAA;AAExD,EAAA,MAAM,eAAkB,GAAA;AAAA,IACtB,GAAG,q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A;AAAA,QAAC,iBAAA;AAAA,QAAA;AAAA,UACC,wBAAA;AAAA,SAAA;AAAA,OACF;AAAA,KAAA;AAAA,GAGJ,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,MAAM,YAAa,CAAA,IAAA;AAAA,MACnB,OAAA,sCACG,sBACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,kBAAA;AAAA,QAAA;AAAA,UACC,qBAAuB,EAAA,eAAA;AAAA,UACvB,OAAS,EAAA,aAAA;AAAA,UACT,WAAW,KAAM,CAAA,SAAA;AAAA,SAAA;AAAA,OAErB,CAAA;AAAA,KAAA;AAAA,GAEJ,kBAEC,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAM,IAAM,EAAA,eAAA,CAAgB,MAAM,OAAS,kBAAA,KAAA,CAAA,aAAA,CAAC,WAAY,EAAA,IAAA,CAAA,EAAI,CAC7D,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,MAAM,0BAA2B,CAAA,IAAA;AAAA,MACjC,OAAA,sCAAU,aAAc,EAAA,IAAA,CAAA;AAAA,KAAA;AAAA,GAE1B,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,IAAK,EAAA,GAAA;AAAA,MACL,yBAAU,KAAA,CAAA,aAAA,CAAA,SAAA,EAAA,EAAU,MAAO,EAAA,KAAA,EAAM,eAAc,gBAAiB,EAAA,CAAA;AAAA,KAAA;AAAA,GAEpE,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -53,7 +53,7 @@ const OwnedEntityPicker = (props) => {
|
|
|
53
53
|
};
|
|
54
54
|
function buildEntityPickerUISchema(uiSchema, identityRefs) {
|
|
55
55
|
const uiOptions = uiSchema?.["ui:options"] || {};
|
|
56
|
-
const allowedKinds = uiOptions
|
|
56
|
+
const { allowedKinds, ...extraOptions } = uiOptions;
|
|
57
57
|
const catalogFilter = asArray(uiOptions.catalogFilter).map((e) => ({
|
|
58
58
|
...e,
|
|
59
59
|
...allowedKinds ? { kind: allowedKinds } : {},
|
|
@@ -61,6 +61,7 @@ function buildEntityPickerUISchema(uiSchema, identityRefs) {
|
|
|
61
61
|
}));
|
|
62
62
|
return {
|
|
63
63
|
"ui:options": {
|
|
64
|
+
...extraOptions,
|
|
64
65
|
catalogFilter
|
|
65
66
|
}
|
|
66
67
|
};
|
|
@@ -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 React from 'react';\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 = uiOptions
|
|
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 React from 'react';\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) ? 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,CAAA;AACxD,EAAM,MAAA;AAAA,IACJ,MAAQ,EAAA;AAAA,MACN,KAAA,GAAQ,EAAE,gCAAgC,CAAA;AAAA,MAC1C,WAAA,GAAc,EAAE,sCAAsC,CAAA;AAAA,KACxD;AAAA,IACA,QAAA;AAAA,IACA,QAAA;AAAA,GACE,GAAA,KAAA,CAAA;AAEJ,EAAM,MAAA,WAAA,GAAc,OAAO,cAAc,CAAA,CAAA;AACzC,EAAA,MAAM,EAAE,OAAS,EAAA,KAAA,EAAO,YAAa,EAAA,GAAI,SAAS,YAAY;AAC5D,IAAM,MAAA,QAAA,GAAW,MAAM,WAAA,CAAY,oBAAqB,EAAA,CAAA;AACxD,IAAA,OAAO,QAAS,CAAA,mBAAA,CAAA;AAAA,GACjB,CAAA,CAAA;AAED,EAAI,IAAA,OAAA;AACF,IACE,uBAAA,KAAA,CAAA,aAAA;AAAA,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A;AAAA,MACZ,GAAG,YAAA;AAAA,MACH,aAAA;AAAA,KACF;AAAA,GACF,CAAA;AACF,CAAA;AAEA,SAAS,QAAQ,aAA2B,EAAA;AAC1C,EAAA,IAAI,aAAe,EAAA;AACjB,IAAA,OAAO,MAAM,OAAQ,CAAA,aAAa,CAAI,GAAA,aAAA,GAAgB,CAAC,aAAa,CAAA,CAAA;AAAA,GACtE;AACA,EAAO,OAAA,CAAC,EAAE,CAAA,CAAA;AACZ;;;;"}
|
|
@@ -20,31 +20,34 @@ import validator from '@rjsf/validator-ajv8';
|
|
|
20
20
|
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
21
21
|
import { scaffolderTranslationRef } from '../../translation.esm.js';
|
|
22
22
|
|
|
23
|
-
const useStyles = makeStyles(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
const useStyles = makeStyles(
|
|
24
|
+
(theme) => ({
|
|
25
|
+
root: {
|
|
26
|
+
gridArea: "pageContent",
|
|
27
|
+
display: "grid",
|
|
28
|
+
gridTemplateAreas: `
|
|
28
29
|
"controls controls"
|
|
29
30
|
"fieldForm preview"
|
|
30
31
|
`,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
})
|
|
32
|
+
gridTemplateRows: "auto 1fr",
|
|
33
|
+
gridTemplateColumns: "1fr 1fr"
|
|
34
|
+
},
|
|
35
|
+
controls: {
|
|
36
|
+
gridArea: "controls",
|
|
37
|
+
display: "flex",
|
|
38
|
+
flexFlow: "row nowrap",
|
|
39
|
+
alignItems: "center",
|
|
40
|
+
margin: theme.spacing(1)
|
|
41
|
+
},
|
|
42
|
+
fieldForm: {
|
|
43
|
+
gridArea: "fieldForm"
|
|
44
|
+
},
|
|
45
|
+
preview: {
|
|
46
|
+
gridArea: "preview"
|
|
47
|
+
}
|
|
48
|
+
}),
|
|
49
|
+
{ name: "ScaffolderCustomFieldExplorer" }
|
|
50
|
+
);
|
|
48
51
|
const CustomFieldExplorer = ({
|
|
49
52
|
customFieldExtensions = [],
|
|
50
53
|
onClose
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomFieldExplorer.esm.js","sources":["../../../src/next/TemplateEditorPage/CustomFieldExplorer.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { StreamLanguage } from '@codemirror/language';\nimport { yaml as yamlSupport } from '@codemirror/legacy-modes/mode/yaml';\nimport Button from '@material-ui/core/Button';\nimport Card from '@material-ui/core/Card';\nimport CardContent from '@material-ui/core/CardContent';\nimport CardHeader from '@material-ui/core/CardHeader';\nimport FormControl from '@material-ui/core/FormControl';\nimport IconButton from '@material-ui/core/IconButton';\nimport InputLabel from '@material-ui/core/InputLabel';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport Select from '@material-ui/core/Select';\nimport { makeStyles } from '@material-ui/core/styles';\nimport CloseIcon from '@material-ui/icons/Close';\nimport CodeMirror from '@uiw/react-codemirror';\nimport React, { useCallback, useMemo, useState } from 'react';\nimport yaml from 'yaml';\nimport { Form } from '@backstage/plugin-scaffolder-react/alpha';\nimport { TemplateEditorForm } from './TemplateEditorForm';\nimport validator from '@rjsf/validator-ajv8';\nimport { FieldExtensionOptions } from '@backstage/plugin-scaffolder-react';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { scaffolderTranslationRef } from '../../translation';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n gridArea: 'pageContent',\n display: 'grid',\n gridTemplateAreas: `\n \"controls controls\"\n \"fieldForm preview\"\n `,\n gridTemplateRows: 'auto 1fr',\n gridTemplateColumns: '1fr 1fr',\n },\n controls: {\n gridArea: 'controls',\n display: 'flex',\n flexFlow: 'row nowrap',\n alignItems: 'center',\n margin: theme.spacing(1),\n },\n fieldForm: {\n gridArea: 'fieldForm',\n },\n preview: {\n gridArea: 'preview',\n },\n}));\n\nexport const CustomFieldExplorer = ({\n customFieldExtensions = [],\n onClose,\n}: {\n customFieldExtensions?: FieldExtensionOptions<any, any>[];\n onClose?: () => void;\n}) => {\n const classes = useStyles();\n const { t } = useTranslationRef(scaffolderTranslationRef);\n const fieldOptions = customFieldExtensions.filter(field => !!field.schema);\n const [selectedField, setSelectedField] = useState(fieldOptions[0]);\n const [fieldFormState, setFieldFormState] = useState({});\n const [refreshKey, setRefreshKey] = useState(Date.now());\n const sampleFieldTemplate = useMemo(\n () =>\n yaml.stringify({\n parameters: [\n {\n title: `${selectedField.name} Example`,\n properties: {\n [selectedField.name]: {\n type: selectedField.schema?.returnValue?.type,\n 'ui:field': selectedField.name,\n 'ui:options': fieldFormState,\n },\n },\n },\n ],\n }),\n [fieldFormState, selectedField],\n );\n\n const fieldComponents = useMemo(() => {\n return Object.fromEntries(\n customFieldExtensions.map(({ name, component }) => [name, component]),\n );\n }, [customFieldExtensions]);\n\n const handleSelectionChange = useCallback(\n (selection: FieldExtensionOptions) => {\n setSelectedField(selection);\n setFieldFormState({});\n },\n [setFieldFormState, setSelectedField],\n );\n\n const handleFieldConfigChange = useCallback(\n (state: {}) => {\n setFieldFormState(state);\n // Force TemplateEditorForm to re-render since some fields\n // may not be responsive to ui:option changes\n setRefreshKey(Date.now());\n },\n [setFieldFormState, setRefreshKey],\n );\n\n return (\n <main className={classes.root}>\n <div className={classes.controls}>\n <FormControl variant=\"outlined\" size=\"small\" fullWidth>\n <InputLabel id=\"select-field-label\">\n {t('templateEditorPage.customFieldExplorer.selectFieldLabel')}\n </InputLabel>\n <Select\n value={selectedField}\n label={t('templateEditorPage.customFieldExplorer.selectFieldLabel')}\n labelId=\"select-field-label\"\n onChange={e =>\n handleSelectionChange(e.target.value as FieldExtensionOptions)\n }\n >\n {fieldOptions.map((option, idx) => (\n <MenuItem key={idx} value={option as any}>\n {option.name}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n\n <IconButton size=\"medium\" onClick={onClose} aria-label=\"Close\">\n <CloseIcon />\n </IconButton>\n </div>\n <div className={classes.fieldForm}>\n <Card>\n <CardHeader\n title={t('templateEditorPage.customFieldExplorer.fieldForm.title')}\n />\n <CardContent>\n <Form\n showErrorList={false}\n fields={{ ...fieldComponents }}\n noHtml5Validate\n formData={fieldFormState}\n formContext={{ fieldFormState }}\n onSubmit={e => handleFieldConfigChange(e.formData)}\n validator={validator}\n schema={selectedField.schema?.uiOptions || {}}\n experimental_defaultFormStateBehavior={{\n allOf: 'populateDefaults',\n }}\n >\n <Button\n variant=\"contained\"\n color=\"primary\"\n type=\"submit\"\n disabled={!selectedField.schema?.uiOptions}\n >\n {t(\n 'templateEditorPage.customFieldExplorer.fieldForm.applyButtonTitle',\n )}\n </Button>\n </Form>\n </CardContent>\n </Card>\n </div>\n <div className={classes.preview}>\n <Card>\n <CardHeader\n title={t('templateEditorPage.customFieldExplorer.preview.title')}\n />\n <CardContent>\n <CodeMirror\n readOnly\n theme=\"dark\"\n height=\"100%\"\n extensions={[StreamLanguage.define(yamlSupport)]}\n value={sampleFieldTemplate}\n />\n </CardContent>\n </Card>\n <TemplateEditorForm\n key={refreshKey}\n content={sampleFieldTemplate}\n contentIsSpec\n fieldExtensions={customFieldExtensions}\n setErrorText={() => null}\n />\n </div>\n </main>\n );\n};\n"],"names":["yamlSupport"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAsCA,MAAM,SAAA,GAAY,WAAW,CA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AAA,CAAOA,MAAW,CAAC,CAAA;AAAA,MAC/C,KAAO,EAAA,mBAAA;AAAA,KAAA;AAAA,GAEX,CACF,CACA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,kBAAA;AAAA,IAAA;AAAA,MACC,GAAK,EAAA,UAAA;AAAA,MACL,OAAS,EAAA,mBAAA;AAAA,MACT,aAAa,EAAA,IAAA;AAAA,MACb,eAAiB,EAAA,qBAAA;AAAA,MACjB,cAAc,MAAM,IAAA;AAAA,KAAA;AAAA,GAExB,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"CustomFieldExplorer.esm.js","sources":["../../../src/next/TemplateEditorPage/CustomFieldExplorer.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { StreamLanguage } from '@codemirror/language';\nimport { yaml as yamlSupport } from '@codemirror/legacy-modes/mode/yaml';\nimport Button from '@material-ui/core/Button';\nimport Card from '@material-ui/core/Card';\nimport CardContent from '@material-ui/core/CardContent';\nimport CardHeader from '@material-ui/core/CardHeader';\nimport FormControl from '@material-ui/core/FormControl';\nimport IconButton from '@material-ui/core/IconButton';\nimport InputLabel from '@material-ui/core/InputLabel';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport Select from '@material-ui/core/Select';\nimport { makeStyles } from '@material-ui/core/styles';\nimport CloseIcon from '@material-ui/icons/Close';\nimport CodeMirror from '@uiw/react-codemirror';\nimport React, { useCallback, useMemo, useState } from 'react';\nimport yaml from 'yaml';\nimport { Form } from '@backstage/plugin-scaffolder-react/alpha';\nimport { TemplateEditorForm } from './TemplateEditorForm';\nimport validator from '@rjsf/validator-ajv8';\nimport { FieldExtensionOptions } from '@backstage/plugin-scaffolder-react';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { scaffolderTranslationRef } from '../../translation';\n\n/** @public */\nexport type ScaffolderCustomFieldExplorerClassKey =\n | 'root'\n | 'controls'\n | 'fieldForm'\n | 'preview';\n\nconst useStyles = makeStyles(\n theme => ({\n root: {\n gridArea: 'pageContent',\n display: 'grid',\n gridTemplateAreas: `\n \"controls controls\"\n \"fieldForm preview\"\n `,\n gridTemplateRows: 'auto 1fr',\n gridTemplateColumns: '1fr 1fr',\n },\n controls: {\n gridArea: 'controls',\n display: 'flex',\n flexFlow: 'row nowrap',\n alignItems: 'center',\n margin: theme.spacing(1),\n },\n fieldForm: {\n gridArea: 'fieldForm',\n },\n preview: {\n gridArea: 'preview',\n },\n }),\n { name: 'ScaffolderCustomFieldExplorer' },\n);\n\nexport const CustomFieldExplorer = ({\n customFieldExtensions = [],\n onClose,\n}: {\n customFieldExtensions?: FieldExtensionOptions<any, any>[];\n onClose?: () => void;\n}) => {\n const classes = useStyles();\n const { t } = useTranslationRef(scaffolderTranslationRef);\n const fieldOptions = customFieldExtensions.filter(field => !!field.schema);\n const [selectedField, setSelectedField] = useState(fieldOptions[0]);\n const [fieldFormState, setFieldFormState] = useState({});\n const [refreshKey, setRefreshKey] = useState(Date.now());\n const sampleFieldTemplate = useMemo(\n () =>\n yaml.stringify({\n parameters: [\n {\n title: `${selectedField.name} Example`,\n properties: {\n [selectedField.name]: {\n type: selectedField.schema?.returnValue?.type,\n 'ui:field': selectedField.name,\n 'ui:options': fieldFormState,\n },\n },\n },\n ],\n }),\n [fieldFormState, selectedField],\n );\n\n const fieldComponents = useMemo(() => {\n return Object.fromEntries(\n customFieldExtensions.map(({ name, component }) => [name, component]),\n );\n }, [customFieldExtensions]);\n\n const handleSelectionChange = useCallback(\n (selection: FieldExtensionOptions) => {\n setSelectedField(selection);\n setFieldFormState({});\n },\n [setFieldFormState, setSelectedField],\n );\n\n const handleFieldConfigChange = useCallback(\n (state: {}) => {\n setFieldFormState(state);\n // Force TemplateEditorForm to re-render since some fields\n // may not be responsive to ui:option changes\n setRefreshKey(Date.now());\n },\n [setFieldFormState, setRefreshKey],\n );\n\n return (\n <main className={classes.root}>\n <div className={classes.controls}>\n <FormControl variant=\"outlined\" size=\"small\" fullWidth>\n <InputLabel id=\"select-field-label\">\n {t('templateEditorPage.customFieldExplorer.selectFieldLabel')}\n </InputLabel>\n <Select\n value={selectedField}\n label={t('templateEditorPage.customFieldExplorer.selectFieldLabel')}\n labelId=\"select-field-label\"\n onChange={e =>\n handleSelectionChange(e.target.value as FieldExtensionOptions)\n }\n >\n {fieldOptions.map((option, idx) => (\n <MenuItem key={idx} value={option as any}>\n {option.name}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n\n <IconButton size=\"medium\" onClick={onClose} aria-label=\"Close\">\n <CloseIcon />\n </IconButton>\n </div>\n <div className={classes.fieldForm}>\n <Card>\n <CardHeader\n title={t('templateEditorPage.customFieldExplorer.fieldForm.title')}\n />\n <CardContent>\n <Form\n showErrorList={false}\n fields={{ ...fieldComponents }}\n noHtml5Validate\n formData={fieldFormState}\n formContext={{ fieldFormState }}\n onSubmit={e => handleFieldConfigChange(e.formData)}\n validator={validator}\n schema={selectedField.schema?.uiOptions || {}}\n experimental_defaultFormStateBehavior={{\n allOf: 'populateDefaults',\n }}\n >\n <Button\n variant=\"contained\"\n color=\"primary\"\n type=\"submit\"\n disabled={!selectedField.schema?.uiOptions}\n >\n {t(\n 'templateEditorPage.customFieldExplorer.fieldForm.applyButtonTitle',\n )}\n </Button>\n </Form>\n </CardContent>\n </Card>\n </div>\n <div className={classes.preview}>\n <Card>\n <CardHeader\n title={t('templateEditorPage.customFieldExplorer.preview.title')}\n />\n <CardContent>\n <CodeMirror\n readOnly\n theme=\"dark\"\n height=\"100%\"\n extensions={[StreamLanguage.define(yamlSupport)]}\n value={sampleFieldTemplate}\n />\n </CardContent>\n </Card>\n <TemplateEditorForm\n key={refreshKey}\n content={sampleFieldTemplate}\n contentIsSpec\n fieldExtensions={customFieldExtensions}\n setErrorText={() => null}\n />\n </div>\n </main>\n );\n};\n"],"names":["yamlSupport"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA6CA,MAAM,SAAY,GAAA,UAAA;AAAA,EAChB,CAAU,KAAA,MAAA;AAAA,IACR,IAAM,EAAA;AAAA,MACJ,QAAU,EAAA,aAAA;AAAA,MACV,OAAS,EAAA,MAAA;AAAA,MACT,iBAAmB,EAAA,CAAA;AAAA;AAAA;AAAA,IAAA,CAAA;AAAA,MAInB,gBAAkB,EAAA,UAAA;AAAA,MAClB,mBAAqB,EAAA,SAAA;AAAA,KACvB;AAAA,IACA,QAAU,EAAA;AAAA,MACR,QAAU,EAAA,UAAA;AAAA,MACV,OAAS,EAAA,MAAA;AAAA,MACT,QAAU,EAAA,YAAA;AAAA,MACV,UAAY,EAAA,QAAA;AAAA,MACZ,MAAA,EAAQ,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,KACzB;AAAA,IACA,SAAW,EAAA;AAAA,MACT,QAAU,EAAA,WAAA;AAAA,KACZ;AAAA,IACA,OAAS,EAAA;AAAA,MACP,QAAU,EAAA,SAAA;AAAA,KACZ;AAAA,GACF,CAAA;AAAA,EACA,EAAE,MAAM,+BAAgC,EAAA;AAC1C,CAAA,CAAA;AAEO,MAAM,sBAAsB,CAAC;AAAA,EAClC,wBAAwB,EAAC;AAAA,EACzB,OAAA;AACF,CAGM,KAAA;AACJ,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAC1B,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,wBAAwB,CAAA,CAAA;AACxD,EAAA,MAAM,eAAe,qBAAsB,CAAA,MAAA,CAAO,WAAS,CAAC,CAAC,MAAM,MAAM,CAAA,CAAA;AACzE,EAAA,MAAM,CAAC,aAAe,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,UAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,EAAE,sDAAsD,CAAA;AAAA,KAAA;AAAA,GACjE,sCACC,WACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,QAAQ,EAAA,IAAA;AAAA,MACR,KAAM,EAAA,MAAA;AAAA,MACN,MAAO,EAAA,MAAA;AAAA,MACP,UAAY,EAAA,CAAC,cAAe,CAAA,MAAA,CAAOA,MAAW,CAAC,CAAA;AAAA,MAC/C,KAAO,EAAA,mBAAA;AAAA,KAAA;AAAA,GAEX,CACF,CACA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,kBAAA;AAAA,IAAA;AAAA,MACC,GAAK,EAAA,UAAA;AAAA,MACL,OAAS,EAAA,mBAAA;AAAA,MACT,aAAa,EAAA,IAAA;AAAA,MACb,eAAiB,EAAA,qBAAA;AAAA,MACjB,cAAc,MAAM,IAAA;AAAA,KAAA;AAAA,GAExB,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -7,34 +7,37 @@ import { TemplateEditorTextArea } from './TemplateEditorTextArea.esm.js';
|
|
|
7
7
|
import { TemplateEditorForm } from './TemplateEditorForm.esm.js';
|
|
8
8
|
import { DryRunResults } from './DryRunResults/DryRunResults.esm.js';
|
|
9
9
|
|
|
10
|
-
const useStyles = makeStyles(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
const useStyles = makeStyles(
|
|
11
|
+
{
|
|
12
|
+
// Reset and fix sizing to make sure scrolling behaves correctly
|
|
13
|
+
root: {
|
|
14
|
+
gridArea: "pageContent",
|
|
15
|
+
display: "grid",
|
|
16
|
+
gridTemplateAreas: `
|
|
16
17
|
"browser editor preview"
|
|
17
18
|
"results results results"
|
|
18
19
|
`,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
20
|
+
gridTemplateColumns: "1fr 3fr 2fr",
|
|
21
|
+
gridTemplateRows: "1fr auto"
|
|
22
|
+
},
|
|
23
|
+
browser: {
|
|
24
|
+
gridArea: "browser",
|
|
25
|
+
overflow: "auto"
|
|
26
|
+
},
|
|
27
|
+
editor: {
|
|
28
|
+
gridArea: "editor",
|
|
29
|
+
overflow: "auto"
|
|
30
|
+
},
|
|
31
|
+
preview: {
|
|
32
|
+
gridArea: "preview",
|
|
33
|
+
overflow: "auto"
|
|
34
|
+
},
|
|
35
|
+
results: {
|
|
36
|
+
gridArea: "results"
|
|
37
|
+
}
|
|
33
38
|
},
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
});
|
|
39
|
+
{ name: "ScaffolderTemplateEditor" }
|
|
40
|
+
);
|
|
38
41
|
const TemplateEditor = (props) => {
|
|
39
42
|
const classes = useStyles();
|
|
40
43
|
const [errorText, setErrorText] = useState();
|
|
@@ -43,7 +46,8 @@ const TemplateEditor = (props) => {
|
|
|
43
46
|
{
|
|
44
47
|
setErrorText,
|
|
45
48
|
fieldExtensions: props.fieldExtensions,
|
|
46
|
-
layouts: props.layouts
|
|
49
|
+
layouts: props.layouts,
|
|
50
|
+
formProps: props.formProps
|
|
47
51
|
}
|
|
48
52
|
)), /* @__PURE__ */ React.createElement("section", { className: classes.results }, /* @__PURE__ */ React.createElement(DryRunResults, null)))));
|
|
49
53
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TemplateEditor.esm.js","sources":["../../../src/next/TemplateEditorPage/TemplateEditor.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { makeStyles } from '@material-ui/core/styles';\nimport React, { useState } from 'react';\nimport type {
|
|
1
|
+
{"version":3,"file":"TemplateEditor.esm.js","sources":["../../../src/next/TemplateEditorPage/TemplateEditor.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { makeStyles } from '@material-ui/core/styles';\nimport React, { useState } from 'react';\nimport type {\n FormProps,\n LayoutOptions,\n} from '@backstage/plugin-scaffolder-react';\nimport { FieldExtensionOptions } from '@backstage/plugin-scaffolder-react';\nimport { TemplateDirectoryAccess } from '../../lib/filesystem';\nimport { DirectoryEditorProvider } from './DirectoryEditorContext';\nimport { TemplateEditorBrowser } from './TemplateEditorBrowser';\nimport { DryRunProvider } from './DryRunContext';\nimport { TemplateEditorTextArea } from './TemplateEditorTextArea';\nimport { TemplateEditorForm } from './TemplateEditorForm';\nimport { DryRunResults } from './DryRunResults';\n\n/** @public */\nexport type ScaffolderTemplateEditorClassKey =\n | 'root'\n | 'browser'\n | 'editor'\n | 'preview'\n | 'results';\n\nconst useStyles = makeStyles(\n {\n // Reset and fix sizing to make sure scrolling behaves correctly\n root: {\n gridArea: 'pageContent',\n display: 'grid',\n gridTemplateAreas: `\n \"browser editor preview\"\n \"results results results\"\n `,\n gridTemplateColumns: '1fr 3fr 2fr',\n gridTemplateRows: '1fr auto',\n },\n browser: {\n gridArea: 'browser',\n overflow: 'auto',\n },\n editor: {\n gridArea: 'editor',\n overflow: 'auto',\n },\n preview: {\n gridArea: 'preview',\n overflow: 'auto',\n },\n results: {\n gridArea: 'results',\n },\n },\n { name: 'ScaffolderTemplateEditor' },\n);\n\nexport const TemplateEditor = (props: {\n directory: TemplateDirectoryAccess;\n fieldExtensions?: FieldExtensionOptions<any, any>[];\n layouts?: LayoutOptions[];\n onClose?: () => void;\n formProps?: FormProps;\n}) => {\n const classes = useStyles();\n\n const [errorText, setErrorText] = useState<string>();\n\n return (\n <DirectoryEditorProvider directory={props.directory}>\n <DryRunProvider>\n <main className={classes.root}>\n <section className={classes.browser}>\n <TemplateEditorBrowser onClose={props.onClose} />\n </section>\n <section className={classes.editor}>\n <TemplateEditorTextArea.DirectoryEditor errorText={errorText} />\n </section>\n <section className={classes.preview}>\n <TemplateEditorForm.DirectoryEditorDryRun\n setErrorText={setErrorText}\n fieldExtensions={props.fieldExtensions}\n layouts={props.layouts}\n formProps={props.formProps}\n />\n </section>\n <section className={classes.results}>\n <DryRunResults />\n </section>\n </main>\n </DryRunProvider>\n </DirectoryEditorProvider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAsCA,MAAM,SAAY,GAAA,UAAA;AAAA,EAChB;AAAA;AAAA,IAEE,IAAM,EAAA;AAAA,MACJ,QAAU,EAAA,aAAA;AAAA,MACV,OAAS,EAAA,MAAA;AAAA,MACT,iBAAmB,EAAA,CAAA;AAAA;AAAA;AAAA,IAAA,CAAA;AAAA,MAInB,mBAAqB,EAAA,aAAA;AAAA,MACrB,gBAAkB,EAAA,UAAA;AAAA,KACpB;AAAA,IACA,OAAS,EAAA;AAAA,MACP,QAAU,EAAA,SAAA;AAAA,MACV,QAAU,EAAA,MAAA;AAAA,KACZ;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,QAAU,EAAA,QAAA;AAAA,MACV,QAAU,EAAA,MAAA;AAAA,KACZ;AAAA,IACA,OAAS,EAAA;AAAA,MACP,QAAU,EA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EAAA,IAAA,CACjB,CACF,CACF,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -122,7 +122,8 @@ function TemplateEditorForm(props) {
|
|
|
122
122
|
onCreate: async (options) => {
|
|
123
123
|
await onDryRun?.(options);
|
|
124
124
|
},
|
|
125
|
-
layouts
|
|
125
|
+
layouts,
|
|
126
|
+
formProps: props.formProps
|
|
126
127
|
}
|
|
127
128
|
))));
|
|
128
129
|
}
|
|
@@ -155,7 +156,8 @@ function TemplateEditorFormDirectoryEditorDryRun(props) {
|
|
|
155
156
|
fieldExtensions,
|
|
156
157
|
setErrorText,
|
|
157
158
|
content,
|
|
158
|
-
layouts
|
|
159
|
+
layouts,
|
|
160
|
+
formProps: props.formProps
|
|
159
161
|
}
|
|
160
162
|
);
|
|
161
163
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TemplateEditorForm.esm.js","sources":["../../../src/next/TemplateEditorPage/TemplateEditorForm.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useApiHolder } from '@backstage/core-plugin-api';\nimport { JsonObject, JsonValue } from '@backstage/types';\nimport { makeStyles } from '@material-ui/core/styles';\nimport React, { Component, ReactNode, useMemo, useState } from 'react';\nimport useDebounce from 'react-use/esm/useDebounce';\nimport yaml from 'yaml';\nimport {\n LayoutOptions,\n TemplateParameterSchema,\n FieldExtensionOptions,\n} from '@backstage/plugin-scaffolder-react';\nimport {\n Stepper,\n createAsyncValidators,\n} from '@backstage/plugin-scaffolder-react/alpha';\nimport { useDryRun } from './DryRunContext';\nimport { useDirectoryEditor } from './DirectoryEditorContext';\n\nconst useStyles = makeStyles({\n containerWrapper: {\n position: 'relative',\n width: '100%',\n height: '100%',\n },\n container: {\n position: 'absolute',\n top: 0,\n bottom: 0,\n left: 0,\n right: 0,\n overflow: 'auto',\n },\n});\n\ninterface ErrorBoundaryProps {\n invalidator: unknown;\n setErrorText(errorText: string | undefined): void;\n children: ReactNode;\n}\n\ninterface ErrorBoundaryState {\n shouldRender: boolean;\n}\n\nclass ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {\n state = {\n shouldRender: true,\n };\n\n componentDidUpdate(prevProps: { invalidator: unknown }) {\n if (prevProps.invalidator !== this.props.invalidator) {\n this.setState({ shouldRender: true });\n }\n }\n\n componentDidCatch(error: Error) {\n this.props.setErrorText(error.message);\n this.setState({ shouldRender: false });\n }\n\n render() {\n return this.state.shouldRender ? this.props.children : null;\n }\n}\n\ninterface TemplateEditorFormProps {\n content?: string;\n /** Setting this to true will cause the content to be parsed as if it is the template entity spec */\n contentIsSpec?: boolean;\n setErrorText: (errorText?: string) => void;\n\n onDryRun?: (data: JsonObject) => Promise<void>;\n fieldExtensions?: FieldExtensionOptions<any, any>[];\n layouts?: LayoutOptions[];\n}\n\nfunction isJsonObject(value: JsonValue | undefined): value is JsonObject {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/** Shows the a template form that is parsed from the provided content */\nexport function TemplateEditorForm(props: TemplateEditorFormProps) {\n const {\n content,\n contentIsSpec,\n onDryRun,\n setErrorText,\n fieldExtensions = [],\n layouts = [],\n } = props;\n const classes = useStyles();\n const apiHolder = useApiHolder();\n\n const [steps, setSteps] = useState<TemplateParameterSchema['steps']>();\n\n const fields = useMemo(() => {\n return Object.fromEntries(\n fieldExtensions.map(({ name, component }) => [name, component]),\n );\n }, [fieldExtensions]);\n\n useDebounce(\n () => {\n try {\n if (!content) {\n setSteps(undefined);\n return;\n }\n const parsed: JsonValue = yaml\n .parseAllDocuments(content)\n .filter(c => c)\n .map(c => c.toJSON())[0];\n\n if (!isJsonObject(parsed)) {\n setSteps(undefined);\n return;\n }\n\n let rootObj = parsed;\n if (!contentIsSpec) {\n const isTemplate =\n String(parsed.kind).toLocaleLowerCase('en-US') === 'template';\n if (!isTemplate) {\n setSteps(undefined);\n return;\n }\n\n rootObj = isJsonObject(parsed.spec) ? parsed.spec : {};\n }\n\n const { parameters } = rootObj;\n\n if (!Array.isArray(parameters)) {\n setErrorText('Template parameters must be an array');\n setSteps(undefined);\n return;\n }\n\n const fieldValidators = Object.fromEntries(\n fieldExtensions.map(({ name, validation }) => [name, validation]),\n );\n\n setErrorText();\n setSteps(\n parameters.flatMap(param =>\n isJsonObject(param)\n ? [\n {\n title: String(param.title),\n schema: param,\n validate: createAsyncValidators(param, fieldValidators, {\n apiHolder,\n }),\n },\n ]\n : [],\n ),\n );\n } catch (e) {\n setErrorText(e.message);\n }\n },\n 250,\n [contentIsSpec, content, apiHolder],\n );\n\n if (!steps) {\n return null;\n }\n\n return (\n <div className={classes.containerWrapper}>\n <div className={classes.container}>\n <ErrorBoundary invalidator={steps} setErrorText={setErrorText}>\n <Stepper\n manifest={{ steps, title: 'Template Editor' }}\n extensions={fieldExtensions}\n components={fields}\n onCreate={async options => {\n await onDryRun?.(options);\n }}\n layouts={layouts}\n />\n </ErrorBoundary>\n </div>\n </div>\n );\n}\n\n/** A version of the TemplateEditorForm that is connected to the DirectoryEditor and DryRun contexts */\nexport function TemplateEditorFormDirectoryEditorDryRun(\n props: Pick<\n TemplateEditorFormProps,\n 'setErrorText' | 'fieldExtensions' | 'layouts'\n >,\n) {\n const { setErrorText, fieldExtensions = [], layouts } = props;\n const dryRun = useDryRun();\n\n const directoryEditor = useDirectoryEditor();\n const { selectedFile } = directoryEditor;\n\n const handleDryRun = async (data: JsonObject) => {\n if (!selectedFile) {\n return;\n }\n\n try {\n await dryRun.execute({\n templateContent: selectedFile.content,\n values: data,\n files: directoryEditor.files,\n });\n setErrorText();\n } catch (e) {\n setErrorText(String(e.cause || e));\n throw e;\n }\n };\n\n const content =\n selectedFile && selectedFile.path.match(/\\.ya?ml$/)\n ? selectedFile.content\n : undefined;\n\n return (\n <TemplateEditorForm\n onDryRun={handleDryRun}\n fieldExtensions={fieldExtensions}\n setErrorText={setErrorText}\n content={content}\n layouts={layouts}\n />\n );\n}\n\nTemplateEditorForm.DirectoryEditorDryRun =\n TemplateEditorFormDirectoryEditorDryRun;\n"],"names":[],"mappings":";;;;;;;;;AAiCA,MAAM,YAAY,UAAW,CAAA;AAAA,EAC3B,gBAAkB,EAAA;AAAA,IAChB,QAAU,EAAA,UAAA;AAAA,IACV,KAAO,EAAA,MAAA;AAAA,IACP,MAAQ,EAAA,MAAA;AAAA,GACV;AAAA,EACA,SAAW,EAAA;AAAA,IACT,QAAU,EAAA,UAAA;AAAA,IACV,GAAK,EAAA,CAAA;AAAA,IACL,MAAQ,EAAA,CAAA;AAAA,IACR,IAAM,EAAA,CAAA;AAAA,IACN,KAAO,EAAA,CAAA;AAAA,IACP,QAAU,EAAA,MAAA;AAAA,GACZ;AACF,CAAC,CAAA,CAAA;AAYD,MAAM,sBAAsB,SAAkD,CAAA;AAAA,EAC5E,KAAQ,GAAA;AAAA,IACN,YAAc,EAAA,IAAA;AAAA,GAChB,CAAA;AAAA,EAEA,mBAAmB,SAAqC,EAAA;AACtD,IAAA,IAAI,SAAU,CAAA,WAAA,KAAgB,IAAK,CAAA,KAAA,CAAM,WAAa,EAAA;AACpD,MAAA,IAAA,CAAK,QAAS,CAAA,EAAE,YAAc,EAAA,IAAA,EAAM,CAAA,CAAA;AAAA,KACtC;AAAA,GACF;AAAA,EAEA,kBAAkB,KAAc,EAAA;AAC9B,IAAK,IAAA,CAAA,KAAA,CAAM,YAAa,CAAA,KAAA,CAAM,OAAO,CAAA,CAAA;AACrC,IAAA,IAAA,CAAK,QAAS,CAAA,EAAE,YAAc,EAAA,KAAA,EAAO,CAAA,CAAA;AAAA,GACvC;AAAA,EAEA,MAAS,GAAA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AA,CAAA;AAEzB,EAAM,MAAA,YAAA,GAAe,OAAO,IAAqB,KAAA;AAC/C,IAAA,IAAI,CAAC,YAAc,EAAA;AACjB,MAAA,OAAA;AAAA,KACF;AAEA,IAAI,IAAA;AACF,MAAA,MAAM,OAAO,OAAQ,CAAA;AAAA,QACnB,iBAAiB,YAAa,CAAA,OAAA;AAAA,QAC9B,MAAQ,EAAA,IAAA;AAAA,QACR,OAAO,eAAgB,CAAA,KAAA;AAAA,OACxB,CAAA,CAAA;AACD,MAAa,YAAA,EAAA,CAAA;AAAA,aACN,CAAG,EAAA;AACV,MAAA,YAAA,CAAa,MAAO,CAAA,CAAA,CAAE,KAAS,IAAA,CAAC,CAAC,CAAA,CAAA;AACjC,MAAM,MAAA,CAAA,CAAA;AAAA,KACR;AAAA,GACF,CAAA;AAEA,EAAM,MAAA,OAAA,GACJ,gBAAgB,YAAa,CAAA,IAAA,CAAK,MAAM,UAAU,CAAA,GAC9C,aAAa,OACb,GAAA,KAAA,CAAA,CAAA;AAEN,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,kBAAA;AAAA,IAAA;AAAA,MACC,QAAU,EAAA,YAAA;AAAA,MACV,eAAA;AAAA,MACA,YAAA;AAAA,MACA,OAAA;AAAA,MACA,OAAA;AAAA,KAAA;AAAA,GACF,CAAA;AAEJ,CAAA;AAEA,kBAAA,CAAmB,qBACjB,GAAA,uCAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"TemplateEditorForm.esm.js","sources":["../../../src/next/TemplateEditorPage/TemplateEditorForm.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useApiHolder } from '@backstage/core-plugin-api';\nimport { JsonObject, JsonValue } from '@backstage/types';\nimport { makeStyles } from '@material-ui/core/styles';\nimport React, { Component, ReactNode, useMemo, useState } from 'react';\nimport useDebounce from 'react-use/esm/useDebounce';\nimport yaml from 'yaml';\nimport {\n LayoutOptions,\n TemplateParameterSchema,\n FieldExtensionOptions,\n FormProps,\n} from '@backstage/plugin-scaffolder-react';\nimport {\n Stepper,\n createAsyncValidators,\n} from '@backstage/plugin-scaffolder-react/alpha';\nimport { useDryRun } from './DryRunContext';\nimport { useDirectoryEditor } from './DirectoryEditorContext';\n\nconst useStyles = makeStyles({\n containerWrapper: {\n position: 'relative',\n width: '100%',\n height: '100%',\n },\n container: {\n position: 'absolute',\n top: 0,\n bottom: 0,\n left: 0,\n right: 0,\n overflow: 'auto',\n },\n});\n\ninterface ErrorBoundaryProps {\n invalidator: unknown;\n setErrorText(errorText: string | undefined): void;\n children: ReactNode;\n}\n\ninterface ErrorBoundaryState {\n shouldRender: boolean;\n}\n\nclass ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {\n state = {\n shouldRender: true,\n };\n\n componentDidUpdate(prevProps: { invalidator: unknown }) {\n if (prevProps.invalidator !== this.props.invalidator) {\n this.setState({ shouldRender: true });\n }\n }\n\n componentDidCatch(error: Error) {\n this.props.setErrorText(error.message);\n this.setState({ shouldRender: false });\n }\n\n render() {\n return this.state.shouldRender ? this.props.children : null;\n }\n}\n\ninterface TemplateEditorFormProps {\n content?: string;\n /** Setting this to true will cause the content to be parsed as if it is the template entity spec */\n contentIsSpec?: boolean;\n setErrorText: (errorText?: string) => void;\n\n onDryRun?: (data: JsonObject) => Promise<void>;\n fieldExtensions?: FieldExtensionOptions<any, any>[];\n layouts?: LayoutOptions[];\n formProps?: FormProps;\n}\n\nfunction isJsonObject(value: JsonValue | undefined): value is JsonObject {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/** Shows the a template form that is parsed from the provided content */\nexport function TemplateEditorForm(props: TemplateEditorFormProps) {\n const {\n content,\n contentIsSpec,\n onDryRun,\n setErrorText,\n fieldExtensions = [],\n layouts = [],\n } = props;\n const classes = useStyles();\n const apiHolder = useApiHolder();\n\n const [steps, setSteps] = useState<TemplateParameterSchema['steps']>();\n\n const fields = useMemo(() => {\n return Object.fromEntries(\n fieldExtensions.map(({ name, component }) => [name, component]),\n );\n }, [fieldExtensions]);\n\n useDebounce(\n () => {\n try {\n if (!content) {\n setSteps(undefined);\n return;\n }\n const parsed: JsonValue = yaml\n .parseAllDocuments(content)\n .filter(c => c)\n .map(c => c.toJSON())[0];\n\n if (!isJsonObject(parsed)) {\n setSteps(undefined);\n return;\n }\n\n let rootObj = parsed;\n if (!contentIsSpec) {\n const isTemplate =\n String(parsed.kind).toLocaleLowerCase('en-US') === 'template';\n if (!isTemplate) {\n setSteps(undefined);\n return;\n }\n\n rootObj = isJsonObject(parsed.spec) ? parsed.spec : {};\n }\n\n const { parameters } = rootObj;\n\n if (!Array.isArray(parameters)) {\n setErrorText('Template parameters must be an array');\n setSteps(undefined);\n return;\n }\n\n const fieldValidators = Object.fromEntries(\n fieldExtensions.map(({ name, validation }) => [name, validation]),\n );\n\n setErrorText();\n setSteps(\n parameters.flatMap(param =>\n isJsonObject(param)\n ? [\n {\n title: String(param.title),\n schema: param,\n validate: createAsyncValidators(param, fieldValidators, {\n apiHolder,\n }),\n },\n ]\n : [],\n ),\n );\n } catch (e) {\n setErrorText(e.message);\n }\n },\n 250,\n [contentIsSpec, content, apiHolder],\n );\n\n if (!steps) {\n return null;\n }\n\n return (\n <div className={classes.containerWrapper}>\n <div className={classes.container}>\n <ErrorBoundary invalidator={steps} setErrorText={setErrorText}>\n <Stepper\n manifest={{ steps, title: 'Template Editor' }}\n extensions={fieldExtensions}\n components={fields}\n onCreate={async options => {\n await onDryRun?.(options);\n }}\n layouts={layouts}\n formProps={props.formProps}\n />\n </ErrorBoundary>\n </div>\n </div>\n );\n}\n\n/** A version of the TemplateEditorForm that is connected to the DirectoryEditor and DryRun contexts */\nexport function TemplateEditorFormDirectoryEditorDryRun(\n props: Pick<\n TemplateEditorFormProps,\n 'setErrorText' | 'fieldExtensions' | 'layouts' | 'formProps'\n >,\n) {\n const { setErrorText, fieldExtensions = [], layouts } = props;\n const dryRun = useDryRun();\n\n const directoryEditor = useDirectoryEditor();\n const { selectedFile } = directoryEditor;\n\n const handleDryRun = async (data: JsonObject) => {\n if (!selectedFile) {\n return;\n }\n\n try {\n await dryRun.execute({\n templateContent: selectedFile.content,\n values: data,\n files: directoryEditor.files,\n });\n setErrorText();\n } catch (e) {\n setErrorText(String(e.cause || e));\n throw e;\n }\n };\n\n const content =\n selectedFile && selectedFile.path.match(/\\.ya?ml$/)\n ? selectedFile.content\n : undefined;\n\n return (\n <TemplateEditorForm\n onDryRun={handleDryRun}\n fieldExtensions={fieldExtensions}\n setErrorText={setErrorText}\n content={content}\n layouts={layouts}\n formProps={props.formProps}\n />\n );\n}\n\nTemplateEditorForm.DirectoryEditorDryRun =\n TemplateEditorFormDirectoryEditorDryRun;\n"],"names":[],"mappings":";;;;;;;;;AAkCA,MAAM,YAAY,UAAW,CAAA;AAAA,EAC3B,gBAAkB,EAAA;AAAA,IAChB,QAAU,EAAA,UAAA;AAAA,IACV,KAAO,EAAA,MAAA;AAAA,IACP,MAAQ,EAAA,MAAA;AAAA,GACV;AAAA,EACA,SAAW,EAAA;AAAA,IACT,QAAU,EAAA,UAAA;AAAA,IACV,GAAK,EAAA,CAAA;AAAA,IACL,MAAQ,EAAA,CAAA;AAAA,IACR,IAAM,EAAA,CAAA;AAAA,IACN,KAAO,EAAA,CAAA;AAAA,IACP,QAAU,EAAA,MAAA;AAAA,GACZ;AACF,CAAC,CAAA,CAAA;AAYD,MAAM,sBAAsB,SAAkD,CAAA;AAAA,EAC5E,KAAQ,GAAA;AAAA,IACN,YAAc,EAAA,IAAA;AAAA,GAChB,CAAA;AAAA,EAEA,mB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AAAA,MACA,OAAA;AAAA,MACA,WAAW,KAAM,CAAA,SAAA;AAAA,KAAA;AAAA,GACnB,CAAA;AAEJ,CAAA;AAEA,kBAAA,CAAmB,qBACjB,GAAA,uCAAA;;;;"}
|
|
@@ -33,7 +33,8 @@ function TemplateEditorPage(props) {
|
|
|
33
33
|
directory: selection.directory,
|
|
34
34
|
fieldExtensions: props.customFieldExtensions,
|
|
35
35
|
onClose: () => setSelection(void 0),
|
|
36
|
-
layouts: props.layouts
|
|
36
|
+
layouts: props.layouts,
|
|
37
|
+
formProps: props.formProps
|
|
37
38
|
}
|
|
38
39
|
);
|
|
39
40
|
} else if (selection?.type === "form") {
|
|
@@ -43,7 +44,8 @@ function TemplateEditorPage(props) {
|
|
|
43
44
|
defaultPreviewTemplate: props.defaultPreviewTemplate,
|
|
44
45
|
customFieldExtensions: props.customFieldExtensions,
|
|
45
46
|
onClose: () => setSelection(void 0),
|
|
46
|
-
layouts: props.layouts
|
|
47
|
+
layouts: props.layouts,
|
|
48
|
+
formProps: props.formProps
|
|
47
49
|
}
|
|
48
50
|
);
|
|
49
51
|
} else if (selection?.type === "field-explorer") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TemplateEditorPage.esm.js","sources":["../../../src/next/TemplateEditorPage/TemplateEditorPage.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useState } from 'react';\nimport { Content, Header, Page } from '@backstage/core-components';\nimport {\n TemplateDirectoryAccess,\n WebFileSystemAccess,\n} from '../../lib/filesystem';\nimport { CustomFieldExplorer } from './CustomFieldExplorer';\nimport { TemplateEditor } from './TemplateEditor';\nimport { TemplateFormPreviewer } from './TemplateFormPreviewer';\nimport {\n FieldExtensionOptions,\n type LayoutOptions,\n} from '@backstage/plugin-scaffolder-react';\nimport { TemplateEditorIntro } from './TemplateEditorIntro';\nimport { ScaffolderPageContextMenu } from '@backstage/plugin-scaffolder-react/alpha';\nimport { useNavigate } from 'react-router-dom';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport {\n actionsRouteRef,\n rootRouteRef,\n scaffolderListTaskRouteRef,\n} from '../../routes';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { scaffolderTranslationRef } from '../../translation';\n\ntype Selection =\n | {\n type: 'local';\n directory: TemplateDirectoryAccess;\n }\n | {\n type: 'form';\n }\n | {\n type: 'field-explorer';\n };\n\ninterface TemplateEditorPageProps {\n defaultPreviewTemplate?: string;\n customFieldExtensions?: FieldExtensionOptions<any, any>[];\n layouts?: LayoutOptions[];\n}\n\nexport function TemplateEditorPage(props: TemplateEditorPageProps) {\n const [selection, setSelection] = useState<Selection>();\n const navigate = useNavigate();\n const actionsLink = useRouteRef(actionsRouteRef);\n const tasksLink = useRouteRef(scaffolderListTaskRouteRef);\n const createLink = useRouteRef(rootRouteRef);\n const { t } = useTranslationRef(scaffolderTranslationRef);\n\n const scaffolderPageContextMenuProps = {\n onEditorClicked: undefined,\n onActionsClicked: () => navigate(actionsLink()),\n onTasksClicked: () => navigate(tasksLink()),\n onCreateClicked: () => navigate(createLink()),\n };\n\n let content: JSX.Element | null = null;\n if (selection?.type === 'local') {\n content = (\n <TemplateEditor\n directory={selection.directory}\n fieldExtensions={props.customFieldExtensions}\n onClose={() => setSelection(undefined)}\n layouts={props.layouts}\n />\n );\n } else if (selection?.type === 'form') {\n content = (\n <TemplateFormPreviewer\n defaultPreviewTemplate={props.defaultPreviewTemplate}\n customFieldExtensions={props.customFieldExtensions}\n onClose={() => setSelection(undefined)}\n layouts={props.layouts}\n />\n );\n } else if (selection?.type === 'field-explorer') {\n content = (\n <CustomFieldExplorer\n customFieldExtensions={props.customFieldExtensions}\n onClose={() => setSelection(undefined)}\n />\n );\n } else {\n content = (\n <Content>\n <TemplateEditorIntro\n onSelect={option => {\n if (option === 'local') {\n WebFileSystemAccess.requestDirectoryAccess()\n .then(directory => setSelection({ type: 'local', directory }))\n .catch(() => {});\n } else if (option === 'form') {\n setSelection({ type: 'form' });\n } else if (option === 'field-explorer') {\n setSelection({ type: 'field-explorer' });\n }\n }}\n />\n </Content>\n );\n }\n\n return (\n <Page themeId=\"home\">\n <Header\n title={t('templateEditorPage.title')}\n subtitle={t('templateEditorPage.subtitle')}\n >\n <ScaffolderPageContextMenu {...scaffolderPageContextMenuProps} />\n </Header>\n {content}\n </Page>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"TemplateEditorPage.esm.js","sources":["../../../src/next/TemplateEditorPage/TemplateEditorPage.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useState } from 'react';\nimport { Content, Header, Page } from '@backstage/core-components';\nimport {\n TemplateDirectoryAccess,\n WebFileSystemAccess,\n} from '../../lib/filesystem';\nimport { CustomFieldExplorer } from './CustomFieldExplorer';\nimport { TemplateEditor } from './TemplateEditor';\nimport { TemplateFormPreviewer } from './TemplateFormPreviewer';\nimport {\n FieldExtensionOptions,\n FormProps,\n type LayoutOptions,\n} from '@backstage/plugin-scaffolder-react';\nimport { TemplateEditorIntro } from './TemplateEditorIntro';\nimport { ScaffolderPageContextMenu } from '@backstage/plugin-scaffolder-react/alpha';\nimport { useNavigate } from 'react-router-dom';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport {\n actionsRouteRef,\n rootRouteRef,\n scaffolderListTaskRouteRef,\n} from '../../routes';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { scaffolderTranslationRef } from '../../translation';\n\ntype Selection =\n | {\n type: 'local';\n directory: TemplateDirectoryAccess;\n }\n | {\n type: 'form';\n }\n | {\n type: 'field-explorer';\n };\n\ninterface TemplateEditorPageProps {\n defaultPreviewTemplate?: string;\n customFieldExtensions?: FieldExtensionOptions<any, any>[];\n layouts?: LayoutOptions[];\n formProps?: FormProps;\n}\n\nexport function TemplateEditorPage(props: TemplateEditorPageProps) {\n const [selection, setSelection] = useState<Selection>();\n const navigate = useNavigate();\n const actionsLink = useRouteRef(actionsRouteRef);\n const tasksLink = useRouteRef(scaffolderListTaskRouteRef);\n const createLink = useRouteRef(rootRouteRef);\n const { t } = useTranslationRef(scaffolderTranslationRef);\n\n const scaffolderPageContextMenuProps = {\n onEditorClicked: undefined,\n onActionsClicked: () => navigate(actionsLink()),\n onTasksClicked: () => navigate(tasksLink()),\n onCreateClicked: () => navigate(createLink()),\n };\n\n let content: JSX.Element | null = null;\n if (selection?.type === 'local') {\n content = (\n <TemplateEditor\n directory={selection.directory}\n fieldExtensions={props.customFieldExtensions}\n onClose={() => setSelection(undefined)}\n layouts={props.layouts}\n formProps={props.formProps}\n />\n );\n } else if (selection?.type === 'form') {\n content = (\n <TemplateFormPreviewer\n defaultPreviewTemplate={props.defaultPreviewTemplate}\n customFieldExtensions={props.customFieldExtensions}\n onClose={() => setSelection(undefined)}\n layouts={props.layouts}\n formProps={props.formProps}\n />\n );\n } else if (selection?.type === 'field-explorer') {\n content = (\n <CustomFieldExplorer\n customFieldExtensions={props.customFieldExtensions}\n onClose={() => setSelection(undefined)}\n />\n );\n } else {\n content = (\n <Content>\n <TemplateEditorIntro\n onSelect={option => {\n if (option === 'local') {\n WebFileSystemAccess.requestDirectoryAccess()\n .then(directory => setSelection({ type: 'local', directory }))\n .catch(() => {});\n } else if (option === 'form') {\n setSelection({ type: 'form' });\n } else if (option === 'field-explorer') {\n setSelection({ type: 'field-explorer' });\n }\n }}\n />\n </Content>\n );\n }\n\n return (\n <Page themeId=\"home\">\n <Header\n title={t('templateEditorPage.title')}\n subtitle={t('templateEditorPage.subtitle')}\n >\n <ScaffolderPageContextMenu {...scaffolderPageContextMenuProps} />\n </Header>\n {content}\n </Page>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;AA4DO,SAAS,mBAAmB,KAAgC,EAAA;AACjE,EAAA,MAAM,CAAC,SAAA,EAAW,YAAY,CAAA,GAAI,QAAoB,EAAA,CAAA;AACtD,EAAA,MAAM,WAAW,WAAY,EAAA,CAAA;AAC7B,EAAM,MAAA,WAAA,GAAc,YAAY,eAAe,CAAA,CAAA;AAC/C,EAAM,MAAA,SAAA,GAAY,YAAY,0BAA0B,CAAA,CAAA;AACxD,EAAM,MAAA,UAAA,GAAa,YAAY,YAAY,CAAA,CAAA;AAC3C,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,wBAAwB,CAAA,CAAA;AAExD,EAAA,MAAM,8BAAiC,GAAA;AAAA,IACrC,eAAiB,EAAA,KAAA,CAAA;AAAA,IACjB,gBAAkB,EAAA,MAAM,QAAS,CAAA,WAAA,EAAa,CAAA;AAAA,IAC9C,cAAgB,EAAA,MAAM,QAAS,CAAA,SAAA,EAAW,CAAA;AAAA,IAC1C,eAAiB,EAAA,MAAM,QAAS,CAAA,UAAA,EAAY,CAAA;AAAA,GAC9C,CAAA;AAEA,EAAA,IAAI,OAA8B,GAAA,IAAA,CAAA;AAClC,EAAI,IAAA,SAAA,EAAW,SAAS,OAAS,EAAA;AAC/B,IACE,OAAA,mBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,cAAA;AAAA,MAAA;AAAA,QACC,WAAW,SAAU,CAAA,SAAA;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AAA,IAAW,WAAW,MAAQ,EAAA;AAC5B,YAAa,YAAA,CAAA,EAAE,IAAM,EAAA,MAAA,EAAQ,CAAA,CAAA;AAAA,WAC/B,MAAA,IAAW,WAAW,gBAAkB,EAAA;AACtC,YAAa,YAAA,CAAA,EAAE,IAAM,EAAA,gBAAA,EAAkB,CAAA,CAAA;AAAA,WACzC;AAAA,SACF;AAAA,OAAA;AAAA,KAEJ,CAAA,CAAA;AAAA,GAEJ;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,OAAA,EAAQ,MACZ,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,MAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,EAAE,0BAA0B,CAAA;AAAA,MACnC,QAAA,EAAU,EAAE,6BAA6B,CAAA;AAAA,KAAA;AAAA,oBAEzC,KAAA,CAAA,aAAA,CAAC,yBAA2B,EAAA,EAAA,GAAG,8BAAgC,EAAA,CAAA;AAAA,KAEhE,OACH,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -54,36 +54,40 @@ steps:
|
|
|
54
54
|
values:
|
|
55
55
|
name: \${{parameters.name}}
|
|
56
56
|
`;
|
|
57
|
-
const useStyles = makeStyles(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
const useStyles = makeStyles(
|
|
58
|
+
(theme) => ({
|
|
59
|
+
root: {
|
|
60
|
+
gridArea: "pageContent",
|
|
61
|
+
display: "grid",
|
|
62
|
+
gridTemplateAreas: `
|
|
62
63
|
"controls controls"
|
|
63
64
|
"textArea preview"
|
|
64
65
|
`,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
})
|
|
66
|
+
gridTemplateRows: "auto 1fr",
|
|
67
|
+
gridTemplateColumns: "1fr 1fr"
|
|
68
|
+
},
|
|
69
|
+
controls: {
|
|
70
|
+
gridArea: "controls",
|
|
71
|
+
display: "flex",
|
|
72
|
+
flexFlow: "row nowrap",
|
|
73
|
+
alignItems: "center",
|
|
74
|
+
margin: theme.spacing(1)
|
|
75
|
+
},
|
|
76
|
+
textArea: {
|
|
77
|
+
gridArea: "textArea"
|
|
78
|
+
},
|
|
79
|
+
preview: {
|
|
80
|
+
gridArea: "preview"
|
|
81
|
+
}
|
|
82
|
+
}),
|
|
83
|
+
{ name: "ScaffolderTemplateFormPreviewer" }
|
|
84
|
+
);
|
|
82
85
|
const TemplateFormPreviewer = ({
|
|
83
86
|
defaultPreviewTemplate = EXAMPLE_TEMPLATE_PARAMS_YAML,
|
|
84
87
|
customFieldExtensions = [],
|
|
85
88
|
onClose,
|
|
86
|
-
layouts = []
|
|
89
|
+
layouts = [],
|
|
90
|
+
formProps
|
|
87
91
|
}) => {
|
|
88
92
|
const classes = useStyles();
|
|
89
93
|
const { t } = useTranslationRef(scaffolderTranslationRef);
|
|
@@ -151,7 +155,8 @@ const TemplateFormPreviewer = ({
|
|
|
151
155
|
contentIsSpec: true,
|
|
152
156
|
fieldExtensions: customFieldExtensions,
|
|
153
157
|
setErrorText,
|
|
154
|
-
layouts
|
|
158
|
+
layouts,
|
|
159
|
+
formProps
|
|
155
160
|
}
|
|
156
161
|
))));
|
|
157
162
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TemplateFormPreviewer.esm.js","sources":["../../../src/next/TemplateEditorPage/TemplateFormPreviewer.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { Entity } from '@backstage/catalog-model';\nimport { alertApiRef, useApi } from '@backstage/core-plugin-api';\nimport {\n catalogApiRef,\n humanizeEntityRef,\n} from '@backstage/plugin-catalog-react';\nimport FormControl from '@material-ui/core/FormControl';\nimport IconButton from '@material-ui/core/IconButton';\nimport InputLabel from '@material-ui/core/InputLabel';\nimport LinearProgress from '@material-ui/core/LinearProgress';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport Select from '@material-ui/core/Select';\nimport { makeStyles } from '@material-ui/core/styles';\nimport CloseIcon from '@material-ui/icons/Close';\nimport React, { useCallback, useState } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport yaml from 'yaml';\nimport {\n LayoutOptions,\n FieldExtensionOptions,\n} from '@backstage/plugin-scaffolder-react';\nimport { TemplateEditorForm } from './TemplateEditorForm';\nimport { TemplateEditorTextArea } from './TemplateEditorTextArea';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { scaffolderTranslationRef } from '../../translation';\n\nconst EXAMPLE_TEMPLATE_PARAMS_YAML = `# Edit the template parameters below to see how they will render in the scaffolder form UI\nparameters:\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\nsteps:\n - id: fetch-base\n name: Fetch Base\n action: fetch:template\n input:\n url: ./template\n values:\n name: \\${{parameters.name}}\n`;\n\ntype TemplateOption = {\n label: string;\n value: Entity;\n};\n\nconst useStyles = makeStyles(theme => ({\n root: {\n gridArea: 'pageContent',\n display: 'grid',\n gridTemplateAreas: `\n \"controls controls\"\n \"textArea preview\"\n `,\n gridTemplateRows: 'auto 1fr',\n gridTemplateColumns: '1fr 1fr',\n },\n controls: {\n gridArea: 'controls',\n display: 'flex',\n flexFlow: 'row nowrap',\n alignItems: 'center',\n margin: theme.spacing(1),\n },\n textArea: {\n gridArea: 'textArea',\n },\n preview: {\n gridArea: 'preview',\n },\n}));\n\nexport const TemplateFormPreviewer = ({\n defaultPreviewTemplate = EXAMPLE_TEMPLATE_PARAMS_YAML,\n customFieldExtensions = [],\n onClose,\n layouts = [],\n}: {\n defaultPreviewTemplate?: string;\n customFieldExtensions?: FieldExtensionOptions<any, any>[];\n onClose?: () => void;\n layouts?: LayoutOptions[];\n}) => {\n const classes = useStyles();\n const { t } = useTranslationRef(scaffolderTranslationRef);\n const alertApi = useApi(alertApiRef);\n const catalogApi = useApi(catalogApiRef);\n const [selectedTemplate, setSelectedTemplate] = useState('');\n const [errorText, setErrorText] = useState<string>();\n const [templateOptions, setTemplateOptions] = useState<TemplateOption[]>([]);\n const [templateYaml, setTemplateYaml] = useState(defaultPreviewTemplate);\n\n const { loading } = useAsync(\n () =>\n catalogApi\n .getEntities({\n filter: { kind: 'template' },\n fields: [\n 'kind',\n 'metadata.namespace',\n 'metadata.name',\n 'metadata.title',\n 'spec.parameters',\n 'spec.steps',\n 'spec.output',\n ],\n })\n .then(({ items }) =>\n setTemplateOptions(\n items.map(template => ({\n label:\n template.metadata.title ??\n humanizeEntityRef(template, { defaultKind: 'template' }),\n value: template,\n })),\n ),\n )\n .catch(e =>\n alertApi.post({\n message: `Error loading exisiting templates: ${e.message}`,\n severity: 'error',\n }),\n ),\n [catalogApi],\n );\n\n const handleSelectChange = useCallback(\n // TODO(Rugvip): Afaik this should be Entity, but didn't want to make runtime changes while fixing types\n (selected: any) => {\n setSelectedTemplate(selected);\n setTemplateYaml(yaml.stringify(selected.spec));\n },\n [setTemplateYaml],\n );\n\n return (\n <>\n {loading && <LinearProgress />}\n <main className={classes.root}>\n <div className={classes.controls}>\n <FormControl variant=\"outlined\" size=\"small\" fullWidth>\n <InputLabel id=\"select-template-label\">\n {t('templateEditorPage.templateFormPreviewer.title')}\n </InputLabel>\n <Select\n value={selectedTemplate}\n label={t('templateEditorPage.templateFormPreviewer.title')}\n labelId=\"select-template-label\"\n onChange={e => handleSelectChange(e.target.value)}\n >\n {templateOptions.map((option, idx) => (\n <MenuItem key={idx} value={option.value as any}>\n {option.label}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n\n <IconButton size=\"medium\" onClick={onClose}>\n <CloseIcon />\n </IconButton>\n </div>\n <div className={classes.textArea}>\n <TemplateEditorTextArea\n content={templateYaml}\n onUpdate={setTemplateYaml}\n errorText={errorText}\n />\n </div>\n <div className={classes.preview}>\n <TemplateEditorForm\n content={templateYaml}\n contentIsSpec\n fieldExtensions={customFieldExtensions}\n setErrorText={setErrorText}\n layouts={layouts}\n />\n </div>\n </main>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAyCA,MAAM,4BAA+B,GAAA,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,CAAA,CAAA;AA4CrC,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,IAAM,EAAA;AAAA,IACJ,QAAU,EAAA,aAAA;AAAA,IACV,OAAS,EAAA,MAAA;AAAA,IACT,iBAAmB,EAAA,CAAA;AAAA;AAAA;AAAA,IAAA,CAAA;AAAA,IAInB,gBAAkB,EAAA,UAAA;AAAA,IAClB,mBAAqB,EAAA,SAAA;AAAA,GACvB;AAAA,EACA,QAAU,EAAA;AAAA,IACR,QAAU,EAAA,UAAA;AAAA,IACV,OAAS,EAAA,MAAA;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ACb,eAAiB,EAAA,qBAAA;AAAA,MACjB,YAAA;AAAA,MACA,OAAA;AAAA,KAAA;AAAA,GAEJ,CACF,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"TemplateFormPreviewer.esm.js","sources":["../../../src/next/TemplateEditorPage/TemplateFormPreviewer.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { Entity } from '@backstage/catalog-model';\nimport { alertApiRef, useApi } from '@backstage/core-plugin-api';\nimport {\n catalogApiRef,\n humanizeEntityRef,\n} from '@backstage/plugin-catalog-react';\nimport FormControl from '@material-ui/core/FormControl';\nimport IconButton from '@material-ui/core/IconButton';\nimport InputLabel from '@material-ui/core/InputLabel';\nimport LinearProgress from '@material-ui/core/LinearProgress';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport Select from '@material-ui/core/Select';\nimport { makeStyles } from '@material-ui/core/styles';\nimport CloseIcon from '@material-ui/icons/Close';\nimport React, { useCallback, useState } from 'react';\nimport useAsync from 'react-use/esm/useAsync';\nimport yaml from 'yaml';\nimport {\n LayoutOptions,\n FieldExtensionOptions,\n FormProps,\n} from '@backstage/plugin-scaffolder-react';\nimport { TemplateEditorForm } from './TemplateEditorForm';\nimport { TemplateEditorTextArea } from './TemplateEditorTextArea';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { scaffolderTranslationRef } from '../../translation';\n\nconst EXAMPLE_TEMPLATE_PARAMS_YAML = `# Edit the template parameters below to see how they will render in the scaffolder form UI\nparameters:\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\nsteps:\n - id: fetch-base\n name: Fetch Base\n action: fetch:template\n input:\n url: ./template\n values:\n name: \\${{parameters.name}}\n`;\n\ntype TemplateOption = {\n label: string;\n value: Entity;\n};\n\n/** @public */\nexport type ScaffolderTemplateFormPreviewerClassKey =\n | 'root'\n | 'controls'\n | 'textArea'\n | 'preview';\n\nconst useStyles = makeStyles(\n theme => ({\n root: {\n gridArea: 'pageContent',\n display: 'grid',\n gridTemplateAreas: `\n \"controls controls\"\n \"textArea preview\"\n `,\n gridTemplateRows: 'auto 1fr',\n gridTemplateColumns: '1fr 1fr',\n },\n controls: {\n gridArea: 'controls',\n display: 'flex',\n flexFlow: 'row nowrap',\n alignItems: 'center',\n margin: theme.spacing(1),\n },\n textArea: {\n gridArea: 'textArea',\n },\n preview: {\n gridArea: 'preview',\n },\n }),\n { name: 'ScaffolderTemplateFormPreviewer' },\n);\n\nexport const TemplateFormPreviewer = ({\n defaultPreviewTemplate = EXAMPLE_TEMPLATE_PARAMS_YAML,\n customFieldExtensions = [],\n onClose,\n layouts = [],\n formProps,\n}: {\n defaultPreviewTemplate?: string;\n customFieldExtensions?: FieldExtensionOptions<any, any>[];\n onClose?: () => void;\n layouts?: LayoutOptions[];\n formProps?: FormProps;\n}) => {\n const classes = useStyles();\n const { t } = useTranslationRef(scaffolderTranslationRef);\n const alertApi = useApi(alertApiRef);\n const catalogApi = useApi(catalogApiRef);\n const [selectedTemplate, setSelectedTemplate] = useState('');\n const [errorText, setErrorText] = useState<string>();\n const [templateOptions, setTemplateOptions] = useState<TemplateOption[]>([]);\n const [templateYaml, setTemplateYaml] = useState(defaultPreviewTemplate);\n\n const { loading } = useAsync(\n () =>\n catalogApi\n .getEntities({\n filter: { kind: 'template' },\n fields: [\n 'kind',\n 'metadata.namespace',\n 'metadata.name',\n 'metadata.title',\n 'spec.parameters',\n 'spec.steps',\n 'spec.output',\n ],\n })\n .then(({ items }) =>\n setTemplateOptions(\n items.map(template => ({\n label:\n template.metadata.title ??\n humanizeEntityRef(template, { defaultKind: 'template' }),\n value: template,\n })),\n ),\n )\n .catch(e =>\n alertApi.post({\n message: `Error loading exisiting templates: ${e.message}`,\n severity: 'error',\n }),\n ),\n [catalogApi],\n );\n\n const handleSelectChange = useCallback(\n // TODO(Rugvip): Afaik this should be Entity, but didn't want to make runtime changes while fixing types\n (selected: any) => {\n setSelectedTemplate(selected);\n setTemplateYaml(yaml.stringify(selected.spec));\n },\n [setTemplateYaml],\n );\n\n return (\n <>\n {loading && <LinearProgress />}\n <main className={classes.root}>\n <div className={classes.controls}>\n <FormControl variant=\"outlined\" size=\"small\" fullWidth>\n <InputLabel id=\"select-template-label\">\n {t('templateEditorPage.templateFormPreviewer.title')}\n </InputLabel>\n <Select\n value={selectedTemplate}\n label={t('templateEditorPage.templateFormPreviewer.title')}\n labelId=\"select-template-label\"\n onChange={e => handleSelectChange(e.target.value)}\n >\n {templateOptions.map((option, idx) => (\n <MenuItem key={idx} value={option.value as any}>\n {option.label}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n\n <IconButton size=\"medium\" onClick={onClose}>\n <CloseIcon />\n </IconButton>\n </div>\n <div className={classes.textArea}>\n <TemplateEditorTextArea\n content={templateYaml}\n onUpdate={setTemplateYaml}\n errorText={errorText}\n />\n </div>\n <div className={classes.preview}>\n <TemplateEditorForm\n content={templateYaml}\n contentIsSpec\n fieldExtensions={customFieldExtensions}\n setErrorText={setErrorText}\n layouts={layouts}\n formProps={formProps}\n />\n </div>\n </main>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AA0CA,MAAM,4BAA+B,GAAA,CAAA;AAAA;AAAA;AAAA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O,KAC/B,EAAA,EAAA,MAAA,CAAO,KACV,CACD,CAAA;AAAA,GAEL,CAEA,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,IAAA,EAAK,UAAS,OAAS,EAAA,OAAA,EAAA,kBAChC,KAAA,CAAA,aAAA,CAAA,SAAA,EAAA,IAAU,CACb,CACF,CAAA,sCACC,KAAI,EAAA,EAAA,SAAA,EAAW,QAAQ,QACtB,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,sBAAA;AAAA,IAAA;AAAA,MACC,OAAS,EAAA,YAAA;AAAA,MACT,QAAU,EAAA,eAAA;AAAA,MACV,SAAA;AAAA,KAAA;AAAA,GAEJ,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,KAAI,EAAA,EAAA,SAAA,EAAW,QAAQ,OACtB,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,kBAAA;AAAA,IAAA;AAAA,MACC,OAAS,EAAA,YAAA;AAAA,MACT,aAAa,EAAA,IAAA;AAAA,MACb,eAAiB,EAAA,qBAAA;AAAA,MACjB,YAAA;AAAA,MACA,OAAA;AAAA,MACA,SAAA;AAAA,KAAA;AAAA,GAEJ,CACF,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -77,7 +77,7 @@ const TemplateListPage = (props) => {
|
|
|
77
77
|
...headerOptions
|
|
78
78
|
},
|
|
79
79
|
/* @__PURE__ */ React.createElement(ScaffolderPageContextMenu, { ...scaffolderPageContextMenuProps })
|
|
80
|
-
), /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(ContentHeader,
|
|
80
|
+
), /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(ContentHeader, null, /* @__PURE__ */ React.createElement(
|
|
81
81
|
RegisterExistingButton,
|
|
82
82
|
{
|
|
83
83
|
title: t(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TemplateListPage.esm.js","sources":["../../../src/next/TemplateListPage/TemplateListPage.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useCallback } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport { useApp, useRouteRef } from '@backstage/core-plugin-api';\n\nimport {\n Content,\n ContentHeader,\n DocsIcon,\n Header,\n Page,\n SupportButton,\n} from '@backstage/core-components';\nimport {\n EntityKindPicker,\n EntityListProvider,\n EntitySearchBar,\n EntityTagPicker,\n CatalogFilterLayout,\n UserListPicker,\n EntityOwnerPicker,\n} from '@backstage/plugin-catalog-react';\nimport {\n ScaffolderPageContextMenu,\n TemplateCategoryPicker,\n TemplateGroups,\n} from '@backstage/plugin-scaffolder-react/alpha';\n\nimport { RegisterExistingButton } from './RegisterExistingButton';\nimport {\n actionsRouteRef,\n editRouteRef,\n registerComponentRouteRef,\n scaffolderListTaskRouteRef,\n selectedTemplateRouteRef,\n viewTechDocRouteRef,\n} from '../../routes';\nimport { parseEntityRef, stringifyEntityRef } from '@backstage/catalog-model';\nimport { TemplateGroupFilter } from '@backstage/plugin-scaffolder-react';\nimport {\n TranslationFunction,\n useTranslationRef,\n} from '@backstage/core-plugin-api/alpha';\nimport { scaffolderTranslationRef } from '../../translation';\n\n/**\n * @alpha\n */\nexport type TemplateListPageProps = {\n TemplateCardComponent?: React.ComponentType<{\n template: TemplateEntityV1beta3;\n }>;\n groups?: TemplateGroupFilter[];\n templateFilter?: (entity: TemplateEntityV1beta3) => boolean;\n contextMenu?: {\n editor?: boolean;\n actions?: boolean;\n tasks?: boolean;\n };\n headerOptions?: {\n pageTitleOverride?: string;\n title?: string;\n subtitle?: string;\n };\n};\n\nconst createGroupsWithOther = (\n groups: TemplateGroupFilter[],\n t: TranslationFunction<typeof scaffolderTranslationRef.T>,\n): TemplateGroupFilter[] => [\n ...groups,\n {\n title: t('templateListPage.templateGroups.otherTitle'),\n filter: e => ![...groups].some(({ filter }) => filter(e)),\n },\n];\n\n/**\n * @alpha\n */\nexport const TemplateListPage = (props: TemplateListPageProps) => {\n const registerComponentLink = useRouteRef(registerComponentRouteRef);\n const {\n TemplateCardComponent,\n groups: givenGroups = [],\n templateFilter,\n headerOptions,\n } = props;\n const navigate = useNavigate();\n const editorLink = useRouteRef(editRouteRef);\n const actionsLink = useRouteRef(actionsRouteRef);\n const tasksLink = useRouteRef(scaffolderListTaskRouteRef);\n const viewTechDocsLink = useRouteRef(viewTechDocRouteRef);\n const templateRoute = useRouteRef(selectedTemplateRouteRef);\n const app = useApp();\n const { t } = useTranslationRef(scaffolderTranslationRef);\n\n const groups = givenGroups.length\n ? createGroupsWithOther(givenGroups, t)\n : [\n {\n title: t('templateListPage.templateGroups.defaultTitle'),\n filter: () => true,\n },\n ];\n\n const scaffolderPageContextMenuProps = {\n onEditorClicked:\n props?.contextMenu?.editor !== false\n ? () => navigate(editorLink())\n : undefined,\n onActionsClicked:\n props?.contextMenu?.actions !== false\n ? () => navigate(actionsLink())\n : undefined,\n onTasksClicked:\n props?.contextMenu?.tasks !== false\n ? () => navigate(tasksLink())\n : undefined,\n };\n\n const additionalLinksForEntity = useCallback(\n (template: TemplateEntityV1beta3) => {\n const { kind, namespace, name } = parseEntityRef(\n stringifyEntityRef(template),\n );\n return template.metadata.annotations?.['backstage.io/techdocs-ref'] &&\n viewTechDocsLink\n ? [\n {\n icon: app.getSystemIcon('docs') ?? DocsIcon,\n text: t(\n 'templateListPage.additionalLinksForEntity.viewTechDocsTitle',\n ),\n url: viewTechDocsLink({ kind, namespace, name }),\n },\n ]\n : [];\n },\n [app, viewTechDocsLink, t],\n );\n\n const onTemplateSelected = useCallback(\n (template: TemplateEntityV1beta3) => {\n const { namespace, name } = parseEntityRef(stringifyEntityRef(template));\n\n navigate(templateRoute({ namespace, templateName: name }));\n },\n [navigate, templateRoute],\n );\n\n return (\n <EntityListProvider>\n <Page themeId=\"home\">\n <Header\n pageTitleOverride={t('templateListPage.pageTitle')}\n title={t('templateListPage.title')}\n subtitle={t('templateListPage.subtitle')}\n {...headerOptions}\n >\n <ScaffolderPageContextMenu {...scaffolderPageContextMenuProps} />\n </Header>\n <Content>\n <ContentHeader title={t('templateListPage.contentHeader.title')}>\n <RegisterExistingButton\n title={t(\n 'templateListPage.contentHeader.registerExistingButtonTitle',\n )}\n to={registerComponentLink && registerComponentLink()}\n />\n <SupportButton>\n {t('templateListPage.contentHeader.supportButtonTitle')}\n </SupportButton>\n </ContentHeader>\n\n <CatalogFilterLayout>\n <CatalogFilterLayout.Filters>\n <EntitySearchBar />\n <EntityKindPicker initialFilter=\"template\" hidden />\n <UserListPicker\n initialFilter=\"all\"\n availableFilters={['all', 'starred']}\n />\n <TemplateCategoryPicker />\n <EntityTagPicker />\n <EntityOwnerPicker />\n </CatalogFilterLayout.Filters>\n <CatalogFilterLayout.Content>\n <TemplateGroups\n groups={groups}\n templateFilter={templateFilter}\n TemplateCardComponent={TemplateCardComponent}\n onTemplateSelected={onTemplateSelected}\n additionalLinksForEntity={additionalLinksForEntity}\n />\n </CatalogFilterLayout.Content>\n </CatalogFilterLayout>\n </Content>\n </Page>\n </EntityListProvider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAkFA,MAAM,qBAAA,GAAwB,CAC5B,MAAA,EACA,CAC0B,KAAA;AAAA,EAC1B,GAAG,MAAA;AAAA,EACH;AAAA,IACE,KAAA,EAAO,EAAE,4CAA4C,CAAA;AAAA,IACrD,MAAQ,EAAA,CAAA,CAAA,KAAK,CAAC,CAAC,GAAG,MAAM,CAAA,CAAE,IAAK,CAAA,CAAC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CAAA,kBACC,KAAA,CAAA,aAAA,CAAA,mBAAA,CAAoB,SAApB,IACC,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,cAAA;AAAA,IAAA;AAAA,MACC,MAAA;AAAA,MACA,cAAA;AAAA,MACA,qBAAA;AAAA,MACA,kBAAA;AAAA,MACA,wBAAA;AAAA,KAAA;AAAA,GAEJ,CACF,CACF,CACF,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"TemplateListPage.esm.js","sources":["../../../src/next/TemplateListPage/TemplateListPage.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { useCallback } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport { useApp, useRouteRef } from '@backstage/core-plugin-api';\n\nimport {\n Content,\n ContentHeader,\n DocsIcon,\n Header,\n Page,\n SupportButton,\n} from '@backstage/core-components';\nimport {\n EntityKindPicker,\n EntityListProvider,\n EntitySearchBar,\n EntityTagPicker,\n CatalogFilterLayout,\n UserListPicker,\n EntityOwnerPicker,\n} from '@backstage/plugin-catalog-react';\nimport {\n ScaffolderPageContextMenu,\n TemplateCategoryPicker,\n TemplateGroups,\n} from '@backstage/plugin-scaffolder-react/alpha';\n\nimport { RegisterExistingButton } from './RegisterExistingButton';\nimport {\n actionsRouteRef,\n editRouteRef,\n registerComponentRouteRef,\n scaffolderListTaskRouteRef,\n selectedTemplateRouteRef,\n viewTechDocRouteRef,\n} from '../../routes';\nimport { parseEntityRef, stringifyEntityRef } from '@backstage/catalog-model';\nimport { TemplateGroupFilter } from '@backstage/plugin-scaffolder-react';\nimport {\n TranslationFunction,\n useTranslationRef,\n} from '@backstage/core-plugin-api/alpha';\nimport { scaffolderTranslationRef } from '../../translation';\n\n/**\n * @alpha\n */\nexport type TemplateListPageProps = {\n TemplateCardComponent?: React.ComponentType<{\n template: TemplateEntityV1beta3;\n }>;\n groups?: TemplateGroupFilter[];\n templateFilter?: (entity: TemplateEntityV1beta3) => boolean;\n contextMenu?: {\n editor?: boolean;\n actions?: boolean;\n tasks?: boolean;\n };\n headerOptions?: {\n pageTitleOverride?: string;\n title?: string;\n subtitle?: string;\n };\n};\n\nconst createGroupsWithOther = (\n groups: TemplateGroupFilter[],\n t: TranslationFunction<typeof scaffolderTranslationRef.T>,\n): TemplateGroupFilter[] => [\n ...groups,\n {\n title: t('templateListPage.templateGroups.otherTitle'),\n filter: e => ![...groups].some(({ filter }) => filter(e)),\n },\n];\n\n/**\n * @alpha\n */\nexport const TemplateListPage = (props: TemplateListPageProps) => {\n const registerComponentLink = useRouteRef(registerComponentRouteRef);\n const {\n TemplateCardComponent,\n groups: givenGroups = [],\n templateFilter,\n headerOptions,\n } = props;\n const navigate = useNavigate();\n const editorLink = useRouteRef(editRouteRef);\n const actionsLink = useRouteRef(actionsRouteRef);\n const tasksLink = useRouteRef(scaffolderListTaskRouteRef);\n const viewTechDocsLink = useRouteRef(viewTechDocRouteRef);\n const templateRoute = useRouteRef(selectedTemplateRouteRef);\n const app = useApp();\n const { t } = useTranslationRef(scaffolderTranslationRef);\n\n const groups = givenGroups.length\n ? createGroupsWithOther(givenGroups, t)\n : [\n {\n title: t('templateListPage.templateGroups.defaultTitle'),\n filter: () => true,\n },\n ];\n\n const scaffolderPageContextMenuProps = {\n onEditorClicked:\n props?.contextMenu?.editor !== false\n ? () => navigate(editorLink())\n : undefined,\n onActionsClicked:\n props?.contextMenu?.actions !== false\n ? () => navigate(actionsLink())\n : undefined,\n onTasksClicked:\n props?.contextMenu?.tasks !== false\n ? () => navigate(tasksLink())\n : undefined,\n };\n\n const additionalLinksForEntity = useCallback(\n (template: TemplateEntityV1beta3) => {\n const { kind, namespace, name } = parseEntityRef(\n stringifyEntityRef(template),\n );\n return template.metadata.annotations?.['backstage.io/techdocs-ref'] &&\n viewTechDocsLink\n ? [\n {\n icon: app.getSystemIcon('docs') ?? DocsIcon,\n text: t(\n 'templateListPage.additionalLinksForEntity.viewTechDocsTitle',\n ),\n url: viewTechDocsLink({ kind, namespace, name }),\n },\n ]\n : [];\n },\n [app, viewTechDocsLink, t],\n );\n\n const onTemplateSelected = useCallback(\n (template: TemplateEntityV1beta3) => {\n const { namespace, name } = parseEntityRef(stringifyEntityRef(template));\n\n navigate(templateRoute({ namespace, templateName: name }));\n },\n [navigate, templateRoute],\n );\n\n return (\n <EntityListProvider>\n <Page themeId=\"home\">\n <Header\n pageTitleOverride={t('templateListPage.pageTitle')}\n title={t('templateListPage.title')}\n subtitle={t('templateListPage.subtitle')}\n {...headerOptions}\n >\n <ScaffolderPageContextMenu {...scaffolderPageContextMenuProps} />\n </Header>\n <Content>\n <ContentHeader>\n <RegisterExistingButton\n title={t(\n 'templateListPage.contentHeader.registerExistingButtonTitle',\n )}\n to={registerComponentLink && registerComponentLink()}\n />\n <SupportButton>\n {t('templateListPage.contentHeader.supportButtonTitle')}\n </SupportButton>\n </ContentHeader>\n\n <CatalogFilterLayout>\n <CatalogFilterLayout.Filters>\n <EntitySearchBar />\n <EntityKindPicker initialFilter=\"template\" hidden />\n <UserListPicker\n initialFilter=\"all\"\n availableFilters={['all', 'starred']}\n />\n <TemplateCategoryPicker />\n <EntityTagPicker />\n <EntityOwnerPicker />\n </CatalogFilterLayout.Filters>\n <CatalogFilterLayout.Content>\n <TemplateGroups\n groups={groups}\n templateFilter={templateFilter}\n TemplateCardComponent={TemplateCardComponent}\n onTemplateSelected={onTemplateSelected}\n additionalLinksForEntity={additionalLinksForEntity}\n />\n </CatalogFilterLayout.Content>\n </Cat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AA,CAAA,aAAA;AAAA,IAAC,cAAA;AAAA,IAAA;AAAA,MACC,aAAc,EAAA,KAAA;AAAA,MACd,gBAAA,EAAkB,CAAC,KAAA,EAAO,SAAS,CAAA;AAAA,KAAA;AAAA,GAErC,kBAAA,KAAA,CAAA,aAAA,CAAC,sBAAuB,EAAA,IAAA,CAAA,sCACvB,eAAgB,EAAA,IAAA,CAAA,kBAChB,KAAA,CAAA,aAAA,CAAA,iBAAA,EAAA,IAAkB,CACrB,CAAA,kBACC,KAAA,CAAA,aAAA,CAAA,mBAAA,CAAoB,SAApB,IACC,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,cAAA;AAAA,IAAA;AAAA,MACC,MAAA;AAAA,MACA,cAAA;AAAA,MACA,qBAAA;AAAA,MACA,kBAAA;AAAA,MACA,wBAAA;AAAA,KAAA;AAAA,GAEJ,CACF,CACF,CACF,CACF,CAAA,CAAA;AAEJ;;;;"}
|
package/dist/translation.esm.js
CHANGED
|
@@ -235,7 +235,6 @@ const scaffolderTranslationRef = createTranslationRef({
|
|
|
235
235
|
otherTitle: "Other Templates"
|
|
236
236
|
},
|
|
237
237
|
contentHeader: {
|
|
238
|
-
title: "Available Templates",
|
|
239
238
|
registerExistingButtonTitle: "Register Existing Component",
|
|
240
239
|
supportButtonTitle: "Create new software components using standard templates. Different templates create different kinds of components (services, websites, documentation, ...)."
|
|
241
240
|
},
|
|
@@ -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 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 showButtonBar: 'Show Button Bar',\n startOver: 'Start Over',\n cancel: 'Cancel',\n },\n },\n templateTypePicker: {\n title: 'Categories',\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 preview: {\n title: 'Example 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 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 title: 'Available Templates',\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,M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A;AAAA,UACV,KAAO,EAAA,oBAAA;AAAA,UACP,WACE,EAAA,6GAAA;AAAA,SACJ;AAAA,QACA,aAAe,EAAA;AAAA,UACb,KAAO,EAAA,uBAAA;AAAA,UACP,WACE,EAAA,wEAAA;AAAA,SACJ;AAAA,OACF;AAAA,MACA,sBAAwB,EAAA;AAAA,QACtB,eAAiB,EAAA,WAAA;AAAA,QACjB,kBAAoB,EAAA,aAAA;AAAA,OACtB;AAAA,MACA,qBAAuB,EAAA;AAAA,QACrB,KAAO,EAAA,wBAAA;AAAA,OACT;AAAA,KACF;AAAA,IACA,gBAAkB,EAAA;AAAA,MAChB,KAAO,EAAA,wBAAA;AAAA,MACP,QACE,EAAA,8EAAA;AAAA,MACF,SAAW,EAAA,wBAAA;AAAA,MACX,cAAgB,EAAA;AAAA,QACd,YAAc,EAAA,WAAA;AAAA,QACd,UAAY,EAAA,iBAAA;AAAA,OACd;AAAA,MACA,aAAe,EAAA;AAAA,QACb,KAAO,EAAA,qBAAA;AAAA,QACP,2BAA6B,EAAA,6BAAA;AAAA,QAC7B,kBACE,EAAA,6JAAA;AAAA,OACJ;AAAA,MACA,wBAA0B,EAAA;AAAA,QACxB,iBAAmB,EAAA,eAAA;AAAA,OACrB;AAAA,KACF;AAAA,IACA,kBAAoB,EAAA;AAAA,MAClB,KAAO,EAAA,wBAAA;AAAA,MACP,QACE,EAAA,8EAAA;AAAA,MACF,SAAW,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 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 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 showButtonBar: 'Show Button Bar',\n startOver: 'Start Over',\n cancel: 'Cancel',\n },\n },\n templateTypePicker: {\n title: 'Categories',\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 preview: {\n title: 'Example 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 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,2BAA2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,yBAAA;AAAA,UACP,WACE,EAAA,iGAAA;AAAA,UACF,kBAAoB,EAAA,gDAAA;AAAA,SACtB;AAAA,QACA,UAAY,EAAA;AAAA,UACV,KAAO,EAAA,oBAAA;AAAA,UACP,WACE,EAAA,6GAAA;AAAA,SACJ;AAAA,QACA,aAAe,EAAA;AAAA,UACb,KAAO,EAAA,uBAAA;AAAA,UACP,WACE,EAAA,wEAAA;AAAA,SACJ;AAAA,OACF;AAAA,MACA,sBAAwB,EAAA;AAAA,QACtB,eAAiB,EAAA,WAAA;AAAA,QACjB,kBAAoB,EAAA,aAAA;AAAA,OACtB;AAAA,MACA,qBAAuB,EAAA;AAAA,QACrB,KAAO,EAAA,wBAAA;AAAA,OACT;AAAA,KACF;AAAA,IACA,gBAAkB,EAAA;AAAA,MAChB,KAAO,EAAA,wBAAA;AAAA,MACP,QACE,EAAA,8EAAA;AAAA,MACF,SAAW,EAAA,wBAAA;AAAA,MACX,cAAgB,EAAA;AAAA,QACd,YAAc,EAAA,WAAA;AAAA,QACd,UAAY,EAAA,iBAAA;AAAA,OACd;AAAA,MACA,aAAe,EAAA;AAAA,QACb,2BAA6B,EAAA,6BAAA;AAAA,QAC7B,kBACE,EAAA,6JAAA;AAAA,OACJ;AAAA,MACA,wBAA0B,EAAA;AAAA,QACxB,iBAAmB,EAAA,eAAA;AAAA,OACrB;AAAA,KACF;AAAA,IACA,kBAAoB,EAAA;AAAA,MAClB,KAAO,EAAA,wBAAA;AAAA,MACP,QACE,EAAA,8EAAA;AAAA,MACF,SAAW,EAAA,wBAAA;AAAA,MACX,eAAiB,EAAA;AAAA,QACf,sBAAwB,EAAA,oBAAA;AAAA,OAC1B;AAAA,KACF;AAAA,GACF;AACF,CAAC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-scaffolder",
|
|
3
|
-
"version": "1.25.0-next.
|
|
3
|
+
"version": "1.25.0-next.2",
|
|
4
4
|
"description": "The Backstage plugin that helps you create new things",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "frontend-plugin",
|
|
@@ -57,20 +57,20 @@
|
|
|
57
57
|
"test": "backstage-cli package test"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@backstage/catalog-client": "^1.
|
|
60
|
+
"@backstage/catalog-client": "^1.7.0-next.1",
|
|
61
61
|
"@backstage/catalog-model": "^1.6.0",
|
|
62
|
-
"@backstage/core-compat-api": "^0.
|
|
63
|
-
"@backstage/core-components": "^0.14.
|
|
64
|
-
"@backstage/core-plugin-api": "^1.9.
|
|
62
|
+
"@backstage/core-compat-api": "^0.3.0-next.2",
|
|
63
|
+
"@backstage/core-components": "^0.14.11-next.1",
|
|
64
|
+
"@backstage/core-plugin-api": "^1.9.4-next.0",
|
|
65
65
|
"@backstage/errors": "^1.2.4",
|
|
66
|
-
"@backstage/frontend-plugin-api": "^0.8.0-next.
|
|
67
|
-
"@backstage/integration": "^1.
|
|
68
|
-
"@backstage/integration-react": "^1.1.
|
|
66
|
+
"@backstage/frontend-plugin-api": "^0.8.0-next.2",
|
|
67
|
+
"@backstage/integration": "^1.15.0-next.0",
|
|
68
|
+
"@backstage/integration-react": "^1.1.31-next.0",
|
|
69
69
|
"@backstage/plugin-catalog-common": "^1.0.26",
|
|
70
|
-
"@backstage/plugin-catalog-react": "^1.
|
|
71
|
-
"@backstage/plugin-permission-react": "^0.4.
|
|
70
|
+
"@backstage/plugin-catalog-react": "^1.13.0-next.2",
|
|
71
|
+
"@backstage/plugin-permission-react": "^0.4.26-next.0",
|
|
72
72
|
"@backstage/plugin-scaffolder-common": "^1.5.5",
|
|
73
|
-
"@backstage/plugin-scaffolder-react": "^1.12.0-next.
|
|
73
|
+
"@backstage/plugin-scaffolder-react": "^1.12.0-next.2",
|
|
74
74
|
"@backstage/types": "^1.1.1",
|
|
75
75
|
"@codemirror/language": "^6.0.0",
|
|
76
76
|
"@codemirror/legacy-modes": "^6.1.0",
|
|
@@ -80,10 +80,10 @@
|
|
|
80
80
|
"@material-ui/lab": "4.0.0-alpha.61",
|
|
81
81
|
"@microsoft/fetch-event-source": "^2.0.1",
|
|
82
82
|
"@react-hookz/web": "^24.0.0",
|
|
83
|
-
"@rjsf/core": "5.
|
|
84
|
-
"@rjsf/material-ui": "5.
|
|
85
|
-
"@rjsf/utils": "5.
|
|
86
|
-
"@rjsf/validator-ajv8": "5.
|
|
83
|
+
"@rjsf/core": "5.20.1",
|
|
84
|
+
"@rjsf/material-ui": "5.20.1",
|
|
85
|
+
"@rjsf/utils": "5.20.1",
|
|
86
|
+
"@rjsf/validator-ajv8": "5.20.1",
|
|
87
87
|
"@types/react": "^16.13.1 || ^17.0.0 || ^18.0.0",
|
|
88
88
|
"@uiw/react-codemirror": "^4.9.3",
|
|
89
89
|
"classnames": "^2.2.6",
|
|
@@ -104,15 +104,15 @@
|
|
|
104
104
|
"zod-to-json-schema": "^3.20.4"
|
|
105
105
|
},
|
|
106
106
|
"devDependencies": {
|
|
107
|
-
"@backstage/cli": "^0.27.1-next.
|
|
108
|
-
"@backstage/core-app-api": "^1.14.
|
|
109
|
-
"@backstage/dev-utils": "^1.0
|
|
110
|
-
"@backstage/plugin-catalog": "^1.
|
|
107
|
+
"@backstage/cli": "^0.27.1-next.2",
|
|
108
|
+
"@backstage/core-app-api": "^1.14.3-next.0",
|
|
109
|
+
"@backstage/dev-utils": "^1.1.0-next.2",
|
|
110
|
+
"@backstage/plugin-catalog": "^1.23.0-next.2",
|
|
111
111
|
"@backstage/plugin-permission-common": "^0.8.1",
|
|
112
|
-
"@backstage/test-utils": "^1.6.0-next.
|
|
112
|
+
"@backstage/test-utils": "^1.6.0-next.1",
|
|
113
113
|
"@testing-library/dom": "^10.0.0",
|
|
114
114
|
"@testing-library/jest-dom": "^6.0.0",
|
|
115
|
-
"@testing-library/react": "^
|
|
115
|
+
"@testing-library/react": "^16.0.0",
|
|
116
116
|
"@testing-library/user-event": "^14.0.0",
|
|
117
117
|
"@types/humanize-duration": "^3.18.1",
|
|
118
118
|
"@types/json-schema": "^7.0.9",
|