@backstage/plugin-scaffolder 1.38.0 → 1.38.1-next.1
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 +33 -0
- package/dist/alpha/components/EditorSubPage.esm.js +22 -3
- package/dist/alpha/components/EditorSubPage.esm.js.map +1 -1
- package/dist/alpha/components/TasksSubPage.esm.js +10 -2
- package/dist/alpha/components/TasksSubPage.esm.js.map +1 -1
- package/dist/alpha/components/TemplatesSubPage.esm.js +16 -4
- package/dist/alpha/components/TemplatesSubPage.esm.js.map +1 -1
- package/dist/components/fields/RepoBranchPicker/RepoBranchPicker.esm.js +2 -0
- package/dist/components/fields/RepoBranchPicker/RepoBranchPicker.esm.js.map +1 -1
- package/dist/components/fields/RepoUrlPicker/RepoUrlPicker.esm.js +1 -1
- package/dist/components/fields/RepoUrlPicker/RepoUrlPicker.esm.js.map +1 -1
- package/dist/plugins/scaffolder/package.json.esm.js +1 -1
- package/package.json +27 -27
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# @backstage/plugin-scaffolder
|
|
2
2
|
|
|
3
|
+
## 1.38.1-next.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- a5b2811: Adds `useBreadcrumbEntries` hook, `BreadcrumbEntry` component, and `BreadcrumbsRegistryProvider` for managing breadcrumb trails across the component tree for plugins using new frontend system. Completes wiring so that new frontend system plugin `Pages` and `SubPages` get automatic-population of `PluginHeader` breadcrumbs.
|
|
8
|
+
|
|
9
|
+
- The app plugin's `PageLayout` registers a root breadcrumb for each plugin page and passes the breadcrumb trail to `PluginHeader`
|
|
10
|
+
- `PageBlueprint` automatically wraps each sub-page route element with `BreadcrumbEntry`, so sub-pages contribute to the PluginHeader breadcrumb trail without extra wiring.
|
|
11
|
+
- Plugin authors who need breadcrumbs for internal routes within a sub-page can wrap their route content with `BreadcrumbEntry` manually.
|
|
12
|
+
- `plugin-scaffolder` internal routes have been wrapped as an example
|
|
13
|
+
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
- @backstage/frontend-plugin-api@0.17.3-next.1
|
|
16
|
+
- @backstage/ui@0.17.0-next.1
|
|
17
|
+
|
|
18
|
+
## 1.38.1-next.0
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- c32e636: Fixed an issue where Bitbucket Cloud and Bitbucket Server hosts would not render the correct repository and branch picker fields in the Scaffolder.
|
|
23
|
+
- Updated dependencies
|
|
24
|
+
- @backstage/plugin-catalog-react@3.2.0-next.0
|
|
25
|
+
- @backstage/ui@0.17.0-next.0
|
|
26
|
+
- @backstage/filter-predicates@0.1.4-next.0
|
|
27
|
+
- @backstage/plugin-scaffolder-react@2.0.2-next.0
|
|
28
|
+
- @backstage/frontend-plugin-api@0.17.3-next.0
|
|
29
|
+
- @backstage/catalog-client@1.16.1-next.0
|
|
30
|
+
- @backstage/core-components@0.18.12-next.0
|
|
31
|
+
- @backstage/core-plugin-api@1.12.8-next.0
|
|
32
|
+
- @backstage/integration-react@1.2.20-next.0
|
|
33
|
+
- @backstage/plugin-permission-react@0.5.3-next.0
|
|
34
|
+
- @backstage/plugin-techdocs-react@1.3.13-next.0
|
|
35
|
+
|
|
3
36
|
## 1.38.0
|
|
4
37
|
|
|
5
38
|
### Minor Changes
|
|
@@ -3,6 +3,7 @@ import { useAsync, useMountEffect } from '@react-hookz/web';
|
|
|
3
3
|
import { useMemo, useCallback } from 'react';
|
|
4
4
|
import { Routes, Route, useNavigate } from 'react-router-dom';
|
|
5
5
|
import { Content } from '@backstage/core-components';
|
|
6
|
+
import { BreadcrumbEntry } from '@backstage/frontend-plugin-api';
|
|
6
7
|
import { useApi } from '@backstage/core-plugin-api';
|
|
7
8
|
import { makeStyles } from '@material-ui/core/styles';
|
|
8
9
|
import { RequirePermission } from '@backstage/plugin-permission-react';
|
|
@@ -105,21 +106,39 @@ function EditorSubPage() {
|
|
|
105
106
|
Route,
|
|
106
107
|
{
|
|
107
108
|
path: "template",
|
|
108
|
-
element: /* @__PURE__ */ jsx(
|
|
109
|
+
element: /* @__PURE__ */ jsx(
|
|
110
|
+
BreadcrumbEntry,
|
|
111
|
+
{
|
|
112
|
+
entry: { label: "Edit Template", href: "template" },
|
|
113
|
+
children: /* @__PURE__ */ jsx(EditorContent, { fieldExtensions })
|
|
114
|
+
}
|
|
115
|
+
)
|
|
109
116
|
}
|
|
110
117
|
),
|
|
111
118
|
/* @__PURE__ */ jsx(
|
|
112
119
|
Route,
|
|
113
120
|
{
|
|
114
121
|
path: "template-form",
|
|
115
|
-
element: /* @__PURE__ */ jsx(
|
|
122
|
+
element: /* @__PURE__ */ jsx(
|
|
123
|
+
BreadcrumbEntry,
|
|
124
|
+
{
|
|
125
|
+
entry: { label: "Template Form", href: "template-form" },
|
|
126
|
+
children: /* @__PURE__ */ jsx(FormPreviewContent, { fieldExtensions })
|
|
127
|
+
}
|
|
128
|
+
)
|
|
116
129
|
}
|
|
117
130
|
),
|
|
118
131
|
/* @__PURE__ */ jsx(
|
|
119
132
|
Route,
|
|
120
133
|
{
|
|
121
134
|
path: "custom-fields",
|
|
122
|
-
element: /* @__PURE__ */ jsx(
|
|
135
|
+
element: /* @__PURE__ */ jsx(
|
|
136
|
+
BreadcrumbEntry,
|
|
137
|
+
{
|
|
138
|
+
entry: { label: "Custom Fields", href: "custom-fields" },
|
|
139
|
+
children: /* @__PURE__ */ jsx(CustomFieldsContent, { fieldExtensions })
|
|
140
|
+
}
|
|
141
|
+
)
|
|
123
142
|
}
|
|
124
143
|
)
|
|
125
144
|
] }) }) });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorSubPage.esm.js","sources":["../../../src/alpha/components/EditorSubPage.tsx"],"sourcesContent":["/*\n * Copyright 2026 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 { useAsync, useMountEffect } from '@react-hookz/web';\nimport { useCallback, useMemo } from 'react';\nimport { Routes, Route, useNavigate } from 'react-router-dom';\nimport { Content } from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { RequirePermission } from '@backstage/plugin-permission-react';\nimport { templateManagementPermission } from '@backstage/plugin-scaffolder-common/alpha';\nimport {\n type FieldExtensionOptions,\n SecretsContextProvider,\n} from '@backstage/plugin-scaffolder-react';\nimport type { FormField } from '@backstage/plugin-scaffolder-react/alpha';\nimport { OpaqueFormField } from '@internal/scaffolder';\nimport { DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS } from '../../extensions/default';\nimport { formFieldsApiRef } from '../formFieldsApi';\nimport { TemplateEditorIntro } from './TemplateEditorPage/TemplateEditorIntro';\nimport { TemplateEditor } from './TemplateEditorPage/TemplateEditor';\nimport { TemplateFormPreviewer } from './TemplateEditorPage/TemplateFormPreviewer';\nimport { CustomFieldExplorer } from './TemplateEditorPage/CustomFieldExplorer';\nimport { useTemplateDirectory } from './TemplateEditorPage/useTemplateDirectory';\n\nconst useEditorStyles = makeStyles({\n editorContent: {\n padding: 0,\n height: 'calc(100dvh - var(--bui-header-height, 0px))',\n },\n formContent: {\n padding: 0,\n height: 'calc(100dvh - var(--bui-header-height, 0px))',\n },\n});\n\nfunction EditorIntroContent() {\n const navigate = useNavigate();\n const { openDirectory, createDirectory } = useTemplateDirectory();\n\n const handleSelect = useCallback(\n (option: 'create-template' | 'local' | 'form' | 'field-explorer') => {\n if (option === 'local') {\n openDirectory()\n .then(() => navigate('template'))\n .catch(() => {});\n } else if (option === 'create-template') {\n createDirectory()\n .then(() => navigate('template'))\n .catch(() => {});\n } else if (option === 'form') {\n navigate('template-form');\n } else if (option === 'field-explorer') {\n navigate('custom-fields');\n }\n },\n [openDirectory, createDirectory, navigate],\n );\n\n return (\n <Content>\n <TemplateEditorIntro onSelect={handleSelect} />\n </Content>\n );\n}\n\nexport function buildEditorFieldExtensions(\n formFields: FieldExtensionOptions[] = [],\n): FieldExtensionOptions[] {\n return [\n ...formFields,\n ...(DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS.filter(\n ({ name }) => !formFields.some(formField => formField.name === name),\n ) as FieldExtensionOptions[]),\n ];\n}\n\nexport function toFieldExtensionOptions(\n formField: FormField,\n): FieldExtensionOptions {\n const internal = OpaqueFormField.toInternal(formField);\n\n return {\n ...internal,\n schema: internal.schema?.schema ?? internal.schema,\n } as FieldExtensionOptions;\n}\n\nfunction EditorContent(props: { fieldExtensions: FieldExtensionOptions[] }) {\n const classes = useEditorStyles();\n return (\n <Content className={classes.editorContent}>\n <TemplateEditor fieldExtensions={props.fieldExtensions} />\n </Content>\n );\n}\n\nfunction FormPreviewContent(props: {\n fieldExtensions: FieldExtensionOptions[];\n}) {\n const classes = useEditorStyles();\n const navigate = useNavigate();\n\n const handleClose = useCallback(() => {\n navigate('..');\n }, [navigate]);\n\n return (\n <Content className={classes.formContent}>\n <TemplateFormPreviewer\n customFieldExtensions={props.fieldExtensions}\n onClose={handleClose}\n />\n </Content>\n );\n}\n\nfunction CustomFieldsContent(props: {\n fieldExtensions: FieldExtensionOptions[];\n}) {\n return (\n <Content>\n <CustomFieldExplorer customFieldExtensions={props.fieldExtensions} />\n </Content>\n );\n}\n\n/**\n * Sub-page for the template editor tab. Renders the editor intro at the index,\n * with sub-routes for the full editor, form previewer, and custom fields explorer.\n *\n * @internal\n */\nexport function EditorSubPage() {\n const formFieldsApi = useApi(formFieldsApiRef);\n const [{ result: customFieldExtensions = [] }, { execute }] = useAsync(\n async () => {\n const formFields = await formFieldsApi.loadFormFields();\n return formFields.map(toFieldExtensionOptions);\n },\n );\n\n useMountEffect(execute);\n\n const fieldExtensions = useMemo(\n () => buildEditorFieldExtensions(customFieldExtensions),\n [customFieldExtensions],\n );\n\n return (\n <RequirePermission permission={templateManagementPermission}>\n <SecretsContextProvider>\n <Routes>\n <Route index element={<EditorIntroContent />} />\n <Route\n path=\"template\"\n element={<EditorContent fieldExtensions={fieldExtensions} />}\n />\n <Route\n path=\"template-form\"\n element={<FormPreviewContent fieldExtensions={fieldExtensions} />}\n />\n <Route\n path=\"custom-fields\"\n element={<CustomFieldsContent fieldExtensions={fieldExtensions} />}\n />\n </Routes>\n </SecretsContextProvider>\n </RequirePermission>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsCA,MAAM,kBAAkB,UAAA,CAAW;AAAA,EACjC,aAAA,EAAe;AAAA,IACb,OAAA,EAAS,CAAA;AAAA,IACT,MAAA,EAAQ;AAAA,GACV;AAAA,EACA,WAAA,EAAa;AAAA,IACX,OAAA,EAAS,CAAA;AAAA,IACT,MAAA,EAAQ;AAAA;AAEZ,CAAC,CAAA;AAED,SAAS,kBAAA,GAAqB;AAC5B,EAAA,MAAM,WAAW,WAAA,EAAY;AAC7B,EAAA,MAAM,EAAE,aAAA,EAAe,eAAA,EAAgB,GAAI,oBAAA,EAAqB;AAEhE,EAAA,MAAM,YAAA,GAAe,WAAA;AAAA,IACnB,CAAC,MAAA,KAAoE;AACnE,MAAA,IAAI,WAAW,OAAA,EAAS;AACtB,QAAA,aAAA,EAAc,CACX,KAAK,MAAM,QAAA,CAAS,UAAU,CAAC,CAAA,CAC/B,MAAM,MAAM;AAAA,QAAC,CAAC,CAAA;AAAA,MACnB,CAAA,MAAA,IAAW,WAAW,iBAAA,EAAmB;AACvC,QAAA,eAAA,EAAgB,CACb,KAAK,MAAM,QAAA,CAAS,UAAU,CAAC,CAAA,CAC/B,MAAM,MAAM;AAAA,QAAC,CAAC,CAAA;AAAA,MACnB,CAAA,MAAA,IAAW,WAAW,MAAA,EAAQ;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,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,IAAA,EAAK,UAAA;AAAA,QACL,OAAA,kBAAS,GAAA,CAAC,aAAA,EAAA,EAAc,eAAA,EAAkC;AAAA;AAAA,KAC5D;AAAA,oBACA,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,IAAA,EAAK,eAAA;AAAA,QACL,OAAA,kBAAS,GAAA,CAAC,kBAAA,EAAA,EAAmB,eAAA,EAAkC;AAAA;AAAA,KACjE;AAAA,oBACA,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,IAAA,EAAK,eAAA;AAAA,QACL,OAAA,kBAAS,GAAA,CAAC,mBAAA,EAAA,EAAoB,eAAA,EAAkC;AAAA;AAAA;AAClE,GAAA,EACF,GACF,CAAA,EACF,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"EditorSubPage.esm.js","sources":["../../../src/alpha/components/EditorSubPage.tsx"],"sourcesContent":["/*\n * Copyright 2026 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 { useAsync, useMountEffect } from '@react-hookz/web';\nimport { useCallback, useMemo } from 'react';\nimport { Routes, Route, useNavigate } from 'react-router-dom';\nimport { Content } from '@backstage/core-components';\nimport { BreadcrumbEntry } from '@backstage/frontend-plugin-api';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { RequirePermission } from '@backstage/plugin-permission-react';\nimport { templateManagementPermission } from '@backstage/plugin-scaffolder-common/alpha';\nimport {\n type FieldExtensionOptions,\n SecretsContextProvider,\n} from '@backstage/plugin-scaffolder-react';\nimport type { FormField } from '@backstage/plugin-scaffolder-react/alpha';\nimport { OpaqueFormField } from '@internal/scaffolder';\nimport { DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS } from '../../extensions/default';\nimport { formFieldsApiRef } from '../formFieldsApi';\nimport { TemplateEditorIntro } from './TemplateEditorPage/TemplateEditorIntro';\nimport { TemplateEditor } from './TemplateEditorPage/TemplateEditor';\nimport { TemplateFormPreviewer } from './TemplateEditorPage/TemplateFormPreviewer';\nimport { CustomFieldExplorer } from './TemplateEditorPage/CustomFieldExplorer';\nimport { useTemplateDirectory } from './TemplateEditorPage/useTemplateDirectory';\n\nconst useEditorStyles = makeStyles({\n editorContent: {\n padding: 0,\n height: 'calc(100dvh - var(--bui-header-height, 0px))',\n },\n formContent: {\n padding: 0,\n height: 'calc(100dvh - var(--bui-header-height, 0px))',\n },\n});\n\nfunction EditorIntroContent() {\n const navigate = useNavigate();\n const { openDirectory, createDirectory } = useTemplateDirectory();\n\n const handleSelect = useCallback(\n (option: 'create-template' | 'local' | 'form' | 'field-explorer') => {\n if (option === 'local') {\n openDirectory()\n .then(() => navigate('template'))\n .catch(() => {});\n } else if (option === 'create-template') {\n createDirectory()\n .then(() => navigate('template'))\n .catch(() => {});\n } else if (option === 'form') {\n navigate('template-form');\n } else if (option === 'field-explorer') {\n navigate('custom-fields');\n }\n },\n [openDirectory, createDirectory, navigate],\n );\n\n return (\n <Content>\n <TemplateEditorIntro onSelect={handleSelect} />\n </Content>\n );\n}\n\nexport function buildEditorFieldExtensions(\n formFields: FieldExtensionOptions[] = [],\n): FieldExtensionOptions[] {\n return [\n ...formFields,\n ...(DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS.filter(\n ({ name }) => !formFields.some(formField => formField.name === name),\n ) as FieldExtensionOptions[]),\n ];\n}\n\nexport function toFieldExtensionOptions(\n formField: FormField,\n): FieldExtensionOptions {\n const internal = OpaqueFormField.toInternal(formField);\n\n return {\n ...internal,\n schema: internal.schema?.schema ?? internal.schema,\n } as FieldExtensionOptions;\n}\n\nfunction EditorContent(props: { fieldExtensions: FieldExtensionOptions[] }) {\n const classes = useEditorStyles();\n return (\n <Content className={classes.editorContent}>\n <TemplateEditor fieldExtensions={props.fieldExtensions} />\n </Content>\n );\n}\n\nfunction FormPreviewContent(props: {\n fieldExtensions: FieldExtensionOptions[];\n}) {\n const classes = useEditorStyles();\n const navigate = useNavigate();\n\n const handleClose = useCallback(() => {\n navigate('..');\n }, [navigate]);\n\n return (\n <Content className={classes.formContent}>\n <TemplateFormPreviewer\n customFieldExtensions={props.fieldExtensions}\n onClose={handleClose}\n />\n </Content>\n );\n}\n\nfunction CustomFieldsContent(props: {\n fieldExtensions: FieldExtensionOptions[];\n}) {\n return (\n <Content>\n <CustomFieldExplorer customFieldExtensions={props.fieldExtensions} />\n </Content>\n );\n}\n\n/**\n * Sub-page for the template editor tab. Renders the editor intro at the index,\n * with sub-routes for the full editor, form previewer, and custom fields explorer.\n *\n * @internal\n */\nexport function EditorSubPage() {\n const formFieldsApi = useApi(formFieldsApiRef);\n const [{ result: customFieldExtensions = [] }, { execute }] = useAsync(\n async () => {\n const formFields = await formFieldsApi.loadFormFields();\n return formFields.map(toFieldExtensionOptions);\n },\n );\n\n useMountEffect(execute);\n\n const fieldExtensions = useMemo(\n () => buildEditorFieldExtensions(customFieldExtensions),\n [customFieldExtensions],\n );\n\n return (\n <RequirePermission permission={templateManagementPermission}>\n <SecretsContextProvider>\n <Routes>\n <Route index element={<EditorIntroContent />} />\n <Route\n path=\"template\"\n element={\n <BreadcrumbEntry\n entry={{ label: 'Edit Template', href: 'template' }}\n >\n <EditorContent fieldExtensions={fieldExtensions} />\n </BreadcrumbEntry>\n }\n />\n <Route\n path=\"template-form\"\n element={\n <BreadcrumbEntry\n entry={{ label: 'Template Form', href: 'template-form' }}\n >\n <FormPreviewContent fieldExtensions={fieldExtensions} />\n </BreadcrumbEntry>\n }\n />\n <Route\n path=\"custom-fields\"\n element={\n <BreadcrumbEntry\n entry={{ label: 'Custom Fields', href: 'custom-fields' }}\n >\n <CustomFieldsContent fieldExtensions={fieldExtensions} />\n </BreadcrumbEntry>\n }\n />\n </Routes>\n </SecretsContextProvider>\n </RequirePermission>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAuCA,MAAM,kBAAkB,UAAA,CAAW;AAAA,EACjC,aAAA,EAAe;AAAA,IACb,OAAA,EAAS,CAAA;AAAA,IACT,MAAA,EAAQ;AAAA,GACV;AAAA,EACA,WAAA,EAAa;AAAA,IACX,OAAA,EAAS,CAAA;AAAA,IACT,MAAA,EAAQ;AAAA;AAEZ,CAAC,CAAA;AAED,SAAS,kBAAA,GAAqB;AAC5B,EAAA,MAAM,WAAW,WAAA,EAAY;AAC7B,EAAA,MAAM,EAAE,aAAA,EAAe,eAAA,EAAgB,GAAI,oBAAA,EAAqB;AAEhE,EAAA,MAAM,YAAA,GAAe,WAAA;AAAA,IACnB,CAAC,MAAA,KAAoE;AACnE,MAAA,IAAI,WAAW,OAAA,EAAS;AACtB,QAAA,aAAA,EAAc,CACX,KAAK,MAAM,QAAA,CAAS,UAAU,CAAC,CAAA,CAC/B,MAAM,MAAM;AAAA,QAAC,CAAC,CAAA;AAAA,MACnB,CAAA,MAAA,IAAW,WAAW,iBAAA,EAAmB;AACvC,QAAA,eAAA,EAAgB,CACb,KAAK,MAAM,QAAA,CAAS,UAAU,CAAC,CAAA,CAC/B,MAAM,MAAM;AAAA,QAAC,CAAC,CAAA;AAAA,MACnB,CAAA,MAAA,IAAW,WAAW,MAAA,EAAQ;AAC5B,QAAA,QAAA,CAAS,eAAe,CAAA;AAAA,MAC1B,CAAA,MAAA,IAAW,WAAW,gBAAA,EAAkB;AACtC,QAAA,QAAA,CAAS,eAAe,CAAA;AAAA,MAC1B;AAAA,IACF,CAAA;AAAA,IACA,CAAC,aAAA,EAAe,eAAA,EAAiB,QAAQ;AAAA,GAC3C;AAEA,EAAA,2BACG,OAAA,EAA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A,EAAkC;AAAA;AAAA;AACnD;AAAA,KAEJ;AAAA,oBACA,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,IAAA,EAAK,eAAA;AAAA,QACL,OAAA,kBACE,GAAA;AAAA,UAAC,eAAA;AAAA,UAAA;AAAA,YACC,KAAA,EAAO,EAAE,KAAA,EAAO,eAAA,EAAiB,MAAM,eAAA,EAAgB;AAAA,YAEvD,QAAA,kBAAA,GAAA,CAAC,sBAAmB,eAAA,EAAkC;AAAA;AAAA;AACxD;AAAA,KAEJ;AAAA,oBACA,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,IAAA,EAAK,eAAA;AAAA,QACL,OAAA,kBACE,GAAA;AAAA,UAAC,eAAA;AAAA,UAAA;AAAA,YACC,KAAA,EAAO,EAAE,KAAA,EAAO,eAAA,EAAiB,MAAM,eAAA,EAAgB;AAAA,YAEvD,QAAA,kBAAA,GAAA,CAAC,uBAAoB,eAAA,EAAkC;AAAA;AAAA;AACzD;AAAA;AAEJ,GAAA,EACF,GACF,CAAA,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { Routes, Route } from 'react-router-dom';
|
|
2
|
+
import { Routes, Route, useParams } from 'react-router-dom';
|
|
3
3
|
import { Content } from '@backstage/core-components';
|
|
4
|
+
import { BreadcrumbEntry } from '@backstage/frontend-plugin-api';
|
|
4
5
|
import { OngoingTaskBody } from '../../components/OngoingTask/OngoingTask.esm.js';
|
|
5
6
|
import { ListTaskPageContent } from '../../components/ListTasksPage/ListTasksPage.esm.js';
|
|
6
7
|
|
|
8
|
+
function TaskDetailWithBreadcrumb() {
|
|
9
|
+
const { taskId } = useParams();
|
|
10
|
+
if (!taskId) {
|
|
11
|
+
return /* @__PURE__ */ jsx(OngoingTaskBody, {});
|
|
12
|
+
}
|
|
13
|
+
return /* @__PURE__ */ jsx(BreadcrumbEntry, { entry: { label: taskId, href: taskId }, children: /* @__PURE__ */ jsx(OngoingTaskBody, {}) });
|
|
14
|
+
}
|
|
7
15
|
function TasksSubPage() {
|
|
8
16
|
return /* @__PURE__ */ jsxs(Routes, { children: [
|
|
9
17
|
/* @__PURE__ */ jsx(
|
|
@@ -13,7 +21,7 @@ function TasksSubPage() {
|
|
|
13
21
|
element: /* @__PURE__ */ jsx(Content, { children: /* @__PURE__ */ jsx(ListTaskPageContent, {}) })
|
|
14
22
|
}
|
|
15
23
|
),
|
|
16
|
-
/* @__PURE__ */ jsx(Route, { path: ":taskId", element: /* @__PURE__ */ jsx(
|
|
24
|
+
/* @__PURE__ */ jsx(Route, { path: ":taskId", element: /* @__PURE__ */ jsx(TaskDetailWithBreadcrumb, {}) })
|
|
17
25
|
] });
|
|
18
26
|
}
|
|
19
27
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TasksSubPage.esm.js","sources":["../../../src/alpha/components/TasksSubPage.tsx"],"sourcesContent":["/*\n * Copyright 2026 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 { Routes, Route } from 'react-router-dom';\nimport { Content } from '@backstage/core-components';\nimport { OngoingTaskBody } from '../../components/OngoingTask';\nimport { ListTaskPageContent } from '../../components/ListTasksPage';\n\n/**\n * Sub-page for the tasks tab. Renders the task list at the index route\n * and the ongoing task detail at the parameterized route.\n *\n * @internal\n */\nexport function TasksSubPage() {\n return (\n <Routes>\n <Route\n index\n element={\n <Content>\n <ListTaskPageContent />\n </Content>\n }\n />\n <Route path=\":taskId\" element={<
|
|
1
|
+
{"version":3,"file":"TasksSubPage.esm.js","sources":["../../../src/alpha/components/TasksSubPage.tsx"],"sourcesContent":["/*\n * Copyright 2026 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 { Routes, Route, useParams } from 'react-router-dom';\nimport { Content } from '@backstage/core-components';\nimport { BreadcrumbEntry } from '@backstage/frontend-plugin-api';\nimport { OngoingTaskBody } from '../../components/OngoingTask';\nimport { ListTaskPageContent } from '../../components/ListTasksPage';\n\nfunction TaskDetailWithBreadcrumb() {\n const { taskId } = useParams<{ taskId: string }>();\n if (!taskId) {\n return <OngoingTaskBody />;\n }\n return (\n <BreadcrumbEntry entry={{ label: taskId, href: taskId }}>\n <OngoingTaskBody />\n </BreadcrumbEntry>\n );\n}\n\n/**\n * Sub-page for the tasks tab. Renders the task list at the index route\n * and the ongoing task detail at the parameterized route.\n *\n * @internal\n */\nexport function TasksSubPage() {\n return (\n <Routes>\n <Route\n index\n element={\n <Content>\n <ListTaskPageContent />\n </Content>\n }\n />\n <Route path=\":taskId\" element={<TaskDetailWithBreadcrumb />} />\n </Routes>\n );\n}\n"],"names":[],"mappings":";;;;;;;AAsBA,SAAS,wBAAA,GAA2B;AAClC,EAAA,MAAM,EAAE,MAAA,EAAO,GAAI,SAAA,EAA8B;AACjD,EAAA,IAAI,CAAC,MAAA,EAAQ;AACX,IAAA,2BAAQ,eAAA,EAAA,EAAgB,CAAA;AAAA,EAC1B;AACA,EAAA,uBACE,GAAA,CAAC,eAAA,EAAA,EAAgB,KAAA,EAAO,EAAE,KAAA,EAAO,MAAA,EAAQ,IAAA,EAAM,MAAA,EAAO,EACpD,QAAA,kBAAA,GAAA,CAAC,eAAA,EAAA,EAAgB,CAAA,EACnB,CAAA;AAEJ;AAQO,SAAS,YAAA,GAAe;AAC7B,EAAA,4BACG,MAAA,EAAA,EACC,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,KAAA,EAAK,IAAA;AAAA,QACL,OAAA,kBACE,GAAA,CAAC,OAAA,EAAA,EACC,QAAA,kBAAA,GAAA,CAAC,uBAAoB,CAAA,EACvB;AAAA;AAAA,KAEJ;AAAA,wBACC,KAAA,EAAA,EAAM,IAAA,EAAK,WAAU,OAAA,kBAAS,GAAA,CAAC,4BAAyB,CAAA,EAAI;AAAA,GAAA,EAC/D,CAAA;AAEJ;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { useMemo, useCallback } from 'react';
|
|
3
|
-
import { Routes, Route, useNavigate } from 'react-router-dom';
|
|
3
|
+
import { Routes, Route, useNavigate, useParams } from 'react-router-dom';
|
|
4
4
|
import { DocsIcon, Content, ContentHeader, SupportButton } from '@backstage/core-components';
|
|
5
5
|
import { useRouteRef, useApp } from '@backstage/core-plugin-api';
|
|
6
6
|
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
@@ -15,6 +15,7 @@ import { registerComponentRouteRef, viewTechDocRouteRef, selectedTemplateRouteRe
|
|
|
15
15
|
import { scaffolderTranslationRef } from '../../translation.esm.js';
|
|
16
16
|
import { DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS } from '../../extensions/default.esm.js';
|
|
17
17
|
import { buildTechDocsURL } from '@backstage/plugin-techdocs-react';
|
|
18
|
+
import { BreadcrumbEntry } from '@backstage/frontend-plugin-api';
|
|
18
19
|
import { TECHDOCS_ANNOTATION, TECHDOCS_EXTERNAL_ANNOTATION } from '@backstage/plugin-techdocs-common';
|
|
19
20
|
import { OpaqueFormField } from '../../packages/scaffolder-internal/src/wiring/InternalFormField.esm.js';
|
|
20
21
|
import '../../packages/scaffolder-internal/src/wiring/InternalFormDecorator.esm.js';
|
|
@@ -104,6 +105,17 @@ function TemplateListContent({
|
|
|
104
105
|
] })
|
|
105
106
|
] }) });
|
|
106
107
|
}
|
|
108
|
+
function TemplateWizardWithBreadcrumb(props) {
|
|
109
|
+
const { templateName } = useParams();
|
|
110
|
+
return /* @__PURE__ */ jsx(BreadcrumbEntry, { entry: { label: templateName ?? "Template", href: "." }, children: /* @__PURE__ */ jsx(SecretsContextProvider, { children: /* @__PURE__ */ jsx(
|
|
111
|
+
TemplateWizardPageContent,
|
|
112
|
+
{
|
|
113
|
+
customFieldExtensions: props.customFieldExtensions,
|
|
114
|
+
layouts: props.layouts,
|
|
115
|
+
formProps: props.formProps
|
|
116
|
+
}
|
|
117
|
+
) }) });
|
|
118
|
+
}
|
|
107
119
|
function TemplatesSubPage(props) {
|
|
108
120
|
const customFieldExtensions = useCustomFieldExtensions(void 0);
|
|
109
121
|
const customLayouts = useCustomLayouts(void 0);
|
|
@@ -122,14 +134,14 @@ function TemplatesSubPage(props) {
|
|
|
122
134
|
Route,
|
|
123
135
|
{
|
|
124
136
|
path: ":namespace/:templateName",
|
|
125
|
-
element: /* @__PURE__ */ jsx(
|
|
126
|
-
|
|
137
|
+
element: /* @__PURE__ */ jsx(
|
|
138
|
+
TemplateWizardWithBreadcrumb,
|
|
127
139
|
{
|
|
128
140
|
customFieldExtensions: fieldExtensions,
|
|
129
141
|
layouts: customLayouts,
|
|
130
142
|
formProps: props.formProps
|
|
131
143
|
}
|
|
132
|
-
)
|
|
144
|
+
)
|
|
133
145
|
}
|
|
134
146
|
)
|
|
135
147
|
] });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TemplatesSubPage.esm.js","sources":["../../../src/alpha/components/TemplatesSubPage.tsx"],"sourcesContent":["/*\n * Copyright 2026 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 { useCallback, useMemo } from 'react';\nimport { Routes, Route, useNavigate } from 'react-router-dom';\nimport {\n Content,\n ContentHeader,\n DocsIcon,\n SupportButton,\n} from '@backstage/core-components';\nimport { useApp, useRouteRef } from '@backstage/core-plugin-api';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport {\n EntityKindPicker,\n EntityListProvider,\n EntitySearchBar,\n EntityTagPicker,\n CatalogFilterLayout,\n UserListPicker,\n EntityOwnerPicker,\n} from '@backstage/plugin-catalog-react';\nimport {\n TemplateCategoryPicker,\n TemplateGroups,\n} from '@backstage/plugin-scaffolder-react/alpha';\nimport { createGroupsWithOther } from '../lib/createGroupsWithOther';\nimport {\n FieldExtensionOptions,\n FormProps,\n SecretsContextProvider,\n TemplateGroupFilter,\n useCustomFieldExtensions,\n useCustomLayouts,\n} from '@backstage/plugin-scaffolder-react';\nimport { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport { parseEntityRef, stringifyEntityRef } from '@backstage/catalog-model';\nimport { FormField } from '@backstage/plugin-scaffolder-react/alpha';\nimport { OpaqueFormField } from '@internal/scaffolder';\nimport { RegisterExistingButton } from './TemplateListPage/RegisterExistingButton';\nimport { TemplateWizardPageContent } from './TemplateWizardPage';\nimport {\n registerComponentRouteRef,\n selectedTemplateRouteRef,\n viewTechDocRouteRef,\n} from '../../routes';\nimport { scaffolderTranslationRef } from '../../translation';\nimport { DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS } from '../../extensions/default';\nimport { buildTechDocsURL } from '@backstage/plugin-techdocs-react';\nimport {\n TECHDOCS_ANNOTATION,\n TECHDOCS_EXTERNAL_ANNOTATION,\n} from '@backstage/plugin-techdocs-common';\n\nfunction TemplateListContent({\n groups: configuredGroups,\n}: {\n groups?: TemplateGroupFilter[];\n}) {\n const registerComponentLink = useRouteRef(registerComponentRouteRef);\n const viewTechDocsLink = useRouteRef(viewTechDocRouteRef);\n const templateRoute = useRouteRef(selectedTemplateRouteRef);\n const navigate = useNavigate();\n const app = useApp();\n const { t } = useTranslationRef(scaffolderTranslationRef);\n\n const groups = useMemo(\n () =>\n configuredGroups?.length\n ? createGroupsWithOther(\n configuredGroups,\n t('templateListPage.templateGroups.otherTitle'),\n )\n : [\n {\n title: t('templateListPage.templateGroups.defaultTitle'),\n filter: () => true,\n },\n ],\n [configuredGroups, t],\n );\n\n const additionalLinksForEntity = useCallback(\n (template: TemplateEntityV1beta3) => {\n if (\n !(\n template.metadata.annotations?.[TECHDOCS_ANNOTATION] ||\n template.metadata.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION]\n ) ||\n !viewTechDocsLink\n ) {\n return [];\n }\n\n const url = buildTechDocsURL(template, viewTechDocsLink);\n return url\n ? [\n {\n icon: app.getSystemIcon('docs') ?? DocsIcon,\n text: t(\n 'templateListPage.additionalLinksForEntity.viewTechDocsTitle',\n ),\n url,\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 navigate(templateRoute({ namespace, templateName: name }));\n },\n [navigate, templateRoute],\n );\n\n return (\n <EntityListProvider>\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 onTemplateSelected={onTemplateSelected}\n additionalLinksForEntity={additionalLinksForEntity}\n />\n </CatalogFilterLayout.Content>\n </CatalogFilterLayout>\n </Content>\n </EntityListProvider>\n );\n}\n\n/**\n * Sub-page for the templates tab. Renders the template list at the index route\n * and the template wizard at the parameterized route.\n *\n * @internal\n */\nexport function TemplatesSubPage(props: {\n formFields?: Array<FormField>;\n formProps?: FormProps;\n groups?: TemplateGroupFilter[];\n}) {\n const customFieldExtensions = useCustomFieldExtensions(undefined);\n const customLayouts = useCustomLayouts(undefined);\n\n const fieldExtensions = [\n ...customFieldExtensions,\n ...(props.formFields?.map(OpaqueFormField.toInternal) ?? []),\n ...DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS.filter(\n ({ name }) =>\n !customFieldExtensions.some(\n (customFieldExtension: FieldExtensionOptions) =>\n customFieldExtension.name === name,\n ),\n ),\n ] as FieldExtensionOptions[];\n\n return (\n <Routes>\n <Route index element={<TemplateListContent groups={props.groups} />} />\n <Route\n path=\":namespace/:templateName\"\n element={\n <SecretsContextProvider>\n <TemplateWizardPageContent\n customFieldExtensions={fieldExtensions}\n layouts={customLayouts}\n formProps={props.formProps}\n />\n </SecretsContextProvider>\n }\n />\n </Routes>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAmEA,SAAS,mBAAA,CAAoB;AAAA,EAC3B,MAAA,EAAQ;AACV,CAAA,EAEG;AACD,EAAA,MAAM,qBAAA,GAAwB,YAAY,yBAAyB,CAAA;AACnE,EAAA,MAAM,gBAAA,GAAmB,YAAY,mBAAmB,CAAA;AACxD,EAAA,MAAM,aAAA,GAAgB,YAAY,wBAAwB,CAAA;AAC1D,EAAA,MAAM,WAAW,WAAA,EAAY;AAC7B,EAAA,MAAM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A;AAEJ;AAQO,SAAS,iBAAiB,KAAA,EAI9B;AACD,EAAA,MAAM,qBAAA,GAAwB,yBAAyB,MAAS,CAAA;AAChE,EAAA,MAAM,aAAA,GAAgB,iBAAiB,MAAS,CAAA;AAEhD,EAAA,MAAM,eAAA,GAAkB;AAAA,IACtB,GAAG,qBAAA;AAAA,IACH,GAAI,KAAA,CAAM,UAAA,EAAY,IAAI,eAAA,CAAgB,UAAU,KAAK,EAAC;AAAA,IAC1D,GAAG,mCAAA,CAAoC,MAAA;AAAA,MACrC,CAAC,EAAE,IAAA,EAAK,KACN,CAAC,qBAAA,CAAsB,IAAA;AAAA,QACrB,CAAC,oBAAA,KACC,oBAAA,CAAqB,IAAA,KAAS;AAAA;AAClC;AACJ,GACF;AAEA,EAAA,4BACG,MAAA,EAAA,EACC,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,KAAA,EAAA,EAAM,OAAK,IAAA,EAAC,OAAA,sBAAU,mBAAA,EAAA,EAAoB,MAAA,EAAQ,KAAA,CAAM,MAAA,EAAQ,CAAA,EAAI,CAAA;AAAA,oBACrE,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,IAAA,EAAK,0BAAA;AAAA,QACL,OAAA,sBACG,sBAAA,EAAA,EACC,QAAA,kBAAA,GAAA;AAAA,UAAC,yBAAA;AAAA,UAAA;AAAA,YACC,qBAAA,EAAuB,eAAA;AAAA,YACvB,OAAA,EAAS,aAAA;AAAA,YACT,WAAW,KAAA,CAAM;AAAA;AAAA,SACnB,EACF;AAAA;AAAA;AAEJ,GAAA,EACF,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"TemplatesSubPage.esm.js","sources":["../../../src/alpha/components/TemplatesSubPage.tsx"],"sourcesContent":["/*\n * Copyright 2026 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 { useCallback, useMemo } from 'react';\nimport { Routes, Route, useNavigate, useParams } from 'react-router-dom';\nimport {\n Content,\n ContentHeader,\n DocsIcon,\n SupportButton,\n} from '@backstage/core-components';\nimport { useApp, useRouteRef } from '@backstage/core-plugin-api';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport {\n EntityKindPicker,\n EntityListProvider,\n EntitySearchBar,\n EntityTagPicker,\n CatalogFilterLayout,\n UserListPicker,\n EntityOwnerPicker,\n} from '@backstage/plugin-catalog-react';\nimport {\n TemplateCategoryPicker,\n TemplateGroups,\n} from '@backstage/plugin-scaffolder-react/alpha';\nimport { createGroupsWithOther } from '../lib/createGroupsWithOther';\nimport {\n FieldExtensionOptions,\n FormProps,\n type LayoutOptions,\n SecretsContextProvider,\n TemplateGroupFilter,\n useCustomFieldExtensions,\n useCustomLayouts,\n} from '@backstage/plugin-scaffolder-react';\nimport { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport { parseEntityRef, stringifyEntityRef } from '@backstage/catalog-model';\nimport { FormField } from '@backstage/plugin-scaffolder-react/alpha';\nimport { OpaqueFormField } from '@internal/scaffolder';\nimport { RegisterExistingButton } from './TemplateListPage/RegisterExistingButton';\nimport { TemplateWizardPageContent } from './TemplateWizardPage';\nimport {\n registerComponentRouteRef,\n selectedTemplateRouteRef,\n viewTechDocRouteRef,\n} from '../../routes';\nimport { scaffolderTranslationRef } from '../../translation';\nimport { DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS } from '../../extensions/default';\nimport { buildTechDocsURL } from '@backstage/plugin-techdocs-react';\nimport { BreadcrumbEntry } from '@backstage/frontend-plugin-api';\nimport {\n TECHDOCS_ANNOTATION,\n TECHDOCS_EXTERNAL_ANNOTATION,\n} from '@backstage/plugin-techdocs-common';\n\nfunction TemplateListContent({\n groups: configuredGroups,\n}: {\n groups?: TemplateGroupFilter[];\n}) {\n const registerComponentLink = useRouteRef(registerComponentRouteRef);\n const viewTechDocsLink = useRouteRef(viewTechDocRouteRef);\n const templateRoute = useRouteRef(selectedTemplateRouteRef);\n const navigate = useNavigate();\n const app = useApp();\n const { t } = useTranslationRef(scaffolderTranslationRef);\n\n const groups = useMemo(\n () =>\n configuredGroups?.length\n ? createGroupsWithOther(\n configuredGroups,\n t('templateListPage.templateGroups.otherTitle'),\n )\n : [\n {\n title: t('templateListPage.templateGroups.defaultTitle'),\n filter: () => true,\n },\n ],\n [configuredGroups, t],\n );\n\n const additionalLinksForEntity = useCallback(\n (template: TemplateEntityV1beta3) => {\n if (\n !(\n template.metadata.annotations?.[TECHDOCS_ANNOTATION] ||\n template.metadata.annotations?.[TECHDOCS_EXTERNAL_ANNOTATION]\n ) ||\n !viewTechDocsLink\n ) {\n return [];\n }\n\n const url = buildTechDocsURL(template, viewTechDocsLink);\n return url\n ? [\n {\n icon: app.getSystemIcon('docs') ?? DocsIcon,\n text: t(\n 'templateListPage.additionalLinksForEntity.viewTechDocsTitle',\n ),\n url,\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 navigate(templateRoute({ namespace, templateName: name }));\n },\n [navigate, templateRoute],\n );\n\n return (\n <EntityListProvider>\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 onTemplateSelected={onTemplateSelected}\n additionalLinksForEntity={additionalLinksForEntity}\n />\n </CatalogFilterLayout.Content>\n </CatalogFilterLayout>\n </Content>\n </EntityListProvider>\n );\n}\n\nfunction TemplateWizardWithBreadcrumb(props: {\n customFieldExtensions: FieldExtensionOptions[];\n layouts: LayoutOptions[];\n formProps?: FormProps;\n}) {\n const { templateName } = useParams<{ templateName: string }>();\n return (\n <BreadcrumbEntry entry={{ label: templateName ?? 'Template', href: '.' }}>\n <SecretsContextProvider>\n <TemplateWizardPageContent\n customFieldExtensions={props.customFieldExtensions}\n layouts={props.layouts}\n formProps={props.formProps}\n />\n </SecretsContextProvider>\n </BreadcrumbEntry>\n );\n}\n\n/**\n * Sub-page for the templates tab. Renders the template list at the index route\n * and the template wizard at the parameterized route.\n *\n * @internal\n */\nexport function TemplatesSubPage(props: {\n formFields?: Array<FormField>;\n formProps?: FormProps;\n groups?: TemplateGroupFilter[];\n}) {\n const customFieldExtensions = useCustomFieldExtensions(undefined);\n const customLayouts = useCustomLayouts(undefined);\n\n const fieldExtensions = [\n ...customFieldExtensions,\n ...(props.formFields?.map(OpaqueFormField.toInternal) ?? []),\n ...DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS.filter(\n ({ name }) =>\n !customFieldExtensions.some(\n (customFieldExtension: FieldExtensionOptions) =>\n customFieldExtension.name === name,\n ),\n ),\n ] as FieldExtensionOptions[];\n\n return (\n <Routes>\n <Route index element={<TemplateListContent groups={props.groups} />} />\n <Route\n path=\":namespace/:templateName\"\n element={\n <TemplateWizardWithBreadcrumb\n customFieldExtensions={fieldExtensions}\n layouts={customLayouts}\n formProps={props.formProps}\n />\n }\n />\n </Routes>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAqEA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,EAAA,EACC,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,KAAA,EAAA,EAAM,OAAK,IAAA,EAAC,OAAA,sBAAU,mBAAA,EAAA,EAAoB,MAAA,EAAQ,KAAA,CAAM,MAAA,EAAQ,CAAA,EAAI,CAAA;AAAA,oBACrE,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,IAAA,EAAK,0BAAA;AAAA,QACL,OAAA,kBACE,GAAA;AAAA,UAAC,4BAAA;AAAA,UAAA;AAAA,YACC,qBAAA,EAAuB,eAAA;AAAA,YACvB,OAAA,EAAS,aAAA;AAAA,YACT,WAAW,KAAA,CAAM;AAAA;AAAA;AACnB;AAAA;AAEJ,GAAA,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RepoBranchPicker.esm.js","sources":["../../../../src/components/fields/RepoBranchPicker/RepoBranchPicker.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useApi } from '@backstage/core-plugin-api';\nimport {\n scmIntegrationsApiRef,\n scmAuthApiRef,\n} from '@backstage/integration-react';\nimport { useEffect, useState, useCallback } from 'react';\nimport useDebounce from 'react-use/esm/useDebounce';\nimport { useTemplateSecrets } from '@backstage/plugin-scaffolder-react';\nimport Box from '@material-ui/core/Box';\nimport Divider from '@material-ui/core/Divider';\nimport Typography from '@material-ui/core/Typography';\n\nimport { RepoBranchPickerProps } from './schema';\nimport { RepoBranchPickerState } from './types';\nimport { BitbucketRepoBranchPicker } from './BitbucketRepoBranchPicker';\nimport { DefaultRepoBranchPicker } from './DefaultRepoBranchPicker';\nimport { GitHubRepoBranchPicker } from './GitHubRepoBranchPicker';\nimport { MarkdownContent } from '@backstage/core-components';\nimport { useScaffolderTheme } from '@backstage/plugin-scaffolder-react/alpha';\nimport { Flex, Text } from '@backstage/ui';\n\n/**\n * The underlying component that is rendered in the form for the `RepoBranchPicker`\n * field extension.\n *\n * @public\n */\nexport const RepoBranchPicker = (props: RepoBranchPickerProps) => {\n const scaffolderTheme = useScaffolderTheme();\n const {\n uiSchema,\n onChange,\n rawErrors,\n formData,\n schema,\n formContext,\n required,\n } = props;\n const {\n formData: { repoUrl },\n } = formContext;\n\n const [state, setState] = useState<RepoBranchPickerState>({\n branch: formData || '',\n });\n const { host, branch } = state;\n\n const integrationApi = useApi(scmIntegrationsApiRef);\n const scmAuthApi = useApi(scmAuthApiRef);\n\n const { secrets, setSecrets } = useTemplateSecrets();\n\n useDebounce(\n async () => {\n const { requestUserCredentials } = uiSchema?.['ui:options'] ?? {};\n\n if (!requestUserCredentials || !host) {\n return;\n }\n\n // don't show login prompt if secret value is already in state\n if (secrets[requestUserCredentials.secretsKey]) {\n return;\n }\n\n // user has requested that we use the users credentials\n // so lets grab them using the scmAuthApi and pass through\n // any additional scopes from the ui:options\n const { token } = await scmAuthApi.getCredentials({\n url: `https://${host}`,\n additionalScope: {\n repoWrite: true,\n customScopes: requestUserCredentials.additionalScopes,\n },\n });\n\n // set the secret using the key provided in the ui:options for use\n // in the templating the manifest with ${{ secrets[secretsKey] }}\n setSecrets({ [requestUserCredentials.secretsKey]: token });\n },\n 500,\n [host, uiSchema],\n );\n\n useEffect(() => {\n if (repoUrl) {\n const url = new URL(`https://${repoUrl}`);\n\n setState(prevState => ({\n ...prevState,\n host: url.host,\n workspace: url.searchParams.get('workspace') || '',\n repository: url.searchParams.get('repo') || '',\n owner: url.searchParams.get('owner') || '',\n }));\n }\n }, [repoUrl]);\n\n useEffect(() => {\n onChange(branch);\n }, [branch, onChange]);\n\n const updateLocalState = useCallback(\n (newState: RepoBranchPickerState) => {\n setState(prevState => ({ ...prevState, ...newState }));\n },\n [setState],\n );\n\n const hostType = (host && integrationApi.byHost(host)?.type) ?? null;\n\n const accessToken =\n uiSchema?.['ui:options']?.requestUserCredentials?.secretsKey &&\n secrets[uiSchema['ui:options'].requestUserCredentials.secretsKey];\n const isDisabled = uiSchema?.['ui:disabled'] ?? false;\n\n const renderRepoBranchPicker = () => {\n switch (hostType) {\n case 'bitbucket':\n return (\n <BitbucketRepoBranchPicker\n onChange={updateLocalState}\n state={state}\n rawErrors={rawErrors}\n accessToken={accessToken}\n isDisabled={isDisabled}\n required={required}\n />\n );\n case 'github':\n return (\n <GitHubRepoBranchPicker\n onChange={updateLocalState}\n state={state}\n rawErrors={rawErrors}\n accessToken={accessToken}\n isDisabled={isDisabled}\n required={required}\n />\n );\n default:\n return (\n <DefaultRepoBranchPicker\n onChange={updateLocalState}\n state={state}\n rawErrors={rawErrors}\n isDisabled={isDisabled}\n required={required}\n />\n );\n }\n };\n\n const description = uiSchema['ui:description'] ?? schema.description;\n\n if (scaffolderTheme === 'bui') {\n return (\n <Flex direction=\"column\" gap=\"4\">\n {schema.title && (\n <Text as=\"h5\" variant=\"title-small\" weight=\"bold\">\n {schema.title}\n </Text>\n )}\n {description && <MarkdownContent content={description} />}\n {renderRepoBranchPicker()}\n </Flex>\n );\n }\n\n return (\n <>\n {schema.title && (\n <Box my={1}>\n <Typography variant=\"h5\">{schema.title}</Typography>\n <Divider />\n </Box>\n )}\n {description && (\n <Typography variant=\"body1\">\n <MarkdownContent content={description} />\n </Typography>\n )}\n {renderRepoBranchPicker()}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AA2CO,MAAM,gBAAA,GAAmB,CAAC,KAAA,KAAiC;AAChE,EAAA,MAAM,kBAAkB,kBAAA,EAAmB;AAC3C,EAAA,MAAM;AAAA,IACJ,QAAA;AAAA,IACA,QAAA;AAAA,IACA,SAAA;AAAA,IAC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C,GAAA,EAAA,EAAI,EAAA,EAAI,CAAA,EACP,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,UAAA,EAAA,EAAW,OAAA,EAAQ,IAAA,EAAM,QAAA,EAAA,MAAA,CAAO,KAAA,EAAM,CAAA;AAAA,0BACtC,OAAA,EAAA,EAAQ;AAAA,KAAA,EACX,CAAA;AAAA,IAED,WAAA,wBACE,UAAA,EAAA,EAAW,OAAA,EAAQ,SAClB,QAAA,kBAAA,GAAA,CAAC,eAAA,EAAA,EAAgB,OAAA,EAAS,WAAA,EAAa,CAAA,EACzC,CAAA;AAAA,IAED,sBAAA;AAAuB,GAAA,EAC1B,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"RepoBranchPicker.esm.js","sources":["../../../../src/components/fields/RepoBranchPicker/RepoBranchPicker.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useApi } from '@backstage/core-plugin-api';\nimport {\n scmIntegrationsApiRef,\n scmAuthApiRef,\n} from '@backstage/integration-react';\nimport { useEffect, useState, useCallback } from 'react';\nimport useDebounce from 'react-use/esm/useDebounce';\nimport { useTemplateSecrets } from '@backstage/plugin-scaffolder-react';\nimport Box from '@material-ui/core/Box';\nimport Divider from '@material-ui/core/Divider';\nimport Typography from '@material-ui/core/Typography';\n\nimport { RepoBranchPickerProps } from './schema';\nimport { RepoBranchPickerState } from './types';\nimport { BitbucketRepoBranchPicker } from './BitbucketRepoBranchPicker';\nimport { DefaultRepoBranchPicker } from './DefaultRepoBranchPicker';\nimport { GitHubRepoBranchPicker } from './GitHubRepoBranchPicker';\nimport { MarkdownContent } from '@backstage/core-components';\nimport { useScaffolderTheme } from '@backstage/plugin-scaffolder-react/alpha';\nimport { Flex, Text } from '@backstage/ui';\n\n/**\n * The underlying component that is rendered in the form for the `RepoBranchPicker`\n * field extension.\n *\n * @public\n */\nexport const RepoBranchPicker = (props: RepoBranchPickerProps) => {\n const scaffolderTheme = useScaffolderTheme();\n const {\n uiSchema,\n onChange,\n rawErrors,\n formData,\n schema,\n formContext,\n required,\n } = props;\n const {\n formData: { repoUrl },\n } = formContext;\n\n const [state, setState] = useState<RepoBranchPickerState>({\n branch: formData || '',\n });\n const { host, branch } = state;\n\n const integrationApi = useApi(scmIntegrationsApiRef);\n const scmAuthApi = useApi(scmAuthApiRef);\n\n const { secrets, setSecrets } = useTemplateSecrets();\n\n useDebounce(\n async () => {\n const { requestUserCredentials } = uiSchema?.['ui:options'] ?? {};\n\n if (!requestUserCredentials || !host) {\n return;\n }\n\n // don't show login prompt if secret value is already in state\n if (secrets[requestUserCredentials.secretsKey]) {\n return;\n }\n\n // user has requested that we use the users credentials\n // so lets grab them using the scmAuthApi and pass through\n // any additional scopes from the ui:options\n const { token } = await scmAuthApi.getCredentials({\n url: `https://${host}`,\n additionalScope: {\n repoWrite: true,\n customScopes: requestUserCredentials.additionalScopes,\n },\n });\n\n // set the secret using the key provided in the ui:options for use\n // in the templating the manifest with ${{ secrets[secretsKey] }}\n setSecrets({ [requestUserCredentials.secretsKey]: token });\n },\n 500,\n [host, uiSchema],\n );\n\n useEffect(() => {\n if (repoUrl) {\n const url = new URL(`https://${repoUrl}`);\n\n setState(prevState => ({\n ...prevState,\n host: url.host,\n workspace: url.searchParams.get('workspace') || '',\n repository: url.searchParams.get('repo') || '',\n owner: url.searchParams.get('owner') || '',\n }));\n }\n }, [repoUrl]);\n\n useEffect(() => {\n onChange(branch);\n }, [branch, onChange]);\n\n const updateLocalState = useCallback(\n (newState: RepoBranchPickerState) => {\n setState(prevState => ({ ...prevState, ...newState }));\n },\n [setState],\n );\n\n const hostType = (host && integrationApi.byHost(host)?.type) ?? null;\n\n const accessToken =\n uiSchema?.['ui:options']?.requestUserCredentials?.secretsKey &&\n secrets[uiSchema['ui:options'].requestUserCredentials.secretsKey];\n const isDisabled = uiSchema?.['ui:disabled'] ?? false;\n\n const renderRepoBranchPicker = () => {\n switch (hostType) {\n case 'bitbucket':\n case 'bitbucketCloud':\n case 'bitbucketServer':\n return (\n <BitbucketRepoBranchPicker\n onChange={updateLocalState}\n state={state}\n rawErrors={rawErrors}\n accessToken={accessToken}\n isDisabled={isDisabled}\n required={required}\n />\n );\n case 'github':\n return (\n <GitHubRepoBranchPicker\n onChange={updateLocalState}\n state={state}\n rawErrors={rawErrors}\n accessToken={accessToken}\n isDisabled={isDisabled}\n required={required}\n />\n );\n default:\n return (\n <DefaultRepoBranchPicker\n onChange={updateLocalState}\n state={state}\n rawErrors={rawErrors}\n isDisabled={isDisabled}\n required={required}\n />\n );\n }\n };\n\n const description = uiSchema['ui:description'] ?? schema.description;\n\n if (scaffolderTheme === 'bui') {\n return (\n <Flex direction=\"column\" gap=\"4\">\n {schema.title && (\n <Text as=\"h5\" variant=\"title-small\" weight=\"bold\">\n {schema.title}\n </Text>\n )}\n {description && <MarkdownContent content={description} />}\n {renderRepoBranchPicker()}\n </Flex>\n );\n }\n\n return (\n <>\n {schema.title && (\n <Box my={1}>\n <Typography variant=\"h5\">{schema.title}</Typography>\n <Divider />\n </Box>\n )}\n {description && (\n <Typography variant=\"body1\">\n <MarkdownContent content={description} />\n </Typography>\n )}\n {renderRepoBranchPicker()}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AA2CO,MAAM,gBAAA,GAAmB,CAAC,KAAA,KAAiC;AAChE,EAAA,MAAM,kBAAkB,kBAAA,EAAmB;AAC3C,EAAA,MAAM;AAAA,IACJ,QAAA;AAAA,IACA,QAAA;AAAA,IACA,SAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAA;AAAA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A,oBACN,IAAA,CAAC,GAAA,EAAA,EAAI,EAAA,EAAI,CAAA,EACP,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,UAAA,EAAA,EAAW,OAAA,EAAQ,IAAA,EAAM,QAAA,EAAA,MAAA,CAAO,KAAA,EAAM,CAAA;AAAA,0BACtC,OAAA,EAAA,EAAQ;AAAA,KAAA,EACX,CAAA;AAAA,IAED,WAAA,wBACE,UAAA,EAAA,EAAW,OAAA,EAAQ,SAClB,QAAA,kBAAA,GAAA,CAAC,eAAA,EAAA,EAAgB,OAAA,EAAS,WAAA,EAAa,CAAA,EACzC,CAAA;AAAA,IAED,sBAAA;AAAuB,GAAA,EAC1B,CAAA;AAEJ;;;;"}
|
|
@@ -165,7 +165,7 @@ const RepoUrlPicker = (props) => {
|
|
|
165
165
|
accessToken
|
|
166
166
|
}
|
|
167
167
|
),
|
|
168
|
-
hostType === "bitbucket" && /* @__PURE__ */ jsx(
|
|
168
|
+
(hostType === "bitbucket" || hostType === "bitbucketCloud" || hostType === "bitbucketServer") && /* @__PURE__ */ jsx(
|
|
169
169
|
BitbucketRepoPicker,
|
|
170
170
|
{
|
|
171
171
|
allowedOwners,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RepoUrlPicker.esm.js","sources":["../../../../src/components/fields/RepoUrlPicker/RepoUrlPicker.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useApi } from '@backstage/core-plugin-api';\nimport {\n scmAuthApiRef,\n scmIntegrationsApiRef,\n} from '@backstage/integration-react';\nimport { useTemplateSecrets } from '@backstage/plugin-scaffolder-react';\nimport Box from '@material-ui/core/Box';\nimport Divider from '@material-ui/core/Divider';\nimport Typography from '@material-ui/core/Typography';\nimport { useCallback, useEffect, useMemo, useState } from 'react';\nimport useDebounce from 'react-use/esm/useDebounce';\nimport { AzureRepoPicker } from './AzureRepoPicker';\nimport { BitbucketRepoPicker } from './BitbucketRepoPicker';\nimport { GerritRepoPicker } from './GerritRepoPicker';\nimport { GiteaRepoPicker } from './GiteaRepoPicker';\nimport { GithubRepoPicker } from './GithubRepoPicker';\nimport { GitlabRepoPicker } from './GitlabRepoPicker';\nimport { RepoUrlPickerHost } from './RepoUrlPickerHost';\nimport { RepoUrlPickerRepoName } from './RepoUrlPickerRepoName';\nimport { RepoUrlPickerFieldSchema } from './schema';\nimport { RepoUrlPickerState } from './types';\nimport { parseRepoPickerUrl, serializeRepoPickerUrl } from './utils';\nimport { MarkdownContent } from '@backstage/core-components';\nimport { useScaffolderTheme } from '@backstage/plugin-scaffolder-react/alpha';\nimport { Flex, Text } from '@backstage/ui';\n\nexport { RepoUrlPickerSchema } from './schema';\n\n/**\n * The underlying component that is rendered in the form for the `RepoUrlPicker`\n * field extension.\n *\n * @public\n */\nexport const RepoUrlPicker = (\n props: typeof RepoUrlPickerFieldSchema.TProps,\n) => {\n const scaffolderTheme = useScaffolderTheme();\n const { uiSchema, onChange, rawErrors, formData, schema } = props;\n const [state, setState] = useState<RepoUrlPickerState>(\n parseRepoPickerUrl(formData),\n );\n const [credentialsHost, setCredentialsHost] = useState<string | undefined>(\n undefined,\n );\n const integrationApi = useApi(scmIntegrationsApiRef);\n const scmAuthApi = useApi(scmAuthApiRef);\n const { secrets, setSecrets } = useTemplateSecrets();\n const allowedHosts = useMemo(\n () => uiSchema?.['ui:options']?.allowedHosts ?? [],\n [uiSchema],\n );\n const allowedOrganizations = useMemo(\n () => uiSchema?.['ui:options']?.allowedOrganizations ?? [],\n [uiSchema],\n );\n const allowedOwners = useMemo(\n () => uiSchema?.['ui:options']?.allowedOwners ?? [],\n [uiSchema],\n );\n const allowedProjects = useMemo(\n () => uiSchema?.['ui:options']?.allowedProjects ?? [],\n [uiSchema],\n );\n const allowedRepos = useMemo(\n () => uiSchema?.['ui:options']?.allowedRepos ?? [],\n [uiSchema],\n );\n const isDisabled = useMemo(\n () => uiSchema?.['ui:disabled'] ?? false,\n [uiSchema],\n );\n const { owner, organization, project, repoName } = state;\n\n useEffect(() => {\n onChange(serializeRepoPickerUrl(state));\n }, [state, onChange]);\n\n /* we deal with calling the repo setting here instead of in each components for ease */\n useEffect(() => {\n if (allowedOrganizations.length > 0 && !organization) {\n setState(prevState => ({\n ...prevState,\n organization: allowedOrganizations[0],\n }));\n }\n }, [setState, allowedOrganizations, organization]);\n\n useEffect(() => {\n if (allowedOwners.length > 0 && !owner) {\n setState(prevState => ({\n ...prevState,\n owner: allowedOwners[0],\n }));\n }\n }, [setState, allowedOwners, owner]);\n\n useEffect(() => {\n if (allowedProjects.length > 0 && !project) {\n setState(prevState => ({\n ...prevState,\n project: allowedProjects[0],\n }));\n }\n }, [setState, allowedProjects, project]);\n\n useEffect(() => {\n if (allowedRepos.length > 0 && !repoName) {\n setState(prevState => ({ ...prevState, repoName: allowedRepos[0] }));\n }\n }, [setState, allowedRepos, repoName]);\n\n const updateLocalState = useCallback(\n (newState: RepoUrlPickerState) => {\n setState(prevState => ({ ...prevState, ...newState }));\n },\n [setState],\n );\n\n useDebounce(\n async () => {\n const { requestUserCredentials } = uiSchema?.['ui:options'] ?? {};\n\n if (!requestUserCredentials || !state.host) {\n return;\n }\n\n // don't show login prompt if secret value is already in state for selected host\n if (\n secrets[requestUserCredentials.secretsKey] &&\n credentialsHost === state.host\n ) {\n return;\n }\n\n // user has requested that we use the users credentials\n // so lets grab them using the scmAuthApi and pass through\n // any additional scopes from the ui:options\n const { token } = await scmAuthApi.getCredentials({\n url: `https://${state.host}`,\n additionalScope: {\n repoWrite: true,\n customScopes: requestUserCredentials.additionalScopes,\n },\n });\n\n // set the secret using the key provided in the ui:options for use\n // in the templating the manifest with ${{ secrets[secretsKey] }}\n setSecrets({ [requestUserCredentials.secretsKey]: token });\n setCredentialsHost(state.host);\n },\n 500,\n [state, uiSchema],\n );\n\n const hostType =\n (state.host && integrationApi.byHost(state.host)?.type) ?? null;\n\n const description = uiSchema['ui:description'] ?? schema.description;\n\n const accessToken =\n uiSchema?.['ui:options']?.requestUserCredentials?.secretsKey &&\n secrets[uiSchema['ui:options'].requestUserCredentials.secretsKey];\n\n const subComponents = (\n <>\n <RepoUrlPickerHost\n host={state.host}\n hosts={allowedHosts}\n onChange={host => setState(prevState => ({ ...prevState, host }))}\n rawErrors={rawErrors}\n isDisabled={isDisabled}\n />\n {hostType === 'github' && (\n <GithubRepoPicker\n allowedOwners={allowedOwners}\n onChange={updateLocalState}\n rawErrors={rawErrors}\n state={state}\n isDisabled={isDisabled}\n accessToken={accessToken}\n />\n )}\n {hostType === 'gitea' && (\n <GiteaRepoPicker\n allowedOwners={allowedOwners}\n allowedRepos={allowedRepos}\n rawErrors={rawErrors}\n state={state}\n isDisabled={isDisabled}\n onChange={updateLocalState}\n />\n )}\n {hostType === 'gitlab' && (\n <GitlabRepoPicker\n allowedOwners={allowedOwners}\n rawErrors={rawErrors}\n state={state}\n onChange={updateLocalState}\n isDisabled={isDisabled}\n accessToken={accessToken}\n />\n )}\n {hostType === 'bitbucket' && (\n <BitbucketRepoPicker\n allowedOwners={allowedOwners}\n allowedProjects={allowedProjects}\n rawErrors={rawErrors}\n state={state}\n onChange={updateLocalState}\n isDisabled={isDisabled}\n accessToken={accessToken}\n />\n )}\n {hostType === 'azure' && (\n <AzureRepoPicker\n allowedOrganizations={allowedOrganizations}\n allowedProject={allowedProjects}\n rawErrors={rawErrors}\n state={state}\n isDisabled={isDisabled}\n onChange={updateLocalState}\n />\n )}\n {hostType === 'gerrit' && (\n <GerritRepoPicker\n rawErrors={rawErrors}\n state={state}\n onChange={updateLocalState}\n isDisabled={isDisabled}\n />\n )}\n <RepoUrlPickerRepoName\n repoName={state.repoName}\n allowedRepos={allowedRepos}\n onChange={repo =>\n setState(prevState => ({\n ...prevState,\n repoName: repo.id || repo.name,\n }))\n }\n isDisabled={isDisabled}\n rawErrors={rawErrors}\n availableRepos={state.availableRepos}\n />\n </>\n );\n\n if (scaffolderTheme === 'bui') {\n return (\n <Flex direction=\"column\" gap=\"4\">\n {schema.title && (\n <Text as=\"h5\" variant=\"title-small\" weight=\"bold\">\n {schema.title}\n </Text>\n )}\n {description && <MarkdownContent content={description} />}\n {subComponents}\n </Flex>\n );\n }\n\n return (\n <>\n {schema.title && (\n <Box my={1}>\n <Typography variant=\"h5\">{schema.title}</Typography>\n <Divider />\n </Box>\n )}\n {description && (\n <Typography variant=\"body1\">\n <MarkdownContent content={description} />\n </Typography>\n )}\n {subComponents}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAiDO,MAAM,aAAA,GAAgB,CAC3B,KAAA,KACG;AACH,EAAA,MAAM,kBAAkB,kBAAA,EAAmB;AAC3C,EAAA,MAAM,EAAE,QAAA,EAAU,QAAA,EAAU,SAAA,EAAW,QAAA,EAAU,QAAO,GAAI,KAAA;AAC5D,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,QAAA;AAAA,IACxB,mBAAmB,QAAQ;AAAA,GAC7B;AACA,EAAA,MAAM,CAAC,eAAA,EAAiB,kBAAkB,CAAA,GAAI,QAAA;AAAA,IAC5C;AAAA,GACF;AACA,EAAA,MAAM,cAAA,GAAiB,OAAO,qBAAqB,CAAA;AACnD,EAAA,MAAM,UAAA,GAAa,OAAO,aAAa,CAAA;AACvC,EAAA,MAAM,EAAE,OAAA,EAAS,UAAA,EAAW,GAAI,kBAAA,EAAmB;AACnD,EAAA,MAAM,YAAA,GAAe,OAAA;AAAA,IACnB,MAAM,QAAA,GAAW,YAAY,CAAA,EAAG,gBAAgB,EAAC;AAAA,IACjD,CAAC,QAAQ;AAAA,GACX;A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AA,CAAC,eAAA,EAAA,EAAgB,OAAA,EAAS,WAAA,EAAa,CAAA,EACzC,CAAA;AAAA,IAED;AAAA,GAAA,EACH,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"RepoUrlPicker.esm.js","sources":["../../../../src/components/fields/RepoUrlPicker/RepoUrlPicker.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useApi } from '@backstage/core-plugin-api';\nimport {\n scmAuthApiRef,\n scmIntegrationsApiRef,\n} from '@backstage/integration-react';\nimport { useTemplateSecrets } from '@backstage/plugin-scaffolder-react';\nimport Box from '@material-ui/core/Box';\nimport Divider from '@material-ui/core/Divider';\nimport Typography from '@material-ui/core/Typography';\nimport { useCallback, useEffect, useMemo, useState } from 'react';\nimport useDebounce from 'react-use/esm/useDebounce';\nimport { AzureRepoPicker } from './AzureRepoPicker';\nimport { BitbucketRepoPicker } from './BitbucketRepoPicker';\nimport { GerritRepoPicker } from './GerritRepoPicker';\nimport { GiteaRepoPicker } from './GiteaRepoPicker';\nimport { GithubRepoPicker } from './GithubRepoPicker';\nimport { GitlabRepoPicker } from './GitlabRepoPicker';\nimport { RepoUrlPickerHost } from './RepoUrlPickerHost';\nimport { RepoUrlPickerRepoName } from './RepoUrlPickerRepoName';\nimport { RepoUrlPickerFieldSchema } from './schema';\nimport { RepoUrlPickerState } from './types';\nimport { parseRepoPickerUrl, serializeRepoPickerUrl } from './utils';\nimport { MarkdownContent } from '@backstage/core-components';\nimport { useScaffolderTheme } from '@backstage/plugin-scaffolder-react/alpha';\nimport { Flex, Text } from '@backstage/ui';\n\nexport { RepoUrlPickerSchema } from './schema';\n\n/**\n * The underlying component that is rendered in the form for the `RepoUrlPicker`\n * field extension.\n *\n * @public\n */\nexport const RepoUrlPicker = (\n props: typeof RepoUrlPickerFieldSchema.TProps,\n) => {\n const scaffolderTheme = useScaffolderTheme();\n const { uiSchema, onChange, rawErrors, formData, schema } = props;\n const [state, setState] = useState<RepoUrlPickerState>(\n parseRepoPickerUrl(formData),\n );\n const [credentialsHost, setCredentialsHost] = useState<string | undefined>(\n undefined,\n );\n const integrationApi = useApi(scmIntegrationsApiRef);\n const scmAuthApi = useApi(scmAuthApiRef);\n const { secrets, setSecrets } = useTemplateSecrets();\n const allowedHosts = useMemo(\n () => uiSchema?.['ui:options']?.allowedHosts ?? [],\n [uiSchema],\n );\n const allowedOrganizations = useMemo(\n () => uiSchema?.['ui:options']?.allowedOrganizations ?? [],\n [uiSchema],\n );\n const allowedOwners = useMemo(\n () => uiSchema?.['ui:options']?.allowedOwners ?? [],\n [uiSchema],\n );\n const allowedProjects = useMemo(\n () => uiSchema?.['ui:options']?.allowedProjects ?? [],\n [uiSchema],\n );\n const allowedRepos = useMemo(\n () => uiSchema?.['ui:options']?.allowedRepos ?? [],\n [uiSchema],\n );\n const isDisabled = useMemo(\n () => uiSchema?.['ui:disabled'] ?? false,\n [uiSchema],\n );\n const { owner, organization, project, repoName } = state;\n\n useEffect(() => {\n onChange(serializeRepoPickerUrl(state));\n }, [state, onChange]);\n\n /* we deal with calling the repo setting here instead of in each components for ease */\n useEffect(() => {\n if (allowedOrganizations.length > 0 && !organization) {\n setState(prevState => ({\n ...prevState,\n organization: allowedOrganizations[0],\n }));\n }\n }, [setState, allowedOrganizations, organization]);\n\n useEffect(() => {\n if (allowedOwners.length > 0 && !owner) {\n setState(prevState => ({\n ...prevState,\n owner: allowedOwners[0],\n }));\n }\n }, [setState, allowedOwners, owner]);\n\n useEffect(() => {\n if (allowedProjects.length > 0 && !project) {\n setState(prevState => ({\n ...prevState,\n project: allowedProjects[0],\n }));\n }\n }, [setState, allowedProjects, project]);\n\n useEffect(() => {\n if (allowedRepos.length > 0 && !repoName) {\n setState(prevState => ({ ...prevState, repoName: allowedRepos[0] }));\n }\n }, [setState, allowedRepos, repoName]);\n\n const updateLocalState = useCallback(\n (newState: RepoUrlPickerState) => {\n setState(prevState => ({ ...prevState, ...newState }));\n },\n [setState],\n );\n\n useDebounce(\n async () => {\n const { requestUserCredentials } = uiSchema?.['ui:options'] ?? {};\n\n if (!requestUserCredentials || !state.host) {\n return;\n }\n\n // don't show login prompt if secret value is already in state for selected host\n if (\n secrets[requestUserCredentials.secretsKey] &&\n credentialsHost === state.host\n ) {\n return;\n }\n\n // user has requested that we use the users credentials\n // so lets grab them using the scmAuthApi and pass through\n // any additional scopes from the ui:options\n const { token } = await scmAuthApi.getCredentials({\n url: `https://${state.host}`,\n additionalScope: {\n repoWrite: true,\n customScopes: requestUserCredentials.additionalScopes,\n },\n });\n\n // set the secret using the key provided in the ui:options for use\n // in the templating the manifest with ${{ secrets[secretsKey] }}\n setSecrets({ [requestUserCredentials.secretsKey]: token });\n setCredentialsHost(state.host);\n },\n 500,\n [state, uiSchema],\n );\n\n const hostType =\n (state.host && integrationApi.byHost(state.host)?.type) ?? null;\n\n const description = uiSchema['ui:description'] ?? schema.description;\n\n const accessToken =\n uiSchema?.['ui:options']?.requestUserCredentials?.secretsKey &&\n secrets[uiSchema['ui:options'].requestUserCredentials.secretsKey];\n\n const subComponents = (\n <>\n <RepoUrlPickerHost\n host={state.host}\n hosts={allowedHosts}\n onChange={host => setState(prevState => ({ ...prevState, host }))}\n rawErrors={rawErrors}\n isDisabled={isDisabled}\n />\n {hostType === 'github' && (\n <GithubRepoPicker\n allowedOwners={allowedOwners}\n onChange={updateLocalState}\n rawErrors={rawErrors}\n state={state}\n isDisabled={isDisabled}\n accessToken={accessToken}\n />\n )}\n {hostType === 'gitea' && (\n <GiteaRepoPicker\n allowedOwners={allowedOwners}\n allowedRepos={allowedRepos}\n rawErrors={rawErrors}\n state={state}\n isDisabled={isDisabled}\n onChange={updateLocalState}\n />\n )}\n {hostType === 'gitlab' && (\n <GitlabRepoPicker\n allowedOwners={allowedOwners}\n rawErrors={rawErrors}\n state={state}\n onChange={updateLocalState}\n isDisabled={isDisabled}\n accessToken={accessToken}\n />\n )}\n {(hostType === 'bitbucket' ||\n hostType === 'bitbucketCloud' ||\n hostType === 'bitbucketServer') && (\n <BitbucketRepoPicker\n allowedOwners={allowedOwners}\n allowedProjects={allowedProjects}\n rawErrors={rawErrors}\n state={state}\n onChange={updateLocalState}\n isDisabled={isDisabled}\n accessToken={accessToken}\n />\n )}\n {hostType === 'azure' && (\n <AzureRepoPicker\n allowedOrganizations={allowedOrganizations}\n allowedProject={allowedProjects}\n rawErrors={rawErrors}\n state={state}\n isDisabled={isDisabled}\n onChange={updateLocalState}\n />\n )}\n {hostType === 'gerrit' && (\n <GerritRepoPicker\n rawErrors={rawErrors}\n state={state}\n onChange={updateLocalState}\n isDisabled={isDisabled}\n />\n )}\n <RepoUrlPickerRepoName\n repoName={state.repoName}\n allowedRepos={allowedRepos}\n onChange={repo =>\n setState(prevState => ({\n ...prevState,\n repoName: repo.id || repo.name,\n }))\n }\n isDisabled={isDisabled}\n rawErrors={rawErrors}\n availableRepos={state.availableRepos}\n />\n </>\n );\n\n if (scaffolderTheme === 'bui') {\n return (\n <Flex direction=\"column\" gap=\"4\">\n {schema.title && (\n <Text as=\"h5\" variant=\"title-small\" weight=\"bold\">\n {schema.title}\n </Text>\n )}\n {description && <MarkdownContent content={description} />}\n {subComponents}\n </Flex>\n );\n }\n\n return (\n <>\n {schema.title && (\n <Box my={1}>\n <Typography variant=\"h5\">{schema.title}</Typography>\n <Divider />\n </Box>\n )}\n {description && (\n <Typography variant=\"body1\">\n <MarkdownContent content={description} />\n </Typography>\n )}\n {subComponents}\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAiDO,MAAM,aAAA,GAAg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,MAAA,CAAO,KAAA,oBACN,GAAA,CAAC,IAAA,EAAA,EAAK,EAAA,EAAG,IAAA,EAAK,SAAQ,aAAA,EAAc,MAAA,EAAO,MAAA,EACxC,QAAA,EAAA,MAAA,CAAO,KAAA,EACV,CAAA;AAAA,MAED,WAAA,oBAAe,GAAA,CAAC,eAAA,EAAA,EAAgB,OAAA,EAAS,WAAA,EAAa,CAAA;AAAA,MACtD;AAAA,KAAA,EACH,CAAA;AAAA,EAEJ;AAEA,EAAA,uBACE,IAAA,CAAA,QAAA,EAAA,EACG,QAAA,EAAA;AAAA,IAAA,MAAA,CAAO,KAAA,oBACN,IAAA,CAAC,GAAA,EAAA,EAAI,EAAA,EAAI,CAAA,EACP,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,UAAA,EAAA,EAAW,OAAA,EAAQ,IAAA,EAAM,QAAA,EAAA,MAAA,CAAO,KAAA,EAAM,CAAA;AAAA,0BACtC,OAAA,EAAA,EAAQ;AAAA,KAAA,EACX,CAAA;AAAA,IAED,WAAA,wBACE,UAAA,EAAA,EAAW,OAAA,EAAQ,SAClB,QAAA,kBAAA,GAAA,CAAC,eAAA,EAAA,EAAgB,OAAA,EAAS,WAAA,EAAa,CAAA,EACzC,CAAA;AAAA,IAED;AAAA,GAAA,EACH,CAAA;AAEJ;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-scaffolder",
|
|
3
|
-
"version": "1.38.
|
|
3
|
+
"version": "1.38.1-next.1",
|
|
4
4
|
"description": "The Backstage plugin that helps you create new things",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "frontend-plugin",
|
|
@@ -70,24 +70,24 @@
|
|
|
70
70
|
"test": "backstage-cli package test"
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@backstage/catalog-client": "
|
|
74
|
-
"@backstage/catalog-model": "
|
|
75
|
-
"@backstage/core-components": "
|
|
76
|
-
"@backstage/core-plugin-api": "
|
|
77
|
-
"@backstage/errors": "
|
|
78
|
-
"@backstage/filter-predicates": "
|
|
79
|
-
"@backstage/frontend-plugin-api": "
|
|
80
|
-
"@backstage/integration": "
|
|
81
|
-
"@backstage/integration-react": "
|
|
82
|
-
"@backstage/plugin-catalog-common": "
|
|
83
|
-
"@backstage/plugin-catalog-react": "
|
|
84
|
-
"@backstage/plugin-permission-react": "
|
|
85
|
-
"@backstage/plugin-scaffolder-common": "
|
|
86
|
-
"@backstage/plugin-scaffolder-react": "
|
|
87
|
-
"@backstage/plugin-techdocs-common": "
|
|
88
|
-
"@backstage/plugin-techdocs-react": "
|
|
89
|
-
"@backstage/types": "
|
|
90
|
-
"@backstage/ui": "
|
|
73
|
+
"@backstage/catalog-client": "1.16.1-next.0",
|
|
74
|
+
"@backstage/catalog-model": "1.9.0",
|
|
75
|
+
"@backstage/core-components": "0.18.12-next.0",
|
|
76
|
+
"@backstage/core-plugin-api": "1.12.8-next.0",
|
|
77
|
+
"@backstage/errors": "1.3.1",
|
|
78
|
+
"@backstage/filter-predicates": "0.1.4-next.0",
|
|
79
|
+
"@backstage/frontend-plugin-api": "0.17.3-next.1",
|
|
80
|
+
"@backstage/integration": "2.0.3",
|
|
81
|
+
"@backstage/integration-react": "1.2.20-next.0",
|
|
82
|
+
"@backstage/plugin-catalog-common": "1.1.10",
|
|
83
|
+
"@backstage/plugin-catalog-react": "3.2.0-next.0",
|
|
84
|
+
"@backstage/plugin-permission-react": "0.5.3-next.0",
|
|
85
|
+
"@backstage/plugin-scaffolder-common": "2.2.1",
|
|
86
|
+
"@backstage/plugin-scaffolder-react": "2.0.2-next.0",
|
|
87
|
+
"@backstage/plugin-techdocs-common": "0.1.1",
|
|
88
|
+
"@backstage/plugin-techdocs-react": "1.3.13-next.0",
|
|
89
|
+
"@backstage/types": "1.2.2",
|
|
90
|
+
"@backstage/ui": "0.17.0-next.1",
|
|
91
91
|
"@codemirror/language": "^6.0.0",
|
|
92
92
|
"@codemirror/legacy-modes": "^6.1.0",
|
|
93
93
|
"@codemirror/view": "^6.0.0",
|
|
@@ -120,14 +120,14 @@
|
|
|
120
120
|
"zod-to-json-schema": "^3.25.1"
|
|
121
121
|
},
|
|
122
122
|
"devDependencies": {
|
|
123
|
-
"@backstage/cli": "
|
|
124
|
-
"@backstage/core-app-api": "
|
|
125
|
-
"@backstage/dev-utils": "
|
|
126
|
-
"@backstage/frontend-test-utils": "
|
|
127
|
-
"@backstage/plugin-catalog": "
|
|
128
|
-
"@backstage/plugin-permission-common": "
|
|
129
|
-
"@backstage/plugin-techdocs": "
|
|
130
|
-
"@backstage/test-utils": "
|
|
123
|
+
"@backstage/cli": "0.36.4-next.1",
|
|
124
|
+
"@backstage/core-app-api": "1.20.3-next.0",
|
|
125
|
+
"@backstage/dev-utils": "1.1.25-next.0",
|
|
126
|
+
"@backstage/frontend-test-utils": "0.6.2-next.0",
|
|
127
|
+
"@backstage/plugin-catalog": "2.0.7-next.0",
|
|
128
|
+
"@backstage/plugin-permission-common": "0.9.9",
|
|
129
|
+
"@backstage/plugin-techdocs": "1.17.8-next.0",
|
|
130
|
+
"@backstage/test-utils": "1.7.20-next.0",
|
|
131
131
|
"@testing-library/dom": "^10.0.0",
|
|
132
132
|
"@testing-library/jest-dom": "^6.0.0",
|
|
133
133
|
"@testing-library/react": "^16.0.0",
|