mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-23 02:41:39 +00:00
Refactor Data Access Utility (#112)
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
import Q from "q";
|
||||
import { DataAccessUtilityBase } from "../../Common/DataAccessUtilityBase";
|
||||
|
||||
export class DataAccessUtility extends DataAccessUtilityBase {
|
||||
public refreshCachedOffers(): Q.Promise<void> {
|
||||
return Q();
|
||||
}
|
||||
|
||||
public refreshCachedResources(): Q.Promise<void> {
|
||||
return Q();
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,10 @@
|
||||
import * as ViewModels from "../../Contracts/ViewModels";
|
||||
import Explorer from "../../Explorer/Explorer";
|
||||
import { NotificationsClient } from "./NotificationsClient";
|
||||
import DocumentClientUtilityBase from "../../Common/DocumentClientUtilityBase";
|
||||
import { DataAccessUtility } from "./DataAccessUtility";
|
||||
|
||||
export default class HostedExplorerFactory {
|
||||
public createExplorer(): Explorer {
|
||||
var documentClientUtility = new DocumentClientUtilityBase(new DataAccessUtility());
|
||||
var documentClientUtility = new DocumentClientUtilityBase();
|
||||
|
||||
const explorer = new Explorer({
|
||||
documentClientUtility: documentClientUtility,
|
||||
@@ -19,7 +17,7 @@ export default class HostedExplorerFactory {
|
||||
|
||||
public static reInitializeDocumentClientUtilityForExplorer(explorer: Explorer): void {
|
||||
if (!!explorer) {
|
||||
const documentClientUtility = new DocumentClientUtilityBase(new DataAccessUtility());
|
||||
const documentClientUtility = new DocumentClientUtilityBase();
|
||||
explorer.rebindDocumentClientUtility(documentClientUtility);
|
||||
explorer.notificationConsoleData([]);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ import { CosmosClient } from "../../Common/CosmosClient";
|
||||
import { DataExplorerInputsFrame } from "../../Contracts/ViewModels";
|
||||
import { DefaultExperienceUtility } from "../../Shared/DefaultExperienceUtility";
|
||||
import { HostedUtils } from "./HostedUtils";
|
||||
import { MessageHandler } from "../../Common/MessageHandler";
|
||||
import { sendMessage } from "../../Common/MessageHandler";
|
||||
import { MessageTypes } from "../../Contracts/ExplorerContracts";
|
||||
import { SessionStorageUtility, StorageKey } from "../../Shared/StorageUtility";
|
||||
import { SubscriptionUtilMappings } from "../../Shared/Constants";
|
||||
@@ -77,7 +77,7 @@ export default class Main {
|
||||
|
||||
const explorer: Explorer = this._instantiateExplorer();
|
||||
if (authType === AuthType.EncryptedToken) {
|
||||
MessageHandler.sendMessage({
|
||||
sendMessage({
|
||||
type: MessageTypes.UpdateAccountSwitch,
|
||||
props: {
|
||||
authType: AuthType.EncryptedToken,
|
||||
@@ -102,7 +102,7 @@ export default class Main {
|
||||
}
|
||||
);
|
||||
} else if (authType === AuthType.AAD) {
|
||||
MessageHandler.sendMessage({
|
||||
sendMessage({
|
||||
type: MessageTypes.GetAccessAadRequest
|
||||
});
|
||||
if (this._getAadAccessDeferred != null) {
|
||||
@@ -287,7 +287,7 @@ export default class Main {
|
||||
const apiExperience: string = DefaultExperienceUtility.getDefaultExperienceFromApiKind(
|
||||
Main._accessInputMetadata.apiKind
|
||||
);
|
||||
MessageHandler.sendMessage({
|
||||
sendMessage({
|
||||
type: MessageTypes.UpdateAccountSwitch,
|
||||
props: {
|
||||
authType: AuthType.EncryptedToken,
|
||||
@@ -385,7 +385,7 @@ export default class Main {
|
||||
window.addEventListener(
|
||||
"click",
|
||||
() => {
|
||||
MessageHandler.sendMessage({
|
||||
sendMessage({
|
||||
type: MessageTypes.ExplorerClickEvent
|
||||
});
|
||||
},
|
||||
@@ -514,7 +514,7 @@ export default class Main {
|
||||
) {
|
||||
Main._initDataExplorerFrameInputs(explorer, masterKey, account, authorizationToken);
|
||||
explorer.isAccountReady.valueHasMutated();
|
||||
MessageHandler.sendMessage("ready");
|
||||
sendMessage("ready");
|
||||
}
|
||||
|
||||
private static _shouldProcessMessage(event: MessageEvent): boolean {
|
||||
|
||||
Reference in New Issue
Block a user