mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-23 09:35:39 -05:00
Adding database backup and accounts page to migration wizard (#13764)
* Added localized strings Created a db backup page added radio buttons * created components for database backup page * Added account selection page * Added accounts page * Some more work done - Added page validations - Almost done with db backup except for a few api calls. * Some more progress added graph api for storage account * Finished hooking up all the endpoints on db page. * Some code fixed and refactoring * Fixed a ton of validation bugs * Added common localized strings to the constants file * some code cleanup * changed method name to makeHttpGetRequest * change http result class name * Added return types and return values to the functions * removed void returns * Added more return types and values * Storing accounts in the map with ids as key Fixed a bug in case of no subscriptions found * cleaning up the code * Fixed localized strings * Added comments to get request api Added validation logic to database backup page removed unnecessary page validations. * Added some get resource functions in azure core * Changed thenable to promise * Added arm calls for file shares and blob storage * Added field specific validation error message * Added examples in validation error message. * Fixed some typings and localized string * Added live validations to dropdowns * Fixed method name to getSQLVMservers * Using older storage package * Update typings/namings (#13767) * Update typings * more typings fixes * switched fileshares and blobcontainers api to http requests * removed the extra line * Adding resource graph documentation link as a comment * remove makeHttpRequest api from azurecore Co-authored-by: Charles Gagnon <chgagnon@microsoft.com>
This commit is contained in:
@@ -39,7 +39,7 @@ export type SqlManagedInstance = AzureProduct;
|
||||
export async function getAvailableManagedInstanceProducts(account: azdata.Account, subscription: Subscription): Promise<SqlManagedInstance[]> {
|
||||
const api = await getAzureCoreAPI();
|
||||
|
||||
const result = await api.runGraphQuery<SqlManagedInstance>(account, [subscription], false, `where type == "${azureResource.AzureResourceType.sqlManagedInstance}"`);
|
||||
const result = await api.getSqlManagedInstances(account, [subscription], false);
|
||||
return result.resources;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ export type SqlServer = AzureProduct;
|
||||
export async function getAvailableSqlServers(account: azdata.Account, subscription: Subscription): Promise<SqlServer[]> {
|
||||
const api = await getAzureCoreAPI();
|
||||
|
||||
const result = await api.runGraphQuery<SqlServer>(account, [subscription], false, `where type == "${azureResource.AzureResourceType.sqlServer}"`);
|
||||
const result = await api.getSqlServers(account, [subscription], false);
|
||||
return result.resources;
|
||||
}
|
||||
|
||||
@@ -55,6 +55,45 @@ export type SqlVMServer = AzureProduct;
|
||||
export async function getAvailableSqlVMs(account: azdata.Account, subscription: Subscription): Promise<SqlVMServer[]> {
|
||||
const api = await getAzureCoreAPI();
|
||||
|
||||
const result = await api.runGraphQuery<SqlVMServer>(account, [subscription], false, `where type == "${azureResource.AzureResourceType.virtualMachines}" and properties.storageProfile.imageReference.publisher == "microsoftsqlserver"`);
|
||||
const result = await api.getSqlVMServers(account, [subscription], false);
|
||||
return result.resources;
|
||||
}
|
||||
|
||||
export type StorageAccount = AzureProduct;
|
||||
export async function getAvailableStorageAccounts(account: azdata.Account, subscription: Subscription): Promise<StorageAccount[]> {
|
||||
const api = await getAzureCoreAPI();
|
||||
const result = await api.getStorageAccounts(account, [subscription], false);
|
||||
sortResourceArrayByName(result.resources);
|
||||
return result.resources;
|
||||
}
|
||||
|
||||
export async function getFileShares(account: azdata.Account, subscription: Subscription, storageAccount: StorageAccount): Promise<azureResource.FileShare[]> {
|
||||
const api = await getAzureCoreAPI();
|
||||
let result = await api.getFileShares(account, subscription, storageAccount, true);
|
||||
let fileShares = result.fileShares;
|
||||
sortResourceArrayByName(fileShares!);
|
||||
return fileShares!;
|
||||
}
|
||||
|
||||
export async function getBlobContainers(account: azdata.Account, subscription: Subscription, storageAccount: StorageAccount): Promise<azureResource.BlobContainer[]> {
|
||||
const api = await getAzureCoreAPI();
|
||||
let result = await api.getBlobContainers(account, subscription, storageAccount, true);
|
||||
let blobContainers = result.blobContainers;
|
||||
sortResourceArrayByName(blobContainers!);
|
||||
return blobContainers!;
|
||||
}
|
||||
|
||||
function sortResourceArrayByName(resourceArray: AzureProduct[] | azureResource.FileShare[] | azureResource.BlobContainer[] | undefined): void {
|
||||
if (!resourceArray) {
|
||||
return;
|
||||
}
|
||||
resourceArray.sort((a: AzureProduct | azureResource.BlobContainer | azureResource.FileShare, b: AzureProduct | azureResource.BlobContainer | azureResource.FileShare) => {
|
||||
if (a.name! < b.name!) {
|
||||
return -1;
|
||||
}
|
||||
if (a.name! > b.name!) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user