mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-09-19 09:02:41 +01:00
Keep the connect form login error local to ConnectExplorer
The error state was lifted into HostedExplorer so a postMessage login could report failures, which meant the connect screen needed a second copy of the error markup for the AAD view. That copy fell outside the connectExplorerContent selector the tooltip styles are scoped to, so it rendered the message as unstyled inline text. Move the state back into ConnectExplorer and let connectWithConnectionString log the failure as it did before. A failed postMessage login still leaves the user on the connect screen either way.
This commit is contained in:
@@ -52,7 +52,6 @@ const App: React.FunctionComponent = () => {
|
||||
const [databaseAccount, setDatabaseAccount] = React.useState<DatabaseAccount>();
|
||||
const [authType, setAuthType] = React.useState<AuthType>(encryptedToken ? AuthType.EncryptedToken : undefined);
|
||||
const [connectionString, setConnectionString] = React.useState<string>();
|
||||
const [errorMessage, setErrorMessage] = React.useState<string>();
|
||||
|
||||
const ref = React.useRef<HTMLIFrameElement>();
|
||||
|
||||
@@ -61,7 +60,6 @@ const App: React.FunctionComponent = () => {
|
||||
if (!connStr || authType) {
|
||||
return;
|
||||
}
|
||||
setErrorMessage(undefined);
|
||||
setConnectionString(connStr);
|
||||
if (isResourceTokenConnectionString(connStr)) {
|
||||
setAuthType(AuthType.ResourceToken);
|
||||
@@ -83,12 +81,10 @@ const App: React.FunctionComponent = () => {
|
||||
setAuthType(AuthType.ConnectionString);
|
||||
})
|
||||
.catch((error) => {
|
||||
const message = getErrorMessage(error);
|
||||
logError(
|
||||
`Failed to connect with connection string: ${message}`,
|
||||
`Failed to connect with connection string: ${getErrorMessage(error)}`,
|
||||
"HostedExplorer/connectWithConnectionString",
|
||||
);
|
||||
setErrorMessage(message);
|
||||
});
|
||||
},
|
||||
[authType],
|
||||
@@ -230,8 +226,6 @@ const App: React.FunctionComponent = () => {
|
||||
connectionString,
|
||||
setConnectionString,
|
||||
setAccountMetadata,
|
||||
errorMessage,
|
||||
setErrorMessage,
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user