diff --git a/src/Common/dataAccess/readDatabaseOffer.ts b/src/Common/dataAccess/readDatabaseOffer.ts index f002f09bf..9c940de8c 100644 --- a/src/Common/dataAccess/readDatabaseOffer.ts +++ b/src/Common/dataAccess/readDatabaseOffer.ts @@ -30,7 +30,7 @@ export const readDatabaseOffer = async ( return undefined; } } else { - offerId = await getDatabaseOfferIdWithSDK(params.databaseResourceId, params.isServerless); + offerId = await getDatabaseOfferIdWithSDK(params.databaseResourceId); if (!offerId) { return undefined; } @@ -80,8 +80,8 @@ const getDatabaseOfferIdWithARM = async (databaseId: string): Promise => return rpResponse?.name; }; -const getDatabaseOfferIdWithSDK = async (databaseResourceId: string, isServerless: boolean): Promise => { - const offers = await readOffers(isServerless); +const getDatabaseOfferIdWithSDK = async (databaseResourceId: string): Promise => { + const offers = await readOffers(); const offer = offers.find(offer => offer.resource === databaseResourceId); return offer?.id; }; diff --git a/src/Common/dataAccess/readOffers.ts b/src/Common/dataAccess/readOffers.ts index 460a591f9..8a5f9a30c 100644 --- a/src/Common/dataAccess/readOffers.ts +++ b/src/Common/dataAccess/readOffers.ts @@ -6,11 +6,7 @@ import { client } from "../CosmosClient"; import { sendCachedDataMessage } from "../MessageHandler"; import { userContext } from "../../UserContext"; -export const readOffers = async (isServerless?: boolean): Promise => { - if (isServerless) { - return []; // Reading offers is not supported for serverless accounts - } - +export const readOffers = async (): Promise => { try { if (configContext.platform === Platform.Portal) { return sendCachedDataMessage(MessageTypes.AllOffers, [ diff --git a/src/Contracts/DataModels.ts b/src/Contracts/DataModels.ts index a5dbc03b0..067c5e2f8 100644 --- a/src/Contracts/DataModels.ts +++ b/src/Contracts/DataModels.ts @@ -292,7 +292,6 @@ export interface CreateCollectionParams { export interface ReadDatabaseOfferParams { databaseId: string; databaseResourceId?: string; - isServerless?: boolean; offerId?: string; } diff --git a/src/Explorer/Panes/AddCollectionPane.ts b/src/Explorer/Panes/AddCollectionPane.ts index 3949471b3..61a21bc36 100644 --- a/src/Explorer/Panes/AddCollectionPane.ts +++ b/src/Explorer/Panes/AddCollectionPane.ts @@ -666,7 +666,7 @@ export default class AddCollectionPane extends ContextualPaneBase { const subscriptionType: ViewModels.SubscriptionType = this.container.subscriptionType && this.container.subscriptionType(); - if (subscriptionType === ViewModels.SubscriptionType.EA) { + if (subscriptionType === ViewModels.SubscriptionType.EA || this.container.isServerlessEnabled()) { return false; } diff --git a/src/Explorer/Panes/AddDatabasePane.ts b/src/Explorer/Panes/AddDatabasePane.ts index d54fffc2f..f392b0120 100644 --- a/src/Explorer/Panes/AddDatabasePane.ts +++ b/src/Explorer/Panes/AddDatabasePane.ts @@ -337,7 +337,7 @@ export default class AddDatabasePane extends ContextualPaneBase { const subscriptionType: ViewModels.SubscriptionType = this.container.subscriptionType && this.container.subscriptionType(); - if (subscriptionType === ViewModels.SubscriptionType.EA) { + if (subscriptionType === ViewModels.SubscriptionType.EA || this.container.isServerlessEnabled()) { return false; } diff --git a/src/Explorer/Tree/Database.ts b/src/Explorer/Tree/Database.ts index ba3b252a4..a8cbce7a5 100644 --- a/src/Explorer/Tree/Database.ts +++ b/src/Explorer/Tree/Database.ts @@ -200,11 +200,10 @@ export default class Database implements ViewModels.Database { } public async loadOffer(): Promise { - if (!this.offer()) { + if (!this.container.isServerlessEnabled() && !this.offer()) { const params: DataModels.ReadDatabaseOfferParams = { databaseId: this.id(), - databaseResourceId: this.self, - isServerless: this.container.isServerlessEnabled() + databaseResourceId: this.self }; this.offer(await readDatabaseOffer(params)); }