@backstage/plugin-scaffolder 1.24.0-next.3 → 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 (76) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/alpha/package.json +1 -1
  3. package/dist/alpha.d.ts +157 -2
  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 +7 -1
  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/next/TemplateEditorPage/CustomFieldExplorer.esm.js +20 -5
  49. package/dist/next/TemplateEditorPage/CustomFieldExplorer.esm.js.map +1 -1
  50. package/dist/next/TemplateEditorPage/DryRunResults/DryRunResults.esm.js +4 -1
  51. package/dist/next/TemplateEditorPage/DryRunResults/DryRunResults.esm.js.map +1 -1
  52. package/dist/next/TemplateEditorPage/DryRunResults/DryRunResultsList.esm.js +17 -3
  53. package/dist/next/TemplateEditorPage/DryRunResults/DryRunResultsList.esm.js.map +1 -1
  54. package/dist/next/TemplateEditorPage/DryRunResults/DryRunResultsView.esm.js +22 -1
  55. package/dist/next/TemplateEditorPage/DryRunResults/DryRunResultsView.esm.js.map +1 -1
  56. package/dist/next/TemplateEditorPage/DryRunResults/TaskStatusStepper.esm.js +6 -1
  57. package/dist/next/TemplateEditorPage/DryRunResults/TaskStatusStepper.esm.js.map +1 -1
  58. package/dist/next/TemplateEditorPage/TemplateEditorBrowser.esm.js +36 -13
  59. package/dist/next/TemplateEditorPage/TemplateEditorBrowser.esm.js.map +1 -1
  60. package/dist/next/TemplateEditorPage/TemplateEditorIntro.esm.js +13 -6
  61. package/dist/next/TemplateEditorPage/TemplateEditorIntro.esm.js.map +1 -1
  62. package/dist/next/TemplateEditorPage/TemplateEditorPage.esm.js +5 -2
  63. package/dist/next/TemplateEditorPage/TemplateEditorPage.esm.js.map +1 -1
  64. package/dist/next/TemplateEditorPage/TemplateEditorTextArea.esm.js +30 -11
  65. package/dist/next/TemplateEditorPage/TemplateEditorTextArea.esm.js.map +1 -1
  66. package/dist/next/TemplateEditorPage/TemplateFormPreviewer.esm.js +5 -2
  67. package/dist/next/TemplateEditorPage/TemplateFormPreviewer.esm.js.map +1 -1
  68. package/dist/next/TemplateListPage/TemplateListPage.esm.js +23 -15
  69. package/dist/next/TemplateListPage/TemplateListPage.esm.js.map +1 -1
  70. package/dist/next/TemplateWizardPage/TemplateWizardPage.esm.js +6 -3
  71. package/dist/next/TemplateWizardPage/TemplateWizardPage.esm.js.map +1 -1
  72. package/dist/next/TemplateWizardPage/TemplateWizardPageContextMenu.esm.js +11 -1
  73. package/dist/next/TemplateWizardPage/TemplateWizardPageContextMenu.esm.js.map +1 -1
  74. package/dist/translation.esm.js +258 -0
  75. package/dist/translation.esm.js.map +1 -0
  76. package/package.json +19 -19
@@ -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,WAAc,GAAA,KAAA,CAAA;AAC3D,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,wBAAwB,CAAA,CAAA;AACxD,EAAA,MAAM,aAA2B,aAC7B,GAAA,aAAA,CAAc,IAAI,CAAM,CAAA,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AA,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,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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AEJ;;;;"}
@@ -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,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,MA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AAA,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\"\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,E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EA,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":";;;;;;;;;;AA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AE,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,KAAA,EAAO,EAAE,iCAAiC,CAAA;AAAA,QAC1C,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,oBAEC,KAAA,CAAA,aAAA,CAAA,cAAA,EAAA,IAAA,EACE,CAAE,CAAA,uCAAuC,CAC5C,CAAA;AAAA,GAEJ,CAAA,CAAA;AAEJ;;;;"}
@@ -4,9 +4,12 @@ import FormControl from '@material-ui/core/FormControl';
4
4
  import FormHelperText 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,EAAA,MAAM,EAAE,QAAU,EAAA,YAAA,EAAc,QAAU,EAAA,SAAA,EAAW,gBAAmB,GAAA,KAAA,CAAA;AAExE,EAAA,SAAA,CAAU,MAAM;AAEd,IAAA,IAAI,CAAC,QAAU,EAAA;AAEb,MAA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AA,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,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,G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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;;;;"}
@@ -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,
@@ -1 +1 @@
1
- {"version":3,"file":"CustomFieldExplorer.esm.js","sources":["../../../src/next/TemplateEditorPage/CustomFieldExplorer.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { StreamLanguage } from '@codemirror/language';\nimport { yaml as yamlSupport } from '@codemirror/legacy-modes/mode/yaml';\nimport Button from '@material-ui/core/Button';\nimport Card from '@material-ui/core/Card';\nimport CardContent from '@material-ui/core/CardContent';\nimport CardHeader from '@material-ui/core/CardHeader';\nimport FormControl from '@material-ui/core/FormControl';\nimport IconButton from '@material-ui/core/IconButton';\nimport InputLabel from '@material-ui/core/InputLabel';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport Select from '@material-ui/core/Select';\nimport { makeStyles } from '@material-ui/core/styles';\nimport CloseIcon from '@material-ui/icons/Close';\nimport CodeMirror from '@uiw/react-codemirror';\nimport React, { useCallback, useMemo, useState } from 'react';\nimport yaml from 'yaml';\nimport { Form } from '@backstage/plugin-scaffolder-react/alpha';\nimport { TemplateEditorForm } from './TemplateEditorForm';\nimport validator from '@rjsf/validator-ajv8';\nimport { FieldExtensionOptions } from '@backstage/plugin-scaffolder-react';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n gridArea: 'pageContent',\n display: 'grid',\n gridTemplateAreas: `\n \"controls controls\"\n \"fieldForm preview\"\n `,\n gridTemplateRows: 'auto 1fr',\n gridTemplateColumns: '1fr 1fr',\n },\n controls: {\n gridArea: 'controls',\n display: 'flex',\n flexFlow: 'row nowrap',\n alignItems: 'center',\n margin: theme.spacing(1),\n },\n fieldForm: {\n gridArea: 'fieldForm',\n },\n preview: {\n gridArea: 'preview',\n },\n}));\n\nexport const CustomFieldExplorer = ({\n customFieldExtensions = [],\n onClose,\n}: {\n customFieldExtensions?: FieldExtensionOptions<any, any>[];\n onClose?: () => void;\n}) => {\n const classes = useStyles();\n const fieldOptions = customFieldExtensions.filter(field => !!field.schema);\n const [selectedField, setSelectedField] = useState(fieldOptions[0]);\n const [fieldFormState, setFieldFormState] = useState({});\n const [refreshKey, setRefreshKey] = useState(Date.now());\n const sampleFieldTemplate = useMemo(\n () =>\n yaml.stringify({\n parameters: [\n {\n title: `${selectedField.name} Example`,\n properties: {\n [selectedField.name]: {\n type: selectedField.schema?.returnValue?.type,\n 'ui:field': selectedField.name,\n 'ui:options': fieldFormState,\n },\n },\n },\n ],\n }),\n [fieldFormState, selectedField],\n );\n\n const fieldComponents = useMemo(() => {\n return Object.fromEntries(\n customFieldExtensions.map(({ name, component }) => [name, component]),\n );\n }, [customFieldExtensions]);\n\n const handleSelectionChange = useCallback(\n (selection: FieldExtensionOptions) => {\n setSelectedField(selection);\n setFieldFormState({});\n },\n [setFieldFormState, setSelectedField],\n );\n\n const handleFieldConfigChange = useCallback(\n (state: {}) => {\n setFieldFormState(state);\n // Force TemplateEditorForm to re-render since some fields\n // may not be responsive to ui:option changes\n setRefreshKey(Date.now());\n },\n [setFieldFormState, setRefreshKey],\n );\n\n return (\n <main className={classes.root}>\n <div className={classes.controls}>\n <FormControl variant=\"outlined\" size=\"small\" fullWidth>\n <InputLabel id=\"select-field-label\">\n Choose Custom Field Extension\n </InputLabel>\n <Select\n value={selectedField}\n label=\"Choose Custom Field Extension\"\n labelId=\"select-field-label\"\n onChange={e =>\n handleSelectionChange(e.target.value as FieldExtensionOptions)\n }\n >\n {fieldOptions.map((option, idx) => (\n <MenuItem key={idx} value={option as any}>\n {option.name}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n\n <IconButton size=\"medium\" onClick={onClose} aria-label=\"Close\">\n <CloseIcon />\n </IconButton>\n </div>\n <div className={classes.fieldForm}>\n <Card>\n <CardHeader title=\"Field Options\" />\n <CardContent>\n <Form\n showErrorList={false}\n fields={{ ...fieldComponents }}\n noHtml5Validate\n formData={fieldFormState}\n formContext={{ fieldFormState }}\n onSubmit={e => handleFieldConfigChange(e.formData)}\n validator={validator}\n schema={selectedField.schema?.uiOptions || {}}\n experimental_defaultFormStateBehavior={{\n allOf: 'populateDefaults',\n }}\n >\n <Button\n variant=\"contained\"\n color=\"primary\"\n type=\"submit\"\n disabled={!selectedField.schema?.uiOptions}\n >\n Apply\n </Button>\n </Form>\n </CardContent>\n </Card>\n </div>\n <div className={classes.preview}>\n <Card>\n <CardHeader title=\"Example Template Spec\" />\n <CardContent>\n <CodeMirror\n readOnly\n theme=\"dark\"\n height=\"100%\"\n extensions={[StreamLanguage.define(yamlSupport)]}\n value={sampleFieldTemplate}\n />\n </CardContent>\n </Card>\n <TemplateEditorForm\n key={refreshKey}\n content={sampleFieldTemplate}\n contentIsSpec\n fieldExtensions={customFieldExtensions}\n setErrorText={() => null}\n />\n </div>\n </main>\n );\n};\n"],"names":["yamlSupport"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoCA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,IAAM,EAAA;AAAA,IACJ,QAAU,EAAA,aAAA;AAAA,IACV,OAAS,EAAA,MAAA;AAAA,IACT,iBAAmB,EAAA,CAAA;AAAA;AAAA;AAAA,IAAA,CAAA;AAAA,IAInB,gBAAkB,EAAA,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plorer.esm.js","sources":["../../../src/next/TemplateEditorPage/CustomFieldExplorer.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { StreamLanguage } from '@codemirror/language';\nimport { yaml as yamlSupport } from '@codemirror/legacy-modes/mode/yaml';\nimport Button from '@material-ui/core/Button';\nimport Card from '@material-ui/core/Card';\nimport CardContent from '@material-ui/core/CardContent';\nimport CardHeader from '@material-ui/core/CardHeader';\nimport FormControl from '@material-ui/core/FormControl';\nimport IconButton from '@material-ui/core/IconButton';\nimport InputLabel from '@material-ui/core/InputLabel';\nimport MenuItem from '@material-ui/core/MenuItem';\nimport Select from '@material-ui/core/Select';\nimport { makeStyles } from '@material-ui/core/styles';\nimport CloseIcon from '@material-ui/icons/Close';\nimport CodeMirror from '@uiw/react-codemirror';\nimport React, { useCallback, useMemo, useState } from 'react';\nimport yaml from 'yaml';\nimport { Form } from '@backstage/plugin-scaffolder-react/alpha';\nimport { TemplateEditorForm } from './TemplateEditorForm';\nimport validator from '@rjsf/validator-ajv8';\nimport { FieldExtensionOptions } from '@backstage/plugin-scaffolder-react';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { scaffolderTranslationRef } from '../../translation';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n gridArea: 'pageContent',\n display: 'grid',\n gridTemplateAreas: `\n \"controls controls\"\n \"fieldForm preview\"\n `,\n gridTemplateRows: 'auto 1fr',\n gridTemplateColumns: '1fr 1fr',\n },\n controls: {\n gridArea: 'controls',\n display: 'flex',\n flexFlow: 'row nowrap',\n alignItems: 'center',\n margin: theme.spacing(1),\n },\n fieldForm: {\n gridArea: 'fieldForm',\n },\n preview: {\n gridArea: 'preview',\n },\n}));\n\nexport const CustomFieldExplorer = ({\n customFieldExtensions = [],\n onClose,\n}: {\n customFieldExtensions?: FieldExtensionOptions<any, any>[];\n onClose?: () => void;\n}) => {\n const classes = useStyles();\n const { t } = useTranslationRef(scaffolderTranslationRef);\n const fieldOptions = customFieldExtensions.filter(field => !!field.schema);\n const [selectedField, setSelectedField] = useState(fieldOptions[0]);\n const [fieldFormState, setFieldFormState] = useState({});\n const [refreshKey, setRefreshKey] = useState(Date.now());\n const sampleFieldTemplate = useMemo(\n () =>\n yaml.stringify({\n parameters: [\n {\n title: `${selectedField.name} Example`,\n properties: {\n [selectedField.name]: {\n type: selectedField.schema?.returnValue?.type,\n 'ui:field': selectedField.name,\n 'ui:options': fieldFormState,\n },\n },\n },\n ],\n }),\n [fieldFormState, selectedField],\n );\n\n const fieldComponents = useMemo(() => {\n return Object.fromEntries(\n customFieldExtensions.map(({ name, component }) => [name, component]),\n );\n }, [customFieldExtensions]);\n\n const handleSelectionChange = useCallback(\n (selection: FieldExtensionOptions) => {\n setSelectedField(selection);\n setFieldFormState({});\n },\n [setFieldFormState, setSelectedField],\n );\n\n const handleFieldConfigChange = useCallback(\n (state: {}) => {\n setFieldFormState(state);\n // Force TemplateEditorForm to re-render since some fields\n // may not be responsive to ui:option changes\n setRefreshKey(Date.now());\n },\n [setFieldFormState, setRefreshKey],\n );\n\n return (\n <main className={classes.root}>\n <div className={classes.controls}>\n <FormControl variant=\"outlined\" size=\"small\" fullWidth>\n <InputLabel id=\"select-field-label\">\n {t('templateEditorPage.customFieldExplorer.selectFieldLabel')}\n </InputLabel>\n <Select\n value={selectedField}\n label={t('templateEditorPage.customFieldExplorer.selectFieldLabel')}\n labelId=\"select-field-label\"\n onChange={e =>\n handleSelectionChange(e.target.value as FieldExtensionOptions)\n }\n >\n {fieldOptions.map((option, idx) => (\n <MenuItem key={idx} value={option as any}>\n {option.name}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n\n <IconButton size=\"medium\" onClick={onClose} aria-label=\"Close\">\n <CloseIcon />\n </IconButton>\n </div>\n <div className={classes.fieldForm}>\n <Card>\n <CardHeader\n title={t('templateEditorPage.customFieldExplorer.fieldForm.title')}\n />\n <CardContent>\n <Form\n showErrorList={false}\n fields={{ ...fieldComponents }}\n noHtml5Validate\n formData={fieldFormState}\n formContext={{ fieldFormState }}\n onSubmit={e => handleFieldConfigChange(e.formData)}\n validator={validator}\n schema={selectedField.schema?.uiOptions || {}}\n experimental_defaultFormStateBehavior={{\n allOf: 'populateDefaults',\n }}\n >\n <Button\n variant=\"contained\"\n color=\"primary\"\n type=\"submit\"\n disabled={!selectedField.schema?.uiOptions}\n >\n {t(\n 'templateEditorPage.customFieldExplorer.fieldForm.applyButtonTitle',\n )}\n </Button>\n </Form>\n </CardContent>\n </Card>\n </div>\n <div className={classes.preview}>\n <Card>\n <CardHeader\n title={t('templateEditorPage.customFieldExplorer.preview.title')}\n />\n <CardContent>\n <CodeMirror\n readOnly\n theme=\"dark\"\n height=\"100%\"\n extensions={[StreamLanguage.define(yamlSupport)]}\n value={sampleFieldTemplate}\n />\n </CardContent>\n </Card>\n <TemplateEditorForm\n key={refreshKey}\n content={sampleFieldTemplate}\n contentIsSpec\n fieldExtensions={customFieldExtensions}\n setErrorText={() => null}\n />\n </div>\n </main>\n );\n};\n"],"names":["yamlSupport"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAsCA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,IAAM,EAAA;AAAA,IACJ,QAAU,EAAA,aAAA;AAAA,IACV,OAAS,EAAA,MAAA;AAAA,IACT,iBAAmB,EAAA,CAAA;AAAA;AAAA;AAAA,IAAA,CAAA;AAAA,IAInB,gBAAkB,EAAA,UAAA;AAAA,IAClB,mBAAqB,EAAA,SAAA;AAAA,GACvB;AAAA,EACA,QAAU,EAAA;AAAA,IACR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A;AAAA,MACjB,cAAc,MAAM,IAAA;AAAA,KAAA;AAAA,GAExB,CACF,CAAA,CAAA;AAEJ;;;;"}
@@ -10,6 +10,8 @@ import React, { useState, useEffect } from 'react';
10
10
  import { useDryRun } from '../DryRunContext.esm.js';
11
11
  import { DryRunResultsList } from './DryRunResultsList.esm.js';
12
12
  import { DryRunResultsView } from './DryRunResultsView.esm.js';
13
+ import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
14
+ import { scaffolderTranslationRef } from '../../../translation.esm.js';
13
15
 
14
16
  const useStyles = makeStyles((theme) => ({
15
17
  header: {
@@ -34,6 +36,7 @@ function DryRunResults() {
34
36
  const dryRun = useDryRun();
35
37
  const [expanded, setExpanded] = useState(false);
36
38
  const [hidden, setHidden] = useState(true);
39
+ const { t } = useTranslationRef(scaffolderTranslationRef);
37
40
  const resultsLength = dryRun.results.length;
38
41
  const prevResultsLength = usePrevious(resultsLength);
39
42
  useEffect(() => {
@@ -59,7 +62,7 @@ function DryRunResults() {
59
62
  className: classes.header,
60
63
  expandIcon: /* @__PURE__ */ React.createElement(ExpandLessIcon, null)
61
64
  },
62
- /* @__PURE__ */ React.createElement(Typography, null, "Dry-run results")
65
+ /* @__PURE__ */ React.createElement(Typography, null, t("templateEditorPage.dryRunResults.title"))
63
66
  ),
64
67
  /* @__PURE__ */ React.createElement(Divider, { orientation: "horizontal" }),
65
68
  /* @__PURE__ */ React.createElement(AccordionDetails, { className: classes.content }, /* @__PURE__ */ React.createElement(DryRunResultsList, null), /* @__PURE__ */ React.createElement(Divider, { orientation: "horizontal" }), /* @__PURE__ */ React.createElement(DryRunResultsView, null))
@@ -1 +1 @@
1
- {"version":3,"file":"DryRunResults.esm.js","sources":["../../../../src/next/TemplateEditorPage/DryRunResults/DryRunResults.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport Divider from '@material-ui/core/Divider';\nimport { makeStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandLess';\nimport { usePrevious } from '@react-hookz/web';\nimport React, { useEffect, useState } from 'react';\nimport { useDryRun } from '../DryRunContext';\nimport { DryRunResultsList } from './DryRunResultsList';\nimport { DryRunResultsView } from './DryRunResultsView';\n\nconst useStyles = makeStyles(theme => ({\n header: {\n height: 48,\n minHeight: 0,\n '&.Mui-expanded': {\n height: 48,\n minHeight: 0,\n },\n },\n content: {\n display: 'grid',\n background: theme.palette.background.default,\n gridTemplateColumns: '180px auto 1fr',\n gridTemplateRows: '1fr',\n padding: 0,\n height: 400,\n },\n}));\n\nexport function DryRunResults() {\n const classes = useStyles();\n const dryRun = useDryRun();\n const [expanded, setExpanded] = useState(false);\n const [hidden, setHidden] = useState(true);\n\n const resultsLength = dryRun.results.length;\n const prevResultsLength = usePrevious(resultsLength);\n useEffect(() => {\n if (prevResultsLength === 0 && resultsLength === 1) {\n setHidden(false);\n setExpanded(true);\n } else if (prevResultsLength === 1 && resultsLength === 0) {\n setExpanded(false);\n }\n }, [prevResultsLength, resultsLength]);\n\n return (\n <>\n <Accordion\n variant=\"outlined\"\n expanded={expanded}\n hidden={resultsLength === 0 && hidden}\n onChange={(_, exp) => setExpanded(exp)}\n onTransitionEnd={() => resultsLength === 0 && setHidden(true)}\n >\n <AccordionSummary\n className={classes.header}\n expandIcon={<ExpandMoreIcon />}\n >\n <Typography>Dry-run results</Typography>\n </AccordionSummary>\n <Divider orientation=\"horizontal\" />\n <AccordionDetails className={classes.content}>\n <DryRunResultsList />\n <Divider orientation=\"horizontal\" />\n <DryRunResultsView />\n </AccordionDetails>\n </Accordion>\n </>\n );\n}\n"],"names":["ExpandMoreIcon"],"mappings":";;;;;;;;;;;;;AA6BA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,MAAQ,EAAA;AAAA,IACN,MAAQ,EAAA,EAAA;AAAA,IACR,SAAW,EAAA,CAAA;AAAA,IACX,gBAAkB,EAAA;AAAA,MAChB,MAAQ,EAAA,EAAA;AAAA,MACR,SAAW,EAAA,CAAA;AAAA,KACb;AAAA,GACF;AAAA,EACA,OAAS,EAAA;AAAA,IACP,OAAS,EAAA,MAAA;AAAA,IACT,UAAA,EAAY,KAAM,CAAA,OAAA,CAAQ,UAAW,CAAA,OAAA;AAAA,IACrC,mBAAqB,EAAA,gBAAA;AAAA,IACrB,gBAAkB,EAAA,KAAA;AAAA,IAClB,OAAS,EAAA,CAAA;AAAA,IACT,MAAQ,EAAA,GAAA;AAAA,GACV;AACF,CAAE,CAAA,CAAA,CAAA;AAEK,SAAS,aAAgB,GAAA;AAC9B,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAC1B,EAAA,MAAM,SAAS,SAAU,EAAA,CAAA;AACzB,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAI,SAAS,KAAK,CAAA,CAAA;AAC9C,EAAA,MAAM,CAAC,MAAA,EAAQ,SAAS,CAAA,GAAI,SAAS,IAAI,CAAA,CAAA;AAEzC,EAAM,MAAA,aAAA,GAAgB,OAAO,OAAQ,CAAA,MAAA,CAAA;AACrC,EAAM,MAAA,iBAAA,GAAoB,YAAY,aAAa,CAAA,CAAA;AACnD,EAAA,SAAA,CAAU,MAAM;AACd,IAAI,IAAA,iBAAA,KAAsB,CAAK,IAAA,aAAA,KAAkB,CAAG,EAAA;AAClD,MAAA,SAAA,CAAU,KAAK,CAAA,C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EJ;;;;"}
1
+ {"version":3,"file":"DryRunResults.esm.js","sources":["../../../../src/next/TemplateEditorPage/DryRunResults/DryRunResults.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport Divider from '@material-ui/core/Divider';\nimport { makeStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandLess';\nimport { usePrevious } from '@react-hookz/web';\nimport React, { useEffect, useState } from 'react';\nimport { useDryRun } from '../DryRunContext';\nimport { DryRunResultsList } from './DryRunResultsList';\nimport { DryRunResultsView } from './DryRunResultsView';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { scaffolderTranslationRef } from '../../../translation';\n\nconst useStyles = makeStyles(theme => ({\n header: {\n height: 48,\n minHeight: 0,\n '&.Mui-expanded': {\n height: 48,\n minHeight: 0,\n },\n },\n content: {\n display: 'grid',\n background: theme.palette.background.default,\n gridTemplateColumns: '180px auto 1fr',\n gridTemplateRows: '1fr',\n padding: 0,\n height: 400,\n },\n}));\n\nexport function DryRunResults() {\n const classes = useStyles();\n const dryRun = useDryRun();\n const [expanded, setExpanded] = useState(false);\n const [hidden, setHidden] = useState(true);\n const { t } = useTranslationRef(scaffolderTranslationRef);\n\n const resultsLength = dryRun.results.length;\n const prevResultsLength = usePrevious(resultsLength);\n useEffect(() => {\n if (prevResultsLength === 0 && resultsLength === 1) {\n setHidden(false);\n setExpanded(true);\n } else if (prevResultsLength === 1 && resultsLength === 0) {\n setExpanded(false);\n }\n }, [prevResultsLength, resultsLength]);\n\n return (\n <>\n <Accordion\n variant=\"outlined\"\n expanded={expanded}\n hidden={resultsLength === 0 && hidden}\n onChange={(_, exp) => setExpanded(exp)}\n onTransitionEnd={() => resultsLength === 0 && setHidden(true)}\n >\n <AccordionSummary\n className={classes.header}\n expandIcon={<ExpandMoreIcon />}\n >\n <Typography>{t('templateEditorPage.dryRunResults.title')}</Typography>\n </AccordionSummary>\n <Divider orientation=\"horizontal\" />\n <AccordionDetails className={classes.content}>\n <DryRunResultsList />\n <Divider orientation=\"horizontal\" />\n <DryRunResultsView />\n </AccordionDetails>\n </Accordion>\n </>\n );\n}\n"],"names":["ExpandMoreIcon"],"mappings":";;;;;;;;;;;;;;;AA+BA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,MAAQ,EAAA;AAAA,IACN,MAAQ,EAAA,EAAA;AAAA,IACR,SAAW,EAAA,CAAA;AAAA,IACX,gBAAkB,EAAA;AAAA,MAChB,MAAQ,EAAA,EAAA;AAAA,MACR,SAAW,EAAA,CAAA;AAAA,KACb;AAAA,GACF;AAAA,EACA,OAAS,EAAA;AAAA,IACP,OAAS,EAAA,MAAA;AAAA,IACT,UAAA,EAAY,KAAM,CAAA,OAAA,CAAQ,UAAW,CAAA,OAAA;AAAA,IACrC,mBAAqB,EAAA,gBAAA;AAAA,IACrB,gBAAkB,EAAA,KAAA;AAAA,IAClB,OAAS,EAAA,CAAA;AAAA,IACT,MAAQ,EAAA,GAAA;AAAA,GACV;AACF,CAAE,CAAA,CAAA,CAAA;AAEK,SAAS,aAAgB,GAAA;AAC9B,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAC1B,EAAA,MAAM,SAAS,SAAU,EAAA,CAAA;AACzB,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAI,SAAS,KAAK,CAAA,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AAA,CAAA,UAAA,EAAA,IAAA,EAAY,CAAE,CAAA,wCAAwC,CAAE,CAAA;AAAA,KAC3D;AAAA,oBACA,KAAA,CAAA,aAAA,CAAC,OAAQ,EAAA,EAAA,WAAA,EAAY,YAAa,EAAA,CAAA;AAAA,oBACjC,KAAA,CAAA,aAAA,CAAA,gBAAA,EAAA,EAAiB,SAAW,EAAA,OAAA,CAAQ,2BAClC,KAAA,CAAA,aAAA,CAAA,iBAAA,EAAA,IAAkB,CACnB,kBAAA,KAAA,CAAA,aAAA,CAAC,WAAQ,WAAY,EAAA,YAAA,EAAa,CAClC,kBAAA,KAAA,CAAA,aAAA,CAAC,uBAAkB,CACrB,CAAA;AAAA,GAEJ,CAAA,CAAA;AAEJ;;;;"}
@@ -12,6 +12,8 @@ import DownloadIcon from '@material-ui/icons/GetApp';
12
12
  import React from 'react';
13
13
  import { useDryRun } from '../DryRunContext.esm.js';
14
14
  import { downloadBlob } from '../../../lib/download/helpers.esm.js';
15
+ import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
16
+ import { scaffolderTranslationRef } from '../../../translation.esm.js';
15
17
 
16
18
  const useStyles = makeStyles((theme) => ({
17
19
  root: {
@@ -32,6 +34,7 @@ const useStyles = makeStyles((theme) => ({
32
34
  function DryRunResultsList() {
33
35
  const classes = useStyles();
34
36
  const dryRun = useDryRun();
37
+ const { t } = useTranslationRef(scaffolderTranslationRef);
35
38
  return /* @__PURE__ */ React.createElement(List, { className: classes.root, dense: true }, dryRun.results.map((result) => {
36
39
  const failed = result.log.some((l) => l.body.status === "failed");
37
40
  let isLoading = false;
@@ -58,13 +61,22 @@ function DryRunResultsList() {
58
61
  },
59
62
  failed ? /* @__PURE__ */ React.createElement(Cancel, null) : /* @__PURE__ */ React.createElement(CheckIcon, null)
60
63
  ),
61
- /* @__PURE__ */ React.createElement(ListItemText, { primary: `Result ${result.id}` }),
64
+ /* @__PURE__ */ React.createElement(
65
+ ListItemText,
66
+ {
67
+ primary: t("templateEditorPage.dryRunResultsList.title", {
68
+ resultId: `${result.id}`
69
+ })
70
+ }
71
+ ),
62
72
  /* @__PURE__ */ React.createElement(ListItemSecondaryAction, null, /* @__PURE__ */ React.createElement(
63
73
  IconButton,
64
74
  {
65
75
  edge: "end",
66
76
  "aria-label": "download",
67
- title: "Download as .zip",
77
+ title: t(
78
+ "templateEditorPage.dryRunResultsList.downloadButtonTitle"
79
+ ),
68
80
  disabled: isLoading,
69
81
  onClick: () => downloadResult()
70
82
  },
@@ -74,7 +86,9 @@ function DryRunResultsList() {
74
86
  {
75
87
  edge: "end",
76
88
  "aria-label": "delete",
77
- title: "Delete result",
89
+ title: t(
90
+ "templateEditorPage.dryRunResultsList.deleteButtonTitle"
91
+ ),
78
92
  onClick: () => dryRun.deleteResult(result.id)
79
93
  },
80
94
  /* @__PURE__ */ React.createElement(DeleteIcon, null)