mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-20 09:20:16 +00:00
* Initial dev for container copy * remove padding from label * Added Copy Job prerequisites screen * Added hooks to evaluate reader role access * added copyjob pre-requsite screen along with it's validations * Added monitor copy job list screen * added copy job list refresh and reset functionality * remove arm token dependency * fetch account details from account id instead of context * Fix lint & typescript checks * show copyjob screen from portal navigation * adding copy job details screen * remove duplicate code & show sql accounts only * ui fixes for list job page * pending icon * copy job details screen ui * reset .vscode/settings.json * Fixed existing UTs * disabling action buttons until it's in progress * fixed formatting * Adding loader on submit button and show job creation errors in the panel itself * updating disabling action menu item logic * added custom pager * fix lint and ts errors * updating file names and removing comments * remove comments * modularize the arom common code * Adding content and removing tooltip * updating job details screen * updating online copy enabled screen * Adding below changes - Don't show permission screen for same account in offline mode - Don't show identity permissions for same account in online mode - Show error message if selected containers are identical - Update abort signal messages * added feedback code from explorer * Add tooltips and long polling - Added tooltips to permission sections - Implemented long polling for PITR and online copy enabled sections - Long polling automatically stops after 15 minutes - After polling ends, a refresh button will be displayed --------- Co-authored-by: nishthaAhujaa <nishtha17354@iiittd.ac.in>
37 lines
1.3 KiB
TypeScript
37 lines
1.3 KiB
TypeScript
import { DatabaseAccount } from "Contracts/DataModels";
|
|
import { userContext } from "UserContext";
|
|
import { buildArmUrl } from "Utils/arm/armUtils";
|
|
|
|
const apiVersion = "2025-04-15";
|
|
export type FetchAccountDetailsParams = {
|
|
subscriptionId: string;
|
|
resourceGroupName: string;
|
|
accountName: string;
|
|
};
|
|
|
|
const buildUrl = (params: FetchAccountDetailsParams): string => {
|
|
const { subscriptionId, resourceGroupName, accountName } = params;
|
|
|
|
return buildArmUrl(
|
|
`/subscriptions/${subscriptionId}/resourceGroups/${resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/${accountName}`,
|
|
apiVersion,
|
|
);
|
|
};
|
|
|
|
export async function fetchDatabaseAccount(subscriptionId: string, resourceGroupName: string, accountName: string) {
|
|
if (!userContext.authorizationToken) {
|
|
return Promise.reject("Authorization token is missing");
|
|
}
|
|
const headers = new Headers();
|
|
headers.append("Authorization", userContext.authorizationToken);
|
|
headers.append("Content-Type", "application/json");
|
|
const uri = buildUrl({ subscriptionId, resourceGroupName, accountName });
|
|
const response = await fetch(uri, { method: "GET", headers: headers });
|
|
|
|
if (!response.ok) {
|
|
throw new Error(`Error fetching database account: ${response.statusText}`);
|
|
}
|
|
const account: DatabaseAccount = await response.json();
|
|
return account;
|
|
}
|