mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-19 01:25:36 -05:00
add error banner for failed migration cutover and cancel migration (#17106)
This commit is contained in:
@@ -126,9 +126,9 @@ export class DatabaseBackupPage extends MigrationWizardPage {
|
||||
}
|
||||
}).component();
|
||||
|
||||
this._disposables.push(this._networkShareButton.onDidChangeCheckedState((e) => {
|
||||
this._disposables.push(this._networkShareButton.onDidChangeCheckedState(async (e) => {
|
||||
if (e) {
|
||||
this.switchNetworkContainerFields(NetworkContainerType.NETWORK_SHARE);
|
||||
await this.switchNetworkContainerFields(NetworkContainerType.NETWORK_SHARE);
|
||||
}
|
||||
}));
|
||||
|
||||
@@ -141,9 +141,9 @@ export class DatabaseBackupPage extends MigrationWizardPage {
|
||||
}
|
||||
}).component();
|
||||
|
||||
this._disposables.push(this._blobContainerButton.onDidChangeCheckedState((e) => {
|
||||
this._disposables.push(this._blobContainerButton.onDidChangeCheckedState(async (e) => {
|
||||
if (e) {
|
||||
this.switchNetworkContainerFields(NetworkContainerType.BLOB_CONTAINER);
|
||||
await this.switchNetworkContainerFields(NetworkContainerType.BLOB_CONTAINER);
|
||||
}
|
||||
}));
|
||||
|
||||
@@ -273,8 +273,8 @@ export class DatabaseBackupPage extends MigrationWizardPage {
|
||||
}
|
||||
return true;
|
||||
}).component();
|
||||
this._disposables.push(this._networkSharePath.onTextChanged((value) => {
|
||||
this.validateFields();
|
||||
this._disposables.push(this._networkSharePath.onTextChanged(async (value) => {
|
||||
await this.validateFields();
|
||||
this.migrationStateModel._databaseBackup.networkShare.networkShareLocation = value;
|
||||
}));
|
||||
|
||||
@@ -745,14 +745,14 @@ export class DatabaseBackupPage extends MigrationWizardPage {
|
||||
|
||||
this._networkShareButton.checked = false;
|
||||
this._networkTableContainer.display = 'none';
|
||||
this._networkShareContainer.updateCssStyles({ 'display': 'none' });
|
||||
await this._networkShareContainer.updateCssStyles({ 'display': 'none' });
|
||||
|
||||
this._blobContainerButton.checked = false;
|
||||
this._blobTableContainer.display = 'none';
|
||||
this._blobContainer.updateCssStyles({ 'display': 'none' });
|
||||
await this._blobContainer.updateCssStyles({ 'display': 'none' });
|
||||
|
||||
this._targetDatabaseContainer.updateCssStyles({ 'display': 'none' });
|
||||
this._networkShareStorageAccountDetails.updateCssStyles({ 'display': 'none' });
|
||||
await this._targetDatabaseContainer.updateCssStyles({ 'display': 'none' });
|
||||
await this._networkShareStorageAccountDetails.updateCssStyles({ 'display': 'none' });
|
||||
const connectionProfile = await this.migrationStateModel.getSourceConnectionProfile();
|
||||
const queryProvider = azdata.dataprotocol.getProvider<azdata.QueryProvider>((await this.migrationStateModel.getSourceConnectionProfile()).providerId, azdata.DataProviderType.QueryProvider);
|
||||
const query = 'select SUSER_NAME()';
|
||||
@@ -798,9 +798,9 @@ export class DatabaseBackupPage extends MigrationWizardPage {
|
||||
}
|
||||
return true;
|
||||
}).component();
|
||||
this._disposables.push(targetDatabaseInput.onTextChanged((value) => {
|
||||
this._disposables.push(targetDatabaseInput.onTextChanged(async (value) => {
|
||||
this.migrationStateModel._targetDatabaseNames[index] = value.trim();
|
||||
this.validateFields();
|
||||
await this.validateFields();
|
||||
}));
|
||||
this._networkShareTargetDatabaseNames.push(targetDatabaseInput);
|
||||
|
||||
@@ -863,9 +863,9 @@ export class DatabaseBackupPage extends MigrationWizardPage {
|
||||
if (selectedIndex > -1 && !blobResourceGroupErrorStrings.includes(value)) {
|
||||
this.migrationStateModel._databaseBackup.blobs[index].resourceGroup = this.migrationStateModel.getAzureResourceGroup(selectedIndex);
|
||||
await this.loadBlobStorageDropdown(index);
|
||||
blobContainerStorageAccountDropdown.updateProperties({ enabled: true });
|
||||
await blobContainerStorageAccountDropdown.updateProperties({ enabled: true });
|
||||
} else {
|
||||
this.disableBlobTableDropdowns(index, constants.RESOURCE_GROUP);
|
||||
await this.disableBlobTableDropdowns(index, constants.RESOURCE_GROUP);
|
||||
}
|
||||
}));
|
||||
this._blobContainerResourceGroupDropdowns.push(blobContainerResourceDropdown);
|
||||
@@ -875,9 +875,9 @@ export class DatabaseBackupPage extends MigrationWizardPage {
|
||||
if (selectedIndex > -1 && !blobStorageAccountErrorStrings.includes(value)) {
|
||||
this.migrationStateModel._databaseBackup.blobs[index].storageAccount = this.migrationStateModel.getStorageAccount(selectedIndex);
|
||||
await this.loadBlobContainerDropdown(index);
|
||||
blobContainerDropdown.updateProperties({ enabled: true });
|
||||
await blobContainerDropdown.updateProperties({ enabled: true });
|
||||
} else {
|
||||
this.disableBlobTableDropdowns(index, constants.STORAGE_ACCOUNT);
|
||||
await this.disableBlobTableDropdowns(index, constants.STORAGE_ACCOUNT);
|
||||
}
|
||||
}));
|
||||
this._blobContainerStorageAccountDropdowns.push(blobContainerStorageAccountDropdown);
|
||||
@@ -888,10 +888,10 @@ export class DatabaseBackupPage extends MigrationWizardPage {
|
||||
this.migrationStateModel._databaseBackup.blobs[index].blobContainer = this.migrationStateModel.getBlobContainer(selectedIndex);
|
||||
if (this.migrationStateModel._databaseBackup.migrationMode === MigrationMode.OFFLINE) {
|
||||
await this.loadBlobLastBackupFileDropdown(index);
|
||||
blobContainerLastBackupFileDropdown.updateProperties({ enabled: true });
|
||||
await blobContainerLastBackupFileDropdown.updateProperties({ enabled: true });
|
||||
}
|
||||
} else {
|
||||
this.disableBlobTableDropdowns(index, constants.BLOB_CONTAINER);
|
||||
await this.disableBlobTableDropdowns(index, constants.BLOB_CONTAINER);
|
||||
}
|
||||
}));
|
||||
this._blobContainerDropdowns.push(blobContainerDropdown);
|
||||
@@ -1062,7 +1062,7 @@ export class DatabaseBackupPage extends MigrationWizardPage {
|
||||
protected async handleStateChange(e: StateChangeEvent): Promise<void> {
|
||||
}
|
||||
|
||||
private switchNetworkContainerFields(containerType: NetworkContainerType): void {
|
||||
private async switchNetworkContainerFields(containerType: NetworkContainerType): Promise<void> {
|
||||
this.wizard.message = {
|
||||
text: '',
|
||||
level: azdata.window.MessageLevel.Error
|
||||
@@ -1070,10 +1070,10 @@ export class DatabaseBackupPage extends MigrationWizardPage {
|
||||
|
||||
this.wizard.nextButton.enabled = true;
|
||||
this.migrationStateModel._databaseBackup.networkContainerType = containerType;
|
||||
this._blobContainer.updateCssStyles({ 'display': (containerType === NetworkContainerType.BLOB_CONTAINER) ? 'inline' : 'none' });
|
||||
this._networkShareContainer.updateCssStyles({ 'display': (containerType === NetworkContainerType.NETWORK_SHARE) ? 'inline' : 'none' });
|
||||
this._networkShareStorageAccountDetails.updateCssStyles({ 'display': (containerType === NetworkContainerType.NETWORK_SHARE) ? 'inline' : 'none' });
|
||||
this._targetDatabaseContainer.updateCssStyles({ 'display': 'inline' });
|
||||
await this._blobContainer.updateCssStyles({ 'display': (containerType === NetworkContainerType.BLOB_CONTAINER) ? 'inline' : 'none' });
|
||||
await this._networkShareContainer.updateCssStyles({ 'display': (containerType === NetworkContainerType.NETWORK_SHARE) ? 'inline' : 'none' });
|
||||
await this._networkShareStorageAccountDetails.updateCssStyles({ 'display': (containerType === NetworkContainerType.NETWORK_SHARE) ? 'inline' : 'none' });
|
||||
await this._targetDatabaseContainer.updateCssStyles({ 'display': 'inline' });
|
||||
this._networkTableContainer.display = (containerType === NetworkContainerType.NETWORK_SHARE) ? 'inline' : 'none';
|
||||
this._blobTableContainer.display = (containerType === NetworkContainerType.BLOB_CONTAINER) ? 'inline' : 'none';
|
||||
|
||||
@@ -1083,19 +1083,19 @@ export class DatabaseBackupPage extends MigrationWizardPage {
|
||||
this._blobContainerTargetDatabaseNames[index].value = v;
|
||||
});
|
||||
|
||||
this._windowsUserAccountText.updateProperties({
|
||||
await this._windowsUserAccountText.updateProperties({
|
||||
required: containerType === NetworkContainerType.NETWORK_SHARE
|
||||
});
|
||||
this._passwordText.updateProperties({
|
||||
await this._passwordText.updateProperties({
|
||||
required: containerType === NetworkContainerType.NETWORK_SHARE
|
||||
});
|
||||
this._sqlSourceUsernameInput.updateProperties({
|
||||
await this._sqlSourceUsernameInput.updateProperties({
|
||||
required: containerType === NetworkContainerType.NETWORK_SHARE
|
||||
});
|
||||
this._sqlSourcepassword.updateProperties({
|
||||
await this._sqlSourcepassword.updateProperties({
|
||||
required: containerType === NetworkContainerType.NETWORK_SHARE
|
||||
});
|
||||
this.validateFields();
|
||||
await this.validateFields();
|
||||
}
|
||||
|
||||
|
||||
@@ -1132,9 +1132,8 @@ export class DatabaseBackupPage extends MigrationWizardPage {
|
||||
|
||||
this.migrationStateModel._databaseBackup.subscription = this.migrationStateModel._targetSubscription;
|
||||
|
||||
|
||||
this.loadNetworkStorageResourceGroup();
|
||||
this.loadBlobResourceGroup();
|
||||
await this.loadNetworkStorageResourceGroup();
|
||||
await this.loadBlobResourceGroup();
|
||||
}
|
||||
|
||||
private async loadNetworkStorageResourceGroup(): Promise<void> {
|
||||
@@ -1219,24 +1218,24 @@ export class DatabaseBackupPage extends MigrationWizardPage {
|
||||
return v.value === undefined || errorStrings.includes((<azdata.CategoryValue>v.value)?.displayName);
|
||||
}
|
||||
|
||||
private disableBlobTableDropdowns(rowIndex: number, columnName: string): void {
|
||||
private async disableBlobTableDropdowns(rowIndex: number, columnName: string): Promise<void> {
|
||||
const dropdownProps = { enabled: false, loading: false };
|
||||
const createDropdownValuesWithPrereq = (displayName: string, name: string = '') => [{ displayName, name }];
|
||||
|
||||
if (this.migrationStateModel._databaseBackup?.migrationMode === MigrationMode.OFFLINE) {
|
||||
this._blobContainerLastBackupFileDropdowns[rowIndex].values = createDropdownValuesWithPrereq(constants.SELECT_BLOB_CONTAINER);
|
||||
selectDropDownIndex(this._blobContainerLastBackupFileDropdowns[rowIndex], 0);
|
||||
this._blobContainerLastBackupFileDropdowns[rowIndex]?.updateProperties(dropdownProps);
|
||||
await this._blobContainerLastBackupFileDropdowns[rowIndex]?.updateProperties(dropdownProps);
|
||||
}
|
||||
if (columnName === constants.BLOB_CONTAINER) { return; }
|
||||
|
||||
this._blobContainerDropdowns[rowIndex].values = createDropdownValuesWithPrereq(constants.SELECT_STORAGE_ACCOUNT);
|
||||
selectDropDownIndex(this._blobContainerDropdowns[rowIndex], 0);
|
||||
this._blobContainerDropdowns[rowIndex].updateProperties(dropdownProps);
|
||||
await this._blobContainerDropdowns[rowIndex].updateProperties(dropdownProps);
|
||||
if (columnName === constants.STORAGE_ACCOUNT) { return; }
|
||||
|
||||
this._blobContainerStorageAccountDropdowns[rowIndex].values = createDropdownValuesWithPrereq(constants.SELECT_RESOURCE_GROUP);
|
||||
selectDropDownIndex(this._blobContainerStorageAccountDropdowns[rowIndex], 0);
|
||||
this._blobContainerStorageAccountDropdowns[rowIndex].updateProperties(dropdownProps);
|
||||
await this._blobContainerStorageAccountDropdowns[rowIndex].updateProperties(dropdownProps);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user