From e80136480097e3cbc38aed5a059184fc994ba98b Mon Sep 17 00:00:00 2001
From: Armando Trejo Oliver
Date: Tue, 5 Jan 2021 10:53:55 -0800
Subject: [PATCH 01/22] Remove stale .main class from tree.less (#362)
.main CSS class has a naming conflict with Moncao editor CSS classes and this is causing A11y issues with Moncao editor.
This class should no longer be used since we moved to the new tree component in REACT, so I am removing it. From my testing, this is not affecting anything.
If we find any styling issue later, we should fix without adding back this class.
---
less/tree.less | 11 -----------
1 file changed, 11 deletions(-)
diff --git a/less/tree.less b/less/tree.less
index f2f7dcd6b..e59a00a87 100644
--- a/less/tree.less
+++ b/less/tree.less
@@ -1,16 +1,5 @@
@import "./Common/Constants";
-.main {
- width: 100%;
- float: left;
- transition: all .0s ease-in-out;
- -ms-transition: all 0s ease-in-out;
- -webkit-transition: all 0s ease-in-out;
- -moz-transition: all .0s ease-in-out;
- height: 100%;
- background-color: white;
- border-left: 0px solid white;
-}
.resourceTree {
height: 100%;
From 4a8f40811226d9c9d11be619328966bd3bf7afa8 Mon Sep 17 00:00:00 2001
From: Steve Faulkner
Date: Tue, 5 Jan 2021 16:04:55 -0600
Subject: [PATCH 02/22] Add UX for Mongo indexing experiment (#368)
Co-authored-by: Tim Sander
---
src/Common/Constants.ts | 1 +
.../Settings/__snapshots__/SettingsComponent.test.tsx.snap | 4 ++++
src/Explorer/Explorer.ts | 5 +++++
src/Explorer/Panes/AddCollectionPane.ts | 6 ++++--
4 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/Common/Constants.ts b/src/Common/Constants.ts
index 1f6fb7ce1..48142e959 100644
--- a/src/Common/Constants.ts
+++ b/src/Common/Constants.ts
@@ -132,6 +132,7 @@ export class Features {
export class Flights {
public static readonly SettingsV2 = "settingsv2";
public static readonly MongoIndexEditor = "mongoindexeditor";
+ public static readonly MongoIndexing = "mongoindexing";
}
export class AfecFeatures {
diff --git a/src/Explorer/Controls/Settings/__snapshots__/SettingsComponent.test.tsx.snap b/src/Explorer/Controls/Settings/__snapshots__/SettingsComponent.test.tsx.snap
index d8cf13e79..00c1cda45 100644
--- a/src/Explorer/Controls/Settings/__snapshots__/SettingsComponent.test.tsx.snap
+++ b/src/Explorer/Controls/Settings/__snapshots__/SettingsComponent.test.tsx.snap
@@ -954,6 +954,7 @@ exports[`SettingsComponent renders 1`] = `
"isHostedDataExplorerEnabled": [Function],
"isLeftPaneExpanded": [Function],
"isLinkInjectionEnabled": [Function],
+ "isMongoIndexingEnabled": [Function],
"isNotebookEnabled": [Function],
"isNotebooksEnabledForAccount": [Function],
"isNotificationConsoleExpanded": [Function],
@@ -2229,6 +2230,7 @@ exports[`SettingsComponent renders 1`] = `
"isHostedDataExplorerEnabled": [Function],
"isLeftPaneExpanded": [Function],
"isLinkInjectionEnabled": [Function],
+ "isMongoIndexingEnabled": [Function],
"isNotebookEnabled": [Function],
"isNotebooksEnabledForAccount": [Function],
"isNotificationConsoleExpanded": [Function],
@@ -3517,6 +3519,7 @@ exports[`SettingsComponent renders 1`] = `
"isHostedDataExplorerEnabled": [Function],
"isLeftPaneExpanded": [Function],
"isLinkInjectionEnabled": [Function],
+ "isMongoIndexingEnabled": [Function],
"isNotebookEnabled": [Function],
"isNotebooksEnabledForAccount": [Function],
"isNotificationConsoleExpanded": [Function],
@@ -4792,6 +4795,7 @@ exports[`SettingsComponent renders 1`] = `
"isHostedDataExplorerEnabled": [Function],
"isLeftPaneExpanded": [Function],
"isLinkInjectionEnabled": [Function],
+ "isMongoIndexingEnabled": [Function],
"isNotebookEnabled": [Function],
"isNotebooksEnabledForAccount": [Function],
"isNotificationConsoleExpanded": [Function],
diff --git a/src/Explorer/Explorer.ts b/src/Explorer/Explorer.ts
index 612f24cc0..86c79b4c9 100644
--- a/src/Explorer/Explorer.ts
+++ b/src/Explorer/Explorer.ts
@@ -207,6 +207,7 @@ export default class Explorer {
public isCopyNotebookPaneEnabled: ko.Observable;
public isHostedDataExplorerEnabled: ko.Computed;
public isRightPanelV2Enabled: ko.Computed;
+ public isMongoIndexingEnabled: ko.Observable;
public canExceedMaximumValue: ko.Computed;
public shouldShowShareDialogContents: ko.Observable;
@@ -402,6 +403,7 @@ export default class Explorer {
this.isFeatureEnabled(Constants.Features.enableLinkInjection)
);
this.isGitHubPaneEnabled = ko.observable(false);
+ this.isMongoIndexingEnabled = ko.observable(false);
this.isPublishNotebookPaneEnabled = ko.observable(false);
this.isCopyNotebookPaneEnabled = ko.observable(false);
@@ -1896,6 +1898,9 @@ export default class Explorer {
if (!flights) {
return;
}
+ if (flights.indexOf(Constants.Flights.MongoIndexing) !== -1) {
+ this.isMongoIndexingEnabled(true);
+ }
}
public findSelectedCollection(): ViewModels.Collection {
diff --git a/src/Explorer/Panes/AddCollectionPane.ts b/src/Explorer/Panes/AddCollectionPane.ts
index 4818a3e47..3a8cefb63 100644
--- a/src/Explorer/Panes/AddCollectionPane.ts
+++ b/src/Explorer/Panes/AddCollectionPane.ts
@@ -92,7 +92,7 @@ export default class AddCollectionPane extends ContextualPaneBase {
public freeTierExceedThroughputTooltip: ko.Computed;
public canConfigureThroughput: ko.PureComputed;
public showUpsellMessage: ko.PureComputed;
- public shouldCreateMongoWildcardIndex: ko.Observable;
+ public shouldCreateMongoWildcardIndex: ko.Computed;
private _isSynapseLinkEnabled: ko.Computed;
@@ -654,7 +654,9 @@ export default class AddCollectionPane extends ContextualPaneBase {
});
});
- this.shouldCreateMongoWildcardIndex = ko.observable(false);
+ this.shouldCreateMongoWildcardIndex = ko.computed(function() {
+ return this.container.isMongoIndexingEnabled();
+ }, this);
}
public getSharedThroughputDefault(): boolean {
From 30e0001b7f1d19f8af84778f9dbb8b4df3b8ba6c Mon Sep 17 00:00:00 2001
From: Chris-MS-896 <64865559+Chris-MS-896@users.noreply.github.com>
Date: Tue, 5 Jan 2021 16:45:13 -0600
Subject: [PATCH 03/22] no message (#359)
---
tsconfig.strict.json | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tsconfig.strict.json b/tsconfig.strict.json
index c2cb50fad..03eb9e492 100644
--- a/tsconfig.strict.json
+++ b/tsconfig.strict.json
@@ -12,7 +12,8 @@
"./src/Bindings/ReactBindingHandler.ts",
"./src/Common/ArrayHashMap.ts",
"./src/Common/Constants.ts",
- "./src/Common/DeleteFeedback.ts",
+ "./src/Common/DeleteFeedback.ts",
+ "./src/Common/DocumentUtility.ts",
"./src/Common/EnvironmentUtility.ts",
"./src/Common/HashMap.ts",
"./src/Common/HeadersUtility.ts",
From 89dc0f394be34300dc68e928d797f7e63153bd79 Mon Sep 17 00:00:00 2001
From: Chris-MS-896 <64865559+Chris-MS-896@users.noreply.github.com>
Date: Wed, 6 Jan 2021 12:51:42 -0600
Subject: [PATCH 04/22] Add Spliter file to Master (#358)
---
src/Common/Splitter.ts | 15 ++++++++-------
.../__snapshots__/SettingsComponent.test.tsx.snap | 8 --------
tsconfig.strict.json | 3 ++-
3 files changed, 10 insertions(+), 16 deletions(-)
diff --git a/src/Common/Splitter.ts b/src/Common/Splitter.ts
index 823a88f99..5699247f1 100644
--- a/src/Common/Splitter.ts
+++ b/src/Common/Splitter.ts
@@ -23,10 +23,10 @@ export class Splitter {
public splitterId: string;
public leftSideId: string;
- public splitter: HTMLElement;
- public leftSide: HTMLElement;
- public lastX: number;
- public lastWidth: number;
+ public splitter!: HTMLElement;
+ public leftSide!: HTMLElement;
+ public lastX!: number;
+ public lastWidth!: number;
private isCollapsed: ko.Observable;
private bounds: SplitterBounds;
@@ -42,9 +42,10 @@ export class Splitter {
}
public initialize() {
- this.splitter = document.getElementById(this.splitterId);
- this.leftSide = document.getElementById(this.leftSideId);
-
+ if (document.getElementById(this.splitterId) !== null && document.getElementById(this.leftSideId) != null) {
+ this.splitter = document.getElementById(this.splitterId);
+ this.leftSide = document.getElementById(this.leftSideId);
+ }
const isVerticalSplitter: boolean = this.direction === SplitterDirection.Vertical;
const splitterOptions: JQueryUI.ResizableOptions = {
animate: true,
diff --git a/src/Explorer/Controls/Settings/__snapshots__/SettingsComponent.test.tsx.snap b/src/Explorer/Controls/Settings/__snapshots__/SettingsComponent.test.tsx.snap
index 00c1cda45..2075134f6 100644
--- a/src/Explorer/Controls/Settings/__snapshots__/SettingsComponent.test.tsx.snap
+++ b/src/Explorer/Controls/Settings/__snapshots__/SettingsComponent.test.tsx.snap
@@ -1180,11 +1180,9 @@ exports[`SettingsComponent renders 1`] = `
},
"direction": "vertical",
"isCollapsed": [Function],
- "leftSide": null,
"leftSideId": "resourcetree",
"onResizeStart": [Function],
"onResizeStop": [Function],
- "splitter": null,
"splitterId": "h_splitter1",
},
"stringInputPane": StringInputPane {
@@ -2456,11 +2454,9 @@ exports[`SettingsComponent renders 1`] = `
},
"direction": "vertical",
"isCollapsed": [Function],
- "leftSide": null,
"leftSideId": "resourcetree",
"onResizeStart": [Function],
"onResizeStop": [Function],
- "splitter": null,
"splitterId": "h_splitter1",
},
"stringInputPane": StringInputPane {
@@ -3745,11 +3741,9 @@ exports[`SettingsComponent renders 1`] = `
},
"direction": "vertical",
"isCollapsed": [Function],
- "leftSide": null,
"leftSideId": "resourcetree",
"onResizeStart": [Function],
"onResizeStop": [Function],
- "splitter": null,
"splitterId": "h_splitter1",
},
"stringInputPane": StringInputPane {
@@ -5021,11 +5015,9 @@ exports[`SettingsComponent renders 1`] = `
},
"direction": "vertical",
"isCollapsed": [Function],
- "leftSide": null,
"leftSideId": "resourcetree",
"onResizeStart": [Function],
"onResizeStop": [Function],
- "splitter": null,
"splitterId": "h_splitter1",
},
"stringInputPane": StringInputPane {
diff --git a/tsconfig.strict.json b/tsconfig.strict.json
index 03eb9e492..9042b7300 100644
--- a/tsconfig.strict.json
+++ b/tsconfig.strict.json
@@ -22,7 +22,8 @@
"./src/Common/MongoUtility.ts",
"./src/Common/ObjectCache.ts",
"./src/Common/ThemeUtility.ts",
- "./src/Common/UrlUtility.ts",
+ "./src/Common/UrlUtility.ts",
+ "./src/Common/Splitter.ts",
"./src/ConfigContext.ts",
"./src/Contracts/ActionContracts.ts",
"./src/Contracts/DataModels.ts",
From 08e8bf4bcf9eb162f49d4af55b37b08b3abfbe80 Mon Sep 17 00:00:00 2001
From: victor-meng <56978073+victor-meng@users.noreply.github.com>
Date: Thu, 7 Jan 2021 13:38:13 -0800
Subject: [PATCH 05/22] Fix two settings tab issues (#374)
---
src/Explorer/Controls/Settings/SettingsComponent.tsx | 4 ++--
.../ThroughputInputAutoPilotV3Component.tsx | 4 ++--
src/Explorer/Controls/Settings/SettingsUtils.tsx | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/Explorer/Controls/Settings/SettingsComponent.tsx b/src/Explorer/Controls/Settings/SettingsComponent.tsx
index 704bebb24..792d9d8e3 100644
--- a/src/Explorer/Controls/Settings/SettingsComponent.tsx
+++ b/src/Explorer/Controls/Settings/SettingsComponent.tsx
@@ -138,8 +138,8 @@ export class SettingsComponent extends React.Component,
newValue?: string
): void => {
- const newThroughput = getSanitizedInputValue(newValue, this.autoPilotInputMaxValue);
+ const newThroughput = getSanitizedInputValue(newValue);
this.props.onMaxAutoPilotThroughputChange(newThroughput);
};
@@ -435,7 +435,7 @@ export class ThroughputInputAutoPilotV3Component extends React.Component<
event: React.FormEvent,
newValue?: string
): void => {
- const newThroughput = getSanitizedInputValue(newValue, this.throughputInputMaxValue);
+ const newThroughput = getSanitizedInputValue(newValue);
if (this.overrideWithAutoPilotSettings()) {
this.props.onMaxAutoPilotThroughputChange(newThroughput);
} else {
diff --git a/src/Explorer/Controls/Settings/SettingsUtils.tsx b/src/Explorer/Controls/Settings/SettingsUtils.tsx
index 06b29b4b3..daa9f5e85 100644
--- a/src/Explorer/Controls/Settings/SettingsUtils.tsx
+++ b/src/Explorer/Controls/Settings/SettingsUtils.tsx
@@ -101,13 +101,13 @@ export const parseConflictResolutionProcedure = (procedureFromBackEnd: string):
return procedureFromBackEnd;
};
-export const getSanitizedInputValue = (newValueString: string, max: number): number => {
+export const getSanitizedInputValue = (newValueString: string, max?: number): number => {
const newValue = parseInt(newValueString);
if (isNaN(newValue)) {
return zeroValue;
}
// make sure new value does not exceed the maximum throughput
- return Math.min(newValue, max);
+ return max ? Math.min(newValue, max) : newValue;
};
export const isDirty = (current: isDirtyTypes, baseline: isDirtyTypes): boolean => {
From 6e619175c6f8d6d9104261085e5410e945ea71c8 Mon Sep 17 00:00:00 2001
From: Laurent Nguyen
Date: Fri, 8 Jan 2021 15:00:26 +0100
Subject: [PATCH 06/22] Fix missing scrollbar in left pane when too many
collections/notebooks (#375)
Constrain left pane container to height: 100% so that scrollbar show up when content wants to overflow.
The `main` classname seems too generic, but I left it alone (so I don't break anything), since this part will eventually be ported to React.
---
less/tree.less | 3 +++
1 file changed, 3 insertions(+)
diff --git a/less/tree.less b/less/tree.less
index e59a00a87..56a5ee38e 100644
--- a/less/tree.less
+++ b/less/tree.less
@@ -4,6 +4,9 @@
.resourceTree {
height: 100%;
flex: 0 0 auto;
+ .main {
+ height: 100%;
+ }
}
.resourceTreeScroll {
From ceefd7c615a3cecddf05461284c51ce58314c02a Mon Sep 17 00:00:00 2001
From: Steve Faulkner
Date: Fri, 8 Jan 2021 12:36:44 -0600
Subject: [PATCH 07/22] Fix Conflict Resolution path setting (#377)
* Fix Conflict Resolution path setting
* Fix test
---
src/Explorer/Controls/Settings/SettingsComponent.test.tsx | 2 +-
src/Explorer/Controls/Settings/SettingsComponent.tsx | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Explorer/Controls/Settings/SettingsComponent.test.tsx b/src/Explorer/Controls/Settings/SettingsComponent.test.tsx
index c8ea4f390..01d0c8d6d 100644
--- a/src/Explorer/Controls/Settings/SettingsComponent.test.tsx
+++ b/src/Explorer/Controls/Settings/SettingsComponent.test.tsx
@@ -231,7 +231,7 @@ describe("SettingsComponent", () => {
it("getUpdatedConflictResolutionPolicy", () => {
const wrapper = shallow();
- const conflictResolutionPolicyPath = "_ts";
+ const conflictResolutionPolicyPath = "/_ts";
const conflictResolutionPolicyProcedure = "sample_sproc";
const expectSprocPath =
"/dbs/" + collection.databaseId + "/colls/" + collection.id() + "/sprocs/" + conflictResolutionPolicyProcedure;
diff --git a/src/Explorer/Controls/Settings/SettingsComponent.tsx b/src/Explorer/Controls/Settings/SettingsComponent.tsx
index 792d9d8e3..8b901bb19 100644
--- a/src/Explorer/Controls/Settings/SettingsComponent.tsx
+++ b/src/Explorer/Controls/Settings/SettingsComponent.tsx
@@ -684,7 +684,7 @@ export class SettingsComponent extends React.Component
Date: Fri, 8 Jan 2021 20:14:12 -0600
Subject: [PATCH 08/22] add file offerUtility to tsconfig (#356)
---
src/Common/OfferUtility.ts | 9 ++++++---
src/Contracts/DataModels.ts | 6 +++---
tsconfig.strict.json | 3 ++-
3 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/src/Common/OfferUtility.ts b/src/Common/OfferUtility.ts
index a6e1377fe..6d7f6bf7f 100644
--- a/src/Common/OfferUtility.ts
+++ b/src/Common/OfferUtility.ts
@@ -2,8 +2,11 @@ import { Offer, SDKOfferDefinition } from "../Contracts/DataModels";
import { OfferResponse } from "@azure/cosmos";
import { HttpHeaders } from "./Constants";
-export const parseSDKOfferResponse = (offerResponse: OfferResponse): Offer => {
- const offerDefinition: SDKOfferDefinition = offerResponse?.resource;
+export const parseSDKOfferResponse = (offerResponse: OfferResponse): Offer | undefined => {
+ const offerDefinition: SDKOfferDefinition | undefined = offerResponse?.resource;
+ if (!offerDefinition) {
+ return undefined;
+ }
const offerContent = offerDefinition.content;
if (!offerContent) {
return undefined;
@@ -12,7 +15,7 @@ export const parseSDKOfferResponse = (offerResponse: OfferResponse): Offer => {
const minimumThroughput = offerContent.collectionThroughputInfo?.minimumRUForCollection;
const autopilotSettings = offerContent.offerAutopilotSettings;
- if (autopilotSettings) {
+ if (autopilotSettings && autopilotSettings.maxThroughput && minimumThroughput) {
return {
id: offerDefinition.id,
autoscaleMaxThroughput: autopilotSettings.maxThroughput,
diff --git a/src/Contracts/DataModels.ts b/src/Contracts/DataModels.ts
index 505090c18..1ee61c489 100644
--- a/src/Contracts/DataModels.ts
+++ b/src/Contracts/DataModels.ts
@@ -210,9 +210,9 @@ export interface QueryMetrics {
export interface Offer {
id: string;
- autoscaleMaxThroughput: number;
- manualThroughput: number;
- minimumThroughput: number;
+ autoscaleMaxThroughput: number | undefined;
+ manualThroughput: number | undefined;
+ minimumThroughput: number | undefined;
offerDefinition?: SDKOfferDefinition;
offerReplacePending: boolean;
}
diff --git a/tsconfig.strict.json b/tsconfig.strict.json
index 9042b7300..8faaf8d07 100644
--- a/tsconfig.strict.json
+++ b/tsconfig.strict.json
@@ -20,7 +20,8 @@
"./src/Common/Logger.ts",
"./src/Common/MessageHandler.ts",
"./src/Common/MongoUtility.ts",
- "./src/Common/ObjectCache.ts",
+ "./src/Common/ObjectCache.ts",
+ "./src/Common/OfferUtility.ts",
"./src/Common/ThemeUtility.ts",
"./src/Common/UrlUtility.ts",
"./src/Common/Splitter.ts",
From 64905977361b23425e16ef6702a228506754514a Mon Sep 17 00:00:00 2001
From: Chris-MS-896 <64865559+Chris-MS-896@users.noreply.github.com>
Date: Fri, 8 Jan 2021 20:29:15 -0600
Subject: [PATCH 09/22] add CollapsiblePanel/CollapsiblePanelComponent.ts and
/ErrorDisplayComponent to Master (#357)
---
.../CollapsiblePanel/CollapsiblePanelComponent.ts | 4 ++--
.../Controls/InputTypeahead/InputTypeahead.ts | 15 ++++++---------
tsconfig.strict.json | 6 ++++--
3 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/src/Explorer/Controls/CollapsiblePanel/CollapsiblePanelComponent.ts b/src/Explorer/Controls/CollapsiblePanel/CollapsiblePanelComponent.ts
index 959980371..b0f398f1a 100644
--- a/src/Explorer/Controls/CollapsiblePanel/CollapsiblePanelComponent.ts
+++ b/src/Explorer/Controls/CollapsiblePanel/CollapsiblePanelComponent.ts
@@ -42,7 +42,7 @@ interface CollapsiblePanelParams {
* Use the optional "collapseToLeft" parameter to collapse to the left.
*/
class CollapsiblePanelViewModel {
- private params: CollapsiblePanelParams;
+ public params: CollapsiblePanelParams;
private isCollapsed: ko.Observable;
public constructor(params: CollapsiblePanelParams) {
@@ -50,7 +50,7 @@ class CollapsiblePanelViewModel {
this.isCollapsed = params.isCollapsed || ko.observable(false);
}
- private toggleCollapse(): void {
+ public toggleCollapse(): void {
this.isCollapsed(!this.isCollapsed());
}
}
diff --git a/src/Explorer/Controls/InputTypeahead/InputTypeahead.ts b/src/Explorer/Controls/InputTypeahead/InputTypeahead.ts
index 9a7f9257f..aff4a14fd 100644
--- a/src/Explorer/Controls/InputTypeahead/InputTypeahead.ts
+++ b/src/Explorer/Controls/InputTypeahead/InputTypeahead.ts
@@ -71,7 +71,7 @@ interface InputTypeaheadParams {
/**
* This function gets called when pressing ENTER on the input box
*/
- submitFct?: (inputValue: string, selection: Item) => void;
+ submitFct?: (inputValue: string | null, selection: Item | null) => void;
/**
* Typehead comes with a Search button that we normally remove.
@@ -88,8 +88,8 @@ interface OnClickItem {
}
interface Cache {
- inputValue: string;
- selection: Item;
+ inputValue: string | null;
+ selection: Item | null;
}
class InputTypeaheadViewModel {
@@ -98,15 +98,12 @@ class InputTypeaheadViewModel {
private params: InputTypeaheadParams;
private cache: Cache;
- private inputValue: string;
- private selection: Item;
public constructor(params: InputTypeaheadParams) {
this.instanceNumber = InputTypeaheadViewModel.instanceCount++;
this.params = params;
this.params.choices.subscribe(this.initializeTypeahead.bind(this));
-
this.cache = {
inputValue: null,
selection: null
@@ -161,7 +158,7 @@ class InputTypeaheadViewModel {
}
}
- $.typeahead(options);
+ ($ as any).typeahead(options);
}
/**
@@ -177,11 +174,11 @@ class InputTypeaheadViewModel {
* Use ko's "template: afterRender" callback to do that without actually using any template.
* Another way is to call it within setTimeout() in constructor.
*/
- private afterRender(): void {
+ public afterRender(): void {
this.initializeTypeahead();
}
- private submit(): void {
+ public submit(): void {
if (this.params.submitFct) {
this.params.submitFct(this.cache.inputValue, this.cache.selection);
}
diff --git a/tsconfig.strict.json b/tsconfig.strict.json
index 8faaf8d07..ae44faaaf 100644
--- a/tsconfig.strict.json
+++ b/tsconfig.strict.json
@@ -41,8 +41,10 @@
"./src/Definitions/jquery.d.ts",
"./src/Definitions/plotly.js-cartesian-dist.d-min.ts",
"./src/Definitions/svg.d.ts",
- "./src/Explorer/Controls/ErrorDisplayComponent/ErrorDisplayComponent.ts",
- "./src/Explorer/Controls/GitHub/GitHubStyleConstants.ts",
+ "./src/Explorer/Controls/ErrorDisplayComponent/ErrorDisplayComponent.ts",
+ "./src/Explorer/Controls/CollapsiblePanel/CollapsiblePanelComponent.ts",
+ "./src/Explorer/Controls/GitHub/GitHubStyleConstants.ts",
+ "./src/Explorer/Controls/InputTypeahead/InputTypeahead.ts",
"./src/Explorer/Controls/SmartUi/InputUtils.ts",
"./src/Explorer/Graph/GraphExplorerComponent/__mocks__/GremlinClient.ts",
"./src/Explorer/Notebook/FileSystemUtil.ts",
From 76d7f00a908ca631ea6cab06a71ee7c604619088 Mon Sep 17 00:00:00 2001
From: Chris-MS-896 <64865559+Chris-MS-896@users.noreply.github.com>
Date: Fri, 8 Jan 2021 20:56:59 -0600
Subject: [PATCH 10/22] Add two files of Table to master (#364)
---
src/Explorer/Tables/DataTable/CacheBase.ts | 2 +-
src/Explorer/Tables/Entities.ts | 2 +-
tsconfig.strict.json | 2 ++
3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/Explorer/Tables/DataTable/CacheBase.ts b/src/Explorer/Tables/DataTable/CacheBase.ts
index e18d1dc1b..e5df50dd4 100644
--- a/src/Explorer/Tables/DataTable/CacheBase.ts
+++ b/src/Explorer/Tables/DataTable/CacheBase.ts
@@ -1,5 +1,5 @@
abstract class CacheBase {
- public data: T[];
+ public data: T[] | null;
public sortOrder: any;
public serverCallInProgress: boolean;
diff --git a/src/Explorer/Tables/Entities.ts b/src/Explorer/Tables/Entities.ts
index 0972e8410..f5f3f3386 100644
--- a/src/Explorer/Tables/Entities.ts
+++ b/src/Explorer/Tables/Entities.ts
@@ -7,7 +7,7 @@ export interface ITableEntity {
export interface ITableEntityForTablesAPI extends ITableEntity {
PartitionKey: ITableEntityAttribute;
RowKey: ITableEntityAttribute;
- Timestamp?: ITableEntityAttribute;
+ Timestamp: ITableEntityAttribute;
}
export interface ITableEntityAttribute {
diff --git a/tsconfig.strict.json b/tsconfig.strict.json
index ae44faaaf..e0432eb30 100644
--- a/tsconfig.strict.json
+++ b/tsconfig.strict.json
@@ -61,6 +61,8 @@
"./src/Explorer/Tables/Constants.ts",
"./src/Explorer/Tables/CqlUtilities.ts",
"./src/Explorer/Tables/QueryBuilder/DateTimeUtilities.ts",
+ "./src/Explorer/Tables/DataTable/CacheBase.ts",
+ "./src/Explorer/Tables/Entities.ts",
"./src/Explorer/Tabs/TabComponents.ts",
"./src/GitHub/GitHubConnector.ts",
"./src/Index.ts",
From 983c9201bbf0c32a2ff9d9b1eb335a843dd53761 Mon Sep 17 00:00:00 2001
From: Chris-MS-896 <64865559+Chris-MS-896@users.noreply.github.com>
Date: Fri, 8 Jan 2021 21:14:53 -0600
Subject: [PATCH 11/22] Add two files of GraphExplorer component in Master
(#365)
---
src/Explorer/Graph/GraphExplorerComponent/GraphData.ts | 6 +++---
.../Notebook/NotebookComponent/__mocks__/rx-jupyter.ts | 10 +++++-----
tsconfig.strict.json | 3 +++
3 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/src/Explorer/Graph/GraphExplorerComponent/GraphData.ts b/src/Explorer/Graph/GraphExplorerComponent/GraphData.ts
index 420d98e5e..9cbf502bd 100644
--- a/src/Explorer/Graph/GraphExplorerComponent/GraphData.ts
+++ b/src/Explorer/Graph/GraphExplorerComponent/GraphData.ts
@@ -413,13 +413,13 @@ export class GraphData {
* @param node
* @param prop
*/
- public static getNodePropValue(node: D3Node, prop: string): string | number | boolean {
+ public static getNodePropValue(node: D3Node, prop: string): undefined | string | number | boolean {
if (node.hasOwnProperty(prop)) {
return (node as any)[prop];
}
// This is DocDB specific
- if (node.hasOwnProperty("properties") && node.properties.hasOwnProperty(prop)) {
+ if (node.properties && node.properties.hasOwnProperty(prop)) {
return node.properties[prop][0]["value"];
}
@@ -496,7 +496,7 @@ export class GraphData {
* Get list of children ids of a given vertex
* @param vertex
*/
- private static getChildrenId(vertex: GremlinVertex): string[] {
+ public static getChildrenId(vertex: GremlinVertex): string[] {
const ids = {}; // HashSet
if (vertex.hasOwnProperty("outE")) {
let outE = vertex.outE;
diff --git a/src/Explorer/Notebook/NotebookComponent/__mocks__/rx-jupyter.ts b/src/Explorer/Notebook/NotebookComponent/__mocks__/rx-jupyter.ts
index 1472d5f5d..564527eec 100644
--- a/src/Explorer/Notebook/NotebookComponent/__mocks__/rx-jupyter.ts
+++ b/src/Explorer/Notebook/NotebookComponent/__mocks__/rx-jupyter.ts
@@ -1,14 +1,14 @@
import { Observable, of } from "rxjs";
-import { AjaxResponse } from "rxjs/ajax";
-import { ServerConfig } from "rx-jupyter";
+import { AjaxRequest, AjaxResponse } from "rxjs/ajax";
+import { ServerConfig } from "@nteract/types";
let fakeAjaxResponse: AjaxResponse = {
- originalEvent: undefined,
+ originalEvent: (undefined),
xhr: new XMLHttpRequest(),
- request: null,
+ request: (null),
status: 200,
response: {},
- responseText: null,
+ responseText: "",
responseType: "json"
};
export const sessions = {
diff --git a/tsconfig.strict.json b/tsconfig.strict.json
index e0432eb30..cc2adecd8 100644
--- a/tsconfig.strict.json
+++ b/tsconfig.strict.json
@@ -47,6 +47,9 @@
"./src/Explorer/Controls/InputTypeahead/InputTypeahead.ts",
"./src/Explorer/Controls/SmartUi/InputUtils.ts",
"./src/Explorer/Graph/GraphExplorerComponent/__mocks__/GremlinClient.ts",
+ "./src/Explorer/Graph/GraphExplorerComponent/EdgeInfoCache.ts",
+ "./src/Explorer/Graph/GraphExplorerComponent/GraphData.ts",
+ "./src/Explorer/Notebook/NotebookComponent/__mocks__/rx-jupyter.ts",
"./src/Explorer/Notebook/FileSystemUtil.ts",
"./src/Explorer/Notebook/NTeractUtil.ts",
"./src/Explorer/Notebook/NotebookComponent/actions.ts",
From a4a367a21236baf95883963d0aac298cd8708d9d Mon Sep 17 00:00:00 2001
From: Chris-MS-896 <64865559+Chris-MS-896@users.noreply.github.com>
Date: Fri, 8 Jan 2021 21:56:29 -0600
Subject: [PATCH 12/22] Add all arm request related files to Matser (#373)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* “minor changes”
* 'changes for unit test'
---
src/Utils/arm/request.test.ts | 27 +++++++++++++++++++++++++++
src/Utils/arm/request.ts | 10 +++++++++-
tsconfig.strict.json | 19 +++++++++++++++++++
3 files changed, 55 insertions(+), 1 deletion(-)
diff --git a/src/Utils/arm/request.test.ts b/src/Utils/arm/request.test.ts
index 89b6d488a..6ed76093c 100644
--- a/src/Utils/arm/request.test.ts
+++ b/src/Utils/arm/request.test.ts
@@ -1,5 +1,7 @@
import { armRequest } from "./request";
import fetch from "node-fetch";
+import { updateUserContext } from "../../UserContext";
+import { AuthType } from "../../AuthType";
interface Global {
Headers: unknown;
@@ -8,6 +10,11 @@ interface Global {
((global as unknown) as Global).Headers = ((fetch as unknown) as Global).Headers;
describe("ARM request", () => {
+ window.authType = AuthType.AAD;
+ updateUserContext({
+ authorizationToken: "some-token"
+ });
+
it("should call window.fetch", async () => {
window.fetch = jest.fn().mockResolvedValue({
ok: true,
@@ -48,4 +55,24 @@ describe("ARM request", () => {
).rejects.toThrow();
expect(window.fetch).toHaveBeenCalledTimes(2);
});
+
+ it("should throw token error", async () => {
+ window.authType = AuthType.AAD;
+ updateUserContext({
+ authorizationToken: undefined
+ });
+ const headers = new Headers();
+ headers.set("location", "https://foo.com/operationStatus");
+ window.fetch = jest.fn().mockResolvedValue({
+ ok: true,
+ headers,
+ status: 200,
+ json: async () => {
+ return { status: "Failed" };
+ }
+ });
+ await expect(() =>
+ armRequest({ apiVersion: "2001-01-01", host: "https://foo.com", path: "foo", method: "GET" })
+ ).rejects.toThrow("No authority token provided");
+ });
});
diff --git a/src/Utils/arm/request.ts b/src/Utils/arm/request.ts
index 23229d46b..429f69c51 100644
--- a/src/Utils/arm/request.ts
+++ b/src/Utils/arm/request.ts
@@ -30,7 +30,7 @@ export class ARMError extends Error {
Object.setPrototypeOf(this, ARMError.prototype);
}
- public code: string | number;
+ public code?: string | number;
}
interface ARMQueryParams {
@@ -63,6 +63,10 @@ export async function armRequest({
queryParams.metricNames && url.searchParams.append("metricnames", queryParams.metricNames);
}
+ if (!userContext.authorizationToken) {
+ throw new Error("No authority token provided");
+ }
+
const response = await window.fetch(url.href, {
method,
headers: {
@@ -98,6 +102,10 @@ export async function armRequest({
}
async function getOperationStatus(operationStatusUrl: string) {
+ if (!userContext.authorizationToken) {
+ throw new Error("No authority token provided");
+ }
+
const response = await window.fetch(operationStatusUrl, {
headers: {
Authorization: userContext.authorizationToken
diff --git a/tsconfig.strict.json b/tsconfig.strict.json
index cc2adecd8..07aa3a115 100644
--- a/tsconfig.strict.json
+++ b/tsconfig.strict.json
@@ -89,6 +89,25 @@
"./src/Utils/StringUtils.ts",
"./src/Utils/WindowUtils.ts",
"./src/Utils/arm/generatedClients/2020-04-01/types.ts",
+ "./src/Utils/arm/generatedClients/2020-04-01/cassandraResources.ts",
+ "./src/Utils/arm/generatedClients/2020-04-01/collection.ts",
+ "./src/Utils/arm/generatedClients/2020-04-01/collectionPartition.ts",
+ "./src/Utils/arm/generatedClients/2020-04-01/collectionPartitionRegion.ts",
+ "./src/Utils/arm/generatedClients/2020-04-01/collectionRegion.ts",
+ "./src/Utils/arm/generatedClients/2020-04-01/database.ts",
+ "./src/Utils/arm/generatedClients/2020-04-01/databaseAccountRegion.ts",
+ "./src/Utils/arm/generatedClients/2020-04-01/databaseAccounts.ts",
+ "./src/Utils/arm/generatedClients/2020-04-01/gremlinResources.ts",
+ "./src/Utils/arm/generatedClients/2020-04-01/mongoDBResources.ts",
+ "./src/Utils/arm/generatedClients/2020-04-01/operations.ts",
+ "./src/Utils/arm/generatedClients/2020-04-01/partitionKeyRangeId.ts",
+ "./src/Utils/arm/generatedClients/2020-04-01/partitionKeyRangeIdRegion.ts",
+ "./src/Utils/arm/generatedClients/2020-04-01/percentile.ts",
+ "./src/Utils/arm/generatedClients/2020-04-01/percentileSourceTarget.ts",
+ "./src/Utils/arm/generatedClients/2020-04-01/percentileTarget.ts",
+ "./src/Utils/arm/generatedClients/2020-04-01/sqlResources.ts",
+ "./src/Utils/arm/generatedClients/2020-04-01/tableResources.ts",
+ "./src/Utils/arm/request.ts",
"./src/quickstart.ts",
"./src/setupTests.ts",
"./src/workers/upload/definitions.ts"
From 19fa5e17a577dd6117aeeb9ffd95ddc19244d8c4 Mon Sep 17 00:00:00 2001
From: Steve Faulkner
Date: Fri, 8 Jan 2021 22:20:06 -0600
Subject: [PATCH 13/22] Fix JSONEditor bug with undefined value (#379)
---
.../Controls/JsonEditor/JsonEditorComponent.ts | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/Explorer/Controls/JsonEditor/JsonEditorComponent.ts b/src/Explorer/Controls/JsonEditor/JsonEditorComponent.ts
index 459f3b884..7611fe567 100644
--- a/src/Explorer/Controls/JsonEditor/JsonEditorComponent.ts
+++ b/src/Explorer/Controls/JsonEditor/JsonEditorComponent.ts
@@ -59,10 +59,12 @@ export class JsonEditorViewModel extends WaitsForTemplateViewModel {
this.params = params;
this.params.content.subscribe((newValue: string) => {
- if (!!this.editor) {
- this.editor.getModel().setValue(newValue);
- } else {
- this.createEditor(newValue, this.configureEditor.bind(this));
+ if (newValue) {
+ if (!!this.editor) {
+ this.editor.getModel().setValue(newValue);
+ } else {
+ this.createEditor(newValue, this.configureEditor.bind(this));
+ }
}
});
From 6627172a520901be2400cd5a8f9b6e2f55742f3a Mon Sep 17 00:00:00 2001
From: Steve Faulkner
Date: Fri, 8 Jan 2021 22:20:40 -0600
Subject: [PATCH 14/22] Add Architecture Diagram to README (#380)
---
README.md | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/README.md b/README.md
index 9057742d5..fb28c5d7a 100644
--- a/README.md
+++ b/README.md
@@ -69,6 +69,10 @@ Jest and Puppeteer are used for end to end browser based tests and are contained
We generally adhere to the release strategy [documented by the Azure SDK Guidelines](https://azure.github.io/azure-sdk/policies_repobranching.html#release-branches). Most releases should happen from the master branch. If master contains commits that cannot be released, you may create a release from a `release/` or `hotfix/` branch. See linked documentation for more details.
+### Architechture
+
+[](https://mermaid-js.github.io/mermaid-live-editor/#/edit/eyJjb2RlIjoiZ3JhcGggTFJcbiAgaG9zdGVkKGh0dHBzOi8vY29zbW9zLmF6dXJlLmNvbSlcbiAgcG9ydGFsKFBvcnRhbClcbiAgZW11bGF0b3IoRW11bGF0b3IpXG4gIGFhZFtBQURdXG4gIHJlc291cmNlVG9rZW5bUmVzb3VyY2UgVG9rZW5dXG4gIGNvbm5lY3Rpb25TdHJpbmdbQ29ubmVjdGlvbiBTdHJpbmddXG4gIHBvcnRhbFRva2VuW0VuY3J5cHRlZCBQb3J0YWwgVG9rZW5dXG4gIG1hc3RlcktleVtNYXN0ZXIgS2V5XVxuICBhcm1bQVJNIFJlc291cmNlIFByb3ZpZGVyXVxuICBkYXRhcGxhbmVbRGF0YSBQbGFuZV1cbiAgcHJveHlbUG9ydGFsIEFQSSBQcm94eV1cbiAgc3FsW1NRTF1cbiAgbW9uZ29bTW9uZ29dXG4gIHRhYmxlc1tUYWJsZXNdXG4gIGNhc3NhbmRyYVtDYXNzYW5kcmFdXG4gIGdyYWZbR3JhcGhdXG5cblxuICBlbXVsYXRvciAtLT4gbWFzdGVyS2V5IC0tLS0-IGRhdGFwbGFuZVxuICBwb3J0YWwgLS0-IGFhZFxuICBob3N0ZWQgLS0-IHBvcnRhbFRva2VuICYgcmVzb3VyY2VUb2tlbiAmIGNvbm5lY3Rpb25TdHJpbmcgJiBhYWRcbiAgYWFkIC0tLT4gYXJtXG4gIGFhZCAtLS0-IGRhdGFwbGFuZVxuICBhYWQgLS0tPiBwcm94eVxuICByZXNvdXJjZVRva2VuIC0tLT4gc3FsIC0tPiBkYXRhcGxhbmVcbiAgcG9ydGFsVG9rZW4gLS0tPiBwcm94eVxuICBwcm94eSAtLT4gZGF0YXBsYW5lXG4gIGNvbm5lY3Rpb25TdHJpbmcgLS0-IHNxbCAmIG1vbmdvICYgY2Fzc2FuZHJhICYgZ3JhZiAmIHRhYmxlc1xuICBzcWwgLS0-IGRhdGFwbGFuZVxuICB0YWJsZXMgLS0-IGRhdGFwbGFuZVxuICBtb25nbyAtLT4gcHJveHlcbiAgY2Fzc2FuZHJhIC0tPiBwcm94eVxuICBncmFmIC0tPiBwcm94eVxuXG5cdFx0IiwibWVybWFpZCI6eyJ0aGVtZSI6ImRlZmF1bHQifSwidXBkYXRlRWRpdG9yIjpmYWxzZX0)
+
# Contributing
Please read the [contribution guidelines](./CONTRIBUTING.md).
From 2d98c5d269293fdf2c853369b4270c5294de57b3 Mon Sep 17 00:00:00 2001
From: Chris-MS-896 <64865559+Chris-MS-896@users.noreply.github.com>
Date: Fri, 8 Jan 2021 22:51:50 -0600
Subject: [PATCH 15/22] add ArraysByKeyCache.ts (#366)
* 'add ArraysByKeyCache'
* "minor change"
---
.../ArraysByKeyCache.ts | 12 +++++++----
tsconfig.strict.json | 21 ++++++++++---------
2 files changed, 19 insertions(+), 14 deletions(-)
diff --git a/src/Explorer/Graph/GraphExplorerComponent/ArraysByKeyCache.ts b/src/Explorer/Graph/GraphExplorerComponent/ArraysByKeyCache.ts
index 81324ecfb..0a4d8fd85 100644
--- a/src/Explorer/Graph/GraphExplorerComponent/ArraysByKeyCache.ts
+++ b/src/Explorer/Graph/GraphExplorerComponent/ArraysByKeyCache.ts
@@ -11,7 +11,9 @@ export class ArraysByKeyCache {
public constructor(maxNbElements: number) {
this.maxNbElements = maxNbElements;
- this.clear();
+ this.keyQueue = [];
+ this.cache = {};
+ this.totalElements = 0;
}
public clear(): void {
@@ -58,7 +60,7 @@ export class ArraysByKeyCache {
* @param startIndex
* @param pageSize
*/
- public retrieve(key: string, startIndex: number, pageSize: number): T[] {
+ public retrieve(key: string, startIndex: number, pageSize: number): T[] | null {
if (!this.cache.hasOwnProperty(key)) {
return null;
}
@@ -77,8 +79,10 @@ export class ArraysByKeyCache {
private reduceCacheSize(): void {
// remove an key and its array
const oldKey = this.keyQueue.shift();
- this.totalElements -= this.cache[oldKey].length;
- delete this.cache[oldKey];
+ if (oldKey) {
+ this.totalElements -= this.cache[oldKey].length;
+ delete this.cache[oldKey];
+ }
}
/**
diff --git a/tsconfig.strict.json b/tsconfig.strict.json
index 07aa3a115..e9fca85d6 100644
--- a/tsconfig.strict.json
+++ b/tsconfig.strict.json
@@ -12,19 +12,19 @@
"./src/Bindings/ReactBindingHandler.ts",
"./src/Common/ArrayHashMap.ts",
"./src/Common/Constants.ts",
- "./src/Common/DeleteFeedback.ts",
- "./src/Common/DocumentUtility.ts",
+ "./src/Common/DeleteFeedback.ts",
+ "./src/Common/DocumentUtility.ts",
"./src/Common/EnvironmentUtility.ts",
"./src/Common/HashMap.ts",
"./src/Common/HeadersUtility.ts",
"./src/Common/Logger.ts",
"./src/Common/MessageHandler.ts",
"./src/Common/MongoUtility.ts",
- "./src/Common/ObjectCache.ts",
- "./src/Common/OfferUtility.ts",
+ "./src/Common/ObjectCache.ts",
+ "./src/Common/OfferUtility.ts",
"./src/Common/ThemeUtility.ts",
- "./src/Common/UrlUtility.ts",
- "./src/Common/Splitter.ts",
+ "./src/Common/UrlUtility.ts",
+ "./src/Common/Splitter.ts",
"./src/ConfigContext.ts",
"./src/Contracts/ActionContracts.ts",
"./src/Contracts/DataModels.ts",
@@ -41,12 +41,13 @@
"./src/Definitions/jquery.d.ts",
"./src/Definitions/plotly.js-cartesian-dist.d-min.ts",
"./src/Definitions/svg.d.ts",
- "./src/Explorer/Controls/ErrorDisplayComponent/ErrorDisplayComponent.ts",
- "./src/Explorer/Controls/CollapsiblePanel/CollapsiblePanelComponent.ts",
- "./src/Explorer/Controls/GitHub/GitHubStyleConstants.ts",
- "./src/Explorer/Controls/InputTypeahead/InputTypeahead.ts",
+ "./src/Explorer/Controls/ErrorDisplayComponent/ErrorDisplayComponent.ts",
+ "./src/Explorer/Controls/CollapsiblePanel/CollapsiblePanelComponent.ts",
+ "./src/Explorer/Controls/GitHub/GitHubStyleConstants.ts",
+ "./src/Explorer/Controls/InputTypeahead/InputTypeahead.ts",
"./src/Explorer/Controls/SmartUi/InputUtils.ts",
"./src/Explorer/Graph/GraphExplorerComponent/__mocks__/GremlinClient.ts",
+ "./src/Explorer/Graph/GraphExplorerComponent/ArraysByKeyCache.ts",
"./src/Explorer/Graph/GraphExplorerComponent/EdgeInfoCache.ts",
"./src/Explorer/Graph/GraphExplorerComponent/GraphData.ts",
"./src/Explorer/Notebook/NotebookComponent/__mocks__/rx-jupyter.ts",
From 767d46480ef2d28a119eb4378a9e78e27fbef2a3 Mon Sep 17 00:00:00 2001
From: Steve Faulkner
Date: Mon, 11 Jan 2021 16:16:40 -0600
Subject: [PATCH 16/22] Revert TablesEntitiyListViewModel changes (#382)
---
src/Common/ErrorHandlingUtils.ts | 6 +-
.../DataTable/TableEntityListViewModel.ts | 163 +++++++++++++-----
2 files changed, 121 insertions(+), 48 deletions(-)
diff --git a/src/Common/ErrorHandlingUtils.ts b/src/Common/ErrorHandlingUtils.ts
index 0491fab77..440b07b25 100644
--- a/src/Common/ErrorHandlingUtils.ts
+++ b/src/Common/ErrorHandlingUtils.ts
@@ -21,7 +21,7 @@ export const handleError = (error: string | ARMError | Error, area: string, cons
sendNotificationForError(errorMessage, errorCode);
};
-export const getErrorMessage = (error: string | Error): string => {
+export const getErrorMessage = (error: string | Error = ""): string => {
const errorMessage = typeof error === "string" ? error : error.message;
return replaceKnownError(errorMessage);
};
@@ -45,10 +45,10 @@ const sendNotificationForError = (errorMessage: string, errorCode: number | stri
const replaceKnownError = (errorMessage: string): string => {
if (
window.dataExplorer?.subscriptionType() === SubscriptionType.Internal &&
- errorMessage.indexOf("SharedOffer is Disabled for your account") >= 0
+ errorMessage?.indexOf("SharedOffer is Disabled for your account") >= 0
) {
return "Database throughput is not supported for internal subscriptions.";
- } else if (errorMessage.indexOf("Partition key paths must contain only valid") >= 0) {
+ } else if (errorMessage?.indexOf("Partition key paths must contain only valid") >= 0) {
return "Partition key paths must contain only valid characters and not contain a trailing slash or wildcard character.";
}
diff --git a/src/Explorer/Tables/DataTable/TableEntityListViewModel.ts b/src/Explorer/Tables/DataTable/TableEntityListViewModel.ts
index 668ec71db..2a3e7765f 100644
--- a/src/Explorer/Tables/DataTable/TableEntityListViewModel.ts
+++ b/src/Explorer/Tables/DataTable/TableEntityListViewModel.ts
@@ -16,14 +16,75 @@ import * as Entities from "../Entities";
import QueryTablesTab from "../../Tabs/QueryTablesTab";
import * as TableEntityProcessor from "../TableEntityProcessor";
import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
-import * as DataModels from "../../../Contracts/DataModels";
import * as ViewModels from "../../../Contracts/ViewModels";
-import { getErrorMessage, getErrorStack } from "../../../Common/ErrorHandlingUtils";
interface IListTableEntitiesSegmentedResult extends Entities.IListTableEntitiesResult {
ExceedMaximumRetries?: boolean;
}
+export interface ErrorDataModel {
+ message: string;
+ severity?: string;
+ location?: {
+ start: string;
+ end: string;
+ };
+ code?: string;
+}
+
+function parseError(err: any): ErrorDataModel[] {
+ try {
+ return _parse(err);
+ } catch (e) {
+ return [{ message: JSON.stringify(err) }];
+ }
+}
+
+function _parse(err: any): ErrorDataModel[] {
+ var normalizedErrors: ErrorDataModel[] = [];
+ if (err.message && !err.code) {
+ normalizedErrors.push(err);
+ } else {
+ const innerErrors: any[] = _getInnerErrors(err.message);
+ normalizedErrors = innerErrors.map(innerError =>
+ typeof innerError === "string" ? { message: innerError } : innerError
+ );
+ }
+
+ return normalizedErrors;
+}
+
+function _getInnerErrors(message: string): any[] {
+ /*
+ The backend error message has an inner-message which is a stringified object.
+ For SQL errors, the "errors" property is an array of SqlErrorDataModel.
+ Example:
+ "Message: {"Errors":["Resource with specified id or name already exists"]}\r\nActivityId: 80005000008d40b6a, Request URI: /apps/19000c000c0a0005/services/mctestdocdbprod-MasterService-0-00066ab9937/partitions/900005f9000e676fb8/replicas/13000000000955p"
+ For non-SQL errors the "Errors" propery is an array of string.
+ Example:
+ "Message: {"errors":[{"severity":"Error","location":{"start":7,"end":8},"code":"SC1001","message":"Syntax error, incorrect syntax near '.'."}]}\r\nActivityId: d3300016d4084e310a, Request URI: /apps/12401f9e1df77/services/dc100232b1f44545/partitions/f86f3bc0001a2f78/replicas/13085003638s"
+ */
+
+ let innerMessage: any = null;
+
+ const singleLineMessage = message.replace(/[\r\n]|\r|\n/g, "");
+ try {
+ // Multi-Partition error flavor
+ const regExp = /^(.*)ActivityId: (.*)/g;
+ const regString = regExp.exec(singleLineMessage);
+ const innerMessageString = regString[1];
+ innerMessage = JSON.parse(innerMessageString);
+ } catch (e) {
+ // Single-partition error flavor
+ const regExp = /^Message: (.*)ActivityId: (.*), Request URI: (.*)/g;
+ const regString = regExp.exec(singleLineMessage);
+ const innerMessageString = regString[1];
+ innerMessage = JSON.parse(innerMessageString);
+ }
+
+ return innerMessage.errors ? innerMessage.errors : innerMessage.Errors;
+}
+
/**
* Storage Table Entity List ViewModel
*/
@@ -387,8 +448,17 @@ export default class TableEntityListViewModel extends DataTableViewModel {
}
})
.catch((error: any) => {
- const errorMessage = getErrorMessage(error);
- this.queryErrorMessage(errorMessage);
+ const parsedErrors = parseError(error);
+ var errors = parsedErrors.map(error => {
+ return {
+ message: error.message,
+ start: error.location ? error.location.start : undefined,
+ end: error.location ? error.location.end : undefined,
+ code: error.code,
+ severity: error.severity
+ };
+ });
+ this.queryErrorMessage(errors[0].message);
if (this.queryTablesTab.onLoadStartKey != null && this.queryTablesTab.onLoadStartKey != undefined) {
TelemetryProcessor.traceFailure(
Action.Tab,
@@ -399,8 +469,7 @@ export default class TableEntityListViewModel extends DataTableViewModel {
defaultExperience: this.queryTablesTab.collection.container.defaultExperience(),
dataExplorerArea: Areas.Tab,
tabTitle: this.queryTablesTab.tabTitle(),
- error: errorMessage,
- errorStack: getErrorStack(error)
+ error: error
},
this.queryTablesTab.onLoadStartKey
);
@@ -421,47 +490,53 @@ export default class TableEntityListViewModel extends DataTableViewModel {
* Note that this also means that we can get less entities than the requested download size in a successful call.
* See Microsoft Azure API Documentation at: https://msdn.microsoft.com/en-us/library/azure/dd135718.aspx
*/
- private async prefetchData(
+ private prefetchData(
tableQuery: Entities.ITableQuery,
downloadSize: number,
currentRetry: number = 0
- ): Promise {
+ ): Q.Promise {
if (!this.cache.serverCallInProgress) {
this.cache.serverCallInProgress = true;
this.allDownloaded = false;
this.lastPrefetchTime = new Date().getTime();
- const time = this.lastPrefetchTime;
+ var time = this.lastPrefetchTime;
+ var promise: Q.Promise;
if (this._documentIterator && this.continuationToken) {
// TODO handle Cassandra case
- const response = await this._documentIterator.fetchNext();
- const entities: Entities.ITableEntity[] = TableEntityProcessor.convertDocumentsToEntities(response?.resources);
- return {
- Results: entities,
- ContinuationToken: this._documentIterator.hasMoreResults()
- };
- }
-
- try {
- let documents: IListTableEntitiesSegmentedResult;
- if (this.continuationToken && this.queryTablesTab.container.isPreferredApiCassandra()) {
- documents = await this.queryTablesTab.container.tableDataClient.queryDocuments(
+ promise = Q(this._documentIterator.fetchNext().then(response => response.resources)).then(
+ (documents: any[]) => {
+ let entities: Entities.ITableEntity[] = TableEntityProcessor.convertDocumentsToEntities(documents);
+ let finalEntities: IListTableEntitiesSegmentedResult = {
+ Results: entities,
+ ContinuationToken: this._documentIterator.hasMoreResults()
+ };
+ return Q.resolve(finalEntities);
+ }
+ );
+ } else if (this.continuationToken && this.queryTablesTab.container.isPreferredApiCassandra()) {
+ promise = Q(
+ this.queryTablesTab.container.tableDataClient.queryDocuments(
this.queryTablesTab.collection,
this.cqlQuery(),
true,
this.continuationToken
- );
- } else {
- const query = this.queryTablesTab.container.isPreferredApiCassandra() ? this.cqlQuery() : this.sqlQuery();
- documents = await this.queryTablesTab.container.tableDataClient.queryDocuments(
- this.queryTablesTab.collection,
- query,
- true
- );
-
+ )
+ );
+ } else {
+ let query = this.sqlQuery();
+ if (this.queryTablesTab.container.isPreferredApiCassandra()) {
+ query = this.cqlQuery();
+ }
+ promise = Q(
+ this.queryTablesTab.container.tableDataClient.queryDocuments(this.queryTablesTab.collection, query, true)
+ );
+ }
+ return promise
+ .then((result: IListTableEntitiesSegmentedResult) => {
if (!this._documentIterator) {
- this._documentIterator = documents.iterator;
+ this._documentIterator = result.iterator;
}
var actualDownloadSize: number = 0;
@@ -472,11 +547,11 @@ export default class TableEntityListViewModel extends DataTableViewModel {
return Q.resolve(null);
}
- var entities = documents.Results;
+ var entities = result.Results;
actualDownloadSize = entities.length;
// Queries can fetch no results and still return a continuation header. See prefetchAndRender() method.
- this.continuationToken = this.isCancelled ? null : documents.ContinuationToken;
+ this.continuationToken = this.isCancelled ? null : result.ContinuationToken;
if (!this.continuationToken) {
this.allDownloaded = true;
@@ -508,22 +583,20 @@ export default class TableEntityListViewModel extends DataTableViewModel {
// For #2.1, set prefetch exceeds maximum retry number and end prefetch.
// For #2.2, go to next round prefetch.
if (this.allDownloaded || nextDownloadSize === 0) {
- return documents;
+ return Q.resolve(result);
}
if (currentRetry >= TableEntityListViewModel._maximumNumberOfPrefetchRetries) {
- documents.ExceedMaximumRetries = true;
- return documents;
+ result.ExceedMaximumRetries = true;
+ return Q.resolve(result);
}
-
- return await this.prefetchData(tableQuery, nextDownloadSize, currentRetry + 1);
- }
- } catch (error) {
- this.cache.serverCallInProgress = false;
- throw error;
- }
+ return this.prefetchData(tableQuery, nextDownloadSize, currentRetry + 1);
+ })
+ .catch((error: Error) => {
+ this.cache.serverCallInProgress = false;
+ return Q.reject(error);
+ });
}
-
- return undefined;
+ return null;
}
}
From 9247a6c4a2ce9b53d68a54a0971261bfbfadc014 Mon Sep 17 00:00:00 2001
From: Armando Trejo Oliver
Date: Tue, 12 Jan 2021 09:55:04 -0800
Subject: [PATCH 17/22] A11y fixes - Add a skip link and remove duplicate ids
(#381)
* Add a skip link to allow people who navigate sequentially through content more direct access to the primary content of the Data Explorer
Co-authored-by: Chris Cao (Zen3 Infosolutions America Inc)
* Rename id of partition key field in Add Collection Pane to ensure no elements contain duplicate attributes.
Co-authored-by: Chris Cao (Zen3 Infosolutions America Inc)
---
less/hostedexplorer.less | 5 +++++
src/Explorer/Panes/AddCollectionPane.html | 2 +-
src/hostedExplorer.html | 23 +++++++++++++----------
3 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/less/hostedexplorer.less b/less/hostedexplorer.less
index 137c76f11..86186d366 100644
--- a/less/hostedexplorer.less
+++ b/less/hostedexplorer.less
@@ -13,6 +13,11 @@
@NavMediumSpace: 10px;
@NavLargeSpace: 15px;
+.skip-link {
+ position: fixed;
+ top: -200px;
+}
+
html {
font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif;
padding: 0px;
diff --git a/src/Explorer/Panes/AddCollectionPane.html b/src/Explorer/Panes/AddCollectionPane.html
index 89096032c..cbbdc8195 100644
--- a/src/Explorer/Panes/AddCollectionPane.html
+++ b/src/Explorer/Panes/AddCollectionPane.html
@@ -257,7 +257,7 @@
range of values and is likely to have evenly distributed access patterns.
- Skip to content
@@ -48,16 +49,18 @@
-
-
+
+
+
+
From b1ad80480e6b3a1ad68f6ba25e58d2dd054fd9f2 Mon Sep 17 00:00:00 2001
From: Chris-MS-896 <64865559+Chris-MS-896@users.noreply.github.com>
Date: Tue, 12 Jan 2021 12:55:21 -0600
Subject: [PATCH 18/22] Add two files of notebook component in Matser (#363)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* “minor changes”
---
.../NotebookComponent/__mocks__/rx-jupyter.ts | 3 +--
src/Explorer/Notebook/NotebookContentClient.ts | 13 ++++++++-----
tsconfig.strict.json | 2 ++
3 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/src/Explorer/Notebook/NotebookComponent/__mocks__/rx-jupyter.ts b/src/Explorer/Notebook/NotebookComponent/__mocks__/rx-jupyter.ts
index 564527eec..1b02ef08e 100644
--- a/src/Explorer/Notebook/NotebookComponent/__mocks__/rx-jupyter.ts
+++ b/src/Explorer/Notebook/NotebookComponent/__mocks__/rx-jupyter.ts
@@ -1,6 +1,5 @@
import { Observable, of } from "rxjs";
import { AjaxRequest, AjaxResponse } from "rxjs/ajax";
-import { ServerConfig } from "@nteract/types";
let fakeAjaxResponse: AjaxResponse = {
originalEvent:
(undefined),
@@ -12,7 +11,7 @@ let fakeAjaxResponse: AjaxResponse = {
responseType: "json"
};
export const sessions = {
- create: (serverConfig: ServerConfig, body: object): Observable => of(fakeAjaxResponse),
+ create: (serverConfig: unknown, body: object): Observable => of(fakeAjaxResponse),
__setResponse: (response: AjaxResponse) => {
fakeAjaxResponse = response;
},
diff --git a/src/Explorer/Notebook/NotebookContentClient.ts b/src/Explorer/Notebook/NotebookContentClient.ts
index d745c7e4f..60358d306 100644
--- a/src/Explorer/Notebook/NotebookContentClient.ts
+++ b/src/Explorer/Notebook/NotebookContentClient.ts
@@ -11,7 +11,7 @@ import { stringifyNotebook } from "@nteract/commutable";
export class NotebookContentClient {
constructor(
private notebookServerInfo: ko.Observable,
- private notebookBasePath: ko.Observable,
+ public notebookBasePath: ko.Observable,
private contentProvider: IContentProvider
) {}
@@ -117,8 +117,11 @@ export class NotebookContentClient {
private async checkIfFilepathExists(filepath: string): Promise {
const parentDirPath = NotebookUtil.getParentPath(filepath);
- const items = await this.fetchNotebookFiles(parentDirPath);
- return items.some(value => FileSystemUtil.isPathEqual(value.path, filepath));
+ if (parentDirPath) {
+ const items = await this.fetchNotebookFiles(parentDirPath);
+ return items.some(value => FileSystemUtil.isPathEqual(value.path, filepath));
+ }
+ return false;
}
/**
@@ -189,7 +192,7 @@ export class NotebookContentClient {
const dir = xhr.response;
const item = NotebookUtil.createNotebookContentItem(dir.name, dir.path, dir.type);
item.parent = parent;
- parent.children.push(item);
+ parent.children!.push(item);
return item;
});
}
@@ -225,7 +228,7 @@ export class NotebookContentClient {
* Convert rx-jupyter type to our type
* @param type
*/
- private static getType(type: FileType): NotebookContentItemType {
+ public static getType(type: FileType): NotebookContentItemType {
switch (type) {
case "directory":
return NotebookContentItemType.Directory;
diff --git a/tsconfig.strict.json b/tsconfig.strict.json
index e9fca85d6..c7b506fa4 100644
--- a/tsconfig.strict.json
+++ b/tsconfig.strict.json
@@ -68,6 +68,8 @@
"./src/Explorer/Tables/DataTable/CacheBase.ts",
"./src/Explorer/Tables/Entities.ts",
"./src/Explorer/Tabs/TabComponents.ts",
+ "./src/Explorer/Notebook/NotebookComponent/__mocks__/rx-jupyter.ts",
+ "./src/Explorer/Notebook/NotebookContentClient.ts",
"./src/GitHub/GitHubConnector.ts",
"./src/Index.ts",
"./src/NotebookWorkspaceManager/NotebookWorkspaceResourceProviderMockClients.ts",
From af53697ff40610abe0adeef58e5c161e6c6265a9 Mon Sep 17 00:00:00 2001
From: Chris-MS-896 <64865559+Chris-MS-896@users.noreply.github.com>
Date: Tue, 12 Jan 2021 12:55:47 -0600
Subject: [PATCH 19/22] Add file of Terminal to Master (#371)
* "minor changes"
---
src/Shared/DefaultExperienceUtility.ts | 14 ++++++--------
src/Terminal/index.ts | 4 ++--
tsconfig.strict.json | 2 ++
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/Shared/DefaultExperienceUtility.ts b/src/Shared/DefaultExperienceUtility.ts
index 81550466e..4007296b0 100644
--- a/src/Shared/DefaultExperienceUtility.ts
+++ b/src/Shared/DefaultExperienceUtility.ts
@@ -4,7 +4,7 @@ import * as DataModels from "../Contracts/DataModels";
import { DefaultAccountExperienceType } from "../DefaultAccountExperienceType";
export class DefaultExperienceUtility {
- public static getDefaultExperienceFromDatabaseAccount(databaseAccount: DataModels.DatabaseAccount): string {
+ public static getDefaultExperienceFromDatabaseAccount(databaseAccount: DataModels.DatabaseAccount): string | null {
if (!databaseAccount) {
return null;
}
@@ -81,11 +81,9 @@ export class DefaultExperienceUtility {
private static _getDefaultExperience(kind: string, capabilities: DataModels.Capability[]): string {
const defaultDefaultExperience: string = Constants.DefaultAccountExperience.DocumentDB;
- const defaultExperienceFromKind: string = DefaultExperienceUtility._getDefaultExperienceFromAccountKind(kind);
- const defaultExperienceFromCapabilities: string = DefaultExperienceUtility._getDefaultExperienceFromAccountCapabilities(
- capabilities
- );
-
+ const defaultExperienceFromKind: string = DefaultExperienceUtility._getDefaultExperienceFromAccountKind(kind) || "";
+ const defaultExperienceFromCapabilities: string =
+ DefaultExperienceUtility._getDefaultExperienceFromAccountCapabilities(capabilities) || "";
if (!!defaultExperienceFromKind) {
return defaultExperienceFromKind;
}
@@ -97,7 +95,7 @@ export class DefaultExperienceUtility {
return defaultDefaultExperience;
}
- private static _getDefaultExperienceFromAccountKind(kind: string): string {
+ private static _getDefaultExperienceFromAccountKind(kind: string): string | null {
if (!kind) {
return null;
}
@@ -113,7 +111,7 @@ export class DefaultExperienceUtility {
return null;
}
- private static _getDefaultExperienceFromAccountCapabilities(capabilities: DataModels.Capability[]): string {
+ private static _getDefaultExperienceFromAccountCapabilities(capabilities: DataModels.Capability[]): string | null {
if (!capabilities) {
return null;
}
diff --git a/src/Terminal/index.ts b/src/Terminal/index.ts
index 7b49dde8b..3a7ae8913 100644
--- a/src/Terminal/index.ts
+++ b/src/Terminal/index.ts
@@ -19,8 +19,8 @@ const getUrlVars = (): { [key: string]: string } => {
};
const createServerSettings = (urlVars: { [key: string]: string }): ServerConnection.ISettings => {
- let body: BodyInit;
- let headers: HeadersInit;
+ let body: BodyInit | undefined;
+ let headers: HeadersInit | undefined;
if (urlVars.hasOwnProperty(TerminalQueryParams.TerminalEndpoint)) {
body = JSON.stringify({
endpoint: urlVars[TerminalQueryParams.TerminalEndpoint]
diff --git a/tsconfig.strict.json b/tsconfig.strict.json
index c7b506fa4..8b947e2c4 100644
--- a/tsconfig.strict.json
+++ b/tsconfig.strict.json
@@ -83,6 +83,8 @@
"./src/Shared/Telemetry/TelemetryConstants.ts",
"./src/Shared/Telemetry/TelemetryProcessor.ts",
"./src/Shared/appInsights.ts",
+ "./src/Shared/DefaultExperienceUtility.ts",
+ "./src/Terminal/index.ts",
"./src/Terminal/JupyterLabAppFactory.ts",
"./src/UserContext.ts",
"./src/Utils/Base64Utils.ts",
From 3effbe6991007cb691543fe9c4f51e978e20963a Mon Sep 17 00:00:00 2001
From: Chris-MS-896 <64865559+Chris-MS-896@users.noreply.github.com>
Date: Tue, 12 Jan 2021 13:09:20 -0600
Subject: [PATCH 20/22] no message (#372)
---
src/Explorer/Tree/AccessibleVerticalList.ts | 10 +++++++---
tsconfig.strict.json | 1 +
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/Explorer/Tree/AccessibleVerticalList.ts b/src/Explorer/Tree/AccessibleVerticalList.ts
index 818328a41..96db22df8 100644
--- a/src/Explorer/Tree/AccessibleVerticalList.ts
+++ b/src/Explorer/Tree/AccessibleVerticalList.ts
@@ -8,7 +8,7 @@ enum ScrollPosition {
export class AccessibleVerticalList {
private items: any[] = [];
- private onSelect: (item: any) => void;
+ private onSelect?: (item: any) => void;
public currentItemIndex: ko.Observable;
public currentItem: ko.Computed;
@@ -42,7 +42,9 @@ export class AccessibleVerticalList {
const targetElement = targetContainer
.getElementsByClassName("accessibleListElement")
.item(this.currentItemIndex());
- this.scrollElementIntoContainerViewIfNeeded(targetElement, targetContainer, ScrollPosition.Top);
+ if (targetElement) {
+ this.scrollElementIntoContainerViewIfNeeded(targetElement, targetContainer, ScrollPosition.Top);
+ }
return false;
}
if (event.keyCode === 40) {
@@ -52,7 +54,9 @@ export class AccessibleVerticalList {
const targetElement = targetContainer
.getElementsByClassName("accessibleListElement")
.item(this.currentItemIndex());
- this.scrollElementIntoContainerViewIfNeeded(targetElement, targetContainer, ScrollPosition.Bottom);
+ if (targetElement) {
+ this.scrollElementIntoContainerViewIfNeeded(targetElement, targetContainer, ScrollPosition.Top);
+ }
return false;
}
return true;
diff --git a/tsconfig.strict.json b/tsconfig.strict.json
index 8b947e2c4..2a7da5bcd 100644
--- a/tsconfig.strict.json
+++ b/tsconfig.strict.json
@@ -59,6 +59,7 @@
"./src/Explorer/Notebook/NotebookComponent/types.ts",
"./src/Explorer/Notebook/NotebookContentItem.ts",
"./src/Explorer/Notebook/NotebookUtil.ts",
+ "./src/Explorer/Tree/AccessibleVerticalList.ts",
"./src/Explorer/Panes/PaneComponents.ts",
"./src/Explorer/Panes/Tables/Validators/EntityPropertyNameValidator.ts",
"./src/Explorer/Panes/Tables/Validators/EntityPropertyValidationCommon.ts",
From 9d20a13dd40cd891ced1fc46ccc3e450ed537b3c Mon Sep 17 00:00:00 2001
From: Steve Faulkner
Date: Tue, 12 Jan 2021 13:53:15 -0600
Subject: [PATCH 21/22] Warn on SubQuery (#378)
---
src/Explorer/Tabs/QueryTab.html | 11 +++++++++++
src/Explorer/Tabs/QueryTab.ts | 8 ++++++--
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/src/Explorer/Tabs/QueryTab.html b/src/Explorer/Tabs/QueryTab.html
index e27a4bb7c..ff4b40b06 100644
--- a/src/Explorer/Tabs/QueryTab.html
+++ b/src/Explorer/Tabs/QueryTab.html
@@ -11,6 +11,17 @@
Start by writing a Mongo query, for example: {'id':'foo'} or { } to get all the
documents.
+
;
+ public maybeSubQuery: ko.Computed;
public sqlQueryEditorContent: ko.Observable;
public selectedContent: ko.Observable;
public sqlStatementToExecute: ko.Observable;
@@ -120,6 +119,11 @@ export default class QueryTab extends TabsBase implements ViewModels.WaitsForTem
return (container && (container.isPreferredApiDocumentDB() || container.isPreferredApiGraph())) || false;
});
+ this.maybeSubQuery = ko.computed(function() {
+ const sql = this.sqlQueryEditorContent();
+ return sql && /.*\(.*SELECT.*\)/i.test(sql);
+ }, this);
+
this.saveQueryButton = {
enabled: this._isSaveQueriesEnabled,
visible: this._isSaveQueriesEnabled
From babda4d9cb122a586f84bb61a952af5f40f5224f Mon Sep 17 00:00:00 2001
From: Tim Sander
Date: Tue, 12 Jan 2021 16:38:16 -0800
Subject: [PATCH 22/22] fix issue where Mongo indexing checkbox stops adding
wildcard index (#384)
---
src/Explorer/Panes/AddCollectionPane.ts | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/Explorer/Panes/AddCollectionPane.ts b/src/Explorer/Panes/AddCollectionPane.ts
index 3a8cefb63..9f705551e 100644
--- a/src/Explorer/Panes/AddCollectionPane.ts
+++ b/src/Explorer/Panes/AddCollectionPane.ts
@@ -92,7 +92,7 @@ export default class AddCollectionPane extends ContextualPaneBase {
public freeTierExceedThroughputTooltip: ko.Computed;
public canConfigureThroughput: ko.PureComputed;
public showUpsellMessage: ko.PureComputed;
- public shouldCreateMongoWildcardIndex: ko.Computed;
+ public shouldCreateMongoWildcardIndex: ko.Observable;
private _isSynapseLinkEnabled: ko.Computed;
@@ -654,9 +654,7 @@ export default class AddCollectionPane extends ContextualPaneBase {
});
});
- this.shouldCreateMongoWildcardIndex = ko.computed(function() {
- return this.container.isMongoIndexingEnabled();
- }, this);
+ this.shouldCreateMongoWildcardIndex = ko.observable(this.container.isMongoIndexingEnabled());
}
public getSharedThroughputDefault(): boolean {
@@ -681,6 +679,7 @@ export default class AddCollectionPane extends ContextualPaneBase {
// TODO: Figure out if a database level partition split is about to happen once shared throughput read is available
this.formWarnings("");
this.databaseCreateNewShared(this.getSharedThroughputDefault());
+ this.shouldCreateMongoWildcardIndex(this.container.isMongoIndexingEnabled());
if (this.isPreferredApiTable() && !databaseId) {
databaseId = SharedConstants.CollectionCreation.TablesAPIDefaultDatabase;
}
@@ -935,6 +934,8 @@ export default class AddCollectionPane extends ContextualPaneBase {
this.autoPilotThroughput(AutoPilotUtils.minAutoPilotThroughput);
this.sharedAutoPilotThroughput(AutoPilotUtils.minAutoPilotThroughput);
+ this.shouldCreateMongoWildcardIndex = ko.observable(this.container.isMongoIndexingEnabled());
+
this.uniqueKeys([]);
this.useIndexingForSharedThroughput(true);