UI for the Backup/Restore Managed Instance Feature (#19244)

* Rebase from main branch

* Made mssql a module

* remove rpc specific stuff

* Added create sas RPC call

* Backup to url works now

* Moved createSas RPC to the BlobService

* Relocated createSas RPC from sql-dataprotocolclient to the mssql

* After rebase

* Removed duplicate symbol

* Renamed Blob to AzureBlob and relocated CreateSasResponse to mssql extension

* Removed AzureBlobProvider, removed AzureBlobService feature

* renamed blob to azureblob, converted thenable to promise

* Simplify API

* fixes

* docs update, blob to azureblob update

* UI design first commit

* Detected Managed Instance, trying to script backup to url

* azure subscription api added, but ADS crashes

* Created url dialog component and added link account

* Changed backup component UI logic

* Changed b/r UI, added restore from URL, detected MI from restore component

* Removed mocked and added real Azure API, changed RestoreDialog UI

* Added file fetching API

* added create sas RPC call

* Backup to url works now

* Fixed some bugs

* Moved createSas RPC to the BlobService

* Relocated createSas RPC from sql-dataprotocolclient to the mssql

* Rebase createSas changed to the backupRestoreManagedInstance

* PR comments fix

* Enabled backup to url for gov clouds

* Replaced anchor element with Link class

* Fixed pick azure account logic

* Removed duplicates from eslintrc

* Fixed url browser dialog

* Fixed restore UI, disabled url empty url browser dropdowns, fixed backup OK button

* bumped sts version

* bumped sts version

* Fix config

* Fixed URL browser dialog UX

* Backup and restore dialog fix

* Referencing azure resource types directly

* Scoped url browser dialog css classes

* Made the url browser dialog field a local variable

* moved url browser files from fileBrowser to the urlBrowser folder

* Changed deviceType from number to enum

* Added all device type options

* Moved mssql

* Added MI backup button comment

* Removed unhelpful comment

* Revert differential copy only backup mistake

* Renamed azurebrowser to urlBrowserDialog

* Localize create sas button label

* Removed unnecessary spinner

* Use UTC date instead of locale date

* Removed * and added required flag

* Use async instead of nested thens

* Added target database tooltip

* Using deferred promise instead of event emitter

* Added error handling to the url browser dialog

* Registered backup component elements

* Register backup component listeners

* Removed redundant setDefaultBackupPaths call

* Added setBackupPathList docs

* Add return types

* Remove code from comment

* Register restore dialog elements

* Register restore dialog listeners

* Pass engine edition enum instead of boolean

* Capitalize enum values

* DatabaseEngineEdition fix

* Use DeviceType instead of number

* Use deferred pointer

* Add new ModalDialogName

* Use constructor fields

* Register URL browser dialog components

* Remove unnecessary helper function

* nextYear function doc and move

* split registerListeners method

* showDialog returns promise

* Backup device type comment

* Pass aria label through constructor

* Fix backup button

* Remove comment

* Comment unsupported MI backup options

* Remove one liner helper function

* Restore dialog methods return types

* Remove comment

* JS doc format

* Renamed UrlBrowserDialog to BackupRestoreUrlBrowserDialog

* Moved MediaDeviceType, added PhisicalDeviceType

* Reorder and rename physical device type

* remove extra spaces

Co-authored-by: chgagnon <chgagnon@microsoft.com>
This commit is contained in:
Nemanja Milovančević
2022-05-11 20:01:06 +02:00
committed by GitHub
parent d38dcc853d
commit 65ef41d53d
24 changed files with 1154 additions and 162 deletions

View File

@@ -34,4 +34,20 @@ export class MainThreadAzureAccount extends Disposable implements MainThreadAzur
return this._proxy.$getSubscriptions(account, ignoreErrors, selectedOnly);
}
public getStorageAccounts(account: azurecore.AzureAccount, subscriptions: azurecore.azureResource.AzureResourceSubscription[], ignoreErrors?: boolean): Promise<azurecore.GetStorageAccountResult> {
return this._proxy.$getStorageAccounts(account, subscriptions, ignoreErrors);
}
public getBlobContainers(account: azurecore.AzureAccount, subscription: azurecore.azureResource.AzureResourceSubscription, storageAccount: azurecore.azureResource.AzureGraphResource, ignoreErrors?: boolean): Promise<azurecore.GetBlobContainersResult> {
return this._proxy.$getBlobContainers(account, subscription, storageAccount, ignoreErrors);
}
public getBlobs(account: azurecore.AzureAccount, subscription: azurecore.azureResource.AzureResourceSubscription, storageAccount: azurecore.azureResource.AzureGraphResource, containerName: string, ignoreErrors?: boolean): Promise<azurecore.GetBlobsResult> {
return this._proxy.$getBlobs(account, subscription, storageAccount, containerName, ignoreErrors);
}
public getStorageAccountAccessKey(account: azurecore.AzureAccount, subscription: azurecore.azureResource.AzureResourceSubscription, storageAccount: azurecore.azureResource.AzureGraphResource, ignoreErrors?: boolean): Promise<azurecore.GetStorageAccountAccessKeyResult> {
return this._proxy.$getStorageAccountAccessKey(account, subscription, storageAccount, ignoreErrors);
}
}

View File

@@ -32,7 +32,6 @@ import { IAdsTelemetryService, ITelemetryEventProperties } from 'sql/platform/te
import * as TelemetryKeys from 'sql/platform/telemetry/common/telemetryKeys';
import { ITableDesignerService } from 'sql/workbench/services/tableDesigner/common/interface';
import { IExecutionPlanService } from 'sql/workbench/services/executionPlan/common/interfaces';
/**
* Main thread class for handling data protocol management registration.
*/

View File

@@ -15,8 +15,31 @@ export class ExtHostAzureAccount extends ExtHostAzureAccountShape {
}
public override $getSubscriptions(account: azurecore.AzureAccount, ignoreErrors?: boolean, selectedOnly?: boolean): Thenable<azurecore.GetSubscriptionsResult> {
const api = this._extHostExtensionService.getExtensionExports(new ExtensionIdentifier(azurecore.extension.name)) as azurecore.IExtension;
const api = this.getApi();
return api.getSubscriptions(account, ignoreErrors, selectedOnly);
}
}
public override $getStorageAccounts(account: azurecore.AzureAccount, subscriptions: azurecore.azureResource.AzureResourceSubscription[], ignoreErrors?: boolean): Promise<azurecore.GetStorageAccountResult> {
const api = this.getApi();
return api.getStorageAccounts(account, subscriptions, ignoreErrors);
}
public override $getBlobContainers(account: azurecore.AzureAccount, subscription: azurecore.azureResource.AzureResourceSubscription, storageAccount: azurecore.azureResource.AzureGraphResource, ignoreErrors?: boolean): Promise<azurecore.GetBlobContainersResult> {
const api = this.getApi();
return api.getBlobContainers(account, subscription, storageAccount);
}
public override $getBlobs(account: azurecore.AzureAccount, subscription: azurecore.azureResource.AzureResourceSubscription, storageAccount: azurecore.azureResource.AzureGraphResource, containerName: string, ignoreErrors?: boolean): Promise<azurecore.GetBlobsResult> {
const api = this.getApi();
return api.getBlobs(account, subscription, storageAccount, containerName, ignoreErrors);
}
public override $getStorageAccountAccessKey(account: azurecore.AzureAccount, subscription: azurecore.azureResource.AzureResourceSubscription, storageAccount: azurecore.azureResource.AzureGraphResource, ignoreErrors?: boolean): Promise<azurecore.GetStorageAccountAccessKeyResult> {
const api = this.getApi();
return api.getStorageAccountAccessKey(account, subscription, storageAccount, ignoreErrors);
}
private getApi(): azurecore.IExtension {
return this._extHostExtensionService.getExtensionExports(new ExtensionIdentifier(azurecore.extension.name)) as azurecore.IExtension;
}
}

View File

@@ -84,6 +84,7 @@ export function createAdsApiFactory(accessor: ServicesAccessor): IAdsExtensionAp
const extHostConnectionManagement = rpcProtocol.set(SqlExtHostContext.ExtHostConnectionManagement, new ExtHostConnectionManagement(rpcProtocol));
const extHostCredentialManagement = rpcProtocol.set(SqlExtHostContext.ExtHostCredentialManagement, new ExtHostCredentialManagement(rpcProtocol));
rpcProtocol.set(SqlExtHostContext.ExtHostAzureBlob, new ExtHostAzureBlob(accessor.get(IExtHostExtensionService)));
rpcProtocol.set(SqlExtHostContext.ExtHostAzureAccount, new ExtHostAzureAccount(accessor.get(IExtHostExtensionService)));
const extHostDataProvider = rpcProtocol.set(SqlExtHostContext.ExtHostDataProtocol, new ExtHostDataProtocol(rpcProtocol, uriTransformer));
const extHostObjectExplorer = rpcProtocol.set(SqlExtHostContext.ExtHostObjectExplorer, new ExtHostObjectExplorer(rpcProtocol, commands));
const extHostResourceProvider = rpcProtocol.set(SqlExtHostContext.ExtHostResourceProvider, new ExtHostResourceProvider(rpcProtocol));

View File

@@ -35,8 +35,13 @@ import { ITelemetryEventProperties } from 'sql/platform/telemetry/common/telemet
export abstract class ExtHostAzureBlobShape {
public $createSas(connectionUri: string, blobContainerUri: string, blobStorageKey: string, storageAccountName: string, expirationDate: string): Thenable<mssql.CreateSasResponse> { throw ni(); }
}
export abstract class ExtHostAzureAccountShape {
public $getSubscriptions(account: azurecore.AzureAccount, ignoreErrors?: boolean, selectedOnly?: boolean): Thenable<azurecore.GetSubscriptionsResult> { throw ni(); }
public $getStorageAccounts(account: azurecore.AzureAccount, subscriptions: azurecore.azureResource.AzureResourceSubscription[], ignoreErrors?: boolean): Promise<azurecore.GetStorageAccountResult> { throw ni(); }
public $getBlobContainers(account: azurecore.AzureAccount, subscription: azurecore.azureResource.AzureResourceSubscription, storageAccount: azurecore.azureResource.AzureGraphResource, ignoreErrors?: boolean): Promise<azurecore.GetBlobContainersResult> { throw ni(); }
public $getBlobs(account: azurecore.AzureAccount, subscription: azurecore.azureResource.AzureResourceSubscription, storageAccount: azurecore.azureResource.AzureGraphResource, containerName: string, ignoreErrors: boolean): Promise<azurecore.GetBlobsResult> { throw ni(); }
public $getStorageAccountAccessKey(account: azurecore.AzureAccount, subscription: azurecore.azureResource.AzureResourceSubscription, storageAccount: azurecore.azureResource.AzureGraphResource, ignoreErrors?: boolean): Promise<azurecore.GetStorageAccountAccessKeyResult> { throw ni(); }
}
export abstract class ExtHostAccountManagementShape {
@@ -628,6 +633,10 @@ export interface MainThreadAzureAccountShape extends IDisposable {
}
export interface MainThreadAzureBlobShape extends IDisposable {
}
export interface MainThreadResourceProviderShape extends IDisposable {
$registerResourceProvider(providerMetadata: azdata.ResourceProviderMetadata, handle: number): Thenable<any>;
$unregisterResourceProvider(handle: number): Thenable<any>;