@backstage/plugin-scaffolder 1.24.0-next.2 → 1.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/alpha/package.json +1 -1
  3. package/dist/alpha.d.ts +156 -1
  4. package/dist/alpha.esm.js +32 -25
  5. package/dist/alpha.esm.js.map +1 -1
  6. package/dist/components/ActionsPage/ActionsPage.esm.js +14 -10
  7. package/dist/components/ActionsPage/ActionsPage.esm.js.map +1 -1
  8. package/dist/components/ListTasksPage/ListTasksPage.esm.js +15 -11
  9. package/dist/components/ListTasksPage/ListTasksPage.esm.js.map +1 -1
  10. package/dist/components/ListTasksPage/OwnerListPicker.esm.js +8 -5
  11. package/dist/components/ListTasksPage/OwnerListPicker.esm.js.map +1 -1
  12. package/dist/components/OngoingTask/ContextMenu.esm.js +12 -4
  13. package/dist/components/OngoingTask/ContextMenu.esm.js.map +1 -1
  14. package/dist/components/OngoingTask/OngoingTask.esm.js +10 -7
  15. package/dist/components/OngoingTask/OngoingTask.esm.js.map +1 -1
  16. package/dist/components/TemplateTypePicker/TemplateTypePicker.esm.js +4 -1
  17. package/dist/components/TemplateTypePicker/TemplateTypePicker.esm.js.map +1 -1
  18. package/dist/components/fields/EntityNamePicker/EntityNamePicker.esm.js +7 -1
  19. package/dist/components/fields/EntityNamePicker/EntityNamePicker.esm.js.map +1 -1
  20. package/dist/components/fields/EntityPicker/EntityPicker.esm.js +7 -1
  21. package/dist/components/fields/EntityPicker/EntityPicker.esm.js.map +1 -1
  22. package/dist/components/fields/EntityTagsPicker/EntityTagsPicker.esm.js +5 -2
  23. package/dist/components/fields/EntityTagsPicker/EntityTagsPicker.esm.js.map +1 -1
  24. package/dist/components/fields/MyGroupsPicker/MyGroupsPicker.esm.js +43 -18
  25. package/dist/components/fields/MyGroupsPicker/MyGroupsPicker.esm.js.map +1 -1
  26. package/dist/components/fields/OwnedEntityPicker/OwnedEntityPicker.esm.js +7 -1
  27. package/dist/components/fields/OwnedEntityPicker/OwnedEntityPicker.esm.js.map +1 -1
  28. package/dist/components/fields/OwnerPicker/OwnerPicker.esm.js +7 -1
  29. package/dist/components/fields/OwnerPicker/OwnerPicker.esm.js.map +1 -1
  30. package/dist/components/fields/RepoBranchPicker/DefaultRepoBranchPicker.esm.js +3 -4
  31. package/dist/components/fields/RepoBranchPicker/DefaultRepoBranchPicker.esm.js.map +1 -1
  32. package/dist/components/fields/RepoUrlPicker/AzureRepoPicker.esm.js +19 -15
  33. package/dist/components/fields/RepoUrlPicker/AzureRepoPicker.esm.js.map +1 -1
  34. package/dist/components/fields/RepoUrlPicker/BitbucketRepoPicker.esm.js +23 -6
  35. package/dist/components/fields/RepoUrlPicker/BitbucketRepoPicker.esm.js.map +1 -1
  36. package/dist/components/fields/RepoUrlPicker/GerritRepoPicker.esm.js +14 -11
  37. package/dist/components/fields/RepoUrlPicker/GerritRepoPicker.esm.js.map +1 -1
  38. package/dist/components/fields/RepoUrlPicker/GiteaRepoPicker.esm.js +14 -9
  39. package/dist/components/fields/RepoUrlPicker/GiteaRepoPicker.esm.js.map +1 -1
  40. package/dist/components/fields/RepoUrlPicker/GithubRepoPicker.esm.js +11 -8
  41. package/dist/components/fields/RepoUrlPicker/GithubRepoPicker.esm.js.map +1 -1
  42. package/dist/components/fields/RepoUrlPicker/GitlabRepoPicker.esm.js +14 -9
  43. package/dist/components/fields/RepoUrlPicker/GitlabRepoPicker.esm.js.map +1 -1
  44. package/dist/components/fields/RepoUrlPicker/RepoUrlPickerHost.esm.js +5 -2
  45. package/dist/components/fields/RepoUrlPicker/RepoUrlPickerHost.esm.js.map +1 -1
  46. package/dist/components/fields/RepoUrlPicker/RepoUrlPickerRepoName.esm.js +13 -3
  47. package/dist/components/fields/RepoUrlPicker/RepoUrlPickerRepoName.esm.js.map +1 -1
  48. package/dist/components/fields/VirtualizedListbox.esm.js +14 -5
  49. package/dist/components/fields/VirtualizedListbox.esm.js.map +1 -1
  50. package/dist/next/TemplateEditorPage/CustomFieldExplorer.esm.js +20 -5
  51. package/dist/next/TemplateEditorPage/CustomFieldExplorer.esm.js.map +1 -1
  52. package/dist/next/TemplateEditorPage/DryRunResults/DryRunResults.esm.js +4 -1
  53. package/dist/next/TemplateEditorPage/DryRunResults/DryRunResults.esm.js.map +1 -1
  54. package/dist/next/TemplateEditorPage/DryRunResults/DryRunResultsList.esm.js +17 -3
  55. package/dist/next/TemplateEditorPage/DryRunResults/DryRunResultsList.esm.js.map +1 -1
  56. package/dist/next/TemplateEditorPage/DryRunResults/DryRunResultsView.esm.js +22 -1
  57. package/dist/next/TemplateEditorPage/DryRunResults/DryRunResultsView.esm.js.map +1 -1
  58. package/dist/next/TemplateEditorPage/DryRunResults/TaskStatusStepper.esm.js +6 -1
  59. package/dist/next/TemplateEditorPage/DryRunResults/TaskStatusStepper.esm.js.map +1 -1
  60. package/dist/next/TemplateEditorPage/TemplateEditorBrowser.esm.js +36 -13
  61. package/dist/next/TemplateEditorPage/TemplateEditorBrowser.esm.js.map +1 -1
  62. package/dist/next/TemplateEditorPage/TemplateEditorIntro.esm.js +13 -6
  63. package/dist/next/TemplateEditorPage/TemplateEditorIntro.esm.js.map +1 -1
  64. package/dist/next/TemplateEditorPage/TemplateEditorPage.esm.js +5 -2
  65. package/dist/next/TemplateEditorPage/TemplateEditorPage.esm.js.map +1 -1
  66. package/dist/next/TemplateEditorPage/TemplateEditorTextArea.esm.js +30 -11
  67. package/dist/next/TemplateEditorPage/TemplateEditorTextArea.esm.js.map +1 -1
  68. package/dist/next/TemplateEditorPage/TemplateFormPreviewer.esm.js +5 -2
  69. package/dist/next/TemplateEditorPage/TemplateFormPreviewer.esm.js.map +1 -1
  70. package/dist/next/TemplateListPage/TemplateListPage.esm.js +23 -15
  71. package/dist/next/TemplateListPage/TemplateListPage.esm.js.map +1 -1
  72. package/dist/next/TemplateWizardPage/TemplateWizardPage.esm.js +6 -3
  73. package/dist/next/TemplateWizardPage/TemplateWizardPage.esm.js.map +1 -1
  74. package/dist/next/TemplateWizardPage/TemplateWizardPageContextMenu.esm.js +11 -1
  75. package/dist/next/TemplateWizardPage/TemplateWizardPageContextMenu.esm.js.map +1 -1
  76. package/dist/translation.esm.js +258 -0
  77. package/dist/translation.esm.js.map +1 -0
  78. package/package.json +19 -19
@@ -1,36 +1,39 @@
1
1
  import React from 'react';
2
2
  import FormControl from '@material-ui/core/FormControl';
3
- import FormHelperText from '@material-ui/core/FormHelperText';
4
- import Input from '@material-ui/core/Input';
5
- import InputLabel from '@material-ui/core/InputLabel';
3
+ import TextField from '@material-ui/core/TextField';
4
+ import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
5
+ import { scaffolderTranslationRef } from '../../../translation.esm.js';
6
6
 
7
7
  const GerritRepoPicker = (props) => {
8
8
  const { onChange, rawErrors, state } = props;
9
+ const { t } = useTranslationRef(scaffolderTranslationRef);
9
10
  const { workspace, owner } = state;
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
- Input,
11
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(FormControl, { margin: "normal", error: rawErrors?.length > 0 && !workspace }, /* @__PURE__ */ React.createElement(
12
+ TextField,
12
13
  {
13
14
  id: "ownerInput",
15
+ label: t("fields.gerritRepoPicker.owner.title"),
14
16
  onChange: (e) => onChange({ owner: e.target.value }),
17
+ helperText: t("fields.gerritRepoPicker.owner.description"),
15
18
  value: owner
16
19
  }
17
- ), /* @__PURE__ */ React.createElement(FormHelperText, null, "The owner of the project (optional)")), /* @__PURE__ */ React.createElement(
20
+ )), /* @__PURE__ */ React.createElement(
18
21
  FormControl,
19
22
  {
20
23
  margin: "normal",
21
24
  required: true,
22
25
  error: rawErrors?.length > 0 && !workspace
23
26
  },
24
- /* @__PURE__ */ React.createElement(InputLabel, { htmlFor: "parentInput" }, "Parent"),
25
27
  /* @__PURE__ */ React.createElement(
26
- Input,
28
+ TextField,
27
29
  {
28
30
  id: "parentInput",
31
+ label: t("fields.gerritRepoPicker.parent.title"),
29
32
  onChange: (e) => onChange({ workspace: e.target.value }),
30
- value: workspace
33
+ value: workspace,
34
+ helperText: t("fields.gerritRepoPicker.parent.description")
31
35
  }
32
- ),
33
- /* @__PURE__ */ React.createElement(FormHelperText, null, "The project parent that the repo will belong to")
36
+ )
34
37
  ));
35
38
  };
36
39
 
@@ -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 { BaseRepoUrlPickerProps } from './types';\n\nexport const GerritRepoPicker = (props: BaseRepoUrlPickerProps) => {\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,KAAkC,KAAA;AACjE,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;;;;"}
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 TextField from '@material-ui/core/TextField';\nimport { BaseRepoUrlPickerProps } from './types';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { scaffolderTranslationRef } from '../../../translation';\n\nexport const GerritRepoPicker = (props: BaseRepoUrlPickerProps) => {\n const { onChange, rawErrors, state } = props;\n const { t } = useTranslationRef(scaffolderTranslationRef);\n const { workspace, owner } = state;\n return (\n <>\n <FormControl margin=\"normal\" error={rawErrors?.length > 0 && !workspace}>\n <TextField\n id=\"ownerInput\"\n label={t('fields.gerritRepoPicker.owner.title')}\n onChange={e => onChange({ owner: e.target.value })}\n helperText={t('fields.gerritRepoPicker.owner.description')}\n value={owner}\n />\n </FormControl>\n <FormControl\n margin=\"normal\"\n required\n error={rawErrors?.length > 0 && !workspace}\n >\n <TextField\n id=\"parentInput\"\n label={t('fields.gerritRepoPicker.parent.title')}\n onChange={e => onChange({ workspace: e.target.value })}\n value={workspace}\n helperText={t('fields.gerritRepoPicker.parent.description')}\n />\n </FormControl>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;AAsBa,MAAA,gBAAA,GAAmB,CAAC,KAAkC,KAAA;AACjE,EAAA,MAAM,EAAE,QAAA,EAAU,SAAW,EAAA,KAAA,EAAU,GAAA,KAAA,CAAA;AACvC,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,wBAAwB,CAAA,CAAA;AACxD,EAAM,MAAA,EAAE,SAAW,EAAA,KAAA,EAAU,GAAA,KAAA,CAAA;AAC7B,EACE,uBAAA,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBACG,KAAA,CAAA,aAAA,CAAA,WAAA,EAAA,EAAY,MAAO,EAAA,QAAA,EAAS,OAAO,SAAW,EAAA,MAAA,GAAS,CAAK,IAAA,CAAC,SAC5D,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACC,EAAG,EAAA,YAAA;AAAA,MACH,KAAA,EAAO,EAAE,qCAAqC,CAAA;AAAA,MAC9C,QAAA,EAAU,OAAK,QAAS,CAAA,EAAE,OAAO,CAAE,CAAA,MAAA,CAAO,OAAO,CAAA;AAAA,MACjD,UAAA,EAAY,EAAE,2CAA2C,CAAA;AAAA,MACzD,KAAO,EAAA,KAAA;AAAA,KAAA;AAAA,GAEX,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,oBAEjC,KAAA,CAAA,aAAA;AAAA,MAAC,SAAA;AAAA,MAAA;AAAA,QACC,EAAG,EAAA,aAAA;AAAA,QACH,KAAA,EAAO,EAAE,sCAAsC,CAAA;AAAA,QAC/C,QAAA,EAAU,OAAK,QAAS,CAAA,EAAE,WAAW,CAAE,CAAA,MAAA,CAAO,OAAO,CAAA;AAAA,QACrD,KAAO,EAAA,SAAA;AAAA,QACP,UAAA,EAAY,EAAE,4CAA4C,CAAA;AAAA,OAAA;AAAA,KAC5D;AAAA,GAEJ,CAAA,CAAA;AAEJ;;;;"}
@@ -1,12 +1,14 @@
1
1
  import React from 'react';
2
2
  import FormControl from '@material-ui/core/FormControl';
3
3
  import FormHelperText from '@material-ui/core/FormHelperText';
4
- import Input from '@material-ui/core/Input';
5
- import InputLabel from '@material-ui/core/InputLabel';
4
+ import TextField from '@material-ui/core/TextField';
6
5
  import { Select } from '@backstage/core-components';
6
+ import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
7
+ import { scaffolderTranslationRef } from '../../../translation.esm.js';
7
8
 
8
9
  const GiteaRepoPicker = (props) => {
9
10
  const { allowedOwners = [], state, onChange, rawErrors } = props;
11
+ const { t } = useTranslationRef(scaffolderTranslationRef);
10
12
  const ownerItems = allowedOwners ? allowedOwners.map((i) => ({ label: i, value: i })) : [{ label: "Loading...", value: "loading" }];
11
13
  const { owner } = state;
12
14
  return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
@@ -16,27 +18,30 @@ const GiteaRepoPicker = (props) => {
16
18
  required: true,
17
19
  error: rawErrors?.length > 0 && !owner
18
20
  },
19
- allowedOwners?.length ? /* @__PURE__ */ React.createElement(
21
+ allowedOwners?.length ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
20
22
  Select,
21
23
  {
22
24
  native: true,
23
- label: "Owner Available",
25
+ label: t("fields.giteaRepoPicker.owner.title"),
24
26
  onChange: (selected) => onChange({
25
- owner: String(Array.isArray(selected) ? selected[0] : selected)
27
+ owner: String(
28
+ Array.isArray(selected) ? selected[0] : selected
29
+ )
26
30
  }),
27
31
  disabled: allowedOwners.length === 1,
28
32
  selected: owner,
29
33
  items: ownerItems
30
34
  }
31
- ) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(InputLabel, { htmlFor: "ownerInput" }, "Owner"), /* @__PURE__ */ React.createElement(
32
- Input,
35
+ ), /* @__PURE__ */ React.createElement(FormHelperText, null, t("fields.giteaRepoPicker.owner.description"))) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
36
+ TextField,
33
37
  {
34
38
  id: "ownerInput",
39
+ label: t("fields.giteaRepoPicker.owner.inputTitle"),
35
40
  onChange: (e) => onChange({ owner: e.target.value }),
41
+ helperText: t("fields.giteaRepoPicker.owner.description"),
36
42
  value: owner
37
43
  }
38
- )),
39
- /* @__PURE__ */ React.createElement(FormHelperText, null, "Gitea namespace where this repository will belong to. It can be the name of organization, group, subgroup, user, or the project.")
44
+ ))
40
45
  ));
41
46
  };
42
47
 
@@ -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 { BaseRepoUrlPickerProps } from './types';\n\nexport const GiteaRepoPicker = (\n props: BaseRepoUrlPickerProps<{\n allowedOwners?: string[];\n allowedRepos?: string[];\n }>,\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,CAC7B,KAIG,KAAA;AACH,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,SAAA,EAAW,MAAS,GAAA,CAAA,IAAK,CAAC,KAAA;AAAA,KAAA;AAAA,IAEhC,eAAe,MACd,mBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,MAAM,EAAA,IAAA;AAAA,QACN,KAAM,EAAA,iBAAA;AAAA,QACN,QAAA,EAAU,cACR,QAAS,CAAA;AAAA,UACP,KAAA,EAAO,OAAO,KAAM,CAAA,OAAA,CAAQ,QAAQ,CAAI,GAAA,QAAA,CAAS,CAAC,CAAA,GAAI,QAAQ,CAAA;AAAA,SAC/D,CAAA;AAAA,QAEH,QAAA,EAAU,cAAc,MAAW,KAAA,CAAA;AAAA,QACnC,QAAU,EAAA,KAAA;AAAA,QACV,KAAO,EAAA,UAAA;AAAA,OAAA;AAAA,wBAIP,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,cAAW,OAAQ,EAAA,YAAA,EAAA,EAAa,OAAK,CACtC,kBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,EAAG,EAAA,YAAA;AAAA,QACH,QAAA,EAAU,OAAK,QAAS,CAAA,EAAE,OAAO,CAAE,CAAA,MAAA,CAAO,OAAO,CAAA;AAAA,QACjD,KAAO,EAAA,KAAA;AAAA,OAAA;AAAA,KAEX,CAAA;AAAA,oBAEF,KAAA,CAAA,aAAA,CAAC,sBAAe,kIAGhB,CAAA;AAAA,GAEJ,CAAA,CAAA;AAEJ;;;;"}
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 TextField from '@material-ui/core/TextField';\nimport { Select, SelectItem } from '@backstage/core-components';\nimport { BaseRepoUrlPickerProps } from './types';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { scaffolderTranslationRef } from '../../../translation';\n\nexport const GiteaRepoPicker = (\n props: BaseRepoUrlPickerProps<{\n allowedOwners?: string[];\n allowedRepos?: string[];\n }>,\n) => {\n const { allowedOwners = [], state, onChange, rawErrors } = props;\n const { t } = useTranslationRef(scaffolderTranslationRef);\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 <>\n <Select\n native\n label={t('fields.giteaRepoPicker.owner.title')}\n onChange={selected =>\n onChange({\n owner: String(\n Array.isArray(selected) ? selected[0] : selected,\n ),\n })\n }\n disabled={allowedOwners.length === 1}\n selected={owner}\n items={ownerItems}\n />\n <FormHelperText>\n {t('fields.giteaRepoPicker.owner.description')}\n </FormHelperText>\n </>\n ) : (\n <>\n <TextField\n id=\"ownerInput\"\n label={t('fields.giteaRepoPicker.owner.inputTitle')}\n onChange={e => onChange({ owner: e.target.value })}\n helperText={t('fields.giteaRepoPicker.owner.description')}\n value={owner}\n />\n </>\n )}\n </FormControl>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAwBa,MAAA,eAAA,GAAkB,CAC7B,KAIG,KAAA;AACH,EAAA,MAAM,EAAE,aAAgB,GAAA,IAAI,KAAO,EAAA,QAAA,EAAU,W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AA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,SAAA;AAAA,MAAA;AAAA,QACC,EAAG,EAAA,YAAA;AAAA,QACH,KAAA,EAAO,EAAE,yCAAyC,CAAA;AAAA,QAClD,QAAA,EAAU,OAAK,QAAS,CAAA,EAAE,OAAO,CAAE,CAAA,MAAA,CAAO,OAAO,CAAA;AAAA,QACjD,UAAA,EAAY,EAAE,0CAA0C,CAAA;AAAA,QACxD,KAAO,EAAA,KAAA;AAAA,OAAA;AAAA,KAEX,CAAA;AAAA,GAGN,CAAA,CAAA;AAEJ;;;;"}
@@ -1,12 +1,14 @@
1
1
  import React from 'react';
2
2
  import FormControl from '@material-ui/core/FormControl';
3
3
  import FormHelperText from '@material-ui/core/FormHelperText';
4
- import Input from '@material-ui/core/Input';
5
- import InputLabel from '@material-ui/core/InputLabel';
4
+ import TextField from '@material-ui/core/TextField';
6
5
  import { Select } from '@backstage/core-components';
6
+ import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
7
+ import { scaffolderTranslationRef } from '../../../translation.esm.js';
7
8
 
8
9
  const GithubRepoPicker = (props) => {
9
10
  const { allowedOwners = [], rawErrors, state, onChange } = props;
11
+ const { t } = useTranslationRef(scaffolderTranslationRef);
10
12
  const ownerItems = allowedOwners ? allowedOwners.map((i) => ({ label: i, value: i })) : [{ label: "Loading...", value: "loading" }];
11
13
  const { owner } = state;
12
14
  return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
@@ -16,25 +18,26 @@ const GithubRepoPicker = (props) => {
16
18
  required: true,
17
19
  error: rawErrors?.length > 0 && !owner
18
20
  },
19
- allowedOwners?.length ? /* @__PURE__ */ React.createElement(
21
+ allowedOwners?.length ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
20
22
  Select,
21
23
  {
22
24
  native: true,
23
- label: "Owner Available",
25
+ label: t("fields.githubRepoPicker.owner.title"),
24
26
  onChange: (s) => onChange({ owner: String(Array.isArray(s) ? s[0] : s) }),
25
27
  disabled: allowedOwners.length === 1,
26
28
  selected: owner,
27
29
  items: ownerItems
28
30
  }
29
- ) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(InputLabel, { htmlFor: "ownerInput" }, "Owner"), /* @__PURE__ */ React.createElement(
30
- Input,
31
+ ), /* @__PURE__ */ React.createElement(FormHelperText, null, t("fields.githubRepoPicker.owner.description"))) : /* @__PURE__ */ React.createElement(
32
+ TextField,
31
33
  {
32
34
  id: "ownerInput",
35
+ label: t("fields.githubRepoPicker.owner.inputTitle"),
33
36
  onChange: (e) => onChange({ owner: e.target.value }),
37
+ helperText: t("fields.githubRepoPicker.owner.description"),
34
38
  value: owner
35
39
  }
36
- )),
37
- /* @__PURE__ */ React.createElement(FormHelperText, null, "The organization, user or project that this repo will belong to")
40
+ )
38
41
  ));
39
42
  };
40
43
 
@@ -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 { BaseRepoUrlPickerProps } from './types';\n\nexport const GithubRepoPicker = (\n props: BaseRepoUrlPickerProps<{\n allowedOwners?: string[];\n }>,\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,CAC9B,KAGG,KAAA;AACH,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,SAAA,EAAW,MAAS,GAAA,CAAA,IAAK,CAAC,KAAA;AAAA,KAAA;AAAA,IAEhC,eAAe,MACd,mBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,MAAM,EAAA,IAAA;AAAA,QACN,KAAM,EAAA,iBAAA;AAAA,QACN,QAAU,EAAA,CAAA,CAAA,KACR,QAAS,CAAA,EAAE,OAAO,MAAO,CAAA,KAAA,CAAM,OAAQ,CAAA,CAAC,IAAI,CAAE,CAAA,CAAC,CAAI,GAAA,CAAC,GAAG,CAAA;AAAA,QAEzD,QAAA,EAAU,cAAc,MAAW,KAAA,CAAA;AAAA,QACnC,QAAU,EAAA,KAAA;AAAA,QACV,KAAO,EAAA,UAAA;AAAA,OAAA;AAAA,wBAIP,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,cAAW,OAAQ,EAAA,YAAA,EAAA,EAAa,OAAK,CACtC,kBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,EAAG,EAAA,YAAA;AAAA,QACH,QAAA,EAAU,OAAK,QAAS,CAAA,EAAE,OAAO,CAAE,CAAA,MAAA,CAAO,OAAO,CAAA;AAAA,QACjD,KAAO,EAAA,KAAA;AAAA,OAAA;AAAA,KAEX,CAAA;AAAA,oBAEF,KAAA,CAAA,aAAA,CAAC,sBAAe,iEAEhB,CAAA;AAAA,GAEJ,CAAA,CAAA;AAEJ;;;;"}
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 TextField from '@material-ui/core/TextField';\nimport { Select, SelectItem } from '@backstage/core-components';\nimport { BaseRepoUrlPickerProps } from './types';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { scaffolderTranslationRef } from '../../../translation';\n\nexport const GithubRepoPicker = (\n props: BaseRepoUrlPickerProps<{\n allowedOwners?: string[];\n }>,\n) => {\n const { allowedOwners = [], rawErrors, state, onChange } = props;\n const { t } = useTranslationRef(scaffolderTranslationRef);\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 <>\n <Select\n native\n label={t('fields.githubRepoPicker.owner.title')}\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 <FormHelperText>\n {t('fields.githubRepoPicker.owner.description')}\n </FormHelperText>\n </>\n ) : (\n <TextField\n id=\"ownerInput\"\n label={t('fields.githubRepoPicker.owner.inputTitle')}\n onChange={e => onChange({ owner: e.target.value })}\n helperText={t('fields.githubRepoPicker.owner.description')}\n value={owner}\n />\n )}\n </FormControl>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAwBa,MAAA,gBAAA,GAAmB,CAC9B,KAGG,KAAA;AACH,EAAA,MAAM,EAAE,aAAgB,GAAA,IAAI,SAAW,EAAA,KAAA,EAAO,UAAa,GAAA,KAAA,CAAA;AAC3D,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,wBAAwB,CAAA,CAAA;AACxD,EAAA,MAAM,aAA2B,aAC7B,GAAA,aAAA,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AAE,OAAO,CAAE,CAAA,MAAA,CAAO,OAAO,CAAA;AAAA,QACjD,UAAA,EAAY,EAAE,2CAA2C,CAAA;AAAA,QACzD,KAAO,EAAA,KAAA;AAAA,OAAA;AAAA,KACT;AAAA,GAGN,CAAA,CAAA;AAEJ;;;;"}
@@ -1,12 +1,14 @@
1
1
  import React from 'react';
2
2
  import FormControl from '@material-ui/core/FormControl';
3
3
  import FormHelperText from '@material-ui/core/FormHelperText';
4
- import Input from '@material-ui/core/Input';
5
- import InputLabel from '@material-ui/core/InputLabel';
4
+ import TextField from '@material-ui/core/TextField';
6
5
  import { Select } from '@backstage/core-components';
6
+ import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
7
+ import { scaffolderTranslationRef } from '../../../translation.esm.js';
7
8
 
8
9
  const GitlabRepoPicker = (props) => {
9
10
  const { allowedOwners = [], state, onChange, rawErrors } = props;
11
+ const { t } = useTranslationRef(scaffolderTranslationRef);
10
12
  const ownerItems = allowedOwners ? allowedOwners.map((i) => ({ label: i, value: i })) : [{ label: "Loading...", value: "loading" }];
11
13
  const { owner } = state;
12
14
  return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
@@ -16,27 +18,30 @@ const GitlabRepoPicker = (props) => {
16
18
  required: true,
17
19
  error: rawErrors?.length > 0 && !owner
18
20
  },
19
- allowedOwners?.length ? /* @__PURE__ */ React.createElement(
21
+ allowedOwners?.length ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
20
22
  Select,
21
23
  {
22
24
  native: true,
23
- label: "Owner Available",
25
+ label: t("fields.gitlabRepoPicker.owner.title"),
24
26
  onChange: (selected) => onChange({
25
- owner: String(Array.isArray(selected) ? selected[0] : selected)
27
+ owner: String(
28
+ Array.isArray(selected) ? selected[0] : selected
29
+ )
26
30
  }),
27
31
  disabled: allowedOwners.length === 1,
28
32
  selected: owner,
29
33
  items: ownerItems
30
34
  }
31
- ) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(InputLabel, { htmlFor: "ownerInput" }, "Owner"), /* @__PURE__ */ React.createElement(
32
- Input,
35
+ ), /* @__PURE__ */ React.createElement(FormHelperText, null, t("fields.gitlabRepoPicker.owner.description"))) : /* @__PURE__ */ React.createElement(
36
+ TextField,
33
37
  {
34
38
  id: "ownerInput",
39
+ label: t("fields.gitlabRepoPicker.owner.inputTitle"),
35
40
  onChange: (e) => onChange({ owner: e.target.value }),
41
+ helperText: t("fields.gitlabRepoPicker.owner.description"),
36
42
  value: owner
37
43
  }
38
- )),
39
- /* @__PURE__ */ React.createElement(FormHelperText, null, "GitLab namespace where this repository will belong to. It can be the name of organization, group, subgroup, user, or the project.")
44
+ )
40
45
  ));
41
46
  };
42
47
 
@@ -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 { BaseRepoUrlPickerProps } from './types';\n\nexport const GitlabRepoPicker = (\n props: BaseRepoUrlPickerProps<{\n allowedOwners?: string[];\n allowedRepos?: string[];\n }>,\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,CAC9B,KAIG,KAAA;AACH,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,SAAA,EAAW,MAAS,GAAA,CAAA,IAAK,CAAC,KAAA;AAAA,KAAA;AAAA,IAEhC,eAAe,MACd,mBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,MAAM,EAAA,IAAA;AAAA,QACN,KAAM,EAAA,iBAAA;AAAA,QACN,QAAA,EAAU,cACR,QAAS,CAAA;AAAA,UACP,KAAA,EAAO,OAAO,KAAM,CAAA,OAAA,CAAQ,QAAQ,CAAI,GAAA,QAAA,CAAS,CAAC,CAAA,GAAI,QAAQ,CAAA;AAAA,SAC/D,CAAA;AAAA,QAEH,QAAA,EAAU,cAAc,MAAW,KAAA,CAAA;AAAA,QACnC,QAAU,EAAA,KAAA;AAAA,QACV,KAAO,EAAA,UAAA;AAAA,OAAA;AAAA,wBAIP,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,cAAW,OAAQ,EAAA,YAAA,EAAA,EAAa,OAAK,CACtC,kBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,EAAG,EAAA,YAAA;AAAA,QACH,QAAA,EAAU,OAAK,QAAS,CAAA,EAAE,OAAO,CAAE,CAAA,MAAA,CAAO,OAAO,CAAA;AAAA,QACjD,KAAO,EAAA,KAAA;AAAA,OAAA;AAAA,KAEX,CAAA;AAAA,oBAEF,KAAA,CAAA,aAAA,CAAC,sBAAe,mIAGhB,CAAA;AAAA,GAEJ,CAAA,CAAA;AAEJ;;;;"}
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 TextField from '@material-ui/core/TextField';\nimport { Select, SelectItem } from '@backstage/core-components';\nimport { BaseRepoUrlPickerProps } from './types';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { scaffolderTranslationRef } from '../../../translation';\n\nexport const GitlabRepoPicker = (\n props: BaseRepoUrlPickerProps<{\n allowedOwners?: string[];\n allowedRepos?: string[];\n }>,\n) => {\n const { allowedOwners = [], state, onChange, rawErrors } = props;\n const { t } = useTranslationRef(scaffolderTranslationRef);\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 <>\n <Select\n native\n label={t('fields.gitlabRepoPicker.owner.title')}\n onChange={selected =>\n onChange({\n owner: String(\n Array.isArray(selected) ? selected[0] : selected,\n ),\n })\n }\n disabled={allowedOwners.length === 1}\n selected={owner}\n items={ownerItems}\n />\n <FormHelperText>\n {t('fields.gitlabRepoPicker.owner.description')}\n </FormHelperText>\n </>\n ) : (\n <TextField\n id=\"ownerInput\"\n label={t('fields.gitlabRepoPicker.owner.inputTitle')}\n onChange={e => onChange({ owner: e.target.value })}\n helperText={t('fields.gitlabRepoPicker.owner.description')}\n value={owner}\n />\n )}\n </FormControl>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AAwBa,MAAA,gBAAA,GAAmB,CAC9B,KAIG,KAAA;AACH,EAAA,MAAM,EAAE,aAAgB,GAAA,IAAI,KAAO,EAAA,QAAA,EAAU,WAAc,GAAA,KAAA,CAAA;AAC3D,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,wBAAwB,CAAA,CAAA;AACxD,EAAA,MAAM,aAA2B,aAC7B,GAAA,aAA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AAU,OAAK,QAAS,CAAA,EAAE,OAAO,CAAE,CAAA,MAAA,CAAO,OAAO,CAAA;AAAA,QACjD,UAAA,EAAY,EAAE,2CAA2C,CAAA;AAAA,QACzD,KAAO,EAAA,KAAA;AAAA,OAAA;AAAA,KACT;AAAA,GAGN,CAAA,CAAA;AAEJ;;;;"}
@@ -5,9 +5,12 @@ import FormHelperText from '@material-ui/core/FormHelperText';
5
5
  import { useApi } from '@backstage/core-plugin-api';
6
6
  import { scaffolderApiRef } from '@backstage/plugin-scaffolder-react';
7
7
  import useAsync from 'react-use/esm/useAsync';
8
+ import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
9
+ import { scaffolderTranslationRef } from '../../../translation.esm.js';
8
10
 
9
11
  const RepoUrlPickerHost = (props) => {
10
12
  const { host, hosts, onChange, rawErrors } = props;
13
+ const { t } = useTranslationRef(scaffolderTranslationRef);
11
14
  const scaffolderApi = useApi(scaffolderApiRef);
12
15
  const { value: { integrations } = { integrations: [] }, loading } = useAsync(
13
16
  async () => {
@@ -41,14 +44,14 @@ const RepoUrlPickerHost = (props) => {
41
44
  {
42
45
  native: true,
43
46
  disabled: hosts?.length === 1,
44
- label: "Host",
47
+ label: t("fields.repoUrlPicker.host.title"),
45
48
  onChange: (s) => onChange(String(Array.isArray(s) ? s[0] : s)),
46
49
  selected: host,
47
50
  items: hostsOptions,
48
51
  "data-testid": "host-select"
49
52
  }
50
53
  ),
51
- /* @__PURE__ */ React.createElement(FormHelperText, null, "The host where the repository will be created")
54
+ /* @__PURE__ */ React.createElement(FormHelperText, null, t("fields.repoUrlPicker.host.description"))
52
55
  ));
53
56
  };
54
57
 
@@ -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\"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C,GAAA,CAAC,EAAE,KAAA,EAAO,YAAc,EAAA,KAAA,EAAO,WAAW,CAAA,CAAA;AAE9C,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,2CAAQ,QAAS,EAAA,IAAA,CAAA,CAAA;AAAA,GACnB;AAEA,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,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;;;;"}
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';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { scaffolderTranslationRef } from '../../../translation';\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 { t } = useTranslationRef(scaffolderTranslationRef);\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={t('fields.repoUrlPicker.host.title')}\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 {t('fields.repoUrlPicker.host.description')}\n </FormHelperText>\n </FormControl>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AAyBa,MAAA,iBAAA,GAAoB,CAAC,KAK5B,KAAA;AACJ,EAAA,MAAM,EAAE,IAAA,EAAM,KAAO,EAAA,QAAA,EAAU,WAAc,GAAA,KAAA,CAAA;AAC7C,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,wBAAwB,CAAA,CAAA;AACxD,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,SAAS,EAAC;AAAA,OACzB,CAAA,CAAA;AAAA,KACH;AAAA,GACF,CAAA;AAEA,EAAA,SAAA,CAAU,MAAM;AAEd,IAAA,IAAI,CAAC,IAAM,EAAA;AAET,MAAA,IAAI,OAAO,MAAQ,EAAA;AACjB,QAAS,QAAA,CAAA,KAAA,CAAM,CAAC,CAAC,CAAA,CAAA;AAAA,OAEnB,MAAA,IAAW,cAAc,MAAQ,EAAA;AAC/B,QAAS,QAAA,CAAA,YAAA,CAAa,CAAC,CAAA,CAAE,IAAI,CAAA,CAAA;AAAA,OAC/B;AAAA,KACF;AAAA,KACC,CAAC,KAAA,EAAO,IAAM,EAAA,QAAA,EAAU,YAAY,CAAC,CAAA,CAAA;AAIxC,EAAA,MAAM,YAA6B,GAAA,YAAA,GAC/B,YACG,CAAA,MAAA,CAAO,CAAM,CAAA,KAAA,KAAA,EAAO,MAAS,GAAA,KAAA,EAAO,QAAS,CAAA,CAAA,CAA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ormHelperText from '@material-ui/core/FormHelperText';
5
5
  import Autocomplete from '@material-ui/lab/Autocomplete';
6
6
  import TextField from '@material-ui/core/TextField';
7
+ import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
8
+ import { scaffolderTranslationRef } from '../../../translation.esm.js';
7
9
 
8
10
  const RepoUrlPickerRepoName = (props) => {
9
11
  const { repoName, allowedRepos, onChange, rawErrors, availableRepos } = props;
12
+ const { t } = useTranslationRef(scaffolderTranslationRef);
10
13
  useEffect(() => {
11
14
  if (!repoName) {
12
15
  if (allowedRepos?.length) {
@@ -26,7 +29,7 @@ const RepoUrlPickerRepoName = (props) => {
26
29
  Select,
27
30
  {
28
31
  native: true,
29
- label: "Repositories Available",
32
+ label: t("fields.repoUrlPicker.repository.title"),
30
33
  onChange: (selected) => onChange(String(Array.isArray(selected) ? selected[0] : selected)),
31
34
  disabled: allowedRepos.length === 1,
32
35
  selected: repoName,
@@ -40,12 +43,19 @@ const RepoUrlPickerRepoName = (props) => {
40
43
  onChange(newValue || "");
41
44
  },
42
45
  options: availableRepos || [],
43
- renderInput: (params) => /* @__PURE__ */ React.createElement(TextField, { ...params, label: "Repository", required: true }),
46
+ renderInput: (params) => /* @__PURE__ */ React.createElement(
47
+ TextField,
48
+ {
49
+ ...params,
50
+ label: t("fields.repoUrlPicker.repository.inputTitle"),
51
+ required: true
52
+ }
53
+ ),
44
54
  freeSolo: true,
45
55
  autoSelect: true
46
56
  }
47
57
  ),
48
- /* @__PURE__ */ React.createElement(FormHelperText, null, "The name of the repository")
58
+ /* @__PURE__ */ React.createElement(FormHelperText, null, t("fields.repoUrlPicker.repository.description"))
49
59
  ));
50
60
  };
51
61
 
@@ -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 Autocomplete from '@material-ui/lab/Autocomplete';\nimport TextField from '@material-ui/core/TextField';\n\nexport const RepoUrlPickerRepoName = (props: {\n repoName?: string;\n allowedRepos?: string[];\n onChange: (host: string) => void;\n rawErrors: string[];\n availableRepos?: string[];\n}) => {\n const { repoName, allowedRepos, onChange, rawErrors, availableRepos } = 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 <Autocomplete\n value={repoName}\n onChange={(_, newValue) => {\n onChange(newValue || '');\n }}\n options={availableRepos || []}\n renderInput={params => (\n <TextField {...params} label=\"Repository\" required />\n )}\n freeSolo\n autoSelect\n />\n )}\n <FormHelperText>The name of the repository</FormHelperText>\n </FormControl>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAsBa,MAAA,qBAAA,GAAwB,CAAC,KAMhC,KAAA;AACJ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OAAA;AAAA,KAGT,mBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,YAAA;AAAA,MAAA;AAAA,QACC,KAAO,EAAA,QAAA;AAAA,QACP,QAAA,EAAU,CAAC,CAAA,EAAG,QAAa,KAAA;AACzB,UAAA,QAAA,CAAS,YAAY,EAAE,CAAA,CAAA;AAAA,SACzB;AAAA,QACA,OAAA,EAAS,kBAAkB,EAAC;AAAA,QAC5B,WAAA,EAAa,4BACV,KAAA,CAAA,aAAA,CAAA,SAAA,EAAA,EAAW,GAAG,MAAQ,EAAA,KAAA,EAAM,YAAa,EAAA,QAAA,EAAQ,IAAC,EAAA,CAAA;AAAA,QAErD,QAAQ,EAAA,IAAA;AAAA,QACR,UAAU,EAAA,IAAA;AAAA,OAAA;AAAA,KACZ;AAAA,oBAEF,KAAA,CAAA,aAAA,CAAC,sBAAe,4BAA0B,CAAA;AAAA,GAE9C,CAAA,CAAA;AAEJ;;;;"}
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 Autocomplete from '@material-ui/lab/Autocomplete';\nimport TextField from '@material-ui/core/TextField';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { scaffolderTranslationRef } from '../../../translation';\n\nexport const RepoUrlPickerRepoName = (props: {\n repoName?: string;\n allowedRepos?: string[];\n onChange: (host: string) => void;\n rawErrors: string[];\n availableRepos?: string[];\n}) => {\n const { repoName, allowedRepos, onChange, rawErrors, availableRepos } = props;\n const { t } = useTranslationRef(scaffolderTranslationRef);\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={t('fields.repoUrlPicker.repository.title')}\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 <Autocomplete\n value={repoName}\n onChange={(_, newValue) => {\n onChange(newValue || '');\n }}\n options={availableRepos || []}\n renderInput={params => (\n <TextField\n {...params}\n label={t('fields.repoUrlPicker.repository.inputTitle')}\n required\n />\n )}\n freeSolo\n autoSelect\n />\n )}\n <FormHelperText>\n {t('fields.repoUrlPicker.repository.description')}\n </FormHelperText>\n </FormControl>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAwBa,MAAA,qBAAA,GAAwB,CAAC,KAMhC,KAAA;AACJ,EAAA,MAAM,EAAE,QAAU,EAAA,YAAA,EAAc,QAAU,EAAA,SAAA,EAAW,gBAAmB,GAAA,KAAA,CAAA;AACxE,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,wBAAwB,CAAA,CAAA;AAExD,EAAA,SAAA,CAAU,MAAM;AAEd,IAAA,IAAI,CAAC,QAAU,EAAA;AAEb,MAAA,IAAI,cAAc,MAAQ,EAAA;AACxB,QAAS,QAAA,CA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AAAA,SACzB;AAAA,QACA,OAAA,EAAS,kBAAkB,EAAC;AAAA,QAC5B,aAAa,CACX,MAAA,qBAAA,KAAA,CAAA,aAAA;AAAA,UAAC,SAAA;AAAA,UAAA;AAAA,YACE,GAAG,MAAA;AAAA,YACJ,KAAA,EAAO,EAAE,4CAA4C,CAAA;AAAA,YACrD,QAAQ,EAAA,IAAA;AAAA,WAAA;AAAA,SACV;AAAA,QAEF,QAAQ,EAAA,IAAA;AAAA,QACR,UAAU,EAAA,IAAA;AAAA,OAAA;AAAA,KACZ;AAAA,oBAED,KAAA,CAAA,aAAA,CAAA,cAAA,EAAA,IAAA,EACE,CAAE,CAAA,6CAA6C,CAClD,CAAA;AAAA,GAEJ,CAAA,CAAA;AAEJ;;;;"}
@@ -5,23 +5,32 @@ const renderRow = (props) => {
5
5
  const { data, index, style } = props;
6
6
  return React.cloneElement(data[index], { style });
7
7
  };
8
+ const OuterElementContext = React.createContext({});
9
+ const OuterElementType = React.forwardRef(
10
+ (props, ref) => {
11
+ const outerProps = React.useContext(OuterElementContext);
12
+ return /* @__PURE__ */ React.createElement("div", { ref, ...props, ...outerProps });
13
+ }
14
+ );
8
15
  const VirtualizedListbox = React.forwardRef((props, ref) => {
9
- const itemData = React.Children.toArray(props.children);
16
+ const { children, ...other } = props;
17
+ const itemData = React.Children.toArray(children);
10
18
  const itemCount = itemData.length;
11
19
  const itemSize = 36;
12
- const itemsToShow = Math.min(10, itemCount);
13
- const height = Math.max(itemSize, itemsToShow * itemSize - 0.5 * itemSize);
14
- return /* @__PURE__ */ React.createElement("div", { ref }, /* @__PURE__ */ React.createElement(
20
+ const itemsToShow = Math.min(10, itemCount) + 0.5;
21
+ const height = itemsToShow * itemSize;
22
+ return /* @__PURE__ */ React.createElement("div", { ref }, /* @__PURE__ */ React.createElement(OuterElementContext.Provider, { value: other }, /* @__PURE__ */ React.createElement(
15
23
  FixedSizeList,
16
24
  {
17
25
  height,
18
26
  itemData,
19
27
  itemCount,
20
28
  itemSize,
29
+ outerElementType: OuterElementType,
21
30
  width: "100%"
22
31
  },
23
32
  renderRow
24
- ));
33
+ )));
25
34
  });
26
35
 
27
36
  export { VirtualizedListbox };
@@ -1 +1 @@
1
- {"version":3,"file":"VirtualizedListbox.esm.js","sources":["../../../src/components/fields/VirtualizedListbox.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport { FixedSizeList, ListChildComponentProps } from 'react-window';\n\nconst renderRow = (props: ListChildComponentProps) => {\n const { data, index, style } = props;\n return React.cloneElement(data[index], { style });\n};\n\nexport const VirtualizedListbox = React.forwardRef<\n HTMLDivElement,\n { children?: React.ReactNode }\n>((props, ref) => {\n const itemData = React.Children.toArray(props.children);\n const itemCount = itemData.length;\n\n const itemSize = 36;\n\n const itemsToShow = Math.min(10, itemCount);\n const height = Math.max(itemSize, itemsToShow * itemSize - 0.5 * itemSize);\n\n return (\n <div ref={ref}>\n <FixedSizeList\n height={height}\n itemData={itemData}\n itemCount={itemCount}\n itemSize={itemSize}\n width=\"100%\"\n >\n {renderRow}\n </FixedSizeList>\n </div>\n );\n});\n"],"names":[],"mappings":";;;AAmBA,MAAM,SAAA,GAAY,CAAC,KAAmC,KAAA;AACpD,EAAA,MAAM,EAAE,IAAA,EAAM,KAAO,EAAA,KAAA,EAAU,GAAA,KAAA,CAAA;AAC/B,EAAA,OAAO,MAAM,YAAa,CAAA,IAAA,CAAK,KAAK,CAAG,EAAA,EAAE,OAAO,CAAA,CAAA;AAClD,CAAA,CAAA;AAEO,MAAM,kBAAqB,GAAA,KAAA,CAAM,UAGtC,CAAA,CAAC,OAAO,GAAQ,KAAA;AAChB,EAAA,MAAM,QAAW,GAAA,KAAA,CAAM,QAAS,CAAA,OAAA,CAAQ,MAAM,QAAQ,CAAA,CAAA;AACtD,EAAA,MAAM,YAAY,QAAS,CAAA,MAAA,CAAA;AAE3B,EAAA,MAAM,QAAW,GAAA,EAAA,CAAA;AAEjB,EAAA,MAAM,WAAc,GAAA,IAAA,CAAK,GAAI,CAAA,EAAA,EAAI,SAAS,CAAA,CAAA;AAC1C,EAAA,MAAM,SAAS,IAAK,CAAA,GAAA,CAAI,UAAU,WAAc,GAAA,QAAA,GAAW,MAAM,QAAQ,CAAA,CAAA;AAEzE,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,SAAI,GACH,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,aAAA;AAAA,IAAA;AAAA,MACC,MAAA;AAAA,MACA,QAAA;AAAA,MACA,SAAA;AAAA,MACA,QAAA;AAAA,MACA,KAAM,EAAA,MAAA;AAAA,KAAA;AAAA,IAEL,SAAA;AAAA,GAEL,CAAA,CAAA;AAEJ,CAAC;;;;"}
1
+ {"version":3,"file":"VirtualizedListbox.esm.js","sources":["../../../src/components/fields/VirtualizedListbox.tsx"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport { FixedSizeList, ListChildComponentProps } from 'react-window';\n\ntype HTMLDivProps = React.HTMLAttributes<HTMLDivElement>;\n\nconst renderRow = (props: ListChildComponentProps) => {\n const { data, index, style } = props;\n return React.cloneElement(data[index], { style });\n};\n\n// Context needed to keep Autocomplete working correctly : https://v4.mui.com/components/autocomplete/#Virtualize.tsx\nconst OuterElementContext = React.createContext<HTMLDivProps>({});\n\nconst OuterElementType = React.forwardRef<HTMLDivElement, HTMLDivProps>(\n (props, ref) => {\n const outerProps = React.useContext(OuterElementContext);\n return <div ref={ref} {...props} {...outerProps} />;\n },\n);\n\nexport const VirtualizedListbox = React.forwardRef<\n HTMLDivElement,\n HTMLDivProps\n>((props, ref) => {\n const { children, ...other } = props;\n const itemData = React.Children.toArray(children);\n const itemCount = itemData.length;\n\n const itemSize = 36;\n\n const itemsToShow = Math.min(10, itemCount) + 0.5;\n const height = itemsToShow * itemSize;\n\n return (\n <div ref={ref}>\n <OuterElementContext.Provider value={other}>\n <FixedSizeList\n height={height}\n itemData={itemData}\n itemCount={itemCount}\n itemSize={itemSize}\n outerElementType={OuterElementType}\n width=\"100%\"\n >\n {renderRow}\n </FixedSizeList>\n </OuterElementContext.Provider>\n </div>\n );\n});\n"],"names":[],"mappings":";;;AAqBA,MAAM,SAAA,GAAY,CAAC,KAAmC,KAAA;AACpD,EAAA,MAAM,EAAE,IAAA,EAAM,KAAO,EAAA,KAAA,EAAU,GAAA,KAAA,CAAA;AAC/B,EAAA,OAAO,MAAM,YAAa,CAAA,IAAA,CAAK,KAAK,CAAG,EAAA,EAAE,OAAO,CAAA,CAAA;AAClD,CAAA,CAAA;AAGA,MAAM,mBAAsB,GAAA,KAAA,CAAM,aAA4B,CAAA,EAAE,CAAA,CAAA;AAEhE,MAAM,mBAAmB,KAAM,CAAA,UAAA;AAAA,EAC7B,CAAC,OAAO,GAAQ,KAAA;AACd,IAAM,MAAA,UAAA,GAAa,KAAM,CAAA,UAAA,CAAW,mBAAmB,CAAA,CAAA;AACvD,IAAA,2CAAQ,KAAI,EAAA,EAAA,GAAA,EAAW,GAAG,KAAA,EAAQ,GAAG,UAAY,EAAA,CAAA,CAAA;AAAA,GACnD;AACF,CAAA,CAAA;AAEO,MAAM,kBAAqB,GAAA,KAAA,CAAM,UAGtC,CAAA,CAAC,OAAO,GAAQ,KAAA;AAChB,EAAA,MAAM,EAAE,QAAA,EAAU,GAAG,KAAA,EAAU,GAAA,KAAA,CAAA;AAC/B,EAAA,MAAM,QAAW,GAAA,KAAA,CAAM,QAAS,CAAA,OAAA,CAAQ,QAAQ,CAAA,CAAA;AAChD,EAAA,MAAM,YAAY,QAAS,CAAA,MAAA,CAAA;AAE3B,EAAA,MAAM,QAAW,GAAA,EAAA,CAAA;AAEjB,EAAA,MAAM,WAAc,GAAA,IAAA,CAAK,GAAI,CAAA,EAAA,EAAI,SAAS,CAAI,GAAA,GAAA,CAAA;AAC9C,EAAA,MAAM,SAAS,WAAc,GAAA,QAAA,CAAA;AAE7B,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,SAAI,GACH,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,oBAAoB,QAApB,EAAA,EAA6B,OAAO,KACnC,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,aAAA;AAAA,IAAA;AAAA,MACC,MAAA;AAAA,MACA,QAAA;AAAA,MACA,SAAA;AAAA,MACA,QAAA;AAAA,MACA,gBAAkB,EAAA,gBAAA;AAAA,MAClB,KAAM,EAAA,MAAA;AAAA,KAAA;AAAA,IAEL,SAAA;AAAA,GAEL,CACF,CAAA,CAAA;AAEJ,CAAC;;;;"}
@@ -17,6 +17,8 @@ import yaml from 'yaml';
17
17
  import { Form } from '@backstage/plugin-scaffolder-react/alpha';
18
18
  import { TemplateEditorForm } from './TemplateEditorForm.esm.js';
19
19
  import validator from '@rjsf/validator-ajv8';
20
+ import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
21
+ import { scaffolderTranslationRef } from '../../translation.esm.js';
20
22
 
21
23
  const useStyles = makeStyles((theme) => ({
22
24
  root: {
@@ -48,6 +50,7 @@ const CustomFieldExplorer = ({
48
50
  onClose
49
51
  }) => {
50
52
  const classes = useStyles();
53
+ const { t } = useTranslationRef(scaffolderTranslationRef);
51
54
  const fieldOptions = customFieldExtensions.filter((field) => !!field.schema);
52
55
  const [selectedField, setSelectedField] = useState(fieldOptions[0]);
53
56
  const [fieldFormState, setFieldFormState] = useState({});
@@ -88,16 +91,21 @@ const CustomFieldExplorer = ({
88
91
  },
89
92
  [setFieldFormState, setRefreshKey]
90
93
  );
91
- return /* @__PURE__ */ React.createElement("main", { className: classes.root }, /* @__PURE__ */ React.createElement("div", { className: classes.controls }, /* @__PURE__ */ React.createElement(FormControl, { variant: "outlined", size: "small", fullWidth: true }, /* @__PURE__ */ React.createElement(InputLabel, { id: "select-field-label" }, "Choose Custom Field Extension"), /* @__PURE__ */ React.createElement(
94
+ return /* @__PURE__ */ React.createElement("main", { className: classes.root }, /* @__PURE__ */ React.createElement("div", { className: classes.controls }, /* @__PURE__ */ React.createElement(FormControl, { variant: "outlined", size: "small", fullWidth: true }, /* @__PURE__ */ React.createElement(InputLabel, { id: "select-field-label" }, t("templateEditorPage.customFieldExplorer.selectFieldLabel")), /* @__PURE__ */ React.createElement(
92
95
  Select,
93
96
  {
94
97
  value: selectedField,
95
- label: "Choose Custom Field Extension",
98
+ label: t("templateEditorPage.customFieldExplorer.selectFieldLabel"),
96
99
  labelId: "select-field-label",
97
100
  onChange: (e) => handleSelectionChange(e.target.value)
98
101
  },
99
102
  fieldOptions.map((option, idx) => /* @__PURE__ */ React.createElement(MenuItem, { key: idx, value: option }, option.name))
100
- )), /* @__PURE__ */ React.createElement(IconButton, { size: "medium", onClick: onClose, "aria-label": "Close" }, /* @__PURE__ */ React.createElement(CloseIcon, null))), /* @__PURE__ */ React.createElement("div", { className: classes.fieldForm }, /* @__PURE__ */ React.createElement(Card, null, /* @__PURE__ */ React.createElement(CardHeader, { title: "Field Options" }), /* @__PURE__ */ React.createElement(CardContent, null, /* @__PURE__ */ React.createElement(
103
+ )), /* @__PURE__ */ React.createElement(IconButton, { size: "medium", onClick: onClose, "aria-label": "Close" }, /* @__PURE__ */ React.createElement(CloseIcon, null))), /* @__PURE__ */ React.createElement("div", { className: classes.fieldForm }, /* @__PURE__ */ React.createElement(Card, null, /* @__PURE__ */ React.createElement(
104
+ CardHeader,
105
+ {
106
+ title: t("templateEditorPage.customFieldExplorer.fieldForm.title")
107
+ }
108
+ ), /* @__PURE__ */ React.createElement(CardContent, null, /* @__PURE__ */ React.createElement(
101
109
  Form,
102
110
  {
103
111
  showErrorList: false,
@@ -120,9 +128,16 @@ const CustomFieldExplorer = ({
120
128
  type: "submit",
121
129
  disabled: !selectedField.schema?.uiOptions
122
130
  },
123
- "Apply"
131
+ t(
132
+ "templateEditorPage.customFieldExplorer.fieldForm.applyButtonTitle"
133
+ )
124
134
  )
125
- )))), /* @__PURE__ */ React.createElement("div", { className: classes.preview }, /* @__PURE__ */ React.createElement(Card, null, /* @__PURE__ */ React.createElement(CardHeader, { title: "Example Template Spec" }), /* @__PURE__ */ React.createElement(CardContent, null, /* @__PURE__ */ React.createElement(
135
+ )))), /* @__PURE__ */ React.createElement("div", { className: classes.preview }, /* @__PURE__ */ React.createElement(Card, null, /* @__PURE__ */ React.createElement(
136
+ CardHeader,
137
+ {
138
+ title: t("templateEditorPage.customFieldExplorer.preview.title")
139
+ }
140
+ ), /* @__PURE__ */ React.createElement(CardContent, null, /* @__PURE__ */ React.createElement(
126
141
  CodeMirror,
127
142
  {
128
143
  readOnly: true,