Fix two bugs with tables database offer (#282)
1. After moving read databases call to RP for Tables API, we lose the `_rid` property. Since we are reading Table's database offer with SDK, we need the `_rid` of the database to find its offer. Without `_rid`, we won't be able to find the database offer and the Scale tab would disappear again. The fix is to use SDK to read databases for Table API so we have `_rid`. 2. There's a bug in the non-aad code path for updating offers which prevents users from switching from manual to autoscale and vice versa. The fix is to properly set the option headers.
This commit is contained in:
parent
274deb13be
commit
b9245101bc
|
@ -12,14 +12,14 @@ import { sendNotificationForError } from "./sendNotificationForError";
|
||||||
import { userContext } from "../../UserContext";
|
import { userContext } from "../../UserContext";
|
||||||
|
|
||||||
export async function readDatabases(): Promise<DataModels.Database[]> {
|
export async function readDatabases(): Promise<DataModels.Database[]> {
|
||||||
if (userContext.defaultExperience === DefaultAccountExperienceType.Table) {
|
|
||||||
return [{ id: "TablesDB" } as DataModels.Database];
|
|
||||||
}
|
|
||||||
|
|
||||||
let databases: DataModels.Database[];
|
let databases: DataModels.Database[];
|
||||||
const clearMessage = logConsoleProgress(`Querying databases`);
|
const clearMessage = logConsoleProgress(`Querying databases`);
|
||||||
try {
|
try {
|
||||||
if (window.authType === AuthType.AAD && !userContext.useSDKOperations) {
|
if (
|
||||||
|
window.authType === AuthType.AAD &&
|
||||||
|
!userContext.useSDKOperations &&
|
||||||
|
userContext.defaultExperience !== DefaultAccountExperienceType.Table
|
||||||
|
) {
|
||||||
databases = await readDatabasesWithARM();
|
databases = await readDatabasesWithARM();
|
||||||
} else {
|
} else {
|
||||||
const sdkResponse = await client()
|
const sdkResponse = await client()
|
||||||
|
|
|
@ -406,10 +406,14 @@ const updateOfferWithSDK = async (params: UpdateOfferParams): Promise<Offer> =>
|
||||||
|
|
||||||
const options: RequestOptions = {};
|
const options: RequestOptions = {};
|
||||||
if (params.migrateToAutoPilot) {
|
if (params.migrateToAutoPilot) {
|
||||||
options.initialHeaders[HttpHeaders.migrateOfferToAutopilot] = "true";
|
options.initialHeaders = {
|
||||||
|
[HttpHeaders.migrateOfferToAutopilot]: "true"
|
||||||
|
};
|
||||||
delete newOffer.content.offerAutopilotSettings;
|
delete newOffer.content.offerAutopilotSettings;
|
||||||
} else if (params.migrateToManual) {
|
} else if (params.migrateToManual) {
|
||||||
options.initialHeaders[HttpHeaders.migrateOfferToManualThroughput] = "true";
|
options.initialHeaders = {
|
||||||
|
[HttpHeaders.migrateOfferToManualThroughput]: "true"
|
||||||
|
};
|
||||||
newOffer.content.offerAutopilotSettings = { maxThroughput: 0 };
|
newOffer.content.offerAutopilotSettings = { maxThroughput: 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue