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 {