mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-21 18:01:39 +00:00
Remove Explorer.isPreferredAPIMongo (#557)
Co-authored-by: hardiknai-techm <HN00734461@TechMahindra.com>
This commit is contained in:
@@ -251,10 +251,7 @@
|
||||
</div>
|
||||
|
||||
<!-- Indexing For Shared Throughput - start -->
|
||||
<div
|
||||
class="seconddivpadding"
|
||||
data-bind="visible: showIndexingOptionsForSharedThroughput() && !container.isPreferredApiMongoDB()"
|
||||
>
|
||||
<div class="seconddivpadding" data-bind="visible: showIndexingOptionsForSharedThroughput() && !isMongo()">
|
||||
<div
|
||||
class="useIndexingForSharedThroughput createNewDatabaseOrUseExisting"
|
||||
aria-label="Indexing For Shared Throughput"
|
||||
@@ -297,7 +294,7 @@
|
||||
|
||||
<p
|
||||
class="seconddivpadding"
|
||||
data-bind="visible: container.isPreferredApiMongoDB() && !databaseHasSharedOffer() || container.isFixedCollectionWithSharedThroughputSupported"
|
||||
data-bind="visible: isMongo() && !databaseHasSharedOffer() || container.isFixedCollectionWithSharedThroughputSupported"
|
||||
>
|
||||
<span class="mandatoryStar">*</span>
|
||||
<span class="addCollectionLabel">Storage capacity</span>
|
||||
@@ -312,7 +309,7 @@
|
||||
<div class="tabs">
|
||||
<div
|
||||
tabindex="0"
|
||||
data-bind="event: { keydown: onStorageOptionsKeyDown }, visible: container.isPreferredApiMongoDB() && !databaseHasSharedOffer() || container.isFixedCollectionWithSharedThroughputSupported"
|
||||
data-bind="event: { keydown: onStorageOptionsKeyDown }, visible: isMongo() && !databaseHasSharedOffer() || container.isFixedCollectionWithSharedThroughputSupported"
|
||||
aria-label="Storage capacity"
|
||||
>
|
||||
<!-- Fixed option button - Start -->
|
||||
|
||||
@@ -119,7 +119,7 @@ export default class AddCollectionPane extends ContextualPaneBase {
|
||||
this.isPreferredApiTable = options.isPreferredApiTable;
|
||||
this.partitionKey = ko.observable<string>();
|
||||
this.partitionKey.subscribe((newPartitionKey: string) => {
|
||||
if (this.container.isPreferredApiMongoDB() || !newPartitionKey || newPartitionKey[0] === "/") {
|
||||
if (userContext.apiType === "Mongo" || !newPartitionKey || newPartitionKey[0] === "/") {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -354,7 +354,7 @@ export default class AddCollectionPane extends ContextualPaneBase {
|
||||
|
||||
// TODO: Create derived classes for Tables and Mongo to replace the If statements below
|
||||
this.partitionKeyName = ko.computed<string>(() => {
|
||||
if (this.container && !!this.container.isPreferredApiMongoDB()) {
|
||||
if (userContext.apiType === "Mongo") {
|
||||
return "Shard key";
|
||||
}
|
||||
|
||||
@@ -364,7 +364,7 @@ export default class AddCollectionPane extends ContextualPaneBase {
|
||||
this.lowerCasePartitionKeyName = ko.computed<string>(() => this.partitionKeyName().toLowerCase());
|
||||
|
||||
this.partitionKeyPlaceholder = ko.computed<string>(() => {
|
||||
if (this.container && !!this.container.isPreferredApiMongoDB()) {
|
||||
if (userContext.apiType === "Mongo") {
|
||||
return "e.g., address.zipCode";
|
||||
}
|
||||
|
||||
@@ -376,7 +376,7 @@ export default class AddCollectionPane extends ContextualPaneBase {
|
||||
});
|
||||
|
||||
this.uniqueKeysPlaceholder = ko.pureComputed<string>(() => {
|
||||
if (this.container && !!this.container.isPreferredApiMongoDB()) {
|
||||
if (userContext.apiType === "Mongo") {
|
||||
return "Comma separated paths e.g. firstName,address.zipCode";
|
||||
}
|
||||
|
||||
@@ -396,11 +396,7 @@ export default class AddCollectionPane extends ContextualPaneBase {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (
|
||||
this.container.isPreferredApiMongoDB() &&
|
||||
!this.isUnlimitedStorageSelected() &&
|
||||
this.databaseHasSharedOffer()
|
||||
) {
|
||||
if (userContext.apiType === "Mongo" && !this.isUnlimitedStorageSelected() && this.databaseHasSharedOffer()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -589,7 +585,7 @@ export default class AddCollectionPane extends ContextualPaneBase {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.container.isPreferredApiMongoDB()) {
|
||||
if (userContext.apiType === "Mongo") {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -728,6 +724,10 @@ export default class AddCollectionPane extends ContextualPaneBase {
|
||||
}
|
||||
}
|
||||
|
||||
private isMongo(): boolean {
|
||||
return userContext.apiType === "Mongo";
|
||||
}
|
||||
|
||||
private _onDatabasesChange(newDatabaseIds: ViewModels.Database[]) {
|
||||
this.databaseIds(newDatabaseIds?.map((database: ViewModels.Database) => database.id()));
|
||||
}
|
||||
@@ -810,7 +810,7 @@ export default class AddCollectionPane extends ContextualPaneBase {
|
||||
let indexingPolicy: DataModels.IndexingPolicy;
|
||||
let createMongoWildcardIndex: boolean;
|
||||
// todo - remove mongo indexing policy ticket # 616274
|
||||
if (this.container.isPreferredApiMongoDB() && this.container.isEnableMongoCapabilityPresent()) {
|
||||
if (userContext.apiType === "Mongo" && this.container.isEnableMongoCapabilityPresent()) {
|
||||
createMongoWildcardIndex = this.shouldCreateMongoWildcardIndex();
|
||||
} else if (this.showIndexingOptionsForSharedThroughput()) {
|
||||
if (this.useIndexingForSharedThroughput()) {
|
||||
@@ -1145,7 +1145,7 @@ export default class AddCollectionPane extends ContextualPaneBase {
|
||||
let transform = (value: string) => {
|
||||
return value;
|
||||
};
|
||||
if (this.container.isPreferredApiMongoDB()) {
|
||||
if (userContext.apiType === "Mongo") {
|
||||
transform = (value: string) => {
|
||||
return this._convertShardKeyToPartitionKey(value);
|
||||
};
|
||||
|
||||
@@ -434,7 +434,6 @@ exports[`Settings Pane should render Default properly 1`] = `
|
||||
"isMongoIndexingEnabled": [Function],
|
||||
"isNotebookEnabled": [Function],
|
||||
"isNotebooksEnabledForAccount": [Function],
|
||||
"isPreferredApiMongoDB": [Function],
|
||||
"isPublishNotebookPaneEnabled": [Function],
|
||||
"isResourceTokenCollectionNodeSelected": [Function],
|
||||
"isRightPanelV2Enabled": [Function],
|
||||
@@ -1073,7 +1072,6 @@ exports[`Settings Pane should render Gremlin properly 1`] = `
|
||||
"isMongoIndexingEnabled": [Function],
|
||||
"isNotebookEnabled": [Function],
|
||||
"isNotebooksEnabledForAccount": [Function],
|
||||
"isPreferredApiMongoDB": [Function],
|
||||
"isPublishNotebookPaneEnabled": [Function],
|
||||
"isResourceTokenCollectionNodeSelected": [Function],
|
||||
"isRightPanelV2Enabled": [Function],
|
||||
|
||||
@@ -437,7 +437,6 @@ exports[`StringInput Pane should render Create new directory properly 1`] = `
|
||||
"isMongoIndexingEnabled": [Function],
|
||||
"isNotebookEnabled": [Function],
|
||||
"isNotebooksEnabledForAccount": [Function],
|
||||
"isPreferredApiMongoDB": [Function],
|
||||
"isPublishNotebookPaneEnabled": [Function],
|
||||
"isResourceTokenCollectionNodeSelected": [Function],
|
||||
"isRightPanelV2Enabled": [Function],
|
||||
@@ -952,7 +951,6 @@ exports[`StringInput Pane should render Create new directory properly 1`] = `
|
||||
"isMongoIndexingEnabled": [Function],
|
||||
"isNotebookEnabled": [Function],
|
||||
"isNotebooksEnabledForAccount": [Function],
|
||||
"isPreferredApiMongoDB": [Function],
|
||||
"isPublishNotebookPaneEnabled": [Function],
|
||||
"isResourceTokenCollectionNodeSelected": [Function],
|
||||
"isRightPanelV2Enabled": [Function],
|
||||
|
||||
@@ -434,7 +434,6 @@ exports[`Upload Items Pane should render Default properly 1`] = `
|
||||
"isMongoIndexingEnabled": [Function],
|
||||
"isNotebookEnabled": [Function],
|
||||
"isNotebooksEnabledForAccount": [Function],
|
||||
"isPreferredApiMongoDB": [Function],
|
||||
"isPublishNotebookPaneEnabled": [Function],
|
||||
"isResourceTokenCollectionNodeSelected": [Function],
|
||||
"isRightPanelV2Enabled": [Function],
|
||||
|
||||
@@ -437,7 +437,6 @@ exports[`Delete Database Confirmation Pane submit() Should call delete database
|
||||
"isMongoIndexingEnabled": [Function],
|
||||
"isNotebookEnabled": [Function],
|
||||
"isNotebooksEnabledForAccount": [Function],
|
||||
"isPreferredApiMongoDB": [Function],
|
||||
"isPublishNotebookPaneEnabled": [Function],
|
||||
"isResourceTokenCollectionNodeSelected": [Function],
|
||||
"isRightPanelV2Enabled": [Function],
|
||||
|
||||
Reference in New Issue
Block a user