mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-21 09:51:11 +00:00
Explorer.ts Cleanup (#341)
Co-authored-by: victor-meng <56978073+victor-meng@users.noreply.github.com>
This commit is contained in:
@@ -19,6 +19,7 @@ export function initializeExplorer(): Explorer {
|
||||
cassandraEndpoint: ""
|
||||
}
|
||||
});
|
||||
|
||||
explorer.isAccountReady(true);
|
||||
return explorer;
|
||||
}
|
||||
|
||||
@@ -268,7 +268,7 @@ export default class Main {
|
||||
masterKey?: string /* master key extracted from connection string if available */,
|
||||
account?: DatabaseAccount,
|
||||
authorizationToken?: string /* access key */
|
||||
): Q.Promise<void> {
|
||||
): void {
|
||||
const serverId: string = AuthHeadersUtil.serverId;
|
||||
const authType: string = (<any>window).authType;
|
||||
const accountResourceId =
|
||||
@@ -373,7 +373,7 @@ export default class Main {
|
||||
});
|
||||
}
|
||||
|
||||
return Q.reject(`Unsupported AuthType ${authType}`);
|
||||
throw new Error(`Unsupported AuthType ${authType}`);
|
||||
}
|
||||
|
||||
private static _instantiateExplorer(): Explorer {
|
||||
|
||||
@@ -1,9 +1,23 @@
|
||||
import "../../Explorer/Tables/DataTable/DataTableBindingManager";
|
||||
import Explorer from "../../Explorer/Explorer";
|
||||
import { handleMessage } from "../../Controls/Heatmap/Heatmap";
|
||||
|
||||
export function initializeExplorer(): Explorer {
|
||||
const explorer = new Explorer();
|
||||
|
||||
// In development mode, try to load the iframe message from session storage.
|
||||
// This allows webpack hot reload to funciton properly
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
const initMessage = sessionStorage.getItem("portalDataExplorerInitMessage");
|
||||
if (initMessage) {
|
||||
const message = JSON.parse(initMessage);
|
||||
console.warn("Loaded cached portal iframe message from session storage");
|
||||
console.dir(message);
|
||||
explorer.initDataExplorerWithFrameInputs(message);
|
||||
}
|
||||
}
|
||||
|
||||
window.addEventListener("message", explorer.handleMessage.bind(explorer), false);
|
||||
|
||||
return explorer;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user