From 9d63a346e4641cdb57fb0d8248915bb73c0af4a9 Mon Sep 17 00:00:00 2001 From: victor-meng <56978073+victor-meng@users.noreply.github.com> Date: Tue, 9 Mar 2021 10:18:40 -0800 Subject: [PATCH] Fix issues in the add collection pane (#501) --- .../ThroughputInputComponentAutoPilotV3.ts | 3 --- .../ThroughputInputComponentAutoscaleV3.html | 2 +- src/Explorer/Panes/AddCollectionPane.html | 2 -- src/Explorer/Panes/AddCollectionPane.ts | 16 ++++++++++------ src/Explorer/Panes/AddDatabasePane.html | 1 - .../Panes/CassandraAddCollectionPane.html | 1 - src/Explorer/Tabs/DatabaseSettingsTab.html | 1 - src/Explorer/Tabs/DatabaseSettingsTab.ts | 6 ------ 8 files changed, 11 insertions(+), 21 deletions(-) diff --git a/src/Explorer/Controls/ThroughputInput/ThroughputInputComponentAutoPilotV3.ts b/src/Explorer/Controls/ThroughputInput/ThroughputInputComponentAutoPilotV3.ts index 9a99d209f..eef3c7193 100644 --- a/src/Explorer/Controls/ThroughputInput/ThroughputInputComponentAutoPilotV3.ts +++ b/src/Explorer/Controls/ThroughputInput/ThroughputInputComponentAutoPilotV3.ts @@ -129,7 +129,6 @@ export interface ThroughputInputParams { throughputModeRadioName: string; maxAutoPilotThroughputSet: ViewModels.Editable; autoPilotUsageCost: ko.Computed; - showAutoPilot?: ko.Observable; overrideWithAutoPilotSettings: ko.Observable; overrideWithProvisionedThroughputSettings: ko.Observable; freeTierExceedThroughputTooltip?: ko.Observable; @@ -158,7 +157,6 @@ export class ThroughputInputViewModel extends WaitsForTemplateViewModel { public infoBubbleText: string | ko.Observable; public label: ko.Observable; public isFixed: boolean; - public showAutoPilot: ko.Observable; public isAutoPilotSelected: ko.Observable; public throughputAutoPilotRadioId: string; public throughputProvisionedRadioId: string; @@ -202,7 +200,6 @@ export class ThroughputInputViewModel extends WaitsForTemplateViewModel { this.isFixed = !!options.isFixed; this.infoBubbleText = options.infoBubbleText || ko.observable(); this.label = options.label || ko.observable(); - this.showAutoPilot = options.showAutoPilot !== undefined ? options.showAutoPilot : ko.observable(true); this.isAutoPilotSelected = options.isAutoPilotSelected || ko.observable(false); this.isAutoPilotSelected.subscribe((value) => { TelemetryProcessor.trace(Action.ToggleAutoscaleSetting, ActionModifiers.Mark, { diff --git a/src/Explorer/Controls/ThroughputInput/ThroughputInputComponentAutoscaleV3.html b/src/Explorer/Controls/ThroughputInput/ThroughputInputComponentAutoscaleV3.html index 8b32134bd..b8ad196b2 100644 --- a/src/Explorer/Controls/ThroughputInput/ThroughputInputComponentAutoscaleV3.html +++ b/src/Explorer/Controls/ThroughputInput/ThroughputInputComponentAutoscaleV3.html @@ -17,7 +17,7 @@ -
+
@@ -435,7 +434,6 @@ maxAutoPilotThroughputSet: autoPilotThroughput, autoPilotUsageCost: autoPilotUsageCost, canExceedMaximumValue: canExceedMaximumValue, - showAutoPilot: !isFixedStorageSelected(), freeTierExceedThroughputTooltip: freeTierExceedThroughputTooltip }" > diff --git a/src/Explorer/Panes/AddCollectionPane.ts b/src/Explorer/Panes/AddCollectionPane.ts index 7b704faa6..bc14278ca 100644 --- a/src/Explorer/Panes/AddCollectionPane.ts +++ b/src/Explorer/Panes/AddCollectionPane.ts @@ -749,12 +749,16 @@ export default class AddCollectionPane extends ContextualPaneBase { return undefined; } - if (this.isAutoPilotSelected()) { - return undefined; - } - - if (this.databaseCreateNewShared() && this.isSharedAutoPilotSelected()) { - return undefined; + // return undefined if autopilot is selected for the new database/collection + if (this.databaseCreateNew()) { + // database is shared and autopilot is sleected for the database + if (this.databaseCreateNewShared() && this.isSharedAutoPilotSelected()) { + return undefined; + } + // database is not shared and autopilot is selected for the collection + if (!this.databaseCreateNewShared() && this.isAutoPilotSelected()) { + return undefined; + } } return this._getThroughput(); diff --git a/src/Explorer/Panes/AddDatabasePane.html b/src/Explorer/Panes/AddDatabasePane.html index 1ad84e775..0166ab7cb 100644 --- a/src/Explorer/Panes/AddDatabasePane.html +++ b/src/Explorer/Panes/AddDatabasePane.html @@ -149,7 +149,6 @@ maxAutoPilotThroughputSet: maxAutoPilotThroughputSet, autoPilotUsageCost: autoPilotUsageCost, canExceedMaximumValue: canExceedMaximumValue, - showAutoPilot: !isFreeTierAccount(), freeTierExceedThroughputTooltip: freeTierExceedThroughputTooltip }" > diff --git a/src/Explorer/Panes/CassandraAddCollectionPane.html b/src/Explorer/Panes/CassandraAddCollectionPane.html index afefc6f8b..c426a272e 100644 --- a/src/Explorer/Panes/CassandraAddCollectionPane.html +++ b/src/Explorer/Panes/CassandraAddCollectionPane.html @@ -166,7 +166,6 @@ autoPilotUsageCost: autoPilotUsageCost, canExceedMaximumValue: canExceedMaximumValue, costsVisible: costsVisible, - showAutoPilot: !isFreeTierAccount() }" > diff --git a/src/Explorer/Tabs/DatabaseSettingsTab.html b/src/Explorer/Tabs/DatabaseSettingsTab.html index 620ea968c..3f770cd7c 100644 --- a/src/Explorer/Tabs/DatabaseSettingsTab.html +++ b/src/Explorer/Tabs/DatabaseSettingsTab.html @@ -53,7 +53,6 @@ throughputAutoPilotRadioId: throughputAutoPilotRadioId, throughputProvisionedRadioId: throughputProvisionedRadioId, throughputModeRadioName: throughputModeRadioName, - showAutoPilot: userCanChangeProvisioningTypes, isAutoPilotSelected: isAutoPilotSelected, maxAutoPilotThroughputSet: autoPilotThroughput, autoPilotUsageCost: autoPilotUsageCost, diff --git a/src/Explorer/Tabs/DatabaseSettingsTab.ts b/src/Explorer/Tabs/DatabaseSettingsTab.ts index fd5c0baa6..d76204b05 100644 --- a/src/Explorer/Tabs/DatabaseSettingsTab.ts +++ b/src/Explorer/Tabs/DatabaseSettingsTab.ts @@ -73,7 +73,6 @@ export default class DatabaseSettingsTab extends TabsBase implements ViewModels. public shouldShowStatusBar: ko.Computed; public throughputTitle: ko.PureComputed; public throughputAriaLabel: ko.PureComputed; - public userCanChangeProvisioningTypes: ko.Observable; public autoPilotUsageCost: ko.PureComputed; public warningMessage: ko.Computed; public canExceedMaximumValue: ko.PureComputed; @@ -106,7 +105,6 @@ export default class DatabaseSettingsTab extends TabsBase implements ViewModels. this._wasAutopilotOriginallySet = ko.observable(false); this.isAutoPilotSelected = editable.observable(false); this.autoPilotThroughput = editable.observable(); - this.userCanChangeProvisioningTypes = ko.observable(true); const autoscaleMaxThroughput = this.database?.offer()?.autoscaleMaxThroughput; if (autoscaleMaxThroughput) { @@ -118,9 +116,6 @@ export default class DatabaseSettingsTab extends TabsBase implements ViewModels. } this._hasProvisioningTypeChanged = ko.pureComputed(() => { - if (!this.userCanChangeProvisioningTypes()) { - return false; - } if (this._wasAutopilotOriginallySet() !== this.isAutoPilotSelected()) { return true; } @@ -448,7 +443,6 @@ export default class DatabaseSettingsTab extends TabsBase implements ViewModels. this.isAutoPilotSelected.setBaseline(AutoPilotUtils.isValidAutoPilotThroughput(offer.autoscaleMaxThroughput)); this.autoPilotThroughput.setBaseline(offer.autoscaleMaxThroughput); this.throughput.setBaseline(offer.manualThroughput); - this.userCanChangeProvisioningTypes(true); } protected getTabsButtons(): CommandButtonComponentProps[] {