Don't hide form elements in GitHub component if we're not checking auth (#675)

* Don't check authentication if we're not requesting you to login

* changelog
This commit is contained in:
Will Hunt 2023-03-24 12:06:37 +00:00 committed by GitHub
parent b5b86d45da
commit 05b23127d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

1
changelog.d/675.bugfix Normal file
View File

@ -0,0 +1 @@
Don't hide Create Connection button in Migration component.

View File

@ -103,9 +103,11 @@ const ConnectionConfiguration: FunctionComponent<ConnectionConfigurationProps<ne
const clearInstance = useCallback(() => setConnectionState(null), [setConnectionState]);
const consideredAuthenticated = (authedResponse?.authenticated || !showAuthPrompt);
return <form onSubmit={handleSave}>
{authedResponse && <ServiceAuth onAuthSucceeded={checkAuth} authState={authedResponse} service="github" loginLabel={loginLabel} api={api} />}
{!existingConnection && authedResponse?.authenticated && <ConnectionSearch
{!existingConnection && consideredAuthenticated && <ConnectionSearch
serviceName="GitHub"
addNewInstanceUrl={newInstallationUrl}
getInstances={getInstances}
@ -152,7 +154,7 @@ const ConnectionConfiguration: FunctionComponent<ConnectionConfigurationProps<ne
</ul>
</InputField>
<ButtonSet>
{ canEdit && authedResponse?.authenticated && <Button type="submit" disabled={!existingConnection && !connectionState}>{ existingConnection?.id ? "Save" : "Add repository" }</Button>}
{ canEdit && consideredAuthenticated && <Button type="submit" disabled={!existingConnection && !connectionState}>{ existingConnection?.id ? "Save" : "Add repository" }</Button>}
{ canEdit && existingConnection?.id && <Button intent="remove" onClick={onRemove}>Remove repository</Button>}
</ButtonSet>
</form>;