mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-20 09:20:16 +00:00
more fixes
This commit is contained in:
@@ -73,6 +73,8 @@ const App: React.FunctionComponent = () => {
|
|||||||
}
|
}
|
||||||
}, [ref, encryptedToken, encryptedTokenMetadata, isLoggedIn, databaseAccount]);
|
}, [ref, encryptedToken, encryptedTokenMetadata, isLoggedIn, databaseAccount]);
|
||||||
|
|
||||||
|
const showAccount = (isLoggedIn && databaseAccount) || (encryptedTokenMetadata && encryptedTokenMetadata);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<header>
|
<header>
|
||||||
@@ -111,23 +113,22 @@ const App: React.FunctionComponent = () => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
{(isLoggedIn && databaseAccount) ||
|
{showAccount && (
|
||||||
(encryptedTokenMetadata && encryptedTokenMetadata && (
|
// Ideally we would import and render data explorer like any other React component, however
|
||||||
// Ideally we would import and render data explorer like any other React component, however
|
// because it still has a significant amount of Knockout code, this would lead to memory leaks.
|
||||||
// because it still has a significant amount of Knockout code, this would lead to memory leaks.
|
// Knockout does not have a way to tear down all of its binding and listeners with a single method.
|
||||||
// Knockout does not have a way to tear down all of its binding and listeners with a single method.
|
// It's possible this can be changed once all knockout code has been removed.
|
||||||
// It's possible this can be changed once all knockout code has been removed.
|
<iframe
|
||||||
<iframe
|
// Setting key is needed so React will re-render this element on any account change
|
||||||
// Setting key is needed so React will re-render this element on any account change
|
key={databaseAccount?.id || encryptedTokenMetadata?.accountName}
|
||||||
key={databaseAccount?.id || encryptedTokenMetadata?.accountName}
|
ref={ref}
|
||||||
ref={ref}
|
id="explorerMenu"
|
||||||
id="explorerMenu"
|
name="explorer"
|
||||||
name="explorer"
|
className="iframe"
|
||||||
className="iframe"
|
title="explorer"
|
||||||
title="explorer"
|
src="explorer.html?v=1.0.1&platform=Hosted"
|
||||||
src="explorer.html?v=1.0.1&platform=Hosted"
|
></iframe>
|
||||||
></iframe>
|
)}
|
||||||
))}
|
|
||||||
{!isLoggedIn && !encryptedTokenMetadata && (
|
{!isLoggedIn && !encryptedTokenMetadata && (
|
||||||
<ConnectExplorer {...{ login, setEncryptedToken, setAuthType, connectionString, setConnectionString }} />
|
<ConnectExplorer {...{ login, setEncryptedToken, setAuthType, connectionString, setConnectionString }} />
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -213,6 +213,9 @@ const App: React.FunctionComponent = () => {
|
|||||||
const accountResourceId = account.id;
|
const accountResourceId = account.id;
|
||||||
const subscriptionId = accountResourceId && accountResourceId.split("subscriptions/")[1].split("/")[0];
|
const subscriptionId = accountResourceId && accountResourceId.split("subscriptions/")[1].split("/")[0];
|
||||||
const resourceGroup = accountResourceId && accountResourceId.split("resourceGroups/")[1].split("/")[0];
|
const resourceGroup = accountResourceId && accountResourceId.split("resourceGroups/")[1].split("/")[0];
|
||||||
|
updateUserContext({
|
||||||
|
databaseAccount: win.hostedConfig.databaseAccount
|
||||||
|
});
|
||||||
explorer.initDataExplorerWithFrameInputs({
|
explorer.initDataExplorerWithFrameInputs({
|
||||||
databaseAccount: account,
|
databaseAccount: account,
|
||||||
subscriptionId,
|
subscriptionId,
|
||||||
|
|||||||
Reference in New Issue
Block a user