@backstage/plugin-scaffolder 1.20.1 → 1.21.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 +62 -3
- package/README.md +9 -0
- package/alpha/package.json +1 -1
- package/dist/api.esm.js +29 -35
- package/dist/api.esm.js.map +1 -1
- package/dist/components/ActionsPage/ActionsPage.esm.js +32 -33
- package/dist/components/ActionsPage/ActionsPage.esm.js.map +1 -1
- package/dist/components/FileBrowser/FileBrowser.esm.js +1 -1
- package/dist/components/FileBrowser/FileBrowser.esm.js.map +1 -1
- package/dist/components/ListTasksPage/ListTasksPage.esm.js +10 -18
- package/dist/components/ListTasksPage/ListTasksPage.esm.js.map +1 -1
- package/dist/components/ListTasksPage/columns/OwnerEntityColumn.esm.js +1 -2
- package/dist/components/ListTasksPage/columns/OwnerEntityColumn.esm.js.map +1 -1
- package/dist/components/ListTasksPage/columns/TemplateTitleColumn.esm.js +1 -1
- package/dist/components/ListTasksPage/columns/TemplateTitleColumn.esm.js.map +1 -1
- package/dist/components/OngoingTask/ContextMenu.esm.js +24 -3
- package/dist/components/OngoingTask/ContextMenu.esm.js.map +1 -1
- package/dist/components/OngoingTask/OngoingTask.esm.js +26 -21
- package/dist/components/OngoingTask/OngoingTask.esm.js.map +1 -1
- package/dist/components/fields/EntityNamePicker/EntityNamePicker.esm.js +3 -3
- package/dist/components/fields/EntityNamePicker/EntityNamePicker.esm.js.map +1 -1
- package/dist/components/fields/EntityPicker/EntityPicker.esm.js +11 -13
- package/dist/components/fields/EntityPicker/EntityPicker.esm.js.map +1 -1
- package/dist/components/fields/EntityTagsPicker/EntityTagsPicker.esm.js +6 -7
- package/dist/components/fields/EntityTagsPicker/EntityTagsPicker.esm.js.map +1 -1
- package/dist/components/fields/MultiEntityPicker/MultiEntityPicker.esm.js +17 -23
- package/dist/components/fields/MultiEntityPicker/MultiEntityPicker.esm.js.map +1 -1
- package/dist/components/fields/MyGroupsPicker/MyGroupsPicker.esm.js +7 -11
- package/dist/components/fields/MyGroupsPicker/MyGroupsPicker.esm.js.map +1 -1
- package/dist/components/fields/OwnedEntityPicker/OwnedEntityPicker.esm.js +1 -1
- package/dist/components/fields/OwnedEntityPicker/OwnedEntityPicker.esm.js.map +1 -1
- package/dist/components/fields/OwnerPicker/OwnerPicker.esm.js +4 -5
- package/dist/components/fields/OwnerPicker/OwnerPicker.esm.js.map +1 -1
- package/dist/components/fields/RepoUrlPicker/AzureRepoPicker.esm.js +16 -16
- package/dist/components/fields/RepoUrlPicker/AzureRepoPicker.esm.js.map +1 -1
- package/dist/components/fields/RepoUrlPicker/BitbucketRepoPicker.esm.js +6 -6
- package/dist/components/fields/RepoUrlPicker/BitbucketRepoPicker.esm.js.map +1 -1
- package/dist/components/fields/RepoUrlPicker/GerritRepoPicker.esm.js +2 -2
- package/dist/components/fields/RepoUrlPicker/GerritRepoPicker.esm.js.map +1 -1
- package/dist/components/fields/RepoUrlPicker/GiteaRepoPicker.esm.js +2 -2
- package/dist/components/fields/RepoUrlPicker/GiteaRepoPicker.esm.js.map +1 -1
- package/dist/components/fields/RepoUrlPicker/GithubRepoPicker.esm.js +2 -2
- package/dist/components/fields/RepoUrlPicker/GithubRepoPicker.esm.js.map +1 -1
- package/dist/components/fields/RepoUrlPicker/GitlabRepoPicker.esm.js +2 -2
- package/dist/components/fields/RepoUrlPicker/GitlabRepoPicker.esm.js.map +1 -1
- package/dist/components/fields/RepoUrlPicker/RepoUrlPicker.esm.js +8 -25
- package/dist/components/fields/RepoUrlPicker/RepoUrlPicker.esm.js.map +1 -1
- package/dist/components/fields/RepoUrlPicker/RepoUrlPickerHost.esm.js +6 -6
- package/dist/components/fields/RepoUrlPicker/RepoUrlPickerHost.esm.js.map +1 -1
- package/dist/components/fields/RepoUrlPicker/RepoUrlPickerRepoName.esm.js +3 -3
- package/dist/components/fields/RepoUrlPicker/RepoUrlPickerRepoName.esm.js.map +1 -1
- package/dist/components/fields/RepoUrlPicker/validation.esm.js +2 -3
- package/dist/components/fields/RepoUrlPicker/validation.esm.js.map +1 -1
- package/dist/components/fields/SecretInput/SecretInput.esm.js +3 -5
- package/dist/components/fields/SecretInput/SecretInput.esm.js.map +1 -1
- package/dist/next/TemplateEditorPage/CustomFieldExplorer.esm.js +14 -18
- package/dist/next/TemplateEditorPage/CustomFieldExplorer.esm.js.map +1 -1
- package/dist/next/TemplateEditorPage/DirectoryEditorContext.esm.js +55 -91
- package/dist/next/TemplateEditorPage/DirectoryEditorContext.esm.js.map +1 -1
- package/dist/next/TemplateEditorPage/DryRunContext.esm.js +5 -9
- package/dist/next/TemplateEditorPage/DryRunContext.esm.js.map +1 -1
- package/dist/next/TemplateEditorPage/DryRunResults/DryRunResultsList.esm.js +1 -2
- package/dist/next/TemplateEditorPage/DryRunResults/DryRunResultsList.esm.js.map +1 -1
- package/dist/next/TemplateEditorPage/DryRunResults/DryRunResultsView.esm.js +8 -12
- package/dist/next/TemplateEditorPage/DryRunResults/DryRunResultsView.esm.js.map +1 -1
- package/dist/next/TemplateEditorPage/DryRunResults/TaskPageLinks.esm.js +2 -5
- package/dist/next/TemplateEditorPage/DryRunResults/TaskPageLinks.esm.js.map +1 -1
- package/dist/next/TemplateEditorPage/TemplateEditorBrowser.esm.js +1 -2
- package/dist/next/TemplateEditorPage/TemplateEditorBrowser.esm.js.map +1 -1
- package/dist/next/TemplateEditorPage/TemplateEditorForm.esm.js +4 -13
- package/dist/next/TemplateEditorPage/TemplateEditorForm.esm.js.map +1 -1
- package/dist/next/TemplateEditorPage/TemplateEditorIntro.esm.js +3 -12
- package/dist/next/TemplateEditorPage/TemplateEditorIntro.esm.js.map +1 -1
- package/dist/next/TemplateEditorPage/TemplateEditorPage.esm.js +3 -3
- package/dist/next/TemplateEditorPage/TemplateEditorPage.esm.js.map +1 -1
- package/dist/next/TemplateEditorPage/TemplateEditorTextArea.esm.js +5 -15
- package/dist/next/TemplateEditorPage/TemplateEditorTextArea.esm.js.map +1 -1
- package/dist/next/TemplateEditorPage/TemplateFormPreviewer.esm.js +4 -7
- package/dist/next/TemplateEditorPage/TemplateFormPreviewer.esm.js.map +1 -1
- package/dist/next/TemplateListPage/TemplateListPage.esm.js +5 -7
- package/dist/next/TemplateListPage/TemplateListPage.esm.js.map +1 -1
- package/dist/next/TemplateWizardPage/TemplateWizardPage.esm.js +1 -2
- package/dist/next/TemplateWizardPage/TemplateWizardPage.esm.js.map +1 -1
- package/dist/routes.esm.js +4 -2
- package/dist/routes.esm.js.map +1 -1
- package/package.json +20 -18
|
@@ -14,8 +14,8 @@ const BitbucketRepoPicker = (props) => {
|
|
|
14
14
|
state
|
|
15
15
|
} = props;
|
|
16
16
|
const { host, workspace, project } = state;
|
|
17
|
-
const ownerItems = allowedOwners ? allowedOwners
|
|
18
|
-
const projectItems = allowedProjects ? allowedProjects
|
|
17
|
+
const ownerItems = allowedOwners ? allowedOwners?.map((i) => ({ label: i, value: i })) : [];
|
|
18
|
+
const projectItems = allowedProjects ? allowedProjects?.map((i) => ({ label: i, value: i })) : [];
|
|
19
19
|
useEffect(() => {
|
|
20
20
|
if (host === "bitbucket.org" && allowedOwners.length) {
|
|
21
21
|
onChange({ workspace: allowedOwners[0] });
|
|
@@ -26,9 +26,9 @@ const BitbucketRepoPicker = (props) => {
|
|
|
26
26
|
{
|
|
27
27
|
margin: "normal",
|
|
28
28
|
required: true,
|
|
29
|
-
error:
|
|
29
|
+
error: rawErrors?.length > 0 && !workspace
|
|
30
30
|
},
|
|
31
|
-
|
|
31
|
+
allowedOwners?.length ? /* @__PURE__ */ React.createElement(
|
|
32
32
|
Select,
|
|
33
33
|
{
|
|
34
34
|
native: true,
|
|
@@ -52,9 +52,9 @@ const BitbucketRepoPicker = (props) => {
|
|
|
52
52
|
{
|
|
53
53
|
margin: "normal",
|
|
54
54
|
required: true,
|
|
55
|
-
error:
|
|
55
|
+
error: rawErrors?.length > 0 && !project
|
|
56
56
|
},
|
|
57
|
-
|
|
57
|
+
allowedProjects?.length ? /* @__PURE__ */ React.createElement(
|
|
58
58
|
Select,
|
|
59
59
|
{
|
|
60
60
|
native: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BitbucketRepoPicker.esm.js","sources":["../../../../src/components/fields/RepoUrlPicker/BitbucketRepoPicker.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 React, { useEffect } from 'react';\nimport FormControl from '@material-ui/core/FormControl';\nimport FormHelperText from '@material-ui/core/FormHelperText';\nimport Input from '@material-ui/core/Input';\nimport InputLabel from '@material-ui/core/InputLabel';\nimport { Select, SelectItem } from '@backstage/core-components';\nimport { RepoUrlPickerState } from './types';\n\n/**\n * The underlying component that is rendered in the form for the `BitbucketRepoPicker`\n * field extension.\n *\n * @public\n * @param allowedOwners - Allowed workspaces for the Bitbucket cloud repository\n * @param allowedProjects - Allowed projects for the Bitbucket cloud repository\n *\n */\nexport const BitbucketRepoPicker = (props: {\n allowedOwners?: string[];\n allowedProjects?: string[];\n onChange: (state: RepoUrlPickerState) => void;\n state: RepoUrlPickerState;\n rawErrors: string[];\n}) => {\n const {\n allowedOwners = [],\n allowedProjects = [],\n onChange,\n rawErrors,\n state,\n } = props;\n const { host, workspace, project } = state;\n const ownerItems: SelectItem[] = allowedOwners\n ? allowedOwners?.map(i => ({ label: i, value: i }))\n : [];\n const projectItems: SelectItem[] = allowedProjects\n ? allowedProjects?.map(i => ({ label: i, value: i }))\n : [];\n\n useEffect(() => {\n if (host === 'bitbucket.org' && allowedOwners.length) {\n onChange({ workspace: allowedOwners[0] });\n }\n }, [allowedOwners, host, onChange]);\n\n return (\n <>\n {host === 'bitbucket.org' && (\n <FormControl\n margin=\"normal\"\n required\n error={rawErrors?.length > 0 && !workspace}\n >\n {allowedOwners?.length ? (\n <Select\n native\n label=\"Allowed Workspaces\"\n onChange={s =>\n onChange({ workspace: String(Array.isArray(s) ? s[0] : s) })\n }\n disabled={allowedOwners.length === 1}\n selected={workspace}\n items={ownerItems}\n />\n ) : (\n <>\n <InputLabel htmlFor=\"workspaceInput\">Workspace</InputLabel>\n <Input\n id=\"workspaceInput\"\n onChange={e => onChange({ workspace: e.target.value })}\n value={workspace}\n />\n </>\n )}\n <FormHelperText>\n The Workspace that this repo will belong to\n </FormHelperText>\n </FormControl>\n )}\n <FormControl\n margin=\"normal\"\n required\n error={rawErrors?.length > 0 && !project}\n >\n {allowedProjects?.length ? (\n <Select\n native\n label=\"Allowed Projects\"\n onChange={s =>\n onChange({ project: String(Array.isArray(s) ? s[0] : s) })\n }\n disabled={allowedProjects.length === 1}\n selected={project}\n items={projectItems}\n />\n ) : (\n <>\n <InputLabel htmlFor=\"projectInput\">Project</InputLabel>\n <Input\n id=\"projectInput\"\n onChange={e => onChange({ project: e.target.value })}\n value={project}\n />\n </>\n )}\n <FormHelperText>\n The Project that this repo will belong to\n </FormHelperText>\n </FormControl>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAgCa,MAAA,mBAAA,GAAsB,CAAC,KAM9B,KAAA;AACJ,EAAM,MAAA;AAAA,IACJ,gBAAgB,EAAC;AAAA,IACjB,kBAAkB,EAAC;AAAA,IACnB,QAAA;AAAA,IACA,SAAA;AAAA,IACA,KAAA;AAAA,GACE,GAAA,KAAA,CAAA;AACJ,EAAA,MAAM,EAAE,IAAA,EAAM,SAAW,EAAA,OAAA,EAAY,GAAA,KAAA,CAAA;AACrC,
|
|
1
|
+
{"version":3,"file":"BitbucketRepoPicker.esm.js","sources":["../../../../src/components/fields/RepoUrlPicker/BitbucketRepoPicker.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 React, { useEffect } from 'react';\nimport FormControl from '@material-ui/core/FormControl';\nimport FormHelperText from '@material-ui/core/FormHelperText';\nimport Input from '@material-ui/core/Input';\nimport InputLabel from '@material-ui/core/InputLabel';\nimport { Select, SelectItem } from '@backstage/core-components';\nimport { RepoUrlPickerState } from './types';\n\n/**\n * The underlying component that is rendered in the form for the `BitbucketRepoPicker`\n * field extension.\n *\n * @public\n * @param allowedOwners - Allowed workspaces for the Bitbucket cloud repository\n * @param allowedProjects - Allowed projects for the Bitbucket cloud repository\n *\n */\nexport const BitbucketRepoPicker = (props: {\n allowedOwners?: string[];\n allowedProjects?: string[];\n onChange: (state: RepoUrlPickerState) => void;\n state: RepoUrlPickerState;\n rawErrors: string[];\n}) => {\n const {\n allowedOwners = [],\n allowedProjects = [],\n onChange,\n rawErrors,\n state,\n } = props;\n const { host, workspace, project } = state;\n const ownerItems: SelectItem[] = allowedOwners\n ? allowedOwners?.map(i => ({ label: i, value: i }))\n : [];\n const projectItems: SelectItem[] = allowedProjects\n ? allowedProjects?.map(i => ({ label: i, value: i }))\n : [];\n\n useEffect(() => {\n if (host === 'bitbucket.org' && allowedOwners.length) {\n onChange({ workspace: allowedOwners[0] });\n }\n }, [allowedOwners, host, onChange]);\n\n return (\n <>\n {host === 'bitbucket.org' && (\n <FormControl\n margin=\"normal\"\n required\n error={rawErrors?.length > 0 && !workspace}\n >\n {allowedOwners?.length ? (\n <Select\n native\n label=\"Allowed Workspaces\"\n onChange={s =>\n onChange({ workspace: String(Array.isArray(s) ? s[0] : s) })\n }\n disabled={allowedOwners.length === 1}\n selected={workspace}\n items={ownerItems}\n />\n ) : (\n <>\n <InputLabel htmlFor=\"workspaceInput\">Workspace</InputLabel>\n <Input\n id=\"workspaceInput\"\n onChange={e => onChange({ workspace: e.target.value })}\n value={workspace}\n />\n </>\n )}\n <FormHelperText>\n The Workspace that this repo will belong to\n </FormHelperText>\n </FormControl>\n )}\n <FormControl\n margin=\"normal\"\n required\n error={rawErrors?.length > 0 && !project}\n >\n {allowedProjects?.length ? (\n <Select\n native\n label=\"Allowed Projects\"\n onChange={s =>\n onChange({ project: String(Array.isArray(s) ? s[0] : s) })\n }\n disabled={allowedProjects.length === 1}\n selected={project}\n items={projectItems}\n />\n ) : (\n <>\n <InputLabel htmlFor=\"projectInput\">Project</InputLabel>\n <Input\n id=\"projectInput\"\n onChange={e => onChange({ project: e.target.value })}\n value={project}\n />\n </>\n )}\n <FormHelperText>\n The Project that this repo will belong to\n </FormHelperText>\n </FormControl>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAgCa,MAAA,mBAAA,GAAsB,CAAC,KAM9B,KAAA;AACJ,EAAM,MAAA;AAAA,IACJ,gBAAgB,EAAC;AAAA,IACjB,kBAAkB,EAAC;AAAA,IACnB,QAAA;AAAA,IACA,SAAA;AAAA,IACA,KAAA;AAAA,GACE,GAAA,KAAA,CAAA;AACJ,EAAA,MAAM,EAAE,IAAA,EAAM,SAAW,EAAA,OAAA,EAAY,GAAA,KAAA,CAAA;AACrC,EAAA,MAAM,UAA2B,GAAA,aAAA,GAC7B,aAAe,EAAA,GAAA,CAAI,CAAM,CAAA,MAAA,EAAE,KAAO,EAAA,CAAA,EAAG,KAAO,EAAA,CAAA,EAAI,CAAA,CAAA,GAChD,EAAC,CAAA;AACL,EAAA,MAAM,YAA6B,GAAA,eAAA,GAC/B,eAAiB,EAAA,GAAA,CAAI,CAAM,CAAA,MAAA,EAAE,KAAO,EAAA,CAAA,EAAG,KAAO,EAAA,CAAA,EAAI,CAAA,CAAA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AAA,CAAA,aAAA,CAAC,sBAAe,2CAEhB,CAAA;AAAA,GAEJ,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -7,7 +7,7 @@ import InputLabel from '@material-ui/core/InputLabel';
|
|
|
7
7
|
const GerritRepoPicker = (props) => {
|
|
8
8
|
const { onChange, rawErrors, state } = props;
|
|
9
9
|
const { workspace, owner } = state;
|
|
10
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(FormControl, { margin: "normal", error:
|
|
10
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(FormControl, { margin: "normal", error: rawErrors?.length > 0 && !workspace }, /* @__PURE__ */ React.createElement(InputLabel, { htmlFor: "ownerInput" }, "Owner"), /* @__PURE__ */ React.createElement(
|
|
11
11
|
Input,
|
|
12
12
|
{
|
|
13
13
|
id: "ownerInput",
|
|
@@ -19,7 +19,7 @@ const GerritRepoPicker = (props) => {
|
|
|
19
19
|
{
|
|
20
20
|
margin: "normal",
|
|
21
21
|
required: true,
|
|
22
|
-
error:
|
|
22
|
+
error: rawErrors?.length > 0 && !workspace
|
|
23
23
|
},
|
|
24
24
|
/* @__PURE__ */ React.createElement(InputLabel, { htmlFor: "parentInput" }, "Parent"),
|
|
25
25
|
/* @__PURE__ */ React.createElement(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GerritRepoPicker.esm.js","sources":["../../../../src/components/fields/RepoUrlPicker/GerritRepoPicker.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\nimport FormControl from '@material-ui/core/FormControl';\nimport FormHelperText from '@material-ui/core/FormHelperText';\nimport Input from '@material-ui/core/Input';\nimport InputLabel from '@material-ui/core/InputLabel';\nimport { RepoUrlPickerState } from './types';\n\nexport const GerritRepoPicker = (props: {\n onChange: (state: RepoUrlPickerState) => void;\n state: RepoUrlPickerState;\n rawErrors: string[];\n}) => {\n const { onChange, rawErrors, state } = props;\n const { workspace, owner } = state;\n return (\n <>\n <FormControl margin=\"normal\" error={rawErrors?.length > 0 && !workspace}>\n <InputLabel htmlFor=\"ownerInput\">Owner</InputLabel>\n <Input\n id=\"ownerInput\"\n onChange={e => onChange({ owner: e.target.value })}\n value={owner}\n />\n <FormHelperText>The owner of the project (optional)</FormHelperText>\n </FormControl>\n <FormControl\n margin=\"normal\"\n required\n error={rawErrors?.length > 0 && !workspace}\n >\n <InputLabel htmlFor=\"parentInput\">Parent</InputLabel>\n <Input\n id=\"parentInput\"\n onChange={e => onChange({ workspace: e.target.value })}\n value={workspace}\n />\n <FormHelperText>\n The project parent that the repo will belong to\n </FormHelperText>\n </FormControl>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;AAsBa,MAAA,gBAAA,GAAmB,CAAC,KAI3B,KAAA;AACJ,EAAA,MAAM,EAAE,QAAA,EAAU,SAAW,EAAA,KAAA,EAAU,GAAA,KAAA,CAAA;AACvC,EAAM,MAAA,EAAE,SAAW,EAAA,KAAA,EAAU,GAAA,KAAA,CAAA;AAC7B,EAAA,iFAEK,KAAA,CAAA,aAAA,CAAA,WAAA,EAAA,EAAY,MAAO,EAAA,QAAA,EAAS,
|
|
1
|
+
{"version":3,"file":"GerritRepoPicker.esm.js","sources":["../../../../src/components/fields/RepoUrlPicker/GerritRepoPicker.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\nimport FormControl from '@material-ui/core/FormControl';\nimport FormHelperText from '@material-ui/core/FormHelperText';\nimport Input from '@material-ui/core/Input';\nimport InputLabel from '@material-ui/core/InputLabel';\nimport { RepoUrlPickerState } from './types';\n\nexport const GerritRepoPicker = (props: {\n onChange: (state: RepoUrlPickerState) => void;\n state: RepoUrlPickerState;\n rawErrors: string[];\n}) => {\n const { onChange, rawErrors, state } = props;\n const { workspace, owner } = state;\n return (\n <>\n <FormControl margin=\"normal\" error={rawErrors?.length > 0 && !workspace}>\n <InputLabel htmlFor=\"ownerInput\">Owner</InputLabel>\n <Input\n id=\"ownerInput\"\n onChange={e => onChange({ owner: e.target.value })}\n value={owner}\n />\n <FormHelperText>The owner of the project (optional)</FormHelperText>\n </FormControl>\n <FormControl\n margin=\"normal\"\n required\n error={rawErrors?.length > 0 && !workspace}\n >\n <InputLabel htmlFor=\"parentInput\">Parent</InputLabel>\n <Input\n id=\"parentInput\"\n onChange={e => onChange({ workspace: e.target.value })}\n value={workspace}\n />\n <FormHelperText>\n The project parent that the repo will belong to\n </FormHelperText>\n </FormControl>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;AAsBa,MAAA,gBAAA,GAAmB,CAAC,KAI3B,KAAA;AACJ,EAAA,MAAM,EAAE,QAAA,EAAU,SAAW,EAAA,KAAA,EAAU,GAAA,KAAA,CAAA;AACvC,EAAM,MAAA,EAAE,SAAW,EAAA,KAAA,EAAU,GAAA,KAAA,CAAA;AAC7B,EAAA,iFAEK,KAAA,CAAA,aAAA,CAAA,WAAA,EAAA,EAAY,MAAO,EAAA,QAAA,EAAS,OAAO,SAAW,EAAA,MAAA,GAAS,CAAK,IAAA,CAAC,6BAC3D,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,YAAA,EAAA,EAAa,OAAK,CACtC,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,EAAG,EAAA,YAAA;AAAA,MACH,QAAA,EAAU,OAAK,QAAS,CAAA,EAAE,OAAO,CAAE,CAAA,MAAA,CAAO,OAAO,CAAA;AAAA,MACjD,KAAO,EAAA,KAAA;AAAA,KAAA;AAAA,GAET,kBAAA,KAAA,CAAA,aAAA,CAAC,cAAe,EAAA,IAAA,EAAA,qCAAmC,CACrD,CACA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,WAAA;AAAA,IAAA;AAAA,MACC,MAAO,EAAA,QAAA;AAAA,MACP,QAAQ,EAAA,IAAA;AAAA,MACR,KAAO,EAAA,SAAA,EAAW,MAAS,GAAA,CAAA,IAAK,CAAC,SAAA;AAAA,KAAA;AAAA,oBAEhC,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,aAAA,EAAA,EAAc,QAAM,CAAA;AAAA,oBACxC,KAAA,CAAA,aAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,EAAG,EAAA,aAAA;AAAA,QACH,QAAA,EAAU,OAAK,QAAS,CAAA,EAAE,WAAW,CAAE,CAAA,MAAA,CAAO,OAAO,CAAA;AAAA,QACrD,KAAO,EAAA,SAAA;AAAA,OAAA;AAAA,KACT;AAAA,oBACA,KAAA,CAAA,aAAA,CAAC,sBAAe,iDAEhB,CAAA;AAAA,GAEJ,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -14,9 +14,9 @@ const GiteaRepoPicker = (props) => {
|
|
|
14
14
|
{
|
|
15
15
|
margin: "normal",
|
|
16
16
|
required: true,
|
|
17
|
-
error:
|
|
17
|
+
error: rawErrors?.length > 0 && !owner
|
|
18
18
|
},
|
|
19
|
-
|
|
19
|
+
allowedOwners?.length ? /* @__PURE__ */ React.createElement(
|
|
20
20
|
Select,
|
|
21
21
|
{
|
|
22
22
|
native: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GiteaRepoPicker.esm.js","sources":["../../../../src/components/fields/RepoUrlPicker/GiteaRepoPicker.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 React from 'react';\nimport FormControl from '@material-ui/core/FormControl';\nimport FormHelperText from '@material-ui/core/FormHelperText';\nimport Input from '@material-ui/core/Input';\nimport InputLabel from '@material-ui/core/InputLabel';\nimport { Select, SelectItem } from '@backstage/core-components';\nimport { RepoUrlPickerState } from './types';\n\nexport const GiteaRepoPicker = (props: {\n allowedOwners?: string[];\n allowedRepos?: string[];\n state: RepoUrlPickerState;\n onChange: (state: RepoUrlPickerState) => void;\n rawErrors: string[];\n}) => {\n const { allowedOwners = [], state, onChange, rawErrors } = props;\n const ownerItems: SelectItem[] = allowedOwners\n ? allowedOwners.map(i => ({ label: i, value: i }))\n : [{ label: 'Loading...', value: 'loading' }];\n\n const { owner } = state;\n\n return (\n <>\n <FormControl\n margin=\"normal\"\n required\n error={rawErrors?.length > 0 && !owner}\n >\n {allowedOwners?.length ? (\n <Select\n native\n label=\"Owner Available\"\n onChange={selected =>\n onChange({\n owner: String(Array.isArray(selected) ? selected[0] : selected),\n })\n }\n disabled={allowedOwners.length === 1}\n selected={owner}\n items={ownerItems}\n />\n ) : (\n <>\n <InputLabel htmlFor=\"ownerInput\">Owner</InputLabel>\n <Input\n id=\"ownerInput\"\n onChange={e => onChange({ owner: e.target.value })}\n value={owner}\n />\n </>\n )}\n <FormHelperText>\n Gitea namespace where this repository will belong to. It can be the\n name of organization, group, subgroup, user, or the project.\n </FormHelperText>\n </FormControl>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAuBa,MAAA,eAAA,GAAkB,CAAC,KAM1B,KAAA;AACJ,EAAA,MAAM,EAAE,aAAgB,GAAA,IAAI,KAAO,EAAA,QAAA,EAAU,WAAc,GAAA,KAAA,CAAA;AAC3D,EAAA,MAAM,aAA2B,aAC7B,GAAA,aAAA,CAAc,IAAI,CAAM,CAAA,MAAA,EAAE,OAAO,CAAG,EAAA,KAAA,EAAO,CAAE,EAAA,CAAE,IAC/C,CAAC,EAAE,OAAO,YAAc,EAAA,KAAA,EAAO,WAAW,CAAA,CAAA;AAE9C,EAAM,MAAA,EAAE,OAAU,GAAA,KAAA,CAAA;AAElB,EAAA,uBAEI,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,WAAA;AAAA,IAAA;AAAA,MACC,MAAO,EAAA,QAAA;AAAA,MACP,QAAQ,EAAA,IAAA;AAAA,MACR,KAAO,EAAA,
|
|
1
|
+
{"version":3,"file":"GiteaRepoPicker.esm.js","sources":["../../../../src/components/fields/RepoUrlPicker/GiteaRepoPicker.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 React from 'react';\nimport FormControl from '@material-ui/core/FormControl';\nimport FormHelperText from '@material-ui/core/FormHelperText';\nimport Input from '@material-ui/core/Input';\nimport InputLabel from '@material-ui/core/InputLabel';\nimport { Select, SelectItem } from '@backstage/core-components';\nimport { RepoUrlPickerState } from './types';\n\nexport const GiteaRepoPicker = (props: {\n allowedOwners?: string[];\n allowedRepos?: string[];\n state: RepoUrlPickerState;\n onChange: (state: RepoUrlPickerState) => void;\n rawErrors: string[];\n}) => {\n const { allowedOwners = [], state, onChange, rawErrors } = props;\n const ownerItems: SelectItem[] = allowedOwners\n ? allowedOwners.map(i => ({ label: i, value: i }))\n : [{ label: 'Loading...', value: 'loading' }];\n\n const { owner } = state;\n\n return (\n <>\n <FormControl\n margin=\"normal\"\n required\n error={rawErrors?.length > 0 && !owner}\n >\n {allowedOwners?.length ? (\n <Select\n native\n label=\"Owner Available\"\n onChange={selected =>\n onChange({\n owner: String(Array.isArray(selected) ? selected[0] : selected),\n })\n }\n disabled={allowedOwners.length === 1}\n selected={owner}\n items={ownerItems}\n />\n ) : (\n <>\n <InputLabel htmlFor=\"ownerInput\">Owner</InputLabel>\n <Input\n id=\"ownerInput\"\n onChange={e => onChange({ owner: e.target.value })}\n value={owner}\n />\n </>\n )}\n <FormHelperText>\n Gitea namespace where this repository will belong to. It can be the\n name of organization, group, subgroup, user, or the project.\n </FormHelperText>\n </FormControl>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAuBa,MAAA,eAAA,GAAkB,CAAC,KAM1B,KAAA;AACJ,EAAA,MAAM,EAAE,aAAgB,GAAA,IAAI,KAAO,EAAA,QAAA,EAAU,WAAc,GAAA,KAAA,CAAA;AAC3D,EAAA,MAAM,aAA2B,aAC7B,GAAA,aAAA,CAAc,IAAI,CAAM,CAAA,MAAA,EAAE,OAAO,CAAG,EAAA,KAAA,EAAO,CAAE,EAAA,CAAE,IAC/C,CAAC,EAAE,OAAO,YAAc,EAAA,KAAA,EAAO,WAAW,CAAA,CAAA;AAE9C,EAAM,MAAA,EAAE,OAAU,GAAA,KAAA,CAAA;AAElB,EAAA,uBAEI,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,C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ors?.length > 0 && !owner
|
|
18
18
|
},
|
|
19
|
-
|
|
19
|
+
allowedOwners?.length ? /* @__PURE__ */ React.createElement(
|
|
20
20
|
Select,
|
|
21
21
|
{
|
|
22
22
|
native: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GithubRepoPicker.esm.js","sources":["../../../../src/components/fields/RepoUrlPicker/GithubRepoPicker.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 React from 'react';\nimport FormControl from '@material-ui/core/FormControl';\nimport FormHelperText from '@material-ui/core/FormHelperText';\nimport Input from '@material-ui/core/Input';\nimport InputLabel from '@material-ui/core/InputLabel';\nimport { Select, SelectItem } from '@backstage/core-components';\nimport { RepoUrlPickerState } from './types';\n\nexport const GithubRepoPicker = (props: {\n allowedOwners?: string[];\n rawErrors: string[];\n state: RepoUrlPickerState;\n onChange: (state: RepoUrlPickerState) => void;\n}) => {\n const { allowedOwners = [], rawErrors, state, onChange } = props;\n const ownerItems: SelectItem[] = allowedOwners\n ? allowedOwners.map(i => ({ label: i, value: i }))\n : [{ label: 'Loading...', value: 'loading' }];\n\n const { owner } = state;\n\n return (\n <>\n <FormControl\n margin=\"normal\"\n required\n error={rawErrors?.length > 0 && !owner}\n >\n {allowedOwners?.length ? (\n <Select\n native\n label=\"Owner Available\"\n onChange={s =>\n onChange({ owner: String(Array.isArray(s) ? s[0] : s) })\n }\n disabled={allowedOwners.length === 1}\n selected={owner}\n items={ownerItems}\n />\n ) : (\n <>\n <InputLabel htmlFor=\"ownerInput\">Owner</InputLabel>\n <Input\n id=\"ownerInput\"\n onChange={e => onChange({ owner: e.target.value })}\n value={owner}\n />\n </>\n )}\n <FormHelperText>\n The organization, user or project that this repo will belong to\n </FormHelperText>\n </FormControl>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAuBa,MAAA,gBAAA,GAAmB,CAAC,KAK3B,KAAA;AACJ,EAAA,MAAM,EAAE,aAAgB,GAAA,IAAI,SAAW,EAAA,KAAA,EAAO,UAAa,GAAA,KAAA,CAAA;AAC3D,EAAA,MAAM,aAA2B,aAC7B,GAAA,aAAA,CAAc,IAAI,CAAM,CAAA,MAAA,EAAE,OAAO,CAAG,EAAA,KAAA,EAAO,CAAE,EAAA,CAAE,IAC/C,CAAC,EAAE,OAAO,YAAc,EAAA,KAAA,EAAO,WAAW,CAAA,CAAA;AAE9C,EAAM,MAAA,EAAE,OAAU,GAAA,KAAA,CAAA;AAElB,EAAA,uBAEI,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,WAAA;AAAA,IAAA;AAAA,MACC,MAAO,EAAA,QAAA;AAAA,MACP,QAAQ,EAAA,IAAA;AAAA,MACR,KAAO,EAAA,
|
|
1
|
+
{"version":3,"file":"GithubRepoPicker.esm.js","sources":["../../../../src/components/fields/RepoUrlPicker/GithubRepoPicker.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 React from 'react';\nimport FormControl from '@material-ui/core/FormControl';\nimport FormHelperText from '@material-ui/core/FormHelperText';\nimport Input from '@material-ui/core/Input';\nimport InputLabel from '@material-ui/core/InputLabel';\nimport { Select, SelectItem } from '@backstage/core-components';\nimport { RepoUrlPickerState } from './types';\n\nexport const GithubRepoPicker = (props: {\n allowedOwners?: string[];\n rawErrors: string[];\n state: RepoUrlPickerState;\n onChange: (state: RepoUrlPickerState) => void;\n}) => {\n const { allowedOwners = [], rawErrors, state, onChange } = props;\n const ownerItems: SelectItem[] = allowedOwners\n ? allowedOwners.map(i => ({ label: i, value: i }))\n : [{ label: 'Loading...', value: 'loading' }];\n\n const { owner } = state;\n\n return (\n <>\n <FormControl\n margin=\"normal\"\n required\n error={rawErrors?.length > 0 && !owner}\n >\n {allowedOwners?.length ? (\n <Select\n native\n label=\"Owner Available\"\n onChange={s =>\n onChange({ owner: String(Array.isArray(s) ? s[0] : s) })\n }\n disabled={allowedOwners.length === 1}\n selected={owner}\n items={ownerItems}\n />\n ) : (\n <>\n <InputLabel htmlFor=\"ownerInput\">Owner</InputLabel>\n <Input\n id=\"ownerInput\"\n onChange={e => onChange({ owner: e.target.value })}\n value={owner}\n />\n </>\n )}\n <FormHelperText>\n The organization, user or project that this repo will belong to\n </FormHelperText>\n </FormControl>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAuBa,MAAA,gBAAA,GAAmB,CAAC,KAK3B,KAAA;AACJ,EAAA,MAAM,EAAE,aAAgB,GAAA,IAAI,SAAW,EAAA,KAAA,EAAO,UAAa,GAAA,KAAA,CAAA;AAC3D,EAAA,MAAM,aAA2B,aAC7B,GAAA,aAAA,CAAc,IAAI,CAAM,CAAA,MAAA,EAAE,OAAO,CAAG,EAAA,KAAA,EAAO,CAAE,EAAA,CAAE,IAC/C,CAAC,EAAE,OAAO,YAAc,EAAA,KAAA,EAAO,WAAW,CAAA,CAAA;AAE9C,EAAM,MAAA,EAAE,OAAU,GAAA,KAAA,CAAA;AAElB,EAAA,uBAEI,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,CAAA,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
|
18
18
|
},
|
|
19
|
-
|
|
19
|
+
allowedOwners?.length ? /* @__PURE__ */ React.createElement(
|
|
20
20
|
Select,
|
|
21
21
|
{
|
|
22
22
|
native: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GitlabRepoPicker.esm.js","sources":["../../../../src/components/fields/RepoUrlPicker/GitlabRepoPicker.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 React from 'react';\nimport FormControl from '@material-ui/core/FormControl';\nimport FormHelperText from '@material-ui/core/FormHelperText';\nimport Input from '@material-ui/core/Input';\nimport InputLabel from '@material-ui/core/InputLabel';\nimport { Select, SelectItem } from '@backstage/core-components';\nimport { RepoUrlPickerState } from './types';\n\nexport const GitlabRepoPicker = (props: {\n allowedOwners?: string[];\n allowedRepos?: string[];\n state: RepoUrlPickerState;\n onChange: (state: RepoUrlPickerState) => void;\n rawErrors: string[];\n}) => {\n const { allowedOwners = [], state, onChange, rawErrors } = props;\n const ownerItems: SelectItem[] = allowedOwners\n ? allowedOwners.map(i => ({ label: i, value: i }))\n : [{ label: 'Loading...', value: 'loading' }];\n\n const { owner } = state;\n\n return (\n <>\n <FormControl\n margin=\"normal\"\n required\n error={rawErrors?.length > 0 && !owner}\n >\n {allowedOwners?.length ? (\n <Select\n native\n label=\"Owner Available\"\n onChange={selected =>\n onChange({\n owner: String(Array.isArray(selected) ? selected[0] : selected),\n })\n }\n disabled={allowedOwners.length === 1}\n selected={owner}\n items={ownerItems}\n />\n ) : (\n <>\n <InputLabel htmlFor=\"ownerInput\">Owner</InputLabel>\n <Input\n id=\"ownerInput\"\n onChange={e => onChange({ owner: e.target.value })}\n value={owner}\n />\n </>\n )}\n <FormHelperText>\n GitLab namespace where this repository will belong to. It can be the\n name of organization, group, subgroup, user, or the project.\n </FormHelperText>\n </FormControl>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAuBa,MAAA,gBAAA,GAAmB,CAAC,KAM3B,KAAA;AACJ,EAAA,MAAM,EAAE,aAAgB,GAAA,IAAI,KAAO,EAAA,QAAA,EAAU,WAAc,GAAA,KAAA,CAAA;AAC3D,EAAA,MAAM,aAA2B,aAC7B,GAAA,aAAA,CAAc,IAAI,CAAM,CAAA,MAAA,EAAE,OAAO,CAAG,EAAA,KAAA,EAAO,CAAE,EAAA,CAAE,IAC/C,CAAC,EAAE,OAAO,YAAc,EAAA,KAAA,EAAO,WAAW,CAAA,CAAA;AAE9C,EAAM,MAAA,EAAE,OAAU,GAAA,KAAA,CAAA;AAElB,EAAA,uBAEI,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,WAAA;AAAA,IAAA;AAAA,MACC,MAAO,EAAA,QAAA;AAAA,MACP,QAAQ,EAAA,IAAA;AAAA,MACR,KAAO,EAAA,
|
|
1
|
+
{"version":3,"file":"GitlabRepoPicker.esm.js","sources":["../../../../src/components/fields/RepoUrlPicker/GitlabRepoPicker.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 React from 'react';\nimport FormControl from '@material-ui/core/FormControl';\nimport FormHelperText from '@material-ui/core/FormHelperText';\nimport Input from '@material-ui/core/Input';\nimport InputLabel from '@material-ui/core/InputLabel';\nimport { Select, SelectItem } from '@backstage/core-components';\nimport { RepoUrlPickerState } from './types';\n\nexport const GitlabRepoPicker = (props: {\n allowedOwners?: string[];\n allowedRepos?: string[];\n state: RepoUrlPickerState;\n onChange: (state: RepoUrlPickerState) => void;\n rawErrors: string[];\n}) => {\n const { allowedOwners = [], state, onChange, rawErrors } = props;\n const ownerItems: SelectItem[] = allowedOwners\n ? allowedOwners.map(i => ({ label: i, value: i }))\n : [{ label: 'Loading...', value: 'loading' }];\n\n const { owner } = state;\n\n return (\n <>\n <FormControl\n margin=\"normal\"\n required\n error={rawErrors?.length > 0 && !owner}\n >\n {allowedOwners?.length ? (\n <Select\n native\n label=\"Owner Available\"\n onChange={selected =>\n onChange({\n owner: String(Array.isArray(selected) ? selected[0] : selected),\n })\n }\n disabled={allowedOwners.length === 1}\n selected={owner}\n items={ownerItems}\n />\n ) : (\n <>\n <InputLabel htmlFor=\"ownerInput\">Owner</InputLabel>\n <Input\n id=\"ownerInput\"\n onChange={e => onChange({ owner: e.target.value })}\n value={owner}\n />\n </>\n )}\n <FormHelperText>\n GitLab namespace where this repository will belong to. It can be the\n name of organization, group, subgroup, user, or the project.\n </FormHelperText>\n </FormControl>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAuBa,MAAA,gBAAA,GAAmB,CAAC,KAM3B,KAAA;AACJ,EAAA,MAAM,EAAE,aAAgB,GAAA,IAAI,KAAO,EAAA,QAAA,EAAU,WAAc,GAAA,KAAA,CAAA;AAC3D,EAAA,MAAM,aAA2B,aAC7B,GAAA,aAAA,CAAc,IAAI,CAAM,CAAA,MAAA,EAAE,OAAO,CAAG,EAAA,KAAA,EAAO,CAAE,EAAA,CAAE,IAC/C,CAAC,EAAE,OAAO,YAAc,EAAA,KAAA,EAAO,WAAW,CAAA,CAAA;AAE9C,EAAM,MAAA,EAAE,OAAU,GAAA,KAAA,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typography';
|
|
|
18
18
|
export { RepoUrlPickerSchema } from './schema.esm.js';
|
|
19
19
|
|
|
20
20
|
const RepoUrlPicker = (props) => {
|
|
21
|
-
var _a, _b;
|
|
22
21
|
const { uiSchema, onChange, rawErrors, formData, schema } = props;
|
|
23
22
|
const [state, setState] = useState(
|
|
24
23
|
parseRepoPickerUrl(formData)
|
|
@@ -27,38 +26,23 @@ const RepoUrlPicker = (props) => {
|
|
|
27
26
|
const scmAuthApi = useApi(scmAuthApiRef);
|
|
28
27
|
const { secrets, setSecrets } = useTemplateSecrets();
|
|
29
28
|
const allowedHosts = useMemo(
|
|
30
|
-
() =>
|
|
31
|
-
var _a2, _b2;
|
|
32
|
-
return (_b2 = (_a2 = uiSchema == null ? void 0 : uiSchema["ui:options"]) == null ? void 0 : _a2.allowedHosts) != null ? _b2 : [];
|
|
33
|
-
},
|
|
29
|
+
() => uiSchema?.["ui:options"]?.allowedHosts ?? [],
|
|
34
30
|
[uiSchema]
|
|
35
31
|
);
|
|
36
32
|
const allowedOrganizations = useMemo(
|
|
37
|
-
() =>
|
|
38
|
-
var _a2, _b2;
|
|
39
|
-
return (_b2 = (_a2 = uiSchema == null ? void 0 : uiSchema["ui:options"]) == null ? void 0 : _a2.allowedOrganizations) != null ? _b2 : [];
|
|
40
|
-
},
|
|
33
|
+
() => uiSchema?.["ui:options"]?.allowedOrganizations ?? [],
|
|
41
34
|
[uiSchema]
|
|
42
35
|
);
|
|
43
36
|
const allowedOwners = useMemo(
|
|
44
|
-
() =>
|
|
45
|
-
var _a2, _b2;
|
|
46
|
-
return (_b2 = (_a2 = uiSchema == null ? void 0 : uiSchema["ui:options"]) == null ? void 0 : _a2.allowedOwners) != null ? _b2 : [];
|
|
47
|
-
},
|
|
37
|
+
() => uiSchema?.["ui:options"]?.allowedOwners ?? [],
|
|
48
38
|
[uiSchema]
|
|
49
39
|
);
|
|
50
40
|
const allowedProjects = useMemo(
|
|
51
|
-
() =>
|
|
52
|
-
var _a2, _b2;
|
|
53
|
-
return (_b2 = (_a2 = uiSchema == null ? void 0 : uiSchema["ui:options"]) == null ? void 0 : _a2.allowedProjects) != null ? _b2 : [];
|
|
54
|
-
},
|
|
41
|
+
() => uiSchema?.["ui:options"]?.allowedProjects ?? [],
|
|
55
42
|
[uiSchema]
|
|
56
43
|
);
|
|
57
44
|
const allowedRepos = useMemo(
|
|
58
|
-
() =>
|
|
59
|
-
var _a2, _b2;
|
|
60
|
-
return (_b2 = (_a2 = uiSchema == null ? void 0 : uiSchema["ui:options"]) == null ? void 0 : _a2.allowedRepos) != null ? _b2 : [];
|
|
61
|
-
},
|
|
45
|
+
() => uiSchema?.["ui:options"]?.allowedRepos ?? [],
|
|
62
46
|
[uiSchema]
|
|
63
47
|
);
|
|
64
48
|
const { owner, organization, project, repoName } = state;
|
|
@@ -102,8 +86,7 @@ const RepoUrlPicker = (props) => {
|
|
|
102
86
|
);
|
|
103
87
|
useDebounce(
|
|
104
88
|
async () => {
|
|
105
|
-
|
|
106
|
-
const { requestUserCredentials } = (_a2 = uiSchema == null ? void 0 : uiSchema["ui:options"]) != null ? _a2 : {};
|
|
89
|
+
const { requestUserCredentials } = uiSchema?.["ui:options"] ?? {};
|
|
107
90
|
const workspace = state.owner ? state.owner : state.project;
|
|
108
91
|
if (!requestUserCredentials || !(state.host && workspace && state.repoName)) {
|
|
109
92
|
return;
|
|
@@ -126,7 +109,7 @@ const RepoUrlPicker = (props) => {
|
|
|
126
109
|
500,
|
|
127
110
|
[state, uiSchema]
|
|
128
111
|
);
|
|
129
|
-
const hostType = (
|
|
112
|
+
const hostType = (state.host && integrationApi.byHost(state.host)?.type) ?? null;
|
|
130
113
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, schema.title && /* @__PURE__ */ React.createElement(Box, { my: 1 }, /* @__PURE__ */ React.createElement(Typography, { variant: "h5" }, schema.title), /* @__PURE__ */ React.createElement(Divider, null)), schema.description && /* @__PURE__ */ React.createElement(Typography, { variant: "body1" }, schema.description), /* @__PURE__ */ React.createElement(
|
|
131
114
|
RepoUrlPickerHost,
|
|
132
115
|
{
|
|
@@ -173,7 +156,7 @@ const RepoUrlPicker = (props) => {
|
|
|
173
156
|
AzureRepoPicker,
|
|
174
157
|
{
|
|
175
158
|
allowedOrganizations,
|
|
176
|
-
|
|
159
|
+
allowedProject: allowedProjects,
|
|
177
160
|
rawErrors,
|
|
178
161
|
state,
|
|
179
162
|
onChange: updateLocalState
|
|
@@ -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 scmIntegrationsApiRef,\n scmAuthApiRef,\n} from '@backstage/integration-react';\nimport React, { useEffect, useState, useMemo, useCallback } from 'react';\nimport { GithubRepoPicker } from './GithubRepoPicker';\nimport { GiteaRepoPicker } from './GiteaRepoPicker';\nimport { GitlabRepoPicker } from './GitlabRepoPicker';\nimport { AzureRepoPicker } from './AzureRepoPicker';\nimport { BitbucketRepoPicker } from './BitbucketRepoPicker';\nimport { GerritRepoPicker } from './GerritRepoPicker';\nimport { RepoUrlPickerHost } from './RepoUrlPickerHost';\nimport { RepoUrlPickerRepoName } from './RepoUrlPickerRepoName';\nimport { parseRepoPickerUrl, serializeRepoPickerUrl } from './utils';\nimport { RepoUrlPickerProps } from './schema';\nimport { RepoUrlPickerState } from './types';\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\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 = (props: RepoUrlPickerProps) => {\n const { uiSchema, onChange, rawErrors, formData, schema } = props;\n const [state, setState] = useState<RepoUrlPickerState>(\n parseRepoPickerUrl(formData),\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\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 const workspace = state.owner ? state.owner : state.project;\n if (\n !requestUserCredentials ||\n !(state.host && workspace && state.repoName)\n ) {\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 // previously, we were encodeURI for state.host, workspace and state.repoName separately.\n // That created an issue where GitLab workspace can be nested like groupA/subgroupB\n // when we encodeURi separately and then join, the URL will be malformed and\n // resulting in 400 request error from GitLab API\n const [encodedHost, encodedRepoName] = [state.host, state.repoName].map(\n encodeURIComponent,\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://${encodedHost}/${workspace}/${encodedRepoName}`,\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 [state, uiSchema],\n );\n\n const hostType =\n (state.host && integrationApi.byHost(state.host)?.type) ?? null;\n return (\n <>\n {schema.title && (\n <Box my={1}>\n <Typography variant=\"h5\">{schema.title}</Typography>\n <Divider />\n </Box>\n )}\n {schema.description && (\n <Typography variant=\"body1\">{schema.description}</Typography>\n )}\n <RepoUrlPickerHost\n host={state.host}\n hosts={allowedHosts}\n onChange={host => setState(prevState => ({ ...prevState, host }))}\n rawErrors={rawErrors}\n />\n {hostType === 'github' && (\n <GithubRepoPicker\n allowedOwners={allowedOwners}\n onChange={updateLocalState}\n rawErrors={rawErrors}\n state={state}\n />\n )}\n {hostType === 'gitea' && (\n <GiteaRepoPicker\n allowedOwners={allowedOwners}\n allowedRepos={allowedRepos}\n rawErrors={rawErrors}\n state={state}\n onChange={updateLocalState}\n />\n )}\n {hostType === 'gitlab' && (\n <GitlabRepoPicker\n allowedOwners={allowedOwners}\n rawErrors={rawErrors}\n state={state}\n onChange={updateLocalState}\n />\n )}\n {hostType === 'bitbucket' && (\n <BitbucketRepoPicker\n allowedOwners={allowedOwners}\n allowedProjects={allowedProjects}\n rawErrors={rawErrors}\n state={state}\n onChange={updateLocalState}\n />\n )}\n {hostType === 'azure' && (\n <AzureRepoPicker\n allowedOrganizations={allowedOrganizations}\n allowedOwners={allowedOwners}\n rawErrors={rawErrors}\n state={state}\n onChange={updateLocalState}\n />\n )}\n {hostType === 'gerrit' && (\n <GerritRepoPicker\n rawErrors={rawErrors}\n state={state}\n onChange={updateLocalState}\n />\n )}\n <RepoUrlPickerRepoName\n repoName={state.repoName}\n allowedRepos={allowedRepos}\n onChange={repo =>\n setState(prevState => ({ ...prevState, repoName: repo }))\n }\n rawErrors={rawErrors}\n />\n </>\n );\n};\n"],"names":["_a","_b"],"mappings":";;;;;;;;;;;;;;;;;;;AA8Ca,MAAA,aAAA,GAAgB,CAAC,KAA8B,KAAA;AA9C5D,EAAA,IAAA,EAAA,EAAA,EAAA,CAAA;AA+CE,EAAA,MAAM,EAAE,QAAU,EAAA,QAAA,EAAU,SAAW,EAAA,QAAA,EAAU,QAAW,GAAA,KAAA,CAAA;AAC5D,EAAM,MAAA,CAAC,KAAO,EAAA,QAAQ,CAAI,GAAA,QAAA;AAAA,IACxB,mBAAmB,QAAQ,CAAA;AAAA,GAC7B,CAAA;AACA,EAAM,MAAA,cAAA,GAAiB,OAAO,qBAAqB,CAAA,CAAA;AACnD,EAAM,MAAA,UAAA,GAAa,OAAO,aAAa,CAAA,CAAA;AACvC,EAAA,MAAM,EAAE,OAAA,EAAS,UAAW,EAAA,GAAI,kBAAmB,EAAA,CAAA;AACnD,EAAA,MAAM,YA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A;AAAA,GACZ,EAED,aAAa,WACZ,oBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,mBAAA;AAAA,IAAA;AAAA,MACC,aAAA;AAAA,MACA,eAAA;AAAA,MACA,SAAA;AAAA,MACA,KAAA;AAAA,MACA,QAAU,EAAA,gBAAA;AAAA,KAAA;AAAA,GACZ,EAED,aAAa,OACZ,oBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,eAAA;AAAA,IAAA;AAAA,MACC,oBAAA;AAAA,MACA,aAAA;AAAA,MACA,SAAA;AAAA,MACA,KAAA;AAAA,MACA,QAAU,EAAA,gBAAA;AAAA,KAAA;AAAA,GACZ,EAED,aAAa,QACZ,oBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,gBAAA;AAAA,IAAA;AAAA,MACC,SAAA;AAAA,MACA,KAAA;AAAA,MACA,QAAU,EAAA,gBAAA;AAAA,KAAA;AAAA,GAGd,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,qBAAA;AAAA,IAAA;AAAA,MACC,UAAU,KAAM,CAAA,QAAA;AAAA,MAChB,YAAA;AAAA,MACA,QAAA,EAAU,UACR,QAAS,CAAA,CAAA,SAAA,MAAc,EAAE,GAAG,SAAA,EAAW,QAAU,EAAA,IAAA,EAAO,CAAA,CAAA;AAAA,MAE1D,SAAA;AAAA,KAAA;AAAA,GAEJ,CAAA,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 scmIntegrationsApiRef,\n scmAuthApiRef,\n} from '@backstage/integration-react';\nimport React, { useEffect, useState, useMemo, useCallback } from 'react';\nimport { GithubRepoPicker } from './GithubRepoPicker';\nimport { GiteaRepoPicker } from './GiteaRepoPicker';\nimport { GitlabRepoPicker } from './GitlabRepoPicker';\nimport { AzureRepoPicker } from './AzureRepoPicker';\nimport { BitbucketRepoPicker } from './BitbucketRepoPicker';\nimport { GerritRepoPicker } from './GerritRepoPicker';\nimport { RepoUrlPickerHost } from './RepoUrlPickerHost';\nimport { RepoUrlPickerRepoName } from './RepoUrlPickerRepoName';\nimport { parseRepoPickerUrl, serializeRepoPickerUrl } from './utils';\nimport { RepoUrlPickerProps } from './schema';\nimport { RepoUrlPickerState } from './types';\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\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 = (props: RepoUrlPickerProps) => {\n const { uiSchema, onChange, rawErrors, formData, schema } = props;\n const [state, setState] = useState<RepoUrlPickerState>(\n parseRepoPickerUrl(formData),\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\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 const workspace = state.owner ? state.owner : state.project;\n if (\n !requestUserCredentials ||\n !(state.host && workspace && state.repoName)\n ) {\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 // previously, we were encodeURI for state.host, workspace and state.repoName separately.\n // That created an issue where GitLab workspace can be nested like groupA/subgroupB\n // when we encodeURi separately and then join, the URL will be malformed and\n // resulting in 400 request error from GitLab API\n const [encodedHost, encodedRepoName] = [state.host, state.repoName].map(\n encodeURIComponent,\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://${encodedHost}/${workspace}/${encodedRepoName}`,\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 [state, uiSchema],\n );\n\n const hostType =\n (state.host && integrationApi.byHost(state.host)?.type) ?? null;\n return (\n <>\n {schema.title && (\n <Box my={1}>\n <Typography variant=\"h5\">{schema.title}</Typography>\n <Divider />\n </Box>\n )}\n {schema.description && (\n <Typography variant=\"body1\">{schema.description}</Typography>\n )}\n <RepoUrlPickerHost\n host={state.host}\n hosts={allowedHosts}\n onChange={host => setState(prevState => ({ ...prevState, host }))}\n rawErrors={rawErrors}\n />\n {hostType === 'github' && (\n <GithubRepoPicker\n allowedOwners={allowedOwners}\n onChange={updateLocalState}\n rawErrors={rawErrors}\n state={state}\n />\n )}\n {hostType === 'gitea' && (\n <GiteaRepoPicker\n allowedOwners={allowedOwners}\n allowedRepos={allowedRepos}\n rawErrors={rawErrors}\n state={state}\n onChange={updateLocalState}\n />\n )}\n {hostType === 'gitlab' && (\n <GitlabRepoPicker\n allowedOwners={allowedOwners}\n rawErrors={rawErrors}\n state={state}\n onChange={updateLocalState}\n />\n )}\n {hostType === 'bitbucket' && (\n <BitbucketRepoPicker\n allowedOwners={allowedOwners}\n allowedProjects={allowedProjects}\n rawErrors={rawErrors}\n state={state}\n onChange={updateLocalState}\n />\n )}\n {hostType === 'azure' && (\n <AzureRepoPicker\n allowedOrganizations={allowedOrganizations}\n allowedProject={allowedProjects}\n rawErrors={rawErrors}\n state={state}\n onChange={updateLocalState}\n />\n )}\n {hostType === 'gerrit' && (\n <GerritRepoPicker\n rawErrors={rawErrors}\n state={state}\n onChange={updateLocalState}\n />\n )}\n <RepoUrlPickerRepoName\n repoName={state.repoName}\n allowedRepos={allowedRepos}\n onChange={repo =>\n setState(prevState => ({ ...prevState, repoName: repo }))\n }\n rawErrors={raw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AA,IAAA,EAAO,CAAA,CAAA;AAAA,MAE1D,SAAA;AAAA,KAAA;AAAA,GAEJ,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -12,20 +12,20 @@ const RepoUrlPickerHost = (props) => {
|
|
|
12
12
|
const { value: { integrations } = { integrations: [] }, loading } = useAsync(
|
|
13
13
|
async () => {
|
|
14
14
|
return await scaffolderApi.getIntegrationsList({
|
|
15
|
-
allowedHosts: hosts
|
|
15
|
+
allowedHosts: hosts ?? []
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
);
|
|
19
19
|
useEffect(() => {
|
|
20
20
|
if (!host) {
|
|
21
|
-
if (hosts
|
|
21
|
+
if (hosts?.length) {
|
|
22
22
|
onChange(hosts[0]);
|
|
23
|
-
} else if (integrations
|
|
23
|
+
} else if (integrations?.length) {
|
|
24
24
|
onChange(integrations[0].host);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
}, [hosts, host, onChange, integrations]);
|
|
28
|
-
const hostsOptions = integrations ? integrations.filter((i) =>
|
|
28
|
+
const hostsOptions = integrations ? integrations.filter((i) => hosts?.length ? hosts?.includes(i.host) : true).map((i) => ({ label: i.title, value: i.host })) : [{ label: "Loading...", value: "loading" }];
|
|
29
29
|
if (loading) {
|
|
30
30
|
return /* @__PURE__ */ React.createElement(Progress, null);
|
|
31
31
|
}
|
|
@@ -34,13 +34,13 @@ const RepoUrlPickerHost = (props) => {
|
|
|
34
34
|
{
|
|
35
35
|
margin: "normal",
|
|
36
36
|
required: true,
|
|
37
|
-
error:
|
|
37
|
+
error: rawErrors?.length > 0 && !host
|
|
38
38
|
},
|
|
39
39
|
/* @__PURE__ */ React.createElement(
|
|
40
40
|
Select,
|
|
41
41
|
{
|
|
42
42
|
native: true,
|
|
43
|
-
disabled:
|
|
43
|
+
disabled: hosts?.length === 1,
|
|
44
44
|
label: "Host",
|
|
45
45
|
onChange: (s) => onChange(String(Array.isArray(s) ? s[0] : s)),
|
|
46
46
|
selected: host,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RepoUrlPickerHost.esm.js","sources":["../../../../src/components/fields/RepoUrlPicker/RepoUrlPickerHost.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 React, { useEffect } from 'react';\nimport { Progress, Select, SelectItem } from '@backstage/core-components';\nimport FormControl from '@material-ui/core/FormControl';\nimport FormHelperText from '@material-ui/core/FormHelperText';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { scaffolderApiRef } from '@backstage/plugin-scaffolder-react';\nimport useAsync from 'react-use/esm/useAsync';\n\nexport const RepoUrlPickerHost = (props: {\n host?: string;\n hosts?: string[];\n onChange: (host: string) => void;\n rawErrors: string[];\n}) => {\n const { host, hosts, onChange, rawErrors } = props;\n const scaffolderApi = useApi(scaffolderApiRef);\n\n const { value: { integrations } = { integrations: [] }, loading } = useAsync(\n async () => {\n return await scaffolderApi.getIntegrationsList({\n allowedHosts: hosts ?? [],\n });\n },\n );\n\n useEffect(() => {\n // If there is no host chosen currently\n if (!host) {\n // Set the first of the allowedHosts option if that available\n if (hosts?.length) {\n onChange(hosts[0]);\n // if there's no hosts provided, fallback to using the first integration\n } else if (integrations?.length) {\n onChange(integrations[0].host);\n }\n }\n }, [hosts, host, onChange, integrations]);\n\n // If there are no allowedHosts provided, then show all integrations. Otherwise, only show integrations\n // that are provided in the dropdown for the user to choose from.\n const hostsOptions: SelectItem[] = integrations\n ? integrations\n .filter(i => (hosts?.length ? hosts?.includes(i.host) : true))\n .map(i => ({ label: i.title, value: i.host }))\n : [{ label: 'Loading...', value: 'loading' }];\n\n if (loading) {\n return <Progress />;\n }\n\n return (\n <>\n <FormControl\n margin=\"normal\"\n required\n error={rawErrors?.length > 0 && !host}\n >\n <Select\n native\n disabled={hosts?.length === 1}\n label=\"Host\"\n onChange={s => onChange(String(Array.isArray(s) ? s[0] : s))}\n selected={host}\n items={hostsOptions}\n data-testid=\"host-select\"\n />\n\n <FormHelperText>\n The host where the repository will be created\n </FormHelperText>\n </FormControl>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAuBa,MAAA,iBAAA,GAAoB,CAAC,KAK5B,KAAA;AACJ,EAAA,MAAM,EAAE,IAAA,EAAM,KAAO,EAAA,QAAA,EAAU,WAAc,GAAA,KAAA,CAAA;AAC7C,EAAM,MAAA,aAAA,GAAgB,OAAO,gBAAgB,CAAA,CAAA;AAE7C,EAAM,MAAA,EAAE,KAAO,EAAA,EAAE,YAAa,EAAA,GAAI,EAAE,YAAA,EAAc,EAAC,EAAK,EAAA,OAAA,EAAY,GAAA,QAAA;AAAA,IAClE,YAAY;AACV,MAAO,OAAA,MAAM,cAAc,mBAAoB,CAAA;AAAA,QAC7C,YAAA,EAAc,
|
|
1
|
+
{"version":3,"file":"RepoUrlPickerHost.esm.js","sources":["../../../../src/components/fields/RepoUrlPicker/RepoUrlPickerHost.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 React, { useEffect } from 'react';\nimport { Progress, Select, SelectItem } from '@backstage/core-components';\nimport FormControl from '@material-ui/core/FormControl';\nimport FormHelperText from '@material-ui/core/FormHelperText';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { scaffolderApiRef } from '@backstage/plugin-scaffolder-react';\nimport useAsync from 'react-use/esm/useAsync';\n\nexport const RepoUrlPickerHost = (props: {\n host?: string;\n hosts?: string[];\n onChange: (host: string) => void;\n rawErrors: string[];\n}) => {\n const { host, hosts, onChange, rawErrors } = props;\n const scaffolderApi = useApi(scaffolderApiRef);\n\n const { value: { integrations } = { integrations: [] }, loading } = useAsync(\n async () => {\n return await scaffolderApi.getIntegrationsList({\n allowedHosts: hosts ?? [],\n });\n },\n );\n\n useEffect(() => {\n // If there is no host chosen currently\n if (!host) {\n // Set the first of the allowedHosts option if that available\n if (hosts?.length) {\n onChange(hosts[0]);\n // if there's no hosts provided, fallback to using the first integration\n } else if (integrations?.length) {\n onChange(integrations[0].host);\n }\n }\n }, [hosts, host, onChange, integrations]);\n\n // If there are no allowedHosts provided, then show all integrations. Otherwise, only show integrations\n // that are provided in the dropdown for the user to choose from.\n const hostsOptions: SelectItem[] = integrations\n ? integrations\n .filter(i => (hosts?.length ? hosts?.includes(i.host) : true))\n .map(i => ({ label: i.title, value: i.host }))\n : [{ label: 'Loading...', value: 'loading' }];\n\n if (loading) {\n return <Progress />;\n }\n\n return (\n <>\n <FormControl\n margin=\"normal\"\n required\n error={rawErrors?.length > 0 && !host}\n >\n <Select\n native\n disabled={hosts?.length === 1}\n label=\"Host\"\n onChange={s => onChange(String(Array.isArray(s) ? s[0] : s))}\n selected={host}\n items={hostsOptions}\n data-testid=\"host-select\"\n />\n\n <FormHelperText>\n The host where the repository will be created\n </FormHelperText>\n </FormControl>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAuBa,MAAA,iBAAA,GAAoB,CAAC,KAK5B,KAAA;AACJ,EAAA,MAAM,EAAE,IAAA,EAAM,KAAO,EAAA,QAAA,EAAU,WAAc,GAAA,KAAA,CAAA;AAC7C,EAAM,MAAA,aAAA,GAAgB,OAAO,gBAAgB,CAAA,CAAA;AAE7C,EAAM,MAAA,EAA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C,MAAO,EAAA,QAAA;AAAA,MACP,QAAQ,EAAA,IAAA;AAAA,MACR,KAAO,EAAA,SAAA,EAAW,MAAS,GAAA,CAAA,IAAK,CAAC,IAAA;AAAA,KAAA;AAAA,oBAEjC,KAAA,CAAA,aAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,MAAM,EAAA,IAAA;AAAA,QACN,QAAA,EAAU,OAAO,MAAW,KAAA,CAAA;AAAA,QAC5B,KAAM,EAAA,MAAA;AAAA,QACN,QAAU,EAAA,CAAA,CAAA,KAAK,QAAS,CAAA,MAAA,CAAO,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA,GAAI,CAAE,CAAA,CAAC,CAAI,GAAA,CAAC,CAAC,CAAA;AAAA,QAC3D,QAAU,EAAA,IAAA;AAAA,QACV,KAAO,EAAA,YAAA;AAAA,QACP,aAAY,EAAA,aAAA;AAAA,OAAA;AAAA,KACd;AAAA,oBAEA,KAAA,CAAA,aAAA,CAAC,sBAAe,+CAEhB,CAAA;AAAA,GAEJ,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -9,7 +9,7 @@ const RepoUrlPickerRepoName = (props) => {
|
|
|
9
9
|
const { repoName, allowedRepos, onChange, rawErrors } = props;
|
|
10
10
|
useEffect(() => {
|
|
11
11
|
if (!repoName) {
|
|
12
|
-
if (allowedRepos
|
|
12
|
+
if (allowedRepos?.length) {
|
|
13
13
|
onChange(allowedRepos[0]);
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -20,9 +20,9 @@ const RepoUrlPickerRepoName = (props) => {
|
|
|
20
20
|
{
|
|
21
21
|
margin: "normal",
|
|
22
22
|
required: true,
|
|
23
|
-
error:
|
|
23
|
+
error: rawErrors?.length > 0 && !repoName
|
|
24
24
|
},
|
|
25
|
-
|
|
25
|
+
allowedRepos?.length ? /* @__PURE__ */ React.createElement(
|
|
26
26
|
Select,
|
|
27
27
|
{
|
|
28
28
|
native: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RepoUrlPickerRepoName.esm.js","sources":["../../../../src/components/fields/RepoUrlPicker/RepoUrlPickerRepoName.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 React, { useEffect } from 'react';\nimport { Select, SelectItem } from '@backstage/core-components';\nimport FormControl from '@material-ui/core/FormControl';\nimport FormHelperText from '@material-ui/core/FormHelperText';\nimport Input from '@material-ui/core/Input';\nimport InputLabel from '@material-ui/core/InputLabel';\n\nexport const RepoUrlPickerRepoName = (props: {\n repoName?: string;\n allowedRepos?: string[];\n onChange: (host: string) => void;\n rawErrors: string[];\n}) => {\n const { repoName, allowedRepos, onChange, rawErrors } = props;\n\n useEffect(() => {\n // If there is no repoName chosen currently\n if (!repoName) {\n // Set the first of the allowedRepos option if that available\n if (allowedRepos?.length) {\n onChange(allowedRepos[0]);\n }\n }\n }, [allowedRepos, repoName, onChange]);\n\n const repoItems: SelectItem[] = allowedRepos\n ? allowedRepos.map(i => ({ label: i, value: i }))\n : [{ label: 'Loading...', value: 'loading' }];\n\n return (\n <>\n <FormControl\n margin=\"normal\"\n required\n error={rawErrors?.length > 0 && !repoName}\n >\n {allowedRepos?.length ? (\n <Select\n native\n label=\"Repositories Available\"\n onChange={selected =>\n onChange(String(Array.isArray(selected) ? selected[0] : selected))\n }\n disabled={allowedRepos.length === 1}\n selected={repoName}\n items={repoItems}\n />\n ) : (\n <>\n <InputLabel htmlFor=\"repoNameInput\">Repository</InputLabel>\n <Input\n id=\"repoNameInput\"\n onChange={e => onChange(String(e.target.value))}\n value={repoName}\n />\n </>\n )}\n <FormHelperText>The name of the repository</FormHelperText>\n </FormControl>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAsBa,MAAA,qBAAA,GAAwB,CAAC,KAKhC,KAAA;AACJ,EAAA,MAAM,EAAE,QAAA,EAAU,YAAc,EAAA,QAAA,EAAU,WAAc,GAAA,KAAA,CAAA;AAExD,EAAA,SAAA,CAAU,MAAM;AAEd,IAAA,IAAI,CAAC,QAAU,EAAA;AAEb,MAAA,IAAI,
|
|
1
|
+
{"version":3,"file":"RepoUrlPickerRepoName.esm.js","sources":["../../../../src/components/fields/RepoUrlPicker/RepoUrlPickerRepoName.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 React, { useEffect } from 'react';\nimport { Select, SelectItem } from '@backstage/core-components';\nimport FormControl from '@material-ui/core/FormControl';\nimport FormHelperText from '@material-ui/core/FormHelperText';\nimport Input from '@material-ui/core/Input';\nimport InputLabel from '@material-ui/core/InputLabel';\n\nexport const RepoUrlPickerRepoName = (props: {\n repoName?: string;\n allowedRepos?: string[];\n onChange: (host: string) => void;\n rawErrors: string[];\n}) => {\n const { repoName, allowedRepos, onChange, rawErrors } = props;\n\n useEffect(() => {\n // If there is no repoName chosen currently\n if (!repoName) {\n // Set the first of the allowedRepos option if that available\n if (allowedRepos?.length) {\n onChange(allowedRepos[0]);\n }\n }\n }, [allowedRepos, repoName, onChange]);\n\n const repoItems: SelectItem[] = allowedRepos\n ? allowedRepos.map(i => ({ label: i, value: i }))\n : [{ label: 'Loading...', value: 'loading' }];\n\n return (\n <>\n <FormControl\n margin=\"normal\"\n required\n error={rawErrors?.length > 0 && !repoName}\n >\n {allowedRepos?.length ? (\n <Select\n native\n label=\"Repositories Available\"\n onChange={selected =>\n onChange(String(Array.isArray(selected) ? selected[0] : selected))\n }\n disabled={allowedRepos.length === 1}\n selected={repoName}\n items={repoItems}\n />\n ) : (\n <>\n <InputLabel htmlFor=\"repoNameInput\">Repository</InputLabel>\n <Input\n id=\"repoNameInput\"\n onChange={e => onChange(String(e.target.value))}\n value={repoName}\n />\n </>\n )}\n <FormHelperText>The name of the repository</FormHelperText>\n </FormControl>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAsBa,MAAA,qBAAA,GAAwB,CAAC,KAKhC,KAAA;AACJ,EAAA,MAAM,EAAE,QAAA,EAAU,YAAc,EAAA,QAAA,EAAU,WAAc,GAAA,KAAA,CAAA;AAExD,EAAA,SAAA,CAAU,MAAM;AAEd,IAAA,IAAI,CAAC,QAAU,EAAA;AAEb,MAAA,IAAI,cAAc,MAAQ,EAAA;AACxB,QAAS,QAAA,CAAA,YAAA,CAAa,CAAC,CAAC,CAAA,CAAA;AAAA,OAC1B;AAAA,KACF;AAAA,GACC,EAAA,CAAC,YAAc,EAAA,QAAA,EAAU,QAAQ,CAAC,CAAA,CAAA;AAErC,EAAA,MAAM,YAA0B,YAC5B,GAAA,YAAA,CAAa,IAAI,CAAM,CAAA,MAAA,EAAE,OAAO,CAAG,EAAA,KAAA,EAAO,CAAE,EAAA,CAAE,IAC9C,CAAC,EAAE,OAAO,YAAc,EAAA,KAAA,EAAO,WAAW,CAAA,CAAA;AAE9C,EAAA,uBAEI,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,WAAA;AAAA,IAAA;AAAA,MACC,MAAO,EAAA,QAAA;AAAA,MACP,QAAQ,EAAA,IAAA;AAAA,MACR,KAAO,EAAA,SAAA,EAAW,MAAS,GAAA,CAAA,IAAK,CAAC,QAAA;AAAA,KAAA;AAAA,IAEhC,cAAc,MACb,mBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,MAAM,EAAA,IAAA;AAAA,QACN,KAAM,EAAA,wBAAA;AAAA,QACN,QAAU,EAAA,CAAA,QAAA,KACR,QAAS,CAAA,MAAA,CAAO,KAAM,CAAA,OAAA,CAAQ,QAAQ,CAAA,GAAI,QAAS,CAAA,CAAC,CAAI,GAAA,QAAQ,CAAC,CAAA;AAAA,QAEnE,QAAA,EAAU,aAAa,MAAW,KAAA,CAAA;AAAA,QAClC,QAAU,EAAA,QAAA;AAAA,QACV,KAAO,EAAA,SAAA;AAAA,OAAA;AAAA,wBAIP,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,cAAW,OAAQ,EAAA,eAAA,EAAA,EAAgB,YAAU,CAC9C,kBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,EAAG,EAAA,eAAA;AAAA,QACH,UAAU,CAAK,CAAA,KAAA,QAAA,CAAS,OAAO,CAAE,CAAA,MAAA,CAAO,KAAK,CAAC,CAAA;AAAA,QAC9C,KAAO,EAAA,QAAA;AAAA,OAAA;AAAA,KAEX,CAAA;AAAA,oBAEF,KAAA,CAAA,aAAA,CAAC,sBAAe,4BAA0B,CAAA;AAAA,GAE9C,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { scmIntegrationsApiRef } from '@backstage/integration-react';
|
|
2
2
|
|
|
3
3
|
const repoPickerValidation = (value, validation, context) => {
|
|
4
|
-
var _a, _b;
|
|
5
4
|
try {
|
|
6
5
|
const { host, searchParams } = new URL(`https://${value}`);
|
|
7
6
|
const integrationApi = context.apiHolder.get(scmIntegrationsApiRef);
|
|
@@ -10,7 +9,7 @@ const repoPickerValidation = (value, validation, context) => {
|
|
|
10
9
|
"Incomplete repository location provided, host not provided"
|
|
11
10
|
);
|
|
12
11
|
} else {
|
|
13
|
-
if (
|
|
12
|
+
if (integrationApi?.byHost(host)?.type === "bitbucket") {
|
|
14
13
|
if (host === "bitbucket.org" && !searchParams.get("workspace")) {
|
|
15
14
|
validation.addError(
|
|
16
15
|
"Incomplete repository location provided, workspace not provided"
|
|
@@ -21,7 +20,7 @@ const repoPickerValidation = (value, validation, context) => {
|
|
|
21
20
|
"Incomplete repository location provided, project not provided"
|
|
22
21
|
);
|
|
23
22
|
}
|
|
24
|
-
} else if (
|
|
23
|
+
} else if (integrationApi?.byHost(host)?.type !== "gerrit") {
|
|
25
24
|
if (!searchParams.get("owner")) {
|
|
26
25
|
validation.addError(
|
|
27
26
|
"Incomplete repository location provided, owner not provided"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.esm.js","sources":["../../../../src/components/fields/RepoUrlPicker/validation.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FieldValidation } from '@rjsf/utils';\nimport { ApiHolder } from '@backstage/core-plugin-api';\nimport { scmIntegrationsApiRef } from '@backstage/integration-react';\n\n/**\n * The validation function for the `repoUrl` that is returned from the\n * field extension. Ensures that you have all the required fields filled for\n * the different providers that exist.\n *\n * @public\n */\nexport const repoPickerValidation = (\n value: string,\n validation: FieldValidation,\n context: { apiHolder: ApiHolder },\n) => {\n try {\n const { host, searchParams } = new URL(`https://${value}`);\n\n const integrationApi = context.apiHolder.get(scmIntegrationsApiRef);\n\n if (!host) {\n validation.addError(\n 'Incomplete repository location provided, host not provided',\n );\n } else {\n if (integrationApi?.byHost(host)?.type === 'bitbucket') {\n // workspace is only applicable for bitbucket cloud\n if (host === 'bitbucket.org' && !searchParams.get('workspace')) {\n validation.addError(\n 'Incomplete repository location provided, workspace not provided',\n );\n }\n\n if (!searchParams.get('project')) {\n validation.addError(\n 'Incomplete repository location provided, project not provided',\n );\n }\n }\n // For anything other than bitbucket and gerrit\n else if (integrationApi?.byHost(host)?.type !== 'gerrit') {\n if (!searchParams.get('owner')) {\n validation.addError(\n 'Incomplete repository location provided, owner not provided',\n );\n }\n }\n\n // Do this for all hosts\n if (!searchParams.get('repo')) {\n validation.addError(\n 'Incomplete repository location provided, repo not provided',\n );\n }\n }\n } catch {\n validation.addError('Unable to parse the Repository URL');\n }\n};\n"],"names":[],"mappings":";;AA2BO,MAAM,oBAAuB,GAAA,CAClC,KACA,EAAA,UAAA,EACA,OACG,KAAA;
|
|
1
|
+
{"version":3,"file":"validation.esm.js","sources":["../../../../src/components/fields/RepoUrlPicker/validation.ts"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FieldValidation } from '@rjsf/utils';\nimport { ApiHolder } from '@backstage/core-plugin-api';\nimport { scmIntegrationsApiRef } from '@backstage/integration-react';\n\n/**\n * The validation function for the `repoUrl` that is returned from the\n * field extension. Ensures that you have all the required fields filled for\n * the different providers that exist.\n *\n * @public\n */\nexport const repoPickerValidation = (\n value: string,\n validation: FieldValidation,\n context: { apiHolder: ApiHolder },\n) => {\n try {\n const { host, searchParams } = new URL(`https://${value}`);\n\n const integrationApi = context.apiHolder.get(scmIntegrationsApiRef);\n\n if (!host) {\n validation.addError(\n 'Incomplete repository location provided, host not provided',\n );\n } else {\n if (integrationApi?.byHost(host)?.type === 'bitbucket') {\n // workspace is only applicable for bitbucket cloud\n if (host === 'bitbucket.org' && !searchParams.get('workspace')) {\n validation.addError(\n 'Incomplete repository location provided, workspace not provided',\n );\n }\n\n if (!searchParams.get('project')) {\n validation.addError(\n 'Incomplete repository location provided, project not provided',\n );\n }\n }\n // For anything other than bitbucket and gerrit\n else if (integrationApi?.byHost(host)?.type !== 'gerrit') {\n if (!searchParams.get('owner')) {\n validation.addError(\n 'Incomplete repository location provided, owner not provided',\n );\n }\n }\n\n // Do this for all hosts\n if (!searchParams.get('repo')) {\n validation.addError(\n 'Incomplete repository location provided, repo not provided',\n );\n }\n }\n } catch {\n validation.addError('Unable to parse the Repository URL');\n }\n};\n"],"names":[],"mappings":";;AA2BO,MAAM,oBAAuB,GAAA,CAClC,KACA,EAAA,UAAA,EACA,OACG,KAAA;AACH,EAAI,IAAA;AACF,IAAM,MAAA,EAAE,MAAM,YAAa,EAAA,GAAI,IAAI,GAAI,CAAA,CAAA,QAAA,EAAW,KAAK,CAAE,CAAA,CAAA,CAAA;AAEzD,IAAA,MAAM,cAAiB,GAAA,OAAA,CAAQ,SAAU,CAAA,GAAA,CAAI,qBAAqB,CAAA,CAAA;AAElE,IAAA,IAAI,CAAC,IAAM,EAAA;AACT,MAAW,UAAA,CAAA,QAAA;AAAA,QACT,4DAAA;AAAA,OACF,CAAA;AAAA,KACK,MAAA;AACL,MAAA,IAAI,cAAgB,EAAA,MAAA,CAAO,IAAI,CAAA,EAAG,SAAS,WAAa,EAAA;AAEtD,QAAA,IAAI,SAAS,eAAmB,IAAA,CAAC,YAAa,CAAA,GAAA,CAAI,WAAW,CAAG,EAAA;AAC9D,UAAW,UAAA,CAAA,QAAA;AAAA,YACT,iEAAA;AAAA,WACF,CAAA;AAAA,SACF;AAEA,QAAA,IAAI,CAAC,YAAA,CAAa,GAAI,CAAA,SAAS,CAAG,EAAA;AAChC,UAAW,UAAA,CAAA,QAAA;AAAA,YACT,+DAAA;AAAA,WACF,CAAA;AAAA,SACF;AAAA,iBAGO,cAAgB,EAAA,MAAA,CAAO,IAAI,CAAA,EAAG,SAAS,QAAU,EAAA;AACxD,QAAA,IAAI,CAAC,YAAA,CAAa,GAAI,CAAA,OAAO,CAAG,EAAA;AAC9B,UAAW,UAAA,CAAA,QAAA;AAAA,YACT,6DAAA;AAAA,WACF,CAAA;AAAA,SACF;AAAA,OACF;AAGA,MAAA,IAAI,CAAC,YAAA,CAAa,GAAI,CAAA,MAAM,CAAG,EAAA;AAC7B,QAAW,UAAA,CAAA,QAAA;AAAA,UACT,4DAAA;AAAA,SACF,CAAA;AAAA,OACF;AAAA,KACF;AAAA,GACM,CAAA,MAAA;AACN,IAAA,UAAA,CAAW,SAAS,oCAAoC,CAAA,CAAA;AAAA,GAC1D;AACF;;;;"}
|
|
@@ -5,7 +5,6 @@ import Input from '@material-ui/core/Input';
|
|
|
5
5
|
import InputLabel from '@material-ui/core/InputLabel';
|
|
6
6
|
|
|
7
7
|
const SecretInput = (props) => {
|
|
8
|
-
var _a;
|
|
9
8
|
const { setSecrets, secrets } = useTemplateSecrets();
|
|
10
9
|
const {
|
|
11
10
|
name,
|
|
@@ -32,11 +31,10 @@ const SecretInput = (props) => {
|
|
|
32
31
|
id: title,
|
|
33
32
|
"aria-describedby": title,
|
|
34
33
|
onChange: (e) => {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
setSecrets({ [name]: (_b = e.target) == null ? void 0 : _b.value });
|
|
34
|
+
onChange(Array(e.target?.value.length).fill("*").join(""));
|
|
35
|
+
setSecrets({ [name]: e.target?.value });
|
|
38
36
|
},
|
|
39
|
-
value:
|
|
37
|
+
value: secrets[name] ?? "",
|
|
40
38
|
type: "password",
|
|
41
39
|
autoComplete: "off"
|
|
42
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SecretInput.esm.js","sources":["../../../../src/components/fields/SecretInput/SecretInput.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\nimport { useTemplateSecrets } from '@backstage/plugin-scaffolder-react';\nimport { ScaffolderRJSFFieldProps } from '@backstage/plugin-scaffolder-react';\nimport { ScaffolderField } from '@backstage/plugin-scaffolder-react/alpha';\nimport Input from '@material-ui/core/Input';\nimport InputLabel from '@material-ui/core/InputLabel';\n\nexport const SecretInput = (props: ScaffolderRJSFFieldProps) => {\n const { setSecrets, secrets } = useTemplateSecrets();\n const {\n name,\n onChange,\n schema: { title, description },\n rawErrors,\n disabled,\n errors,\n required,\n } = props;\n\n return (\n <ScaffolderField\n rawErrors={rawErrors}\n rawDescription={description}\n disabled={disabled}\n errors={errors}\n required={required}\n >\n <InputLabel htmlFor={title}>{title}</InputLabel>\n <Input\n id={title}\n aria-describedby={title}\n onChange={e => {\n onChange(Array(e.target?.value.length).fill('*').join(''));\n setSecrets({ [name]: e.target?.value });\n }}\n value={secrets[name] ?? ''}\n type=\"password\"\n autoComplete=\"off\"\n />\n </ScaffolderField>\n );\n};\n"],"names":[
|
|
1
|
+
{"version":3,"file":"SecretInput.esm.js","sources":["../../../../src/components/fields/SecretInput/SecretInput.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\nimport { useTemplateSecrets } from '@backstage/plugin-scaffolder-react';\nimport { ScaffolderRJSFFieldProps } from '@backstage/plugin-scaffolder-react';\nimport { ScaffolderField } from '@backstage/plugin-scaffolder-react/alpha';\nimport Input from '@material-ui/core/Input';\nimport InputLabel from '@material-ui/core/InputLabel';\n\nexport const SecretInput = (props: ScaffolderRJSFFieldProps) => {\n const { setSecrets, secrets } = useTemplateSecrets();\n const {\n name,\n onChange,\n schema: { title, description },\n rawErrors,\n disabled,\n errors,\n required,\n } = props;\n\n return (\n <ScaffolderField\n rawErrors={rawErrors}\n rawDescription={description}\n disabled={disabled}\n errors={errors}\n required={required}\n >\n <InputLabel htmlFor={title}>{title}</InputLabel>\n <Input\n id={title}\n aria-describedby={title}\n onChange={e => {\n onChange(Array(e.target?.value.length).fill('*').join(''));\n setSecrets({ [name]: e.target?.value });\n }}\n value={secrets[name] ?? ''}\n type=\"password\"\n autoComplete=\"off\"\n />\n </ScaffolderField>\n );\n};\n"],"names":[],"mappings":";;;;;;AAsBa,MAAA,WAAA,GAAc,CAAC,KAAoC,KAAA;AAC9D,EAAA,MAAM,EAAE,UAAA,EAAY,OAAQ,EAAA,GAAI,kBAAmB,EAAA,CAAA;AACnD,EAAM,MAAA;AAAA,IACJ,IAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAA,EAAQ,EAAE,KAAA,EAAO,WAAY,EAAA;AAAA,IAC7B,SAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAA;AAAA,IACA,QAAA;AAAA,GACE,GAAA,KAAA,CAAA;AAEJ,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,eAAA;AAAA,IAAA;AAAA,MACC,SAAA;AAAA,MACA,cAAgB,EAAA,WAAA;AAAA,MAChB,QAAA;AAAA,MACA,MAAA;AAAA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