diff --git a/src/HostedExplorer.tsx b/src/HostedExplorer.tsx index 5f17348db..d764c3635 100644 --- a/src/HostedExplorer.tsx +++ b/src/HostedExplorer.tsx @@ -52,7 +52,6 @@ const App: React.FunctionComponent = () => { const [databaseAccount, setDatabaseAccount] = React.useState(); const [authType, setAuthType] = React.useState(encryptedToken ? AuthType.EncryptedToken : undefined); const [connectionString, setConnectionString] = React.useState(); - const [errorMessage, setErrorMessage] = React.useState(); const ref = React.useRef(); @@ -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, }} /> )} diff --git a/src/Platform/Hosted/Components/ConnectExplorer.test.tsx b/src/Platform/Hosted/Components/ConnectExplorer.test.tsx index 3c8c40cb7..a98a89ccc 100644 --- a/src/Platform/Hosted/Components/ConnectExplorer.test.tsx +++ b/src/Platform/Hosted/Components/ConnectExplorer.test.tsx @@ -13,7 +13,6 @@ it("shows the connect form", () => { const setEncryptedToken = jest.fn(); const setAuthType = jest.fn(); const setAccountMetadata = jest.fn(); - const setErrorMessage = jest.fn(); render( { connectionString, setConnectionString, setAccountMetadata, - setErrorMessage, }} />, ); @@ -40,7 +38,6 @@ it("hides the connection string link when feature.disableConnectionStringLogin i const setEncryptedToken = jest.fn(); const setAuthType = jest.fn(); const setAccountMetadata = jest.fn(); - const setErrorMessage = jest.fn(); const oldFeatures = userContext.features; const params = new URLSearchParams({ @@ -59,7 +56,6 @@ it("hides the connection string link when feature.disableConnectionStringLogin i connectionString, setConnectionString, setAccountMetadata, - setErrorMessage, }} />, ); diff --git a/src/Platform/Hosted/Components/ConnectExplorer.tsx b/src/Platform/Hosted/Components/ConnectExplorer.tsx index 98778ad9d..b0b474ded 100644 --- a/src/Platform/Hosted/Components/ConnectExplorer.tsx +++ b/src/Platform/Hosted/Components/ConnectExplorer.tsx @@ -19,8 +19,6 @@ interface Props { setConnectionString: (connectionString: string) => void; setAuthType: (authType: AuthType) => void; setAccountMetadata: (metadata: AccessInputMetadata) => void; - errorMessage?: string; - setErrorMessage: (message: string) => void; } // Turns a failed Portal Backend response into an error that carries the message returned by the service. @@ -60,10 +58,9 @@ export const ConnectExplorer: React.FunctionComponent = ({ connectionString, setConnectionString, setAccountMetadata, - errorMessage, - setErrorMessage, }: Props) => { const [isFormVisible, { setTrue: showForm }] = useBoolean(false); + const [errorMessage, setErrorMessage] = React.useState(""); const enableConnectionStringLogin = !userContext.features.disableConnectionStringLogin; return ( @@ -128,7 +125,7 @@ export const ConnectExplorer: React.FunctionComponent = ({ setConnectionString(event.target.value); }} /> - {errorMessage && ( + {errorMessage.length > 0 && ( Error notification {errorMessage} @@ -150,12 +147,6 @@ export const ConnectExplorer: React.FunctionComponent = ({ Connect to your account with connection string

)} - {errorMessage && ( - - Error notification - {errorMessage} - - )} )}