diff --git a/src/Explorer/Controls/Settings/__snapshots__/SettingsComponent.test.tsx.snap b/src/Explorer/Controls/Settings/__snapshots__/SettingsComponent.test.tsx.snap index 1fa13d27b..fe793ef02 100644 --- a/src/Explorer/Controls/Settings/__snapshots__/SettingsComponent.test.tsx.snap +++ b/src/Explorer/Controls/Settings/__snapshots__/SettingsComponent.test.tsx.snap @@ -831,7 +831,6 @@ exports[`SettingsComponent renders 1`] = ` }, "hasStorageAnalyticsAfecFeature": [Function], "isAccountReady": [Function], - "isAutoscaleDefaultEnabled": [Function], "isFixedCollectionWithSharedThroughputSupported": [Function], "isHostedDataExplorerEnabled": [Function], "isLeftPaneExpanded": [Function], @@ -1727,7 +1726,6 @@ exports[`SettingsComponent renders 1`] = ` }, "hasStorageAnalyticsAfecFeature": [Function], "isAccountReady": [Function], - "isAutoscaleDefaultEnabled": [Function], "isFixedCollectionWithSharedThroughputSupported": [Function], "isHostedDataExplorerEnabled": [Function], "isLeftPaneExpanded": [Function], @@ -2636,7 +2634,6 @@ exports[`SettingsComponent renders 1`] = ` }, "hasStorageAnalyticsAfecFeature": [Function], "isAccountReady": [Function], - "isAutoscaleDefaultEnabled": [Function], "isFixedCollectionWithSharedThroughputSupported": [Function], "isHostedDataExplorerEnabled": [Function], "isLeftPaneExpanded": [Function], @@ -3532,7 +3529,6 @@ exports[`SettingsComponent renders 1`] = ` }, "hasStorageAnalyticsAfecFeature": [Function], "isAccountReady": [Function], - "isAutoscaleDefaultEnabled": [Function], "isFixedCollectionWithSharedThroughputSupported": [Function], "isHostedDataExplorerEnabled": [Function], "isLeftPaneExpanded": [Function], diff --git a/src/Explorer/Explorer.tsx b/src/Explorer/Explorer.tsx index eba6ee305..49c4c334d 100644 --- a/src/Explorer/Explorer.tsx +++ b/src/Explorer/Explorer.tsx @@ -157,7 +157,6 @@ export default class Explorer { public isHostedDataExplorerEnabled: ko.Computed; public isMongoIndexingEnabled: ko.Observable; public canExceedMaximumValue: ko.Computed; - public isAutoscaleDefaultEnabled: ko.Observable; public isSchemaEnabled: ko.Computed; // Notebooks @@ -313,8 +312,6 @@ export default class Explorer { this.isSchemaEnabled = ko.computed(() => userContext.features.enableSchema); - this.isAutoscaleDefaultEnabled = ko.observable(false); - this.databases = ko.observableArray(); this.canSaveQueries = ko.computed(() => { const savedQueriesDatabase: ViewModels.Database = _.find( @@ -1026,26 +1023,10 @@ export default class Explorer { if (inputs.defaultCollectionThroughput) { this.collectionCreationDefaults = inputs.defaultCollectionThroughput; } - this.setFeatureFlagsFromFlights(inputs.flights); this.isAccountReady(true); } } - public setFeatureFlagsFromFlights(flights: readonly string[]): void { - if (!flights) { - return; - } - if (flights.indexOf(Constants.Flights.AutoscaleTest) !== -1) { - this.isAutoscaleDefaultEnabled(true); - } - if (flights.indexOf(Constants.Flights.MongoIndexing) !== -1) { - this.isMongoIndexingEnabled(true); - } - if (flights.indexOf(Constants.Flights.SchemaAnalyzer) !== -1) { - userContext.features.enableSchemaAnalyzer = true; - } - } - public findSelectedCollection(): ViewModels.Collection { return (this.selectedNode().nodeKind === "Collection" ? this.selectedNode() diff --git a/src/Explorer/Panes/CassandraAddCollectionPane/CassandraAddCollectionPane.tsx b/src/Explorer/Panes/CassandraAddCollectionPane/CassandraAddCollectionPane.tsx index d7b587d95..7fcb77f7d 100644 --- a/src/Explorer/Panes/CassandraAddCollectionPane/CassandraAddCollectionPane.tsx +++ b/src/Explorer/Panes/CassandraAddCollectionPane/CassandraAddCollectionPane.tsx @@ -36,10 +36,10 @@ export const CassandraAddCollectionPane: FunctionComponent(container.isAutoscaleDefaultEnabled()); + const [isAutoPilotSelected, setIsAutoPilotSelected] = useState(userContext.features.autoscaleDefault); const [isSharedAutoPilotSelected, setIsSharedAutoPilotSelected] = useState( - container.isAutoscaleDefaultEnabled() + userContext.features.autoscaleDefault ); const [userTableQuery, setUserTableQuery] = useState( @@ -108,7 +108,7 @@ export const CassandraAddCollectionPane: FunctionComponent { if (!container.isServerlessEnabled()) { - setIsAutoPilotSelected(container.isAutoscaleDefaultEnabled()); + setIsAutoPilotSelected(userContext.features.autoscaleDefault); } TelemetryProcessor.trace(Action.CreateCollection, ActionModifiers.Open, addCollectionPaneOpenMessage); diff --git a/src/Explorer/Panes/GitHubReposPanel/__snapshots__/GitHubReposPanel.test.tsx.snap b/src/Explorer/Panes/GitHubReposPanel/__snapshots__/GitHubReposPanel.test.tsx.snap index 571e69152..005c20c0e 100644 --- a/src/Explorer/Panes/GitHubReposPanel/__snapshots__/GitHubReposPanel.test.tsx.snap +++ b/src/Explorer/Panes/GitHubReposPanel/__snapshots__/GitHubReposPanel.test.tsx.snap @@ -820,7 +820,6 @@ exports[`GitHub Repos Panel should render Default properly 1`] = ` }, "hasStorageAnalyticsAfecFeature": [Function], "isAccountReady": [Function], - "isAutoscaleDefaultEnabled": [Function], "isFixedCollectionWithSharedThroughputSupported": [Function], "isHostedDataExplorerEnabled": [Function], "isLeftPaneExpanded": [Function], diff --git a/src/Explorer/Panes/StringInputPane/__snapshots__/StringInputPane.test.tsx.snap b/src/Explorer/Panes/StringInputPane/__snapshots__/StringInputPane.test.tsx.snap index b12f75260..699bdea86 100644 --- a/src/Explorer/Panes/StringInputPane/__snapshots__/StringInputPane.test.tsx.snap +++ b/src/Explorer/Panes/StringInputPane/__snapshots__/StringInputPane.test.tsx.snap @@ -810,7 +810,6 @@ exports[`StringInput Pane should render Create new directory properly 1`] = ` }, "hasStorageAnalyticsAfecFeature": [Function], "isAccountReady": [Function], - "isAutoscaleDefaultEnabled": [Function], "isFixedCollectionWithSharedThroughputSupported": [Function], "isHostedDataExplorerEnabled": [Function], "isLeftPaneExpanded": [Function], diff --git a/src/Explorer/Panes/__snapshots__/DeleteDatabaseConfirmationPanel.test.tsx.snap b/src/Explorer/Panes/__snapshots__/DeleteDatabaseConfirmationPanel.test.tsx.snap index afd2bc908..eb89ccf5d 100644 --- a/src/Explorer/Panes/__snapshots__/DeleteDatabaseConfirmationPanel.test.tsx.snap +++ b/src/Explorer/Panes/__snapshots__/DeleteDatabaseConfirmationPanel.test.tsx.snap @@ -808,7 +808,6 @@ exports[`Delete Database Confirmation Pane submit() Should call delete database }, "hasStorageAnalyticsAfecFeature": [Function], "isAccountReady": [Function], - "isAutoscaleDefaultEnabled": [Function], "isFixedCollectionWithSharedThroughputSupported": [Function], "isHostedDataExplorerEnabled": [Function], "isLastCollection": [Function], diff --git a/src/Platform/Hosted/extractFeatures.ts b/src/Platform/Hosted/extractFeatures.ts index 9b0805515..95e3695df 100644 --- a/src/Platform/Hosted/extractFeatures.ts +++ b/src/Platform/Hosted/extractFeatures.ts @@ -9,6 +9,7 @@ export type Features = { readonly enableRightPanelV2: boolean; readonly enableSchema: boolean; enableSchemaAnalyzer: boolean; + autoscaleDefault: boolean; readonly enableSDKoperations: boolean; readonly enableSpark: boolean; readonly enableTtl: boolean; @@ -68,5 +69,6 @@ export function extractFeatures(given = new URLSearchParams(window.location.sear pr: get("pr"), showMinRUSurvey: "true" === get("showminrusurvey"), ttl90Days: "true" === get("ttl90days"), + autoscaleDefault: "true" === get("autoscaledefault"), }; } diff --git a/src/hooks/useKnockoutExplorer.ts b/src/hooks/useKnockoutExplorer.ts index d73c0572a..bea73afc5 100644 --- a/src/hooks/useKnockoutExplorer.ts +++ b/src/hooks/useKnockoutExplorer.ts @@ -1,7 +1,7 @@ import { useEffect, useState } from "react"; import { applyExplorerBindings } from "../applyExplorerBindings"; import { AuthType } from "../AuthType"; -import { AccountKind } from "../Common/Constants"; +import { AccountKind, Flights } from "../Common/Constants"; import { normalizeArmEndpoint } from "../Common/EnvironmentUtility"; import { sendMessage, sendReadyMessage } from "../Common/MessageHandler"; import { configContext, Platform, updateConfigContext } from "../ConfigContext"; @@ -303,6 +303,14 @@ function updateContextsFromPortalMessage(inputs: DataExplorerInputsFrame) { if (inputs.features) { Object.assign(userContext.features, extractFeatures(new URLSearchParams(inputs.features))); } + if (inputs.flights) { + if (inputs.flights.indexOf(Flights.AutoscaleTest) !== -1) { + userContext.features.autoscaleDefault; + } + if (inputs.flights.indexOf(Flights.SchemaAnalyzer) !== -1) { + userContext.features.enableSchemaAnalyzer = true; + } + } } interface PortalMessage {