mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-19 17:01:13 +00:00
use ES6 Map if we can (#602)
This commit is contained in:
@@ -199,9 +199,7 @@ exports[`SettingsComponent renders 1`] = `
|
||||
"keyspaceHasSharedOffer": [Function],
|
||||
"keyspaceId": [Function],
|
||||
"keyspaceIds": [Function],
|
||||
"keyspaceOffers": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
"keyspaceOffers": Map {},
|
||||
"keyspaceThroughput": [Function],
|
||||
"maxThroughputRU": [Function],
|
||||
"minThroughputRU": [Function],
|
||||
@@ -378,9 +376,7 @@ exports[`SettingsComponent renders 1`] = `
|
||||
"keyspaceHasSharedOffer": [Function],
|
||||
"keyspaceId": [Function],
|
||||
"keyspaceIds": [Function],
|
||||
"keyspaceOffers": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
"keyspaceOffers": Map {},
|
||||
"keyspaceThroughput": [Function],
|
||||
"maxThroughputRU": [Function],
|
||||
"minThroughputRU": [Function],
|
||||
@@ -494,21 +490,9 @@ exports[`SettingsComponent renders 1`] = `
|
||||
"resourceTree": ResourceTreeAdapter {
|
||||
"container": [Circular],
|
||||
"copyNotebook": [Function],
|
||||
"databaseCollectionIdMap": ArrayHashMap {
|
||||
"store": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
},
|
||||
"koSubsCollectionIdMap": ArrayHashMap {
|
||||
"store": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
},
|
||||
"koSubsDatabaseIdMap": ArrayHashMap {
|
||||
"store": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
},
|
||||
"databaseCollectionIdMap": Map {},
|
||||
"koSubsCollectionIdMap": Map {},
|
||||
"koSubsDatabaseIdMap": Map {},
|
||||
"parameters": [Function],
|
||||
},
|
||||
"resourceTreeForResourceToken": ResourceTreeAdapterForResourceToken {
|
||||
@@ -731,9 +715,7 @@ exports[`SettingsComponent renders 1`] = `
|
||||
"keyspaceHasSharedOffer": [Function],
|
||||
"keyspaceId": [Function],
|
||||
"keyspaceIds": [Function],
|
||||
"keyspaceOffers": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
"keyspaceOffers": Map {},
|
||||
"keyspaceThroughput": [Function],
|
||||
"maxThroughputRU": [Function],
|
||||
"minThroughputRU": [Function],
|
||||
@@ -910,9 +892,7 @@ exports[`SettingsComponent renders 1`] = `
|
||||
"keyspaceHasSharedOffer": [Function],
|
||||
"keyspaceId": [Function],
|
||||
"keyspaceIds": [Function],
|
||||
"keyspaceOffers": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
"keyspaceOffers": Map {},
|
||||
"keyspaceThroughput": [Function],
|
||||
"maxThroughputRU": [Function],
|
||||
"minThroughputRU": [Function],
|
||||
@@ -1026,21 +1006,9 @@ exports[`SettingsComponent renders 1`] = `
|
||||
"resourceTree": ResourceTreeAdapter {
|
||||
"container": [Circular],
|
||||
"copyNotebook": [Function],
|
||||
"databaseCollectionIdMap": ArrayHashMap {
|
||||
"store": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
},
|
||||
"koSubsCollectionIdMap": ArrayHashMap {
|
||||
"store": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
},
|
||||
"koSubsDatabaseIdMap": ArrayHashMap {
|
||||
"store": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
},
|
||||
"databaseCollectionIdMap": Map {},
|
||||
"koSubsCollectionIdMap": Map {},
|
||||
"koSubsDatabaseIdMap": Map {},
|
||||
"parameters": [Function],
|
||||
},
|
||||
"resourceTreeForResourceToken": ResourceTreeAdapterForResourceToken {
|
||||
@@ -1276,9 +1244,7 @@ exports[`SettingsComponent renders 1`] = `
|
||||
"keyspaceHasSharedOffer": [Function],
|
||||
"keyspaceId": [Function],
|
||||
"keyspaceIds": [Function],
|
||||
"keyspaceOffers": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
"keyspaceOffers": Map {},
|
||||
"keyspaceThroughput": [Function],
|
||||
"maxThroughputRU": [Function],
|
||||
"minThroughputRU": [Function],
|
||||
@@ -1455,9 +1421,7 @@ exports[`SettingsComponent renders 1`] = `
|
||||
"keyspaceHasSharedOffer": [Function],
|
||||
"keyspaceId": [Function],
|
||||
"keyspaceIds": [Function],
|
||||
"keyspaceOffers": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
"keyspaceOffers": Map {},
|
||||
"keyspaceThroughput": [Function],
|
||||
"maxThroughputRU": [Function],
|
||||
"minThroughputRU": [Function],
|
||||
@@ -1571,21 +1535,9 @@ exports[`SettingsComponent renders 1`] = `
|
||||
"resourceTree": ResourceTreeAdapter {
|
||||
"container": [Circular],
|
||||
"copyNotebook": [Function],
|
||||
"databaseCollectionIdMap": ArrayHashMap {
|
||||
"store": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
},
|
||||
"koSubsCollectionIdMap": ArrayHashMap {
|
||||
"store": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
},
|
||||
"koSubsDatabaseIdMap": ArrayHashMap {
|
||||
"store": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
},
|
||||
"databaseCollectionIdMap": Map {},
|
||||
"koSubsCollectionIdMap": Map {},
|
||||
"koSubsDatabaseIdMap": Map {},
|
||||
"parameters": [Function],
|
||||
},
|
||||
"resourceTreeForResourceToken": ResourceTreeAdapterForResourceToken {
|
||||
@@ -1808,9 +1760,7 @@ exports[`SettingsComponent renders 1`] = `
|
||||
"keyspaceHasSharedOffer": [Function],
|
||||
"keyspaceId": [Function],
|
||||
"keyspaceIds": [Function],
|
||||
"keyspaceOffers": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
"keyspaceOffers": Map {},
|
||||
"keyspaceThroughput": [Function],
|
||||
"maxThroughputRU": [Function],
|
||||
"minThroughputRU": [Function],
|
||||
@@ -1987,9 +1937,7 @@ exports[`SettingsComponent renders 1`] = `
|
||||
"keyspaceHasSharedOffer": [Function],
|
||||
"keyspaceId": [Function],
|
||||
"keyspaceIds": [Function],
|
||||
"keyspaceOffers": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
"keyspaceOffers": Map {},
|
||||
"keyspaceThroughput": [Function],
|
||||
"maxThroughputRU": [Function],
|
||||
"minThroughputRU": [Function],
|
||||
@@ -2103,21 +2051,9 @@ exports[`SettingsComponent renders 1`] = `
|
||||
"resourceTree": ResourceTreeAdapter {
|
||||
"container": [Circular],
|
||||
"copyNotebook": [Function],
|
||||
"databaseCollectionIdMap": ArrayHashMap {
|
||||
"store": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
},
|
||||
"koSubsCollectionIdMap": ArrayHashMap {
|
||||
"store": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
},
|
||||
"koSubsDatabaseIdMap": ArrayHashMap {
|
||||
"store": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
},
|
||||
"databaseCollectionIdMap": Map {},
|
||||
"koSubsCollectionIdMap": Map {},
|
||||
"koSubsDatabaseIdMap": Map {},
|
||||
"parameters": [Function],
|
||||
},
|
||||
"resourceTreeForResourceToken": ResourceTreeAdapterForResourceToken {
|
||||
|
||||
@@ -11,7 +11,6 @@ import * as ko from "knockout";
|
||||
import Q from "q";
|
||||
import _ from "underscore";
|
||||
import * as Constants from "../../../Common/Constants";
|
||||
import { HashMap } from "../../../Common/HashMap";
|
||||
import { NeighborType } from "../../../Contracts/ViewModels";
|
||||
import { logConsoleError } from "../../../Utils/NotificationConsoleUtils";
|
||||
import { GraphConfig } from "../../Tabs/GraphTab";
|
||||
@@ -195,8 +194,8 @@ export class D3ForceGraph implements GraphRenderer {
|
||||
* Count edges and store in a hashmap: vertex id <--> number of links
|
||||
* @param linkSelection
|
||||
*/
|
||||
public static countEdges(links: D3Link[]): HashMap<number> {
|
||||
const countMap = new HashMap<number>();
|
||||
public static countEdges(links: D3Link[]): Map<string, number> {
|
||||
const countMap = new Map<string, number>();
|
||||
links.forEach((l: D3Link) => {
|
||||
let val = countMap.get(l.inV) || 0;
|
||||
val += 1;
|
||||
@@ -407,7 +406,7 @@ export class D3ForceGraph implements GraphRenderer {
|
||||
const rootId = graph.findRootNodeId();
|
||||
|
||||
// Remember nodes current position
|
||||
const posMap = new HashMap<Point2D>();
|
||||
const posMap = new Map<string, Point2D>();
|
||||
this.simulation.nodes().forEach((d: D3Node) => {
|
||||
if (d.x == undefined || d.y == undefined) {
|
||||
return;
|
||||
@@ -501,8 +500,8 @@ export class D3ForceGraph implements GraphRenderer {
|
||||
if (!nodes || nodes.length === 0) {
|
||||
return;
|
||||
}
|
||||
const nodeFinalPositionMap = new HashMap<Point2D>();
|
||||
|
||||
const nodeFinalPositionMap = new Map<string, Point2D>();
|
||||
const viewCenter = this.viewCenter;
|
||||
const nonFixedNodes = _.filter(nodes, (node: D3Node) => {
|
||||
return !node._isFixedPosition && node.x === viewCenter.x && node.y === viewCenter.y;
|
||||
@@ -559,7 +558,7 @@ export class D3ForceGraph implements GraphRenderer {
|
||||
newNodes.selectAll(".loadmore").attr("visibility", "hidden").transition().delay(600).attr("visibility", "visible");
|
||||
}
|
||||
|
||||
private restartSimulation(graph: GraphData<D3Node, D3Link>, posMap: HashMap<Point2D>) {
|
||||
private restartSimulation(graph: GraphData<D3Node, D3Link>, posMap: Map<string, Point2D>) {
|
||||
if (!graph) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ObjectCache } from "../../../Common/ObjectCache";
|
||||
import { GremlinVertex, GraphData } from "./GraphData";
|
||||
import { GraphData, GremlinVertex } from "./GraphData";
|
||||
|
||||
/**
|
||||
* Remember vertex edge information
|
||||
@@ -10,9 +10,8 @@ export class EdgeInfoCache extends ObjectCache<GremlinVertex> {
|
||||
* @param vertex
|
||||
*/
|
||||
public addVertex(vertex: GremlinVertex): void {
|
||||
let v: GremlinVertex;
|
||||
if (super.has(vertex.id)) {
|
||||
v = super.get(vertex.id);
|
||||
let v = super.get(vertex.id);
|
||||
if (super.has(vertex.id) && v) {
|
||||
GraphData.addEdgeInfoToVertex(v, vertex);
|
||||
v._outEdgeIds = vertex._outEdgeIds;
|
||||
v._inEdgeIds = vertex._inEdgeIds;
|
||||
@@ -29,8 +28,8 @@ export class EdgeInfoCache extends ObjectCache<GremlinVertex> {
|
||||
* @param id
|
||||
*/
|
||||
public mergeEdgeInfo(target: GremlinVertex): void {
|
||||
if (super.has(target.id)) {
|
||||
const cachedVertex = super.get(target.id);
|
||||
const cachedVertex = super.get(target.id);
|
||||
if (super.has(target.id) && cachedVertex) {
|
||||
GraphData.addEdgeInfoToVertex(target, cachedVertex);
|
||||
target._outEdgeIds = cachedVertex._outEdgeIds;
|
||||
target._inEdgeIds = cachedVertex._inEdgeIds;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as sinon from "sinon";
|
||||
import { GremlinClient, GremlinClientParameters } from "./GremlinClient";
|
||||
import * as NotificationConsoleUtils from "../../../Utils/NotificationConsoleUtils";
|
||||
import * as Logger from "../../../Common/Logger";
|
||||
import * as NotificationConsoleUtils from "../../../Utils/NotificationConsoleUtils";
|
||||
import { GremlinClient, GremlinClientParameters } from "./GremlinClient";
|
||||
|
||||
describe("Gremlin Client", () => {
|
||||
const emptyParams: GremlinClientParameters = {
|
||||
@@ -70,7 +70,7 @@ describe("Gremlin Client", () => {
|
||||
gremlinClient.execute("fake query");
|
||||
gremlinClient.execute("fake query");
|
||||
gremlinClient.execute("fake query");
|
||||
expect(gremlinClient.pendingResults.size()).toBe(3);
|
||||
expect(gremlinClient.pendingResults.size).toBe(3);
|
||||
});
|
||||
|
||||
it("should clean up pending request ids after success", async () => {
|
||||
@@ -89,7 +89,7 @@ describe("Gremlin Client", () => {
|
||||
return requestId;
|
||||
});
|
||||
await gremlinClient.execute("fake query");
|
||||
expect(gremlinClient.pendingResults.size()).toBe(0);
|
||||
expect(gremlinClient.pendingResults.size).toBe(0);
|
||||
});
|
||||
|
||||
it("should log and display error out on unknown requestId", () => {
|
||||
@@ -247,7 +247,7 @@ describe("Gremlin Client", () => {
|
||||
sinon.stub(gremlinClient.client, "executeGremlinQuery").callsFake((query: string): string => requestId);
|
||||
gremlinClient.execute("fake query").finally(() => {
|
||||
try {
|
||||
expect(gremlinClient.pendingResults.size()).toBe(0);
|
||||
expect(gremlinClient.pendingResults.size).toBe(0);
|
||||
done();
|
||||
} catch (e) {
|
||||
done(e);
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
import * as Q from "q";
|
||||
import { getErrorMessage, handleError } from "../../../Common/ErrorHandlingUtils";
|
||||
import { HashMap } from "../../../Common/HashMap";
|
||||
import { logConsoleInfo } from "../../../Utils/NotificationConsoleUtils";
|
||||
import { GremlinSimpleClient, Result } from "./GremlinSimpleClient";
|
||||
|
||||
@@ -30,7 +29,7 @@ interface PendingResultData {
|
||||
|
||||
export class GremlinClient {
|
||||
public client: GremlinSimpleClient;
|
||||
public pendingResults: HashMap<PendingResultData>; // public for testing purposes
|
||||
public pendingResults: Map<string, PendingResultData>; // public for testing purposes
|
||||
private maxResultSize: number;
|
||||
private static readonly PENDING_REQUEST_TIMEOUT_MS = 6 /* minutes */ * 60 /* seconds */ * 1000 /* ms */;
|
||||
private static readonly TIMEOUT_ERROR_MSG = `Pending request timed out (${GremlinClient.PENDING_REQUEST_TIMEOUT_MS} ms)`;
|
||||
@@ -38,7 +37,7 @@ export class GremlinClient {
|
||||
|
||||
public initialize(params: GremlinClientParameters) {
|
||||
this.destroy();
|
||||
this.pendingResults = new HashMap();
|
||||
this.pendingResults = new Map();
|
||||
this.maxResultSize = params.maxResultSize;
|
||||
|
||||
this.client = new GremlinSimpleClient({
|
||||
@@ -68,9 +67,9 @@ export class GremlinClient {
|
||||
|
||||
// Fail all pending requests if no request id (fatal)
|
||||
if (!requestId) {
|
||||
this.pendingResults.keys().forEach((reqId: string) => {
|
||||
for (const reqId of this.pendingResults.keys()) {
|
||||
this.abortPendingRequest(reqId, errorMessage, null);
|
||||
});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.abortPendingRequest(requestId, errorMessage, result.requestCharge);
|
||||
|
||||
@@ -2,7 +2,6 @@ import * as ko from "knockout";
|
||||
import * as _ from "underscore";
|
||||
import * as Constants from "../../Common/Constants";
|
||||
import { getErrorMessage, getErrorStack } from "../../Common/ErrorHandlingUtils";
|
||||
import { HashMap } from "../../Common/HashMap";
|
||||
import { configContext, Platform } from "../../ConfigContext";
|
||||
import * as DataModels from "../../Contracts/DataModels";
|
||||
import * as ViewModels from "../../Contracts/ViewModels";
|
||||
@@ -51,7 +50,7 @@ export default class CassandraAddCollectionPane extends ContextualPaneBase {
|
||||
public ruToolTipText: ko.Computed<string>;
|
||||
public canConfigureThroughput: ko.PureComputed<boolean>;
|
||||
|
||||
private keyspaceOffers: HashMap<DataModels.Offer>;
|
||||
private keyspaceOffers: Map<string, DataModels.Offer>;
|
||||
|
||||
constructor(options: ViewModels.PaneOptions) {
|
||||
super(options);
|
||||
@@ -60,7 +59,7 @@ export default class CassandraAddCollectionPane extends ContextualPaneBase {
|
||||
this.keyspaceCreateNew = ko.observable<boolean>(true);
|
||||
this.ruToolTipText = ko.pureComputed(() => PricingUtils.getRuToolTipText());
|
||||
this.canConfigureThroughput = ko.pureComputed(() => !this.container.isServerlessEnabled());
|
||||
this.keyspaceOffers = new HashMap<DataModels.Offer>();
|
||||
this.keyspaceOffers = new Map();
|
||||
this.keyspaceIds = ko.observableArray<string>();
|
||||
this.keyspaceHasSharedOffer = ko.observable<boolean>(false);
|
||||
this.keyspaceThroughput = ko.observable<number>();
|
||||
|
||||
@@ -175,9 +175,7 @@ exports[`Settings Pane should render Default properly 1`] = `
|
||||
"keyspaceHasSharedOffer": [Function],
|
||||
"keyspaceId": [Function],
|
||||
"keyspaceIds": [Function],
|
||||
"keyspaceOffers": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
"keyspaceOffers": Map {},
|
||||
"keyspaceThroughput": [Function],
|
||||
"maxThroughputRU": [Function],
|
||||
"minThroughputRU": [Function],
|
||||
@@ -354,9 +352,7 @@ exports[`Settings Pane should render Default properly 1`] = `
|
||||
"keyspaceHasSharedOffer": [Function],
|
||||
"keyspaceId": [Function],
|
||||
"keyspaceIds": [Function],
|
||||
"keyspaceOffers": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
"keyspaceOffers": Map {},
|
||||
"keyspaceThroughput": [Function],
|
||||
"maxThroughputRU": [Function],
|
||||
"minThroughputRU": [Function],
|
||||
@@ -470,21 +466,9 @@ exports[`Settings Pane should render Default properly 1`] = `
|
||||
"resourceTree": ResourceTreeAdapter {
|
||||
"container": [Circular],
|
||||
"copyNotebook": [Function],
|
||||
"databaseCollectionIdMap": ArrayHashMap {
|
||||
"store": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
},
|
||||
"koSubsCollectionIdMap": ArrayHashMap {
|
||||
"store": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
},
|
||||
"koSubsDatabaseIdMap": ArrayHashMap {
|
||||
"store": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
},
|
||||
"databaseCollectionIdMap": Map {},
|
||||
"koSubsCollectionIdMap": Map {},
|
||||
"koSubsDatabaseIdMap": Map {},
|
||||
"parameters": [Function],
|
||||
},
|
||||
"resourceTreeForResourceToken": ResourceTreeAdapterForResourceToken {
|
||||
@@ -830,9 +814,7 @@ exports[`Settings Pane should render Gremlin properly 1`] = `
|
||||
"keyspaceHasSharedOffer": [Function],
|
||||
"keyspaceId": [Function],
|
||||
"keyspaceIds": [Function],
|
||||
"keyspaceOffers": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
"keyspaceOffers": Map {},
|
||||
"keyspaceThroughput": [Function],
|
||||
"maxThroughputRU": [Function],
|
||||
"minThroughputRU": [Function],
|
||||
@@ -1009,9 +991,7 @@ exports[`Settings Pane should render Gremlin properly 1`] = `
|
||||
"keyspaceHasSharedOffer": [Function],
|
||||
"keyspaceId": [Function],
|
||||
"keyspaceIds": [Function],
|
||||
"keyspaceOffers": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
"keyspaceOffers": Map {},
|
||||
"keyspaceThroughput": [Function],
|
||||
"maxThroughputRU": [Function],
|
||||
"minThroughputRU": [Function],
|
||||
@@ -1125,21 +1105,9 @@ exports[`Settings Pane should render Gremlin properly 1`] = `
|
||||
"resourceTree": ResourceTreeAdapter {
|
||||
"container": [Circular],
|
||||
"copyNotebook": [Function],
|
||||
"databaseCollectionIdMap": ArrayHashMap {
|
||||
"store": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
},
|
||||
"koSubsCollectionIdMap": ArrayHashMap {
|
||||
"store": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
},
|
||||
"koSubsDatabaseIdMap": ArrayHashMap {
|
||||
"store": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
},
|
||||
"databaseCollectionIdMap": Map {},
|
||||
"koSubsCollectionIdMap": Map {},
|
||||
"koSubsDatabaseIdMap": Map {},
|
||||
"parameters": [Function],
|
||||
},
|
||||
"resourceTreeForResourceToken": ResourceTreeAdapterForResourceToken {
|
||||
|
||||
@@ -178,9 +178,7 @@ exports[`StringInput Pane should render Create new directory properly 1`] = `
|
||||
"keyspaceHasSharedOffer": [Function],
|
||||
"keyspaceId": [Function],
|
||||
"keyspaceIds": [Function],
|
||||
"keyspaceOffers": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
"keyspaceOffers": Map {},
|
||||
"keyspaceThroughput": [Function],
|
||||
"maxThroughputRU": [Function],
|
||||
"minThroughputRU": [Function],
|
||||
@@ -357,9 +355,7 @@ exports[`StringInput Pane should render Create new directory properly 1`] = `
|
||||
"keyspaceHasSharedOffer": [Function],
|
||||
"keyspaceId": [Function],
|
||||
"keyspaceIds": [Function],
|
||||
"keyspaceOffers": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
"keyspaceOffers": Map {},
|
||||
"keyspaceThroughput": [Function],
|
||||
"maxThroughputRU": [Function],
|
||||
"minThroughputRU": [Function],
|
||||
@@ -473,21 +469,9 @@ exports[`StringInput Pane should render Create new directory properly 1`] = `
|
||||
"resourceTree": ResourceTreeAdapter {
|
||||
"container": [Circular],
|
||||
"copyNotebook": [Function],
|
||||
"databaseCollectionIdMap": ArrayHashMap {
|
||||
"store": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
},
|
||||
"koSubsCollectionIdMap": ArrayHashMap {
|
||||
"store": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
},
|
||||
"koSubsDatabaseIdMap": ArrayHashMap {
|
||||
"store": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
},
|
||||
"databaseCollectionIdMap": Map {},
|
||||
"koSubsCollectionIdMap": Map {},
|
||||
"koSubsDatabaseIdMap": Map {},
|
||||
"parameters": [Function],
|
||||
},
|
||||
"resourceTreeForResourceToken": ResourceTreeAdapterForResourceToken {
|
||||
@@ -709,9 +693,7 @@ exports[`StringInput Pane should render Create new directory properly 1`] = `
|
||||
"keyspaceHasSharedOffer": [Function],
|
||||
"keyspaceId": [Function],
|
||||
"keyspaceIds": [Function],
|
||||
"keyspaceOffers": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
"keyspaceOffers": Map {},
|
||||
"keyspaceThroughput": [Function],
|
||||
"maxThroughputRU": [Function],
|
||||
"minThroughputRU": [Function],
|
||||
@@ -888,9 +870,7 @@ exports[`StringInput Pane should render Create new directory properly 1`] = `
|
||||
"keyspaceHasSharedOffer": [Function],
|
||||
"keyspaceId": [Function],
|
||||
"keyspaceIds": [Function],
|
||||
"keyspaceOffers": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
"keyspaceOffers": Map {},
|
||||
"keyspaceThroughput": [Function],
|
||||
"maxThroughputRU": [Function],
|
||||
"minThroughputRU": [Function],
|
||||
@@ -1004,21 +984,9 @@ exports[`StringInput Pane should render Create new directory properly 1`] = `
|
||||
"resourceTree": ResourceTreeAdapter {
|
||||
"container": [Circular],
|
||||
"copyNotebook": [Function],
|
||||
"databaseCollectionIdMap": ArrayHashMap {
|
||||
"store": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
},
|
||||
"koSubsCollectionIdMap": ArrayHashMap {
|
||||
"store": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
},
|
||||
"koSubsDatabaseIdMap": ArrayHashMap {
|
||||
"store": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
},
|
||||
"databaseCollectionIdMap": Map {},
|
||||
"koSubsCollectionIdMap": Map {},
|
||||
"koSubsDatabaseIdMap": Map {},
|
||||
"parameters": [Function],
|
||||
},
|
||||
"resourceTreeForResourceToken": ResourceTreeAdapterForResourceToken {
|
||||
|
||||
@@ -175,9 +175,7 @@ exports[`Upload Items Pane should render Default properly 1`] = `
|
||||
"keyspaceHasSharedOffer": [Function],
|
||||
"keyspaceId": [Function],
|
||||
"keyspaceIds": [Function],
|
||||
"keyspaceOffers": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
"keyspaceOffers": Map {},
|
||||
"keyspaceThroughput": [Function],
|
||||
"maxThroughputRU": [Function],
|
||||
"minThroughputRU": [Function],
|
||||
@@ -354,9 +352,7 @@ exports[`Upload Items Pane should render Default properly 1`] = `
|
||||
"keyspaceHasSharedOffer": [Function],
|
||||
"keyspaceId": [Function],
|
||||
"keyspaceIds": [Function],
|
||||
"keyspaceOffers": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
"keyspaceOffers": Map {},
|
||||
"keyspaceThroughput": [Function],
|
||||
"maxThroughputRU": [Function],
|
||||
"minThroughputRU": [Function],
|
||||
@@ -470,21 +466,9 @@ exports[`Upload Items Pane should render Default properly 1`] = `
|
||||
"resourceTree": ResourceTreeAdapter {
|
||||
"container": [Circular],
|
||||
"copyNotebook": [Function],
|
||||
"databaseCollectionIdMap": ArrayHashMap {
|
||||
"store": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
},
|
||||
"koSubsCollectionIdMap": ArrayHashMap {
|
||||
"store": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
},
|
||||
"koSubsDatabaseIdMap": ArrayHashMap {
|
||||
"store": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
},
|
||||
"databaseCollectionIdMap": Map {},
|
||||
"koSubsCollectionIdMap": Map {},
|
||||
"koSubsDatabaseIdMap": Map {},
|
||||
"parameters": [Function],
|
||||
},
|
||||
"resourceTreeForResourceToken": ResourceTreeAdapterForResourceToken {
|
||||
|
||||
@@ -176,9 +176,7 @@ exports[`Delete Database Confirmation Pane submit() Should call delete database
|
||||
"keyspaceHasSharedOffer": [Function],
|
||||
"keyspaceId": [Function],
|
||||
"keyspaceIds": [Function],
|
||||
"keyspaceOffers": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
"keyspaceOffers": Map {},
|
||||
"keyspaceThroughput": [Function],
|
||||
"maxThroughputRU": [Function],
|
||||
"minThroughputRU": [Function],
|
||||
@@ -355,9 +353,7 @@ exports[`Delete Database Confirmation Pane submit() Should call delete database
|
||||
"keyspaceHasSharedOffer": [Function],
|
||||
"keyspaceId": [Function],
|
||||
"keyspaceIds": [Function],
|
||||
"keyspaceOffers": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
"keyspaceOffers": Map {},
|
||||
"keyspaceThroughput": [Function],
|
||||
"maxThroughputRU": [Function],
|
||||
"minThroughputRU": [Function],
|
||||
@@ -475,21 +471,9 @@ exports[`Delete Database Confirmation Pane submit() Should call delete database
|
||||
"resourceTree": ResourceTreeAdapter {
|
||||
"container": [Circular],
|
||||
"copyNotebook": [Function],
|
||||
"databaseCollectionIdMap": ArrayHashMap {
|
||||
"store": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
},
|
||||
"koSubsCollectionIdMap": ArrayHashMap {
|
||||
"store": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
},
|
||||
"koSubsDatabaseIdMap": ArrayHashMap {
|
||||
"store": HashMap {
|
||||
"container": Object {},
|
||||
},
|
||||
},
|
||||
"databaseCollectionIdMap": Map {},
|
||||
"koSubsCollectionIdMap": Map {},
|
||||
"koSubsDatabaseIdMap": Map {},
|
||||
"parameters": [Function],
|
||||
},
|
||||
"resourceTreeForResourceToken": ResourceTreeAdapterForResourceToken {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import * as ko from "knockout";
|
||||
import * as Constants from "../../Common/Constants";
|
||||
import { HashMap } from "../../Common/HashMap";
|
||||
import { configContext, Platform } from "../../ConfigContext";
|
||||
import * as ViewModels from "../../Contracts/ViewModels";
|
||||
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
|
||||
@@ -17,11 +16,11 @@ export default class MongoShellTab extends TabsBase {
|
||||
public url: ko.Computed<string>;
|
||||
private _container: Explorer;
|
||||
private _runtimeEndpoint: string;
|
||||
private _logTraces: HashMap<number>;
|
||||
private _logTraces: Map<string, number>;
|
||||
|
||||
constructor(options: ViewModels.TabOptions) {
|
||||
super(options);
|
||||
this._logTraces = new HashMap<number>();
|
||||
this._logTraces = new Map();
|
||||
this._container = options.collection.container;
|
||||
this.url = ko.computed<string>(() => {
|
||||
const account = userContext.databaseAccount;
|
||||
|
||||
@@ -5,7 +5,6 @@ import * as Constants from "../../Common/Constants";
|
||||
import { queryDocuments } from "../../Common/dataAccess/queryDocuments";
|
||||
import { queryDocumentsPage } from "../../Common/dataAccess/queryDocumentsPage";
|
||||
import { getErrorMessage, getErrorStack } from "../../Common/ErrorHandlingUtils";
|
||||
import { HashMap } from "../../Common/HashMap";
|
||||
import * as HeadersUtility from "../../Common/HeadersUtility";
|
||||
import { MinimalQueryIterator } from "../../Common/IteratorUtilities";
|
||||
import { Splitter, SplitterBounds, SplitterDirection } from "../../Common/Splitter";
|
||||
@@ -47,7 +46,7 @@ export default class QueryTab extends TabsBase implements ViewModels.WaitsForTem
|
||||
public splitter: Splitter;
|
||||
public isPreferredApiMongoDB: boolean;
|
||||
|
||||
public queryMetrics: ko.Observable<HashMap<DataModels.QueryMetrics>>;
|
||||
public queryMetrics: ko.Observable<Map<string, DataModels.QueryMetrics>>;
|
||||
public aggregatedQueryMetrics: ko.Observable<DataModels.QueryMetrics>;
|
||||
public activityId: ko.Observable<string>;
|
||||
public roundTrips: ko.Observable<number>;
|
||||
@@ -91,10 +90,8 @@ export default class QueryTab extends TabsBase implements ViewModels.WaitsForTem
|
||||
this.isPreferredApiMongoDB = false;
|
||||
this.aggregatedQueryMetrics = ko.observable<DataModels.QueryMetrics>();
|
||||
this._resetAggregateQueryMetrics();
|
||||
this.queryMetrics = ko.observable<HashMap<DataModels.QueryMetrics>>(new HashMap<DataModels.QueryMetrics>());
|
||||
this.queryMetrics.subscribe((metrics: HashMap<DataModels.QueryMetrics>) =>
|
||||
this.aggregatedQueryMetrics(this._aggregateQueryMetrics(metrics))
|
||||
);
|
||||
this.queryMetrics = ko.observable<Map<string, DataModels.QueryMetrics>>(new Map());
|
||||
this.queryMetrics.subscribe((metrics) => this.aggregatedQueryMetrics(this._aggregateQueryMetrics(metrics)));
|
||||
this.isQueryMetricsEnabled = ko.computed<boolean>(() => {
|
||||
return userContext.apiType === "SQL" || false;
|
||||
});
|
||||
@@ -364,13 +361,13 @@ export default class QueryTab extends TabsBase implements ViewModels.WaitsForTem
|
||||
this.queryMetrics.valueHasMutated();
|
||||
}
|
||||
|
||||
private _aggregateQueryMetrics(metricsMap: HashMap<DataModels.QueryMetrics>): DataModels.QueryMetrics {
|
||||
private _aggregateQueryMetrics(metricsMap: Map<string, DataModels.QueryMetrics>): DataModels.QueryMetrics {
|
||||
if (!metricsMap) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const aggregatedMetrics: DataModels.QueryMetrics = this.aggregatedQueryMetrics();
|
||||
metricsMap.forEach((partitionKeyRangeId: string, queryMetrics: DataModels.QueryMetrics) => {
|
||||
metricsMap.forEach((queryMetrics) => {
|
||||
if (queryMetrics) {
|
||||
aggregatedMetrics.documentLoadTime =
|
||||
queryMetrics.documentLoadTime &&
|
||||
@@ -510,7 +507,7 @@ export default class QueryTab extends TabsBase implements ViewModels.WaitsForTem
|
||||
return null;
|
||||
}
|
||||
|
||||
const queryMetrics: HashMap<DataModels.QueryMetrics> = this.queryMetrics();
|
||||
const queryMetrics = this.queryMetrics();
|
||||
let csvData: string = "";
|
||||
const columnHeaders: string =
|
||||
[
|
||||
@@ -528,7 +525,7 @@ export default class QueryTab extends TabsBase implements ViewModels.WaitsForTem
|
||||
"Document write time (ms)",
|
||||
].join(",") + "\n";
|
||||
csvData = csvData + columnHeaders;
|
||||
queryMetrics.forEach((partitionKeyRangeId: string, queryMetric: DataModels.QueryMetrics) => {
|
||||
queryMetrics.forEach((queryMetric, partitionKeyRangeId) => {
|
||||
const partitionKeyRangeData: string =
|
||||
[
|
||||
partitionKeyRangeId,
|
||||
|
||||
@@ -930,7 +930,7 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
||||
}
|
||||
|
||||
private cleanupDatabasesKoSubs(): void {
|
||||
this.koSubsDatabaseIdMap.keys().forEach((databaseId: string) => {
|
||||
for (const databaseId of this.koSubsDatabaseIdMap.keys()) {
|
||||
this.koSubsDatabaseIdMap.get(databaseId).forEach((sub: ko.Subscription) => sub.dispose());
|
||||
this.koSubsDatabaseIdMap.delete(databaseId);
|
||||
|
||||
@@ -939,7 +939,7 @@ export class ResourceTreeAdapter implements ReactAdapter {
|
||||
.get(databaseId)
|
||||
.forEach((collectionId: string) => this.cleanupKoSubsForCollection(databaseId, collectionId));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private cleanupCollectionsKoSubs(databaseId: string, existingCollectionIds: string[]): void {
|
||||
|
||||
Reference in New Issue
Block a user