Fixed setup save queries within serverless accounts (#1626)
* Fixed setup save queries within serverless accounts * Fixed format * ran prettier
This commit is contained in:
parent
68b45e77a8
commit
07d242f972
|
@ -13,6 +13,7 @@ import { createDocument } from "./dataAccess/createDocument";
|
|||
import { deleteDocument } from "./dataAccess/deleteDocument";
|
||||
import { queryDocuments } from "./dataAccess/queryDocuments";
|
||||
import { handleError } from "./ErrorHandlingUtils";
|
||||
import { isServerlessAccount } from "Utils/CapabilityUtils";
|
||||
|
||||
export class QueriesClient {
|
||||
private static readonly PartitionKey: DataModels.PartitionKey = {
|
||||
|
@ -32,6 +33,16 @@ export class QueriesClient {
|
|||
}
|
||||
|
||||
const clearMessage = NotificationConsoleUtils.logConsoleProgress("Setting up account for saving queries");
|
||||
|
||||
if (isServerlessAccount()) {
|
||||
return createCollection({
|
||||
collectionId: SavedQueries.CollectionName,
|
||||
createNewDatabase: true,
|
||||
databaseId: SavedQueries.DatabaseName,
|
||||
partitionKey: QueriesClient.PartitionKey,
|
||||
databaseLevelThroughput: false,
|
||||
});
|
||||
} else {
|
||||
return createCollection({
|
||||
collectionId: SavedQueries.CollectionName,
|
||||
createNewDatabase: true,
|
||||
|
@ -52,6 +63,7 @@ export class QueriesClient {
|
|||
)
|
||||
.finally(() => clearMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public async saveQuery(query: DataModels.Query): Promise<void> {
|
||||
const queriesCollection = this.findQueriesCollection();
|
||||
|
|
|
@ -318,7 +318,7 @@ export interface CreateCollectionParams {
|
|||
collectionId: string;
|
||||
databaseId: string;
|
||||
databaseLevelThroughput: boolean;
|
||||
offerThroughput: number;
|
||||
offerThroughput?: number;
|
||||
analyticalStorageTtl?: number;
|
||||
autoPilotMaxThroughput?: number;
|
||||
indexingPolicy?: IndexingPolicy;
|
||||
|
|
|
@ -113,6 +113,7 @@ export const SaveQueryPane: FunctionComponent<SaveQueryPaneProps> = ({
|
|||
},
|
||||
startKey,
|
||||
);
|
||||
closeSidePanel();
|
||||
} catch (error) {
|
||||
const errorMessage = getErrorMessage(error);
|
||||
traceFailure(
|
||||
|
|
Loading…
Reference in New Issue