diff --git a/plugins/scaffolder/src/components/fields/RepoUrlPicker/RepoUrlPicker.test.tsx b/plugins/scaffolder/src/components/fields/RepoUrlPicker/RepoUrlPicker.test.tsx
index 163f397857..2d612f317d 100644
--- a/plugins/scaffolder/src/components/fields/RepoUrlPicker/RepoUrlPicker.test.tsx
+++ b/plugins/scaffolder/src/components/fields/RepoUrlPicker/RepoUrlPicker.test.tsx
@@ -119,6 +119,36 @@ describe('RepoUrlPicker', () => {
);
});
+ it('should disable the picker when ui:disabled', async () => {
+ const onSubmit = jest.fn();
+ const { getAllByRole } = await renderInTestApp(
+
+
+
+ ,
+ );
+
+ const [ownerInput, repoInput] = getAllByRole('textbox');
+
+ expect(ownerInput).toBeDisabled();
+ expect(repoInput).toBeDisabled();
+ });
+
it('should render properly with allowedHosts', async () => {
const { getByRole } = await renderInTestApp(
uiSchema?.['ui:options']?.allowedRepos ?? [],
[uiSchema],
);
-
+ const isDisabled = useMemo(
+ () => uiSchema?.['ui:disabled'] ?? false,
+ [uiSchema],
+ );
const { owner, organization, project, repoName } = state;
useEffect(() => {
@@ -179,6 +182,7 @@ export const RepoUrlPicker = (
hosts={allowedHosts}
onChange={host => setState(prevState => ({ ...prevState, host }))}
rawErrors={rawErrors}
+ isDisabled={isDisabled}
/>
{hostType === 'github' && (
)}
@@ -207,6 +213,7 @@ export const RepoUrlPicker = (
rawErrors={rawErrors}
state={state}
onChange={updateLocalState}
+ isDisabled={isDisabled}
accessToken={
uiSchema?.['ui:options']?.requestUserCredentials?.secretsKey &&
secrets[uiSchema['ui:options'].requestUserCredentials.secretsKey]
@@ -220,6 +227,7 @@ export const RepoUrlPicker = (
rawErrors={rawErrors}
state={state}
onChange={updateLocalState}
+ isDisabled={isDisabled}
accessToken={
uiSchema?.['ui:options']?.requestUserCredentials?.secretsKey &&
secrets[uiSchema['ui:options'].requestUserCredentials.secretsKey]
@@ -232,6 +240,7 @@ export const RepoUrlPicker = (
allowedProject={allowedProjects}
rawErrors={rawErrors}
state={state}
+ isDisabled={isDisabled}
onChange={updateLocalState}
/>
)}
@@ -240,6 +249,7 @@ export const RepoUrlPicker = (
rawErrors={rawErrors}
state={state}
onChange={updateLocalState}
+ isDisabled={isDisabled}
/>
)}