@backstage/plugin-scaffolder 1.37.0 → 1.38.0-next.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @backstage/plugin-scaffolder
2
2
 
3
+ ## 1.38.0-next.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 3e5acb5: Extended the `RepoOwnerPicker` implementation with a custom variant for GitLab.
8
+
9
+ ### Patch Changes
10
+
11
+ - e0889a3: chore(deps): bump `qs` from 6.15.1 to 6.15.2
12
+ - Updated dependencies
13
+ - @backstage/catalog-client@1.16.0-next.0
14
+ - @backstage/plugin-catalog-react@3.0.1-next.0
15
+ - @backstage/core-components@0.18.11-next.0
16
+ - @backstage/plugin-scaffolder-react@2.0.1-next.0
17
+ - @backstage/integration@2.0.3-next.0
18
+ - @backstage/integration-react@1.2.19-next.0
19
+ - @backstage/plugin-techdocs-react@1.3.12-next.0
20
+ - @backstage/plugin-scaffolder-common@2.2.1-next.0
21
+
3
22
  ## 1.37.0
4
23
 
5
24
  ### Minor Changes
@@ -0,0 +1,105 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { useApi } from '@backstage/core-plugin-api';
3
+ import { scaffolderApiRef } from '@backstage/plugin-scaffolder-react';
4
+ import FormControl from '@material-ui/core/FormControl';
5
+ import FormHelperText from '@material-ui/core/FormHelperText';
6
+ import MuiTextField from '@material-ui/core/TextField';
7
+ import MuiAutocomplete from '@material-ui/lab/Autocomplete';
8
+ import { useState, useCallback } from 'react';
9
+ import useDebounce from 'react-use/esm/useDebounce';
10
+ import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
11
+ import { scaffolderTranslationRef } from '../../../translation.esm.js';
12
+ import { useScaffolderTheme } from '@backstage/plugin-scaffolder-react/alpha';
13
+ import { Autocomplete } from '../Autocomplete/Autocomplete.esm.js';
14
+
15
+ const GitLabRepoOwnerPicker = ({
16
+ onChange,
17
+ state,
18
+ rawErrors,
19
+ accessToken,
20
+ isDisabled,
21
+ required,
22
+ schema,
23
+ excludedOwners = []
24
+ }) => {
25
+ const theme = useScaffolderTheme();
26
+ const { host, owner } = state;
27
+ const [availableOwners, setAvailableOwners] = useState([]);
28
+ const scaffolderApi = useApi(scaffolderApiRef);
29
+ const { t } = useTranslationRef(scaffolderTranslationRef);
30
+ const updateAvailableOwners = useCallback(() => {
31
+ if (!scaffolderApi.autocomplete || !accessToken || !host) {
32
+ setAvailableOwners([]);
33
+ return;
34
+ }
35
+ scaffolderApi.autocomplete({
36
+ token: accessToken,
37
+ resource: "groups",
38
+ provider: "gitlab",
39
+ context: { host }
40
+ }).then(({ results }) => {
41
+ const owners = results.map((r) => r.title).filter((title) => !excludedOwners.includes(title));
42
+ setAvailableOwners(owners);
43
+ }).catch(() => {
44
+ setAvailableOwners([]);
45
+ });
46
+ }, [host, accessToken, scaffolderApi, excludedOwners]);
47
+ useDebounce(updateAvailableOwners, 500, [updateAvailableOwners]);
48
+ if (theme === "bui") {
49
+ const options = availableOwners.map((o) => ({ label: o, value: o }));
50
+ return /* @__PURE__ */ jsx(
51
+ Autocomplete,
52
+ {
53
+ label: schema?.title ?? t("fields.repoOwnerPicker.title"),
54
+ description: schema?.description ?? t("fields.repoOwnerPicker.description"),
55
+ inputValue: owner ?? "",
56
+ onInputChange: (value) => onChange({ owner: value }),
57
+ onSelectionChange: (key) => {
58
+ if (key !== null) {
59
+ onChange({ owner: String(key) });
60
+ }
61
+ },
62
+ options,
63
+ isDisabled,
64
+ isRequired: required,
65
+ isInvalid: rawErrors?.length > 0 && !owner
66
+ }
67
+ );
68
+ }
69
+ return /* @__PURE__ */ jsxs(
70
+ FormControl,
71
+ {
72
+ margin: "normal",
73
+ required,
74
+ error: rawErrors?.length > 0 && !owner,
75
+ children: [
76
+ /* @__PURE__ */ jsx(
77
+ MuiAutocomplete,
78
+ {
79
+ value: owner,
80
+ onChange: (_, newValue) => {
81
+ onChange({ owner: newValue || "" });
82
+ },
83
+ disabled: isDisabled,
84
+ options: availableOwners,
85
+ renderInput: (params) => /* @__PURE__ */ jsx(
86
+ MuiTextField,
87
+ {
88
+ ...params,
89
+ label: schema?.title ?? t("fields.repoOwnerPicker.title"),
90
+ disabled: isDisabled,
91
+ required
92
+ }
93
+ ),
94
+ freeSolo: true,
95
+ autoSelect: true
96
+ }
97
+ ),
98
+ /* @__PURE__ */ jsx(FormHelperText, { children: schema?.description ?? t("fields.repoOwnerPicker.description") })
99
+ ]
100
+ }
101
+ );
102
+ };
103
+
104
+ export { GitLabRepoOwnerPicker };
105
+ //# sourceMappingURL=GitLabRepoOwnerPicker.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GitLabRepoOwnerPicker.esm.js","sources":["../../../../src/components/fields/RepoOwnerPicker/GitLabRepoOwnerPicker.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useApi } from '@backstage/core-plugin-api';\nimport { scaffolderApiRef } from '@backstage/plugin-scaffolder-react';\nimport FormControl from '@material-ui/core/FormControl';\nimport FormHelperText from '@material-ui/core/FormHelperText';\nimport MuiTextField from '@material-ui/core/TextField';\nimport MuiAutocomplete from '@material-ui/lab/Autocomplete';\nimport { useCallback, useState } from 'react';\nimport useDebounce from 'react-use/esm/useDebounce';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\n\nimport { BaseRepoOwnerPickerProps } from './types';\nimport { scaffolderTranslationRef } from '../../../translation';\nimport { useScaffolderTheme } from '@backstage/plugin-scaffolder-react/alpha';\nimport { Autocomplete as BuiAutocomplete } from '../Autocomplete';\nimport type { Key } from 'react-aria-components';\n\n/**\n * The underlying component that is rendered in the form for the `GitLabRepoOwnerPicker`\n * field extension.\n *\n * @public\n *\n */\nexport const GitLabRepoOwnerPicker = ({\n onChange,\n state,\n rawErrors,\n accessToken,\n isDisabled,\n required,\n schema,\n excludedOwners = [],\n}: BaseRepoOwnerPickerProps<{\n accessToken?: string;\n excludedOwners?: string[];\n}>) => {\n const theme = useScaffolderTheme();\n const { host, owner } = state;\n\n const [availableOwners, setAvailableOwners] = useState<string[]>([]);\n\n const scaffolderApi = useApi(scaffolderApiRef);\n const { t } = useTranslationRef(scaffolderTranslationRef);\n\n const updateAvailableOwners = useCallback(() => {\n if (!scaffolderApi.autocomplete || !accessToken || !host) {\n setAvailableOwners([]);\n return;\n }\n\n scaffolderApi\n .autocomplete({\n token: accessToken,\n resource: 'groups',\n provider: 'gitlab',\n context: { host },\n })\n .then(({ results }) => {\n const owners = results\n .map(r => r.title!)\n .filter(title => !excludedOwners.includes(title));\n\n setAvailableOwners(owners);\n })\n .catch(() => {\n setAvailableOwners([]);\n });\n }, [host, accessToken, scaffolderApi, excludedOwners]);\n\n useDebounce(updateAvailableOwners, 500, [updateAvailableOwners]);\n\n if (theme === 'bui') {\n const options = availableOwners.map(o => ({ label: o, value: o }));\n\n return (\n <BuiAutocomplete\n label={schema?.title ?? t('fields.repoOwnerPicker.title')}\n description={\n schema?.description ?? t('fields.repoOwnerPicker.description')\n }\n inputValue={owner ?? ''}\n onInputChange={value => onChange({ owner: value })}\n onSelectionChange={(key: Key | null) => {\n if (key !== null) {\n onChange({ owner: String(key) });\n }\n }}\n options={options}\n isDisabled={isDisabled}\n isRequired={required}\n isInvalid={rawErrors?.length > 0 && !owner}\n />\n );\n }\n\n return (\n <FormControl\n margin=\"normal\"\n required={required}\n error={rawErrors?.length > 0 && !owner}\n >\n <MuiAutocomplete\n value={owner}\n onChange={(_, newValue) => {\n onChange({ owner: newValue || '' });\n }}\n disabled={isDisabled}\n options={availableOwners}\n renderInput={params => (\n <MuiTextField\n {...params}\n label={schema?.title ?? t('fields.repoOwnerPicker.title')}\n disabled={isDisabled}\n required={required}\n />\n )}\n freeSolo\n autoSelect\n />\n <FormHelperText>\n {schema?.description ?? t('fields.repoOwnerPicker.description')}\n </FormHelperText>\n </FormControl>\n );\n};\n"],"names":["BuiAutocomplete"],"mappings":";;;;;;;;;;;;;;AAuCO,MAAM,wBAAwB,CAAC;AAAA,EACpC,QAAA;AAAA,EACA,KAAA;AAAA,EACA,SAAA;AAAA,EACA,WAAA;AAAA,EACA,UAAA;AAAA,EACA,QAAA;AAAA,EACA,MAAA;AAAA,EACA,iBAAiB;AACnB,CAAA,KAGO;AACL,EAAA,MAAM,QAAQ,kBAAA,EAAmB;AACjC,EAAA,MAAM,EAAE,IAAA,EAAM,KAAA,EAAM,GAAI,KAAA;AAExB,EAAA,MAAM,CAAC,eAAA,EAAiB,kBAAkB,CAAA,GAAI,QAAA,CAAmB,EAAE,CAAA;AAEnE,EAAA,MAAM,aAAA,GAAgB,OAAO,gBAAgB,CAAA;AAC7C,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,wBAAwB,CAAA;AAExD,EAAA,MAAM,qBAAA,GAAwB,YAAY,MAAM;AAC9C,IAAA,IAAI,CAAC,aAAA,CAAc,YAAA,IAAgB,CAAC,WAAA,IAAe,CAAC,IAAA,EAAM;AACxD,MAAA,kBAAA,CAAmB,EAAE,CAAA;AACrB,MAAA;AAAA,IACF;AAEA,IAAA,aAAA,CACG,YAAA,CAAa;AAAA,MACZ,KAAA,EAAO,WAAA;AAAA,MACP,QAAA,EAAU,QAAA;AAAA,MACV,QAAA,EAAU,QAAA;AAAA,MACV,OAAA,EAAS,EAAE,IAAA;AAAK,KACjB,CAAA,CACA,IAAA,CAAK,CAAC,EAAE,SAAQ,KAAM;AACrB,MAAA,MAAM,MAAA,GAAS,OAAA,CACZ,GAAA,CAAI,CAAA,CAAA,KAAK,C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AAAA,EAEJ;AAEA,EAAA,uBACE,IAAA;AAAA,IAAC,WAAA;AAAA,IAAA;AAAA,MACC,MAAA,EAAO,QAAA;AAAA,MACP,QAAA;AAAA,MACA,KAAA,EAAO,SAAA,EAAW,MAAA,GAAS,CAAA,IAAK,CAAC,KAAA;AAAA,MAEjC,QAAA,EAAA;AAAA,wBAAA,GAAA;AAAA,UAAC,eAAA;AAAA,UAAA;AAAA,YACC,KAAA,EAAO,KAAA;AAAA,YACP,QAAA,EAAU,CAAC,CAAA,EAAG,QAAA,KAAa;AACzB,cAAA,QAAA,CAAS,EAAE,KAAA,EAAO,QAAA,IAAY,EAAA,EAAI,CAAA;AAAA,YACpC,CAAA;AAAA,YACA,QAAA,EAAU,UAAA;AAAA,YACV,OAAA,EAAS,eAAA;AAAA,YACT,aAAa,CAAA,MAAA,qBACX,GAAA;AAAA,cAAC,YAAA;AAAA,cAAA;AAAA,gBACE,GAAG,MAAA;AAAA,gBACJ,KAAA,EAAO,MAAA,EAAQ,KAAA,IAAS,CAAA,CAAE,8BAA8B,CAAA;AAAA,gBACxD,QAAA,EAAU,UAAA;AAAA,gBACV;AAAA;AAAA,aACF;AAAA,YAEF,QAAA,EAAQ,IAAA;AAAA,YACR,UAAA,EAAU;AAAA;AAAA,SACZ;AAAA,4BACC,cAAA,EAAA,EACE,QAAA,EAAA,MAAA,EAAQ,WAAA,IAAe,CAAA,CAAE,oCAAoC,CAAA,EAChE;AAAA;AAAA;AAAA,GACF;AAEJ;;;;"}
@@ -6,6 +6,7 @@ import useDebounce from 'react-use/esm/useDebounce';
6
6
  import { useTemplateSecrets } from '@backstage/plugin-scaffolder-react';
7
7
  import { DefaultRepoOwnerPicker } from './DefaultRepoOwnerPicker.esm.js';
8
8
  import { GitHubRepoOwnerPicker } from './GitHubRepoOwnerPicker.esm.js';
9
+ import { GitLabRepoOwnerPicker } from './GitLabRepoOwnerPicker.esm.js';
9
10
 
10
11
  const RepoOwnerPicker = (props) => {
11
12
  const { uiSchema, onChange, rawErrors, formData, schema, required } = props;
@@ -72,6 +73,20 @@ const RepoOwnerPicker = (props) => {
72
73
  excludedOwners
73
74
  }
74
75
  );
76
+ case "gitlab":
77
+ return /* @__PURE__ */ jsx(
78
+ GitLabRepoOwnerPicker,
79
+ {
80
+ onChange: updateLocalState,
81
+ state,
82
+ rawErrors,
83
+ accessToken: uiSchema?.["ui:options"]?.requestUserCredentials?.secretsKey && secrets[uiSchema["ui:options"].requestUserCredentials.secretsKey],
84
+ isDisabled: uiSchema?.["ui:disabled"] ?? false,
85
+ required,
86
+ schema,
87
+ excludedOwners
88
+ }
89
+ );
75
90
  default:
76
91
  return /* @__PURE__ */ jsx(
77
92
  DefaultRepoOwnerPicker,
@@ -1 +1 @@
1
- {"version":3,"file":"RepoOwnerPicker.esm.js","sources":["../../../../src/components/fields/RepoOwnerPicker/RepoOwnerPicker.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useApi } from '@backstage/core-plugin-api';\nimport {\n scmIntegrationsApiRef,\n scmAuthApiRef,\n} from '@backstage/integration-react';\nimport { useEffect, useState, useCallback, useMemo } from 'react';\nimport useDebounce from 'react-use/esm/useDebounce';\nimport { useTemplateSecrets } from '@backstage/plugin-scaffolder-react';\n\nimport { RepoOwnerPickerProps } from './schema';\nimport { RepoOwnerPickerState } from './types';\nimport { DefaultRepoOwnerPicker } from './DefaultRepoOwnerPicker';\nimport { GitHubRepoOwnerPicker } from './GitHubRepoOwnerPicker';\n/**\n * The underlying component that is rendered in the form for the `RepoOwnerPicker`\n * field extension.\n *\n * @public\n */\nexport const RepoOwnerPicker = (props: RepoOwnerPickerProps) => {\n const { uiSchema, onChange, rawErrors, formData, schema, required } = props;\n const [state, setState] = useState<RepoOwnerPickerState>({\n owner: formData || '',\n });\n const excludedOwners = useMemo(\n () => uiSchema?.['ui:options']?.excludedOwners ?? [],\n [uiSchema],\n );\n const { host, owner } = state;\n\n const integrationApi = useApi(scmIntegrationsApiRef);\n const scmAuthApi = useApi(scmAuthApiRef);\n\n const { secrets, setSecrets } = useTemplateSecrets();\n\n useDebounce(\n async () => {\n const { requestUserCredentials } = uiSchema?.['ui:options'] ?? {};\n\n if (!requestUserCredentials || !host) {\n return;\n }\n\n // don't show login prompt if secret value is already in state\n if (secrets[requestUserCredentials.secretsKey]) {\n return;\n }\n\n // user has requested that we use the users credentials\n // so lets grab them using the scmAuthApi and pass through\n // any additional scopes from the ui:options\n const { token } = await scmAuthApi.getCredentials({\n url: `https://${host}`,\n additionalScope: {\n repoWrite: true,\n customScopes: requestUserCredentials.additionalScopes,\n },\n });\n\n // set the secret using the key provided in the ui:options for use\n // in the templating the manifest with ${{ secrets[secretsKey] }}\n setSecrets({ [requestUserCredentials.secretsKey]: token });\n },\n 500,\n [host, uiSchema],\n );\n\n useEffect(() => {\n if (uiSchema?.['ui:options']?.host) {\n const hostUiOption = uiSchema['ui:options'].host;\n setState(prevState => ({ ...prevState, host: hostUiOption }));\n }\n }, [uiSchema]);\n\n useEffect(() => {\n onChange(owner);\n }, [owner, onChange]);\n\n const updateLocalState = useCallback(\n (newState: RepoOwnerPickerState) => {\n setState(prevState => ({ ...prevState, ...newState }));\n },\n [setState],\n );\n\n const hostType = (host && integrationApi.byHost(host)?.type) ?? null;\n\n switch (hostType) {\n case 'github':\n return (\n <GitHubRepoOwnerPicker\n onChange={updateLocalState}\n state={state}\n rawErrors={rawErrors}\n accessToken={\n uiSchema?.['ui:options']?.requestUserCredentials?.secretsKey &&\n secrets[uiSchema['ui:options'].requestUserCredentials.secretsKey]\n }\n isDisabled={uiSchema?.['ui:disabled'] ?? false}\n required={required}\n schema={schema}\n excludedOwners={excludedOwners}\n />\n );\n default:\n return (\n <DefaultRepoOwnerPicker\n onChange={updateLocalState}\n state={state}\n rawErrors={rawErrors}\n isDisabled={uiSchema?.['ui:disabled'] ?? false}\n required={required}\n schema={schema}\n />\n );\n }\n};\n"],"names":[],"mappings":";;;;;;;;;AAmCO,MAAM,eAAA,GAAkB,CAAC,KAAA,KAAgC;AAC9D,EAAA,MAAM,EAAE,QAAA,EAAU,QAAA,EAAU,WAAW,QAAA,EAAU,MAAA,EAAQ,UAAS,GAAI,KAAA;AACtE,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,QAAA,CAA+B;AAAA,IACvD,OAAO,QAAA,IAAY;AAAA,GACpB,CAAA;AACD,EAAA,MAAM,cAAA,GAAiB,OAAA;AAAA,IACrB,MAAM,QAAA,GAAW,YAAY,CAAA,EAAG,kBAAkB,EAAC;AAAA,IACnD,CAAC,QAAQ;AAAA,GACX;AACA,EAAA,MAAM,EAAE,IAAA,EAAM,KAAA,EAAM,GAAI,KAAA;AAExB,EAAA,MAAM,cAAA,GAAiB,OAAO,qBAAqB,CAAA;AACnD,EAAA,MAAM,UAAA,GAAa,OAAO,aAAa,CAAA;AAEvC,EAAA,MAAM,EAAE,OAAA,EAAS,UAAA,EAAW,GAAI,kBAAA,EAAmB;AAEnD,EAAA,WAAA;AAAA,IACE,YAAY;AACV,MAAA,MAAM,EAAE,sBAAA,EAAuB,GAAI,QAAA,GAAW,YAAY,KAAK,EAAC;AAEhE,MAAA,IAAI,CAAC,sBAAA,IAA0B,CAAC,IAAA,EAAM;AACpC,QAAA;AAAA,MACF;AAGA,MAAA,IAAI,OAAA,CAAQ,sBAAA,CAAuB,UAAU,CAAA,EAAG;AAC9C,QAAA;AAAA,MACF;AAKA,MAAA,MAAM,EAAE,KAAA,EAAM,GAAI,MAAM,WAAW,cAAA,CAAe;AAAA,QAChD,GAAA,EAAK,WAAW,IAAI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UAAA,IAClD,OAAA,CAAQ,QAAA,CAAS,YAAY,CAAA,CAAE,sBAAA,CAAuB,UAAU,CAAA;AAAA,UAElE,UAAA,EAAY,QAAA,GAAW,aAAa,CAAA,IAAK,KAAA;AAAA,UACzC,QAAA;AAAA,UACA,MAAA;AAAA,UACA;AAAA;AAAA,OACF;AAAA,IAEJ;AACE,MAAA,uBACE,GAAA;AAAA,QAAC,sBAAA;AAAA,QAAA;AAAA,UACC,QAAA,EAAU,gBAAA;AAAA,UACV,KAAA;AAAA,UACA,SAAA;AAAA,UACA,UAAA,EAAY,QAAA,GAAW,aAAa,CAAA,IAAK,KAAA;AAAA,UACzC,QAAA;AAAA,UACA;AAAA;AAAA,OACF;AAAA;AAGR;;;;"}
1
+ {"version":3,"file":"RepoOwnerPicker.esm.js","sources":["../../../../src/components/fields/RepoOwnerPicker/RepoOwnerPicker.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useApi } from '@backstage/core-plugin-api';\nimport {\n scmIntegrationsApiRef,\n scmAuthApiRef,\n} from '@backstage/integration-react';\nimport { useEffect, useState, useCallback, useMemo } from 'react';\nimport useDebounce from 'react-use/esm/useDebounce';\nimport { useTemplateSecrets } from '@backstage/plugin-scaffolder-react';\n\nimport { RepoOwnerPickerProps } from './schema';\nimport { RepoOwnerPickerState } from './types';\nimport { DefaultRepoOwnerPicker } from './DefaultRepoOwnerPicker';\nimport { GitHubRepoOwnerPicker } from './GitHubRepoOwnerPicker';\nimport { GitLabRepoOwnerPicker } from './GitLabRepoOwnerPicker';\n\n/**\n * The underlying component that is rendered in the form for the `RepoOwnerPicker`\n * field extension.\n *\n * @public\n */\nexport const RepoOwnerPicker = (props: RepoOwnerPickerProps) => {\n const { uiSchema, onChange, rawErrors, formData, schema, required } = props;\n const [state, setState] = useState<RepoOwnerPickerState>({\n owner: formData || '',\n });\n const excludedOwners = useMemo(\n () => uiSchema?.['ui:options']?.excludedOwners ?? [],\n [uiSchema],\n );\n const { host, owner } = state;\n\n const integrationApi = useApi(scmIntegrationsApiRef);\n const scmAuthApi = useApi(scmAuthApiRef);\n\n const { secrets, setSecrets } = useTemplateSecrets();\n\n useDebounce(\n async () => {\n const { requestUserCredentials } = uiSchema?.['ui:options'] ?? {};\n\n if (!requestUserCredentials || !host) {\n return;\n }\n\n // don't show login prompt if secret value is already in state\n if (secrets[requestUserCredentials.secretsKey]) {\n return;\n }\n\n // user has requested that we use the users credentials\n // so lets grab them using the scmAuthApi and pass through\n // any additional scopes from the ui:options\n const { token } = await scmAuthApi.getCredentials({\n url: `https://${host}`,\n additionalScope: {\n repoWrite: true,\n customScopes: requestUserCredentials.additionalScopes,\n },\n });\n\n // set the secret using the key provided in the ui:options for use\n // in the templating the manifest with ${{ secrets[secretsKey] }}\n setSecrets({ [requestUserCredentials.secretsKey]: token });\n },\n 500,\n [host, uiSchema],\n );\n\n useEffect(() => {\n if (uiSchema?.['ui:options']?.host) {\n const hostUiOption = uiSchema['ui:options'].host;\n setState(prevState => ({ ...prevState, host: hostUiOption }));\n }\n }, [uiSchema]);\n\n useEffect(() => {\n onChange(owner);\n }, [owner, onChange]);\n\n const updateLocalState = useCallback(\n (newState: RepoOwnerPickerState) => {\n setState(prevState => ({ ...prevState, ...newState }));\n },\n [setState],\n );\n\n const hostType = (host && integrationApi.byHost(host)?.type) ?? null;\n\n switch (hostType) {\n case 'github':\n return (\n <GitHubRepoOwnerPicker\n onChange={updateLocalState}\n state={state}\n rawErrors={rawErrors}\n accessToken={\n uiSchema?.['ui:options']?.requestUserCredentials?.secretsKey &&\n secrets[uiSchema['ui:options'].requestUserCredentials.secretsKey]\n }\n isDisabled={uiSchema?.['ui:disabled'] ?? false}\n required={required}\n schema={schema}\n excludedOwners={excludedOwners}\n />\n );\n case 'gitlab':\n return (\n <GitLabRepoOwnerPicker\n onChange={updateLocalState}\n state={state}\n rawErrors={rawErrors}\n accessToken={\n uiSchema?.['ui:options']?.requestUserCredentials?.secretsKey &&\n secrets[uiSchema['ui:options'].requestUserCredentials.secretsKey]\n }\n isDisabled={uiSchema?.['ui:disabled'] ?? false}\n required={required}\n schema={schema}\n excludedOwners={excludedOwners}\n />\n );\n default:\n return (\n <DefaultRepoOwnerPicker\n onChange={updateLocalState}\n state={state}\n rawErrors={rawErrors}\n isDisabled={uiSchema?.['ui:disabled'] ?? false}\n required={required}\n schema={schema}\n />\n );\n }\n};\n"],"names":[],"mappings":";;;;;;;;;;AAqCO,MAAM,eAAA,GAAkB,CAAC,KAAA,KAAgC;AAC9D,EAAA,MAAM,EAAE,QAAA,EAAU,QAAA,EAAU,WAAW,QAAA,EAAU,MAAA,EAAQ,UAAS,GAAI,KAAA;AACtE,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,QAAA,CAA+B;AAAA,IACvD,OAAO,QAAA,IAAY;AAAA,GACpB,CAAA;AACD,EAAA,MAAM,cAAA,GAAiB,OAAA;AAAA,IACrB,MAAM,QAAA,GAAW,YAAY,CAAA,EAAG,kBAAkB,EAAC;AAAA,IACnD,CAAC,QAAQ;AAAA,GACX;AACA,EAAA,MAAM,EAAE,IAAA,EAAM,KAAA,EAAM,GAAI,KAAA;AAExB,EAAA,MAAM,cAAA,GAAiB,OAAO,qBAAqB,CAAA;AACnD,EAAA,MAAM,UAAA,GAAa,OAAO,aAAa,CAAA;AAEvC,EAAA,MAAM,EAAE,OAAA,EAAS,UAAA,EAAW,GAAI,kBAAA,EAAmB;AAEnD,EAAA,WAAA;AAAA,IACE,YAAY;AACV,MAAA,MAAM,EAAE,sBAAA,EAAuB,GAAI,Q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37.0";
2
+ var version = "1.38.0-next.0";
3
3
  var description = "The Backstage plugin that helps you create new things";
4
4
  var backstage = {
5
5
  role: "frontend-plugin",
@@ -97,7 +97,7 @@ var dependencies = {
97
97
  jszip: "^3.10.1",
98
98
  lodash: "^4.17.21",
99
99
  luxon: "^3.0.0",
100
- qs: "^6.9.4",
100
+ qs: "^6.15.2",
101
101
  "react-aria-components": "^1.14.0",
102
102
  "react-resizable": "^3.0.5",
103
103
  "react-resizable-panels": "^3.0.4",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder",
3
- "version": "1.37.0",
3
+ "version": "1.38.0-next.0",
4
4
  "description": "The Backstage plugin that helps you create new things",
5
5
  "backstage": {
6
6
  "role": "frontend-plugin",
@@ -70,24 +70,24 @@
70
70
  "test": "backstage-cli package test"
71
71
  },
72
72
  "dependencies": {
73
- "@backstage/catalog-client": "^1.15.1",
74
- "@backstage/catalog-model": "^1.9.0",
75
- "@backstage/core-components": "^0.18.10",
76
- "@backstage/core-plugin-api": "^1.12.6",
77
- "@backstage/errors": "^1.3.1",
78
- "@backstage/filter-predicates": "^0.1.3",
79
- "@backstage/frontend-plugin-api": "^0.17.0",
80
- "@backstage/integration": "^2.0.2",
81
- "@backstage/integration-react": "^1.2.18",
82
- "@backstage/plugin-catalog-common": "^1.1.10",
83
- "@backstage/plugin-catalog-react": "^3.0.0",
84
- "@backstage/plugin-permission-react": "^0.5.1",
85
- "@backstage/plugin-scaffolder-common": "^2.2.0",
86
- "@backstage/plugin-scaffolder-react": "^2.0.0",
87
- "@backstage/plugin-techdocs-common": "^0.1.1",
88
- "@backstage/plugin-techdocs-react": "^1.3.11",
89
- "@backstage/types": "^1.2.2",
90
- "@backstage/ui": "^0.15.0",
73
+ "@backstage/catalog-client": "1.16.0-next.0",
74
+ "@backstage/catalog-model": "1.9.0",
75
+ "@backstage/core-components": "0.18.11-next.0",
76
+ "@backstage/core-plugin-api": "1.12.6",
77
+ "@backstage/errors": "1.3.1",
78
+ "@backstage/filter-predicates": "0.1.3",
79
+ "@backstage/frontend-plugin-api": "0.17.0",
80
+ "@backstage/integration": "2.0.3-next.0",
81
+ "@backstage/integration-react": "1.2.19-next.0",
82
+ "@backstage/plugin-catalog-common": "1.1.10",
83
+ "@backstage/plugin-catalog-react": "3.0.1-next.0",
84
+ "@backstage/plugin-permission-react": "0.5.1",
85
+ "@backstage/plugin-scaffolder-common": "2.2.1-next.0",
86
+ "@backstage/plugin-scaffolder-react": "2.0.1-next.0",
87
+ "@backstage/plugin-techdocs-common": "0.1.1",
88
+ "@backstage/plugin-techdocs-react": "1.3.12-next.0",
89
+ "@backstage/types": "1.2.2",
90
+ "@backstage/ui": "0.15.0",
91
91
  "@codemirror/language": "^6.0.0",
92
92
  "@codemirror/legacy-modes": "^6.1.0",
93
93
  "@codemirror/view": "^6.0.0",
@@ -110,7 +110,7 @@
110
110
  "jszip": "^3.10.1",
111
111
  "lodash": "^4.17.21",
112
112
  "luxon": "^3.0.0",
113
- "qs": "^6.9.4",
113
+ "qs": "^6.15.2",
114
114
  "react-aria-components": "^1.14.0",
115
115
  "react-resizable": "^3.0.5",
116
116
  "react-resizable-panels": "^3.0.4",
@@ -121,14 +121,14 @@
121
121
  "zod-to-json-schema": "^3.25.1"
122
122
  },
123
123
  "devDependencies": {
124
- "@backstage/cli": "^0.36.2",
125
- "@backstage/core-app-api": "^1.20.1",
126
- "@backstage/dev-utils": "^1.1.23",
127
- "@backstage/frontend-test-utils": "^0.6.0",
128
- "@backstage/plugin-catalog": "^2.0.5",
129
- "@backstage/plugin-permission-common": "^0.9.9",
130
- "@backstage/plugin-techdocs": "^1.17.6",
131
- "@backstage/test-utils": "^1.7.18",
124
+ "@backstage/cli": "0.36.3-next.0",
125
+ "@backstage/core-app-api": "1.20.1",
126
+ "@backstage/dev-utils": "1.1.24-next.0",
127
+ "@backstage/frontend-test-utils": "0.6.1-next.0",
128
+ "@backstage/plugin-catalog": "2.0.6-next.0",
129
+ "@backstage/plugin-permission-common": "0.9.9",
130
+ "@backstage/plugin-techdocs": "1.17.7-next.0",
131
+ "@backstage/test-utils": "1.7.18",
132
132
  "@testing-library/dom": "^10.0.0",
133
133
  "@testing-library/jest-dom": "^6.0.0",
134
134
  "@testing-library/react": "^16.0.0",