Explorer.ts Cleanup (#341)

Co-authored-by: victor-meng <56978073+victor-meng@users.noreply.github.com>
This commit is contained in:
Steve Faulkner
2020-12-16 20:00:39 -06:00
committed by GitHub
parent f54e8eb692
commit dfb1b50621
16 changed files with 121 additions and 224 deletions

View File

@@ -19,6 +19,7 @@ export function initializeExplorer(): Explorer {
cassandraEndpoint: ""
}
});
explorer.isAccountReady(true);
return explorer;
}

View File

@@ -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 {

View File

@@ -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;
}