mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-21 18:01:39 +00:00
Initial Move from Azure DevOps to GitHub
This commit is contained in:
12
src/Platform/Emulator/DataAccessUtility.ts
Normal file
12
src/Platform/Emulator/DataAccessUtility.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import Q from "q";
|
||||
import { DataAccessUtilityBase } from "../../Common/DataAccessUtilityBase";
|
||||
|
||||
export class DataAccessUtility extends DataAccessUtilityBase {
|
||||
public refreshCachedOffers(): Q.Promise<void> {
|
||||
return Q();
|
||||
}
|
||||
|
||||
public refreshCachedResources(options: any): Q.Promise<void> {
|
||||
return Q();
|
||||
}
|
||||
}
|
||||
39
src/Platform/Emulator/ExplorerFactory.ts
Normal file
39
src/Platform/Emulator/ExplorerFactory.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import * as ViewModels from "../../Contracts/ViewModels";
|
||||
import { AccountKind, TagNames, DefaultAccountExperience } from "../../Common/Constants";
|
||||
|
||||
import Explorer from "../../Explorer/Explorer";
|
||||
|
||||
import { NotificationsClient } from "./NotificationsClient";
|
||||
import DocumentClientUtilityBase from "../../Common/DocumentClientUtilityBase";
|
||||
import { DataAccessUtility } from "./DataAccessUtility";
|
||||
|
||||
export default class EmulatorExplorerFactory {
|
||||
public static createExplorer(): ViewModels.Explorer {
|
||||
DocumentClientUtilityBase;
|
||||
const documentClientUtility: DocumentClientUtilityBase = new DocumentClientUtilityBase(new DataAccessUtility());
|
||||
|
||||
const explorer: Explorer = new Explorer({
|
||||
documentClientUtility: documentClientUtility,
|
||||
notificationsClient: new NotificationsClient(),
|
||||
isEmulator: true
|
||||
});
|
||||
explorer.databaseAccount({
|
||||
name: "",
|
||||
id: "",
|
||||
location: "",
|
||||
type: "",
|
||||
kind: AccountKind.DocumentDB,
|
||||
tags: {
|
||||
[TagNames.defaultExperience]: DefaultAccountExperience.DocumentDB
|
||||
},
|
||||
properties: {
|
||||
documentEndpoint: "",
|
||||
tableEndpoint: "",
|
||||
gremlinEndpoint: "",
|
||||
cassandraEndpoint: ""
|
||||
}
|
||||
});
|
||||
explorer.isAccountReady(true);
|
||||
return explorer;
|
||||
}
|
||||
}
|
||||
7
src/Platform/Emulator/Main.ts
Normal file
7
src/Platform/Emulator/Main.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import * as ViewModels from "../../Contracts/ViewModels";
|
||||
import EmulatorExplorerFactory from "./ExplorerFactory";
|
||||
|
||||
export function initializeExplorer(): ViewModels.Explorer {
|
||||
const explorer = EmulatorExplorerFactory.createExplorer();
|
||||
return explorer;
|
||||
}
|
||||
16
src/Platform/Emulator/NotificationsClient.ts
Normal file
16
src/Platform/Emulator/NotificationsClient.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import Q from "q";
|
||||
import * as DataModels from "../../Contracts/DataModels";
|
||||
import { NotificationsClientBase } from "../../Common/NotificationsClientBase";
|
||||
|
||||
export class NotificationsClient extends NotificationsClientBase {
|
||||
private static readonly _notificationsApiSuffix: string = "/api/notifications";
|
||||
|
||||
public constructor() {
|
||||
super(NotificationsClient._notificationsApiSuffix);
|
||||
}
|
||||
|
||||
public fetchNotifications(): Q.Promise<DataModels.Notification[]> {
|
||||
// no notifications for the emulator
|
||||
return Q([]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user