mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-20 17:30:46 +00:00
More ViewModel cleanup (#116)
This commit is contained in:
@@ -22,6 +22,12 @@ import { HashMap } from "../../Common/HashMap";
|
||||
import { PlatformType } from "../../PlatformType";
|
||||
import { refreshCachedResources, getOrCreateDatabaseAndCollection } from "../../Common/DocumentClientUtilityBase";
|
||||
|
||||
export interface AddCollectionPaneOptions extends ViewModels.PaneOptions {
|
||||
isPreferredApiTable: ko.Computed<boolean>;
|
||||
databaseId?: string;
|
||||
databaseSelfLink?: string;
|
||||
}
|
||||
|
||||
export default class AddCollectionPane extends ContextualPaneBase {
|
||||
public defaultExperience: ko.Computed<string>;
|
||||
public databaseIds: ko.ObservableArray<string>;
|
||||
@@ -100,7 +106,7 @@ export default class AddCollectionPane extends ContextualPaneBase {
|
||||
private _databaseOffers: HashMap<DataModels.Offer>;
|
||||
private _isSynapseLinkEnabled: ko.Computed<boolean>;
|
||||
|
||||
constructor(options: ViewModels.AddCollectionPaneOptions) {
|
||||
constructor(options: AddCollectionPaneOptions) {
|
||||
super(options);
|
||||
this._databaseOffers = new HashMap<DataModels.Offer>();
|
||||
this.hasAutoPilotV2FeatureFlag = ko.pureComputed(() => this.container.hasAutoPilotV2FeatureFlag());
|
||||
@@ -619,7 +625,7 @@ export default class AddCollectionPane extends ContextualPaneBase {
|
||||
this._isSynapseLinkEnabled = ko.computed(() => {
|
||||
const databaseAccount =
|
||||
(this.container && this.container.databaseAccount && this.container.databaseAccount()) ||
|
||||
({} as ViewModels.DatabaseAccount);
|
||||
({} as DataModels.DatabaseAccount);
|
||||
const properties = databaseAccount.properties || ({} as DataModels.DatabaseAccountExtendedProperties);
|
||||
|
||||
// TODO: remove check for capability once all accounts have been migrated
|
||||
@@ -1266,10 +1272,7 @@ export default class AddCollectionPane extends ContextualPaneBase {
|
||||
: SharedConstants.CollectionCreation.NumberOfPartitionsInUnlimitedCollection;
|
||||
}
|
||||
|
||||
private _convertShardKeyToPartitionKey(
|
||||
shardKey: string,
|
||||
configurationOverrides: ViewModels.ConfigurationOverrides
|
||||
): string {
|
||||
private _convertShardKeyToPartitionKey(shardKey: string): string {
|
||||
if (!shardKey) {
|
||||
return shardKey;
|
||||
}
|
||||
@@ -1331,10 +1334,7 @@ export default class AddCollectionPane extends ContextualPaneBase {
|
||||
};
|
||||
if (this.container.isPreferredApiMongoDB()) {
|
||||
transform = (value: string) => {
|
||||
return this._convertShardKeyToPartitionKey(
|
||||
value,
|
||||
this.container.databaseAccount().properties.configurationOverrides
|
||||
);
|
||||
return this._convertShardKeyToPartitionKey(value);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user