mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-30 01:25:38 -05:00
Dev/brih/hotfix status page (#16407)
* add dispose pattern, fix migration status enum * format strings * add dispose handler to more events
This commit is contained in:
@@ -16,6 +16,7 @@ export class AccountsSelectionPage extends MigrationWizardPage {
|
||||
private _azureAccountsDropdown!: azdata.DropDownComponent;
|
||||
private _accountTenantDropdown!: azdata.DropDownComponent;
|
||||
private _accountTenantFlexContainer!: azdata.FlexContainer;
|
||||
private _disposables: vscode.Disposable[] = [];
|
||||
|
||||
constructor(wizard: azdata.window.Wizard, migrationStateModel: MigrationStateModel) {
|
||||
super(wizard, azdata.window.createWizardPage(constants.ACCOUNTS_SELECTION_PAGE_TITLE), migrationStateModel);
|
||||
@@ -32,6 +33,9 @@ export class AccountsSelectionPage extends MigrationWizardPage {
|
||||
);
|
||||
await view.initializeModel(form.component());
|
||||
await this.populateAzureAccountsDropdown();
|
||||
this._disposables.push(view.onClosed(e =>
|
||||
this._disposables.forEach(
|
||||
d => { try { d.dispose(); } catch { } })));
|
||||
}
|
||||
|
||||
private createAzureAccountsDropdown(view: azdata.ModelView): azdata.FormComponent {
|
||||
@@ -74,7 +78,7 @@ export class AccountsSelectionPage extends MigrationWizardPage {
|
||||
return false;
|
||||
}).component();
|
||||
|
||||
this._azureAccountsDropdown.onValueChanged(async (value) => {
|
||||
this._disposables.push(this._azureAccountsDropdown.onValueChanged(async (value) => {
|
||||
const selectedIndex = findDropDownItemIndex(this._azureAccountsDropdown, value);
|
||||
if (selectedIndex > -1) {
|
||||
const selectedAzureAccount = this.migrationStateModel.getAccount(selectedIndex);
|
||||
@@ -97,7 +101,7 @@ export class AccountsSelectionPage extends MigrationWizardPage {
|
||||
this.migrationStateModel._databaseBackup.subscription = undefined!;
|
||||
await this._azureAccountsDropdown.validate();
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
const linkAccountButton = view.modelBuilder.hyperlink()
|
||||
.withProps({
|
||||
@@ -109,14 +113,14 @@ export class AccountsSelectionPage extends MigrationWizardPage {
|
||||
})
|
||||
.component();
|
||||
|
||||
linkAccountButton.onDidClick(async (event) => {
|
||||
this._disposables.push(linkAccountButton.onDidClick(async (event) => {
|
||||
await vscode.commands.executeCommand('workbench.actions.modal.linkedAccount');
|
||||
await this.populateAzureAccountsDropdown();
|
||||
this.wizard.message = {
|
||||
text: ''
|
||||
};
|
||||
this._azureAccountsDropdown.validate();
|
||||
});
|
||||
}));
|
||||
|
||||
const flexContainer = view.modelBuilder.flexContainer()
|
||||
.withLayout({
|
||||
@@ -152,7 +156,7 @@ export class AccountsSelectionPage extends MigrationWizardPage {
|
||||
fireOnTextChange: true,
|
||||
}).component();
|
||||
|
||||
this._accountTenantDropdown.onValueChanged(value => {
|
||||
this._disposables.push(this._accountTenantDropdown.onValueChanged(value => {
|
||||
/**
|
||||
* Replacing all the tenants in azure account with the tenant user has selected.
|
||||
* All azure requests will only run on this tenant from now on
|
||||
@@ -164,7 +168,7 @@ export class AccountsSelectionPage extends MigrationWizardPage {
|
||||
this.migrationStateModel._targetSubscription = undefined!;
|
||||
this.migrationStateModel._databaseBackup.subscription = undefined!;
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
this._accountTenantFlexContainer = view.modelBuilder.flexContainer()
|
||||
.withLayout({
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
import * as vscode from 'vscode';
|
||||
import { EOL } from 'os';
|
||||
import { getStorageAccountAccessKeys } from '../api/azure';
|
||||
import { MigrationWizardPage } from '../models/migrationWizardPage';
|
||||
@@ -48,8 +49,8 @@ export class DatabaseBackupPage extends MigrationWizardPage {
|
||||
private _networkShareTargetDatabaseNames: azdata.InputBoxComponent[] = [];
|
||||
private _blobContainerTargetDatabaseNames: azdata.InputBoxComponent[] = [];
|
||||
|
||||
|
||||
private _existingDatabases: string[] = [];
|
||||
private _disposables: vscode.Disposable[] = [];
|
||||
|
||||
constructor(wizard: azdata.window.Wizard, migrationStateModel: MigrationStateModel) {
|
||||
super(wizard, azdata.window.createWizardPage(constants.DATABASE_BACKUP_PAGE_TITLE), migrationStateModel);
|
||||
@@ -87,9 +88,13 @@ export class DatabaseBackupPage extends MigrationWizardPage {
|
||||
}
|
||||
]
|
||||
);
|
||||
|
||||
this._disposables.push(this._view.onClosed(e => {
|
||||
this._disposables.forEach(
|
||||
d => { try { d.dispose(); } catch { } });
|
||||
}));
|
||||
|
||||
await view.initializeModel(form.component());
|
||||
|
||||
|
||||
}
|
||||
|
||||
private createBackupLocationComponent(): azdata.FlexContainer {
|
||||
@@ -111,11 +116,11 @@ export class DatabaseBackupPage extends MigrationWizardPage {
|
||||
}
|
||||
}).component();
|
||||
|
||||
networkShareButton.onDidChangeCheckedState((e) => {
|
||||
this._disposables.push(networkShareButton.onDidChangeCheckedState((e) => {
|
||||
if (e) {
|
||||
this.switchNetworkContainerFields(NetworkContainerType.NETWORK_SHARE);
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
const blobContainerButton = this._view.modelBuilder.radioButton()
|
||||
.withProps({
|
||||
@@ -126,11 +131,11 @@ export class DatabaseBackupPage extends MigrationWizardPage {
|
||||
}
|
||||
}).component();
|
||||
|
||||
blobContainerButton.onDidChangeCheckedState((e) => {
|
||||
this._disposables.push(blobContainerButton.onDidChangeCheckedState((e) => {
|
||||
if (e) {
|
||||
this.switchNetworkContainerFields(NetworkContainerType.BLOB_CONTAINER);
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
const flexContainer = this._view.modelBuilder.flexContainer().withItems(
|
||||
[
|
||||
@@ -189,9 +194,9 @@ export class DatabaseBackupPage extends MigrationWizardPage {
|
||||
enabled: false,
|
||||
width: WIZARD_INPUT_COMPONENT_WIDTH
|
||||
}).component();
|
||||
this._sqlSourceUsernameInput.onTextChanged(value => {
|
||||
this._disposables.push(this._sqlSourceUsernameInput.onTextChanged(value => {
|
||||
this.migrationStateModel._sqlServerUsername = value;
|
||||
});
|
||||
}));
|
||||
|
||||
const sqlPasswordLabel = this._view.modelBuilder.text().withProps({
|
||||
value: constants.DATABASE_BACKUP_NETWORK_SHARE_PASSWORD_LABEL,
|
||||
@@ -206,9 +211,9 @@ export class DatabaseBackupPage extends MigrationWizardPage {
|
||||
inputType: 'password',
|
||||
width: WIZARD_INPUT_COMPONENT_WIDTH
|
||||
}).component();
|
||||
this._sqlSourcepassword.onTextChanged(value => {
|
||||
this._disposables.push(this._sqlSourcepassword.onTextChanged(value => {
|
||||
this.migrationStateModel._sqlServerPassword = value;
|
||||
});
|
||||
}));
|
||||
|
||||
|
||||
const networkShareHeading = this._view.modelBuilder.text().withProps({
|
||||
@@ -254,10 +259,10 @@ export class DatabaseBackupPage extends MigrationWizardPage {
|
||||
}
|
||||
return true;
|
||||
}).component();
|
||||
this._networkSharePath.onTextChanged((value) => {
|
||||
this._disposables.push(this._networkSharePath.onTextChanged((value) => {
|
||||
this.validateFields();
|
||||
this.migrationStateModel._databaseBackup.networkShare.networkShareLocation = value;
|
||||
});
|
||||
}));
|
||||
|
||||
const networkShareInfoBox = this._view.modelBuilder.infoBox().withProps({
|
||||
text: constants.DATABASE_SERVICE_ACCOUNT_INFO_TEXT,
|
||||
@@ -295,9 +300,9 @@ export class DatabaseBackupPage extends MigrationWizardPage {
|
||||
}
|
||||
return true;
|
||||
}).component();
|
||||
this._windowsUserAccountText.onTextChanged((value) => {
|
||||
this._disposables.push(this._windowsUserAccountText.onTextChanged((value) => {
|
||||
this.migrationStateModel._databaseBackup.networkShare.windowsUser = value;
|
||||
});
|
||||
}));
|
||||
|
||||
const passwordLabel = this._view.modelBuilder.text()
|
||||
.withProps({
|
||||
@@ -315,12 +320,9 @@ export class DatabaseBackupPage extends MigrationWizardPage {
|
||||
required: true,
|
||||
width: WIZARD_INPUT_COMPONENT_WIDTH
|
||||
}).component();
|
||||
this._passwordText.onTextChanged((value) => {
|
||||
this._disposables.push(this._passwordText.onTextChanged((value) => {
|
||||
this.migrationStateModel._databaseBackup.networkShare.password = value;
|
||||
});
|
||||
|
||||
|
||||
|
||||
}));
|
||||
|
||||
const flexContainer = this._view.modelBuilder.flexContainer().withItems(
|
||||
[
|
||||
@@ -560,13 +562,13 @@ export class DatabaseBackupPage extends MigrationWizardPage {
|
||||
editable: true,
|
||||
fireOnTextChange: true,
|
||||
}).component();
|
||||
this._networkShareStorageAccountResourceGroupDropdown.onValueChanged(async (value) => {
|
||||
this._disposables.push(this._networkShareStorageAccountResourceGroupDropdown.onValueChanged(async (value) => {
|
||||
const selectedIndex = findDropDownItemIndex(this._networkShareStorageAccountResourceGroupDropdown, value);
|
||||
if (selectedIndex > -1) {
|
||||
this.migrationStateModel._databaseBackup.networkShare.resourceGroup = this.migrationStateModel.getAzureResourceGroup(selectedIndex);
|
||||
await this.loadNetworkShareStorageDropdown();
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
const storageAccountLabel = this._view.modelBuilder.text()
|
||||
.withProps({
|
||||
@@ -585,12 +587,12 @@ export class DatabaseBackupPage extends MigrationWizardPage {
|
||||
editable: true,
|
||||
fireOnTextChange: true,
|
||||
}).component();
|
||||
this._networkShareContainerStorageAccountDropdown.onValueChanged((value) => {
|
||||
this._disposables.push(this._networkShareContainerStorageAccountDropdown.onValueChanged((value) => {
|
||||
const selectedIndex = findDropDownItemIndex(this._networkShareContainerStorageAccountDropdown, value);
|
||||
if (selectedIndex > -1) {
|
||||
this.migrationStateModel._databaseBackup.networkShare.storageAccount = this.migrationStateModel.getStorageAccount(selectedIndex);
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
this._networkShareContainerStorageAccountRefreshButton = this._view.modelBuilder.button().withProps({
|
||||
iconPath: IconPathHelper.refresh,
|
||||
@@ -600,9 +602,9 @@ export class DatabaseBackupPage extends MigrationWizardPage {
|
||||
ariaLabel: constants.REFRESH,
|
||||
}).component();
|
||||
|
||||
this._networkShareContainerStorageAccountRefreshButton.onDidClick(async (value) => {
|
||||
this._disposables.push(this._networkShareContainerStorageAccountRefreshButton.onDidClick(async (value) => {
|
||||
await this.loadNetworkShareStorageDropdown();
|
||||
});
|
||||
}));
|
||||
|
||||
const storageAccountContainer = this._view.modelBuilder.flexContainer().component();
|
||||
|
||||
@@ -685,10 +687,10 @@ export class DatabaseBackupPage extends MigrationWizardPage {
|
||||
}
|
||||
return true;
|
||||
}).component();
|
||||
targetDatabaseInput.onTextChanged((value) => {
|
||||
this._disposables.push(targetDatabaseInput.onTextChanged((value) => {
|
||||
this.migrationStateModel._targetDatabaseNames[index] = value.trim();
|
||||
this.validateFields();
|
||||
});
|
||||
}));
|
||||
this._networkShareTargetDatabaseNames.push(targetDatabaseInput);
|
||||
|
||||
const blobtargetDatabaseInput = this._view.modelBuilder.inputBox().withProps({
|
||||
@@ -710,9 +712,9 @@ export class DatabaseBackupPage extends MigrationWizardPage {
|
||||
}
|
||||
return true;
|
||||
}).component();
|
||||
blobtargetDatabaseInput.onTextChanged((value) => {
|
||||
this._disposables.push(blobtargetDatabaseInput.onTextChanged((value) => {
|
||||
this.migrationStateModel._targetDatabaseNames[index] = value.trim();
|
||||
});
|
||||
}));
|
||||
this._blobContainerTargetDatabaseNames.push(blobtargetDatabaseInput);
|
||||
|
||||
const blobContainerResourceDropdown = this._view.modelBuilder.dropDown().withProps({
|
||||
@@ -721,14 +723,14 @@ export class DatabaseBackupPage extends MigrationWizardPage {
|
||||
editable: true,
|
||||
fireOnTextChange: true,
|
||||
}).component();
|
||||
blobContainerResourceDropdown.onValueChanged(async (value) => {
|
||||
this._disposables.push(blobContainerResourceDropdown.onValueChanged(async (value) => {
|
||||
const selectedIndex = findDropDownItemIndex(blobContainerResourceDropdown, value);
|
||||
if (selectedIndex > -1 && value !== constants.RESOURCE_GROUP_NOT_FOUND) {
|
||||
this.migrationStateModel._databaseBackup.blobs[index].resourceGroup = this.migrationStateModel.getAzureResourceGroup(selectedIndex);
|
||||
}
|
||||
|
||||
await this.loadblobStorageDropdown(index);
|
||||
});
|
||||
}));
|
||||
this._blobContainerResourceGroupDropdowns.push(blobContainerResourceDropdown);
|
||||
|
||||
const blobContainerStorageAccountDropdown = this._view.modelBuilder.dropDown()
|
||||
@@ -739,13 +741,13 @@ export class DatabaseBackupPage extends MigrationWizardPage {
|
||||
fireOnTextChange: true,
|
||||
}).component();
|
||||
|
||||
blobContainerStorageAccountDropdown.onValueChanged(async (value) => {
|
||||
this._disposables.push(blobContainerStorageAccountDropdown.onValueChanged(async (value) => {
|
||||
const selectedIndex = findDropDownItemIndex(blobContainerStorageAccountDropdown, value);
|
||||
if (selectedIndex > -1 && value !== constants.NO_STORAGE_ACCOUNT_FOUND) {
|
||||
this.migrationStateModel._databaseBackup.blobs[index].storageAccount = this.migrationStateModel.getStorageAccount(selectedIndex);
|
||||
}
|
||||
await this.loadBlobContainerDropdown(index);
|
||||
});
|
||||
}));
|
||||
this._blobContainerStorageAccountDropdowns.push(blobContainerStorageAccountDropdown);
|
||||
|
||||
const blobContainerDropdown = this._view.modelBuilder.dropDown()
|
||||
@@ -755,12 +757,12 @@ export class DatabaseBackupPage extends MigrationWizardPage {
|
||||
editable: true,
|
||||
fireOnTextChange: true,
|
||||
}).component();
|
||||
blobContainerDropdown.onValueChanged(value => {
|
||||
this._disposables.push(blobContainerDropdown.onValueChanged(value => {
|
||||
const selectedIndex = findDropDownItemIndex(blobContainerDropdown, value);
|
||||
if (selectedIndex > -1 && value !== constants.NO_BLOBCONTAINERS_FOUND) {
|
||||
this.migrationStateModel._databaseBackup.blobs[index].blobContainer = this.migrationStateModel.getBlobContainer(selectedIndex);
|
||||
}
|
||||
});
|
||||
}));
|
||||
this._blobContainerDropdowns.push(blobContainerDropdown);
|
||||
});
|
||||
|
||||
|
||||
@@ -4,10 +4,11 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
import * as vscode from 'vscode';
|
||||
import { MigrationWizardPage } from '../models/migrationWizardPage';
|
||||
import { MigrationStateModel, StateChangeEvent } from '../models/stateMachine';
|
||||
import * as constants from '../constants/strings';
|
||||
import { IconPath, IconPathHelper } from '../constants/iconPathHelper';
|
||||
// import { IconPath, IconPathHelper } from '../constants/iconPathHelper';
|
||||
import { debounce } from '../api/utils';
|
||||
|
||||
const headerLeft: azdata.CssStyles = {
|
||||
@@ -41,6 +42,7 @@ export class DatabaseSelectorPage extends MigrationWizardPage {
|
||||
private _dbNames!: string[];
|
||||
private _dbCount!: azdata.TextComponent;
|
||||
private _databaseTableValues!: azdata.DeclarativeTableCellValue[][];
|
||||
private _disposables: vscode.Disposable[] = [];
|
||||
|
||||
constructor(wizard: azdata.window.Wizard, migrationStateModel: MigrationStateModel) {
|
||||
super(wizard, azdata.window.createWizardPage(constants.SOURCE_CONFIGURATION, 'MigrationModePage'), migrationStateModel);
|
||||
@@ -56,6 +58,11 @@ export class DatabaseSelectorPage extends MigrationWizardPage {
|
||||
}).component();
|
||||
flex.addItem(await this.createRootContainer(view), { flex: '1 1 auto' });
|
||||
|
||||
this._disposables.push(this._view.onClosed(e => {
|
||||
this._disposables.forEach(
|
||||
d => { try { d.dispose(); } catch { } });
|
||||
}));
|
||||
|
||||
await view.initializeModel(flex);
|
||||
}
|
||||
|
||||
@@ -82,7 +89,7 @@ export class DatabaseSelectorPage extends MigrationWizardPage {
|
||||
width: 200
|
||||
}).component();
|
||||
|
||||
resourceSearchBox.onTextChanged(value => this._filterTableList(value));
|
||||
this._disposables.push(resourceSearchBox.onTextChanged(value => this._filterTableList(value)));
|
||||
|
||||
const searchContainer = this._view.modelBuilder.divContainer().withItems([resourceSearchBox]).withProps({
|
||||
CSSStyles: {
|
||||
@@ -142,7 +149,8 @@ export class DatabaseSelectorPage extends MigrationWizardPage {
|
||||
enabled: selectable
|
||||
},
|
||||
{
|
||||
value: this.createIconTextCell(IconPathHelper.sqlDatabaseLogo, finalResult[index].options.name),
|
||||
// value: this.createIconTextCell(IconPathHelper.sqlDatabaseLogo, finalResult[index].options.name),
|
||||
value: finalResult[index].options.name,
|
||||
style: styleLeft
|
||||
},
|
||||
{
|
||||
@@ -207,7 +215,8 @@ export class DatabaseSelectorPage extends MigrationWizardPage {
|
||||
},
|
||||
{
|
||||
displayName: constants.DATABASE,
|
||||
valueType: azdata.DeclarativeDataType.component,
|
||||
// valueType: azdata.DeclarativeDataType.component,
|
||||
valueType: azdata.DeclarativeDataType.string,
|
||||
width: 100,
|
||||
isReadOnly: true,
|
||||
headerCssStyles: headerLeft
|
||||
@@ -238,11 +247,11 @@ export class DatabaseSelectorPage extends MigrationWizardPage {
|
||||
).component();
|
||||
|
||||
await this._databaseSelectorTable.setDataValues(this._databaseTableValues);
|
||||
this._databaseSelectorTable.onDataChanged(() => {
|
||||
this._disposables.push(this._databaseSelectorTable.onDataChanged(() => {
|
||||
this._dbCount.updateProperties({
|
||||
'value': constants.DATABASES_SELECTED(this.selectedDbs().length, this._databaseTableValues.length)
|
||||
});
|
||||
});
|
||||
}));
|
||||
const flex = view.modelBuilder.flexContainer().withLayout({
|
||||
flexFlow: 'column',
|
||||
height: '100%',
|
||||
@@ -271,42 +280,41 @@ export class DatabaseSelectorPage extends MigrationWizardPage {
|
||||
return result;
|
||||
}
|
||||
|
||||
private createIconTextCell(icon: IconPath, text: string): azdata.FlexContainer {
|
||||
// private createIconTextCell(icon: IconPath, text: string): azdata.FlexContainer {
|
||||
// const iconComponent = this._view.modelBuilder.image().withProps({
|
||||
// iconPath: icon,
|
||||
// iconWidth: '16px',
|
||||
// iconHeight: '16px',
|
||||
// width: '20px',
|
||||
// height: '20px'
|
||||
// }).component();
|
||||
// const textComponent = this._view.modelBuilder.text().withProps({
|
||||
// value: text,
|
||||
// title: text,
|
||||
// CSSStyles: {
|
||||
// 'margin': '0px',
|
||||
// 'width': '110px'
|
||||
// }
|
||||
// }).component();
|
||||
|
||||
const iconComponent = this._view.modelBuilder.image().withProps({
|
||||
iconPath: icon,
|
||||
iconWidth: '16px',
|
||||
iconHeight: '16px',
|
||||
width: '20px',
|
||||
height: '20px'
|
||||
}).component();
|
||||
const textComponent = this._view.modelBuilder.text().withProps({
|
||||
value: text,
|
||||
title: text,
|
||||
CSSStyles: {
|
||||
'margin': '0px',
|
||||
'width': '110px'
|
||||
}
|
||||
}).component();
|
||||
// const cellContainer = this._view.modelBuilder.flexContainer().withProps({
|
||||
// CSSStyles: {
|
||||
// 'justify-content': 'left'
|
||||
// }
|
||||
// }).component();
|
||||
// cellContainer.addItem(iconComponent, {
|
||||
// flex: '0',
|
||||
// CSSStyles: {
|
||||
// 'width': '32px'
|
||||
// }
|
||||
// });
|
||||
// cellContainer.addItem(textComponent, {
|
||||
// CSSStyles: {
|
||||
// 'width': 'auto'
|
||||
// }
|
||||
// });
|
||||
|
||||
const cellContainer = this._view.modelBuilder.flexContainer().withProps({
|
||||
CSSStyles: {
|
||||
'justify-content': 'left'
|
||||
}
|
||||
}).component();
|
||||
cellContainer.addItem(iconComponent, {
|
||||
flex: '0',
|
||||
CSSStyles: {
|
||||
'width': '32px'
|
||||
}
|
||||
});
|
||||
cellContainer.addItem(textComponent, {
|
||||
CSSStyles: {
|
||||
'width': 'auto'
|
||||
}
|
||||
});
|
||||
|
||||
return cellContainer;
|
||||
}
|
||||
// return cellContainer;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ export class IntergrationRuntimePage extends MigrationWizardPage {
|
||||
private _copy2!: azdata.ButtonComponent;
|
||||
private _refresh1!: azdata.ButtonComponent;
|
||||
private _refresh2!: azdata.ButtonComponent;
|
||||
private _disposables: vscode.Disposable[] = [];
|
||||
|
||||
constructor(wizard: azdata.window.Wizard, migrationStateModel: MigrationStateModel) {
|
||||
super(wizard, azdata.window.createWizardPage(constants.IR_PAGE_TITLE), migrationStateModel);
|
||||
@@ -50,14 +51,14 @@ export class IntergrationRuntimePage extends MigrationWizardPage {
|
||||
}
|
||||
}).component();
|
||||
|
||||
createNewMigrationService.onDidClick(async (e) => {
|
||||
this._disposables.push(createNewMigrationService.onDidClick(async (e) => {
|
||||
const dialog = new CreateSqlMigrationServiceDialog();
|
||||
const createdDmsResult = await dialog.createNewDms(this.migrationStateModel, (<azdata.CategoryValue>this._resourceGroupDropdown.value).displayName);
|
||||
this.migrationStateModel._sqlMigrationServiceResourceGroup = createdDmsResult.resourceGroup;
|
||||
this.migrationStateModel._sqlMigrationService = createdDmsResult.service;
|
||||
await this.loadResourceGroupDropdown();
|
||||
await this.populateDms(createdDmsResult.resourceGroup);
|
||||
});
|
||||
}));
|
||||
|
||||
this._statusLoadingComponent = view.modelBuilder.loadingComponent().withItem(this.createDMSDetailsContainer()).component();
|
||||
|
||||
@@ -91,6 +92,12 @@ export class IntergrationRuntimePage extends MigrationWizardPage {
|
||||
|
||||
]
|
||||
);
|
||||
|
||||
this._disposables.push(this._view.onClosed(e => {
|
||||
this._disposables.forEach(
|
||||
d => { try { d.dispose(); } catch { } });
|
||||
}));
|
||||
|
||||
await view.initializeModel(this._form.component());
|
||||
}
|
||||
|
||||
@@ -187,12 +194,12 @@ export class IntergrationRuntimePage extends MigrationWizardPage {
|
||||
fireOnTextChange: true,
|
||||
}).component();
|
||||
|
||||
this._resourceGroupDropdown.onValueChanged(async (value) => {
|
||||
this._disposables.push(this._resourceGroupDropdown.onValueChanged(async (value) => {
|
||||
const selectedIndex = findDropDownItemIndex(this._resourceGroupDropdown, value);
|
||||
if (selectedIndex > -1) {
|
||||
await this.populateDms(value);
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
const migrationServcieDropdownLabel = this._view.modelBuilder.text().withProps({
|
||||
value: constants.IR_PAGE_TITLE,
|
||||
@@ -209,7 +216,7 @@ export class IntergrationRuntimePage extends MigrationWizardPage {
|
||||
fireOnTextChange: true,
|
||||
}).component();
|
||||
|
||||
this._dmsDropdown.onValueChanged(async (value) => {
|
||||
this._disposables.push(this._dmsDropdown.onValueChanged(async (value) => {
|
||||
if (value && value !== constants.SQL_MIGRATION_SERVICE_NOT_FOUND_ERROR) {
|
||||
if (this.migrationStateModel._databaseBackup.networkContainerType === NetworkContainerType.NETWORK_SHARE) {
|
||||
this._dmsInfoContainer.display = 'inline';
|
||||
@@ -225,7 +232,7 @@ export class IntergrationRuntimePage extends MigrationWizardPage {
|
||||
} else {
|
||||
this._dmsInfoContainer.display = 'none';
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
const flexContainer = this._view.modelBuilder.flexContainer().withItems([
|
||||
descriptionText,
|
||||
@@ -267,14 +274,14 @@ export class IntergrationRuntimePage extends MigrationWizardPage {
|
||||
ariaLabel: constants.REFRESH,
|
||||
}).component();
|
||||
|
||||
this._refreshButton.onDidClick(async (e) => {
|
||||
this._disposables.push(this._refreshButton.onDidClick(async (e) => {
|
||||
this._connectionStatusLoader.loading = true;
|
||||
try {
|
||||
await this.loadStatus();
|
||||
} finally {
|
||||
this._connectionStatusLoader.loading = false;
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
const connectionLabelContainer = this._view.modelBuilder.flexContainer().withProps({
|
||||
CSSStyles: {
|
||||
@@ -318,10 +325,10 @@ export class IntergrationRuntimePage extends MigrationWizardPage {
|
||||
ariaLabel: constants.COPY_KEY1,
|
||||
}).component();
|
||||
|
||||
this._copy1.onDidClick(async (e) => {
|
||||
this._disposables.push(this._copy1.onDidClick(async (e) => {
|
||||
await vscode.env.clipboard.writeText(<string>this._authKeyTable.dataValues![0][1].value);
|
||||
vscode.window.showInformationMessage(constants.SERVICE_KEY1_COPIED_HELP);
|
||||
});
|
||||
}));
|
||||
|
||||
this._copy2 = this._view.modelBuilder.button().withProps({
|
||||
title: constants.COPY_KEY2,
|
||||
@@ -329,10 +336,10 @@ export class IntergrationRuntimePage extends MigrationWizardPage {
|
||||
ariaLabel: constants.COPY_KEY2,
|
||||
}).component();
|
||||
|
||||
this._copy2.onDidClick(async (e) => {
|
||||
this._disposables.push(this._copy2.onDidClick(async (e) => {
|
||||
await vscode.env.clipboard.writeText(<string>this._authKeyTable.dataValues![1][1].value);
|
||||
vscode.window.showInformationMessage(constants.SERVICE_KEY2_COPIED_HELP);
|
||||
});
|
||||
}));
|
||||
|
||||
this._refresh1 = this._view.modelBuilder.button().withProps({
|
||||
title: constants.REFRESH_KEY1,
|
||||
|
||||
@@ -11,6 +11,7 @@ import * as constants from '../constants/strings';
|
||||
|
||||
export class MigrationModePage extends MigrationWizardPage {
|
||||
private _view!: azdata.ModelView;
|
||||
private _disposables: vscode.Disposable[] = [];
|
||||
|
||||
constructor(wizard: azdata.window.Wizard, migrationStateModel: MigrationStateModel) {
|
||||
super(wizard, azdata.window.createWizardPage(constants.DATABASE_BACKUP_MIGRATION_MODE_LABEL, 'MigrationModePage'), migrationStateModel);
|
||||
@@ -25,6 +26,11 @@ export class MigrationModePage extends MigrationWizardPage {
|
||||
this.migrationModeContainer(),
|
||||
]
|
||||
);
|
||||
|
||||
this._disposables.push(this._view.onClosed(e => {
|
||||
this._disposables.forEach(
|
||||
d => { try { d.dispose(); } catch { } });
|
||||
}));
|
||||
await view.initializeModel(form.component());
|
||||
}
|
||||
|
||||
@@ -64,11 +70,11 @@ export class MigrationModePage extends MigrationWizardPage {
|
||||
|
||||
this.migrationStateModel._databaseBackup.migrationMode = MigrationMode.ONLINE;
|
||||
|
||||
onlineButton.onDidChangeCheckedState((e) => {
|
||||
this._disposables.push(onlineButton.onDidChangeCheckedState((e) => {
|
||||
if (e) {
|
||||
this.migrationStateModel._databaseBackup.migrationMode = MigrationMode.ONLINE;
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
const offlineButton = this._view.modelBuilder.radioButton().withProps({
|
||||
label: constants.DATABASE_BACKUP_MIGRATION_MODE_OFFLINE_LABEL,
|
||||
@@ -88,13 +94,13 @@ export class MigrationModePage extends MigrationWizardPage {
|
||||
}).component();
|
||||
|
||||
|
||||
offlineButton.onDidChangeCheckedState((e) => {
|
||||
this._disposables.push(offlineButton.onDidChangeCheckedState((e) => {
|
||||
if (e) {
|
||||
vscode.window.showInformationMessage('Feature coming soon');
|
||||
onlineButton.checked = true;
|
||||
//this.migrationStateModel._databaseBackup.migrationCutover = MigrationCutover.OFFLINE; TODO: Enable when offline mode is supported.
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
const flexContainer = this._view.modelBuilder.flexContainer().withItems(
|
||||
[
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
import * as vscode from 'vscode';
|
||||
import { MigrationWizardPage } from '../models/migrationWizardPage';
|
||||
import { MigrationStateModel, MigrationTargetType, StateChangeEvent } from '../models/stateMachine';
|
||||
import { AssessmentResultsDialog } from '../dialog/assessmentResults/assessmentResultsDialog';
|
||||
import * as constants from '../constants/strings';
|
||||
import * as vscode from 'vscode';
|
||||
import { EOL } from 'os';
|
||||
import { IconPath, IconPathHelper } from '../constants/iconPathHelper';
|
||||
import { WIZARD_INPUT_COMPONENT_WIDTH } from './wizardController';
|
||||
@@ -46,6 +46,7 @@ export class SKURecommendationPage extends MigrationWizardPage {
|
||||
private _databaseSelectedHelperText!: azdata.TextComponent;
|
||||
private assessmentGroupContainer!: azdata.FlexContainer;
|
||||
private _targetContainer!: azdata.FlexContainer;
|
||||
private _disposables: vscode.Disposable[] = [];
|
||||
|
||||
private _supportedProducts: Product[] = [
|
||||
{
|
||||
@@ -148,6 +149,11 @@ export class SKURecommendationPage extends MigrationWizardPage {
|
||||
this._rootContainer.addItem(this._assessmentComponent, { flex: '0 0 auto' });
|
||||
this._rootContainer.addItem(this._formContainer.component(), { flex: '0 0 auto' });
|
||||
|
||||
this._disposables.push(this._view.onClosed(e => {
|
||||
this._disposables.forEach(
|
||||
d => { try { d.dispose(); } catch { } });
|
||||
}));
|
||||
|
||||
await this._view.initializeModel(this._rootContainer);
|
||||
}
|
||||
|
||||
@@ -209,12 +215,12 @@ export class SKURecommendationPage extends MigrationWizardPage {
|
||||
});
|
||||
});
|
||||
|
||||
this._rbg.onSelectionChanged((value) => {
|
||||
this._disposables.push(this._rbg.onSelectionChanged((value) => {
|
||||
if (value) {
|
||||
this.assessmentGroupContainer.display = 'inline';
|
||||
this.changeTargetType(value.cardId);
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
this._rbgLoader = this._view.modelBuilder.loadingComponent().withItem(
|
||||
this._rbg
|
||||
@@ -247,7 +253,7 @@ export class SKURecommendationPage extends MigrationWizardPage {
|
||||
let miDialog = new AssessmentResultsDialog('ownerUri', this.migrationStateModel, constants.ASSESSMENT_TILE(serverName), this, MigrationTargetType.SQLMI);
|
||||
let vmDialog = new AssessmentResultsDialog('ownerUri', this.migrationStateModel, constants.ASSESSMENT_TILE(serverName), this, MigrationTargetType.SQLVM);
|
||||
|
||||
button.onDidClick(async (e) => {
|
||||
this._disposables.push(button.onDidClick(async (e) => {
|
||||
if (this._rbg.selectedCardId === MigrationTargetType.SQLVM) {
|
||||
this._rbg.selectedCardId = MigrationTargetType.SQLVM;
|
||||
await vmDialog.openDialog();
|
||||
@@ -255,7 +261,7 @@ export class SKURecommendationPage extends MigrationWizardPage {
|
||||
this._rbg.selectedCardId = MigrationTargetType.SQLMI;
|
||||
await miDialog.openDialog();
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
this._databaseSelectedHelperText = this._view.modelBuilder.text().withProps({
|
||||
CSSStyles: {
|
||||
@@ -296,7 +302,7 @@ export class SKURecommendationPage extends MigrationWizardPage {
|
||||
editable: true,
|
||||
fireOnTextChange: true,
|
||||
}).component();
|
||||
this._managedInstanceSubscriptionDropdown.onValueChanged(async (value) => {
|
||||
this._disposables.push(this._managedInstanceSubscriptionDropdown.onValueChanged(async (value) => {
|
||||
const selectedIndex = findDropDownItemIndex(this._managedInstanceSubscriptionDropdown, value);
|
||||
if (selectedIndex > -1) {
|
||||
this.migrationStateModel._targetSubscription = this.migrationStateModel.getSubscription(selectedIndex);
|
||||
@@ -304,7 +310,7 @@ export class SKURecommendationPage extends MigrationWizardPage {
|
||||
this.migrationStateModel._sqlMigrationService = undefined!;
|
||||
await this.populateLocationAndResourceGroupDropdown();
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
const azureLocationLabel = this._view.modelBuilder.text().withProps({
|
||||
value: constants.LOCATION,
|
||||
@@ -320,13 +326,13 @@ export class SKURecommendationPage extends MigrationWizardPage {
|
||||
editable: true,
|
||||
fireOnTextChange: true,
|
||||
}).component();
|
||||
this._azureLocationDropdown.onValueChanged(async (value) => {
|
||||
this._disposables.push(this._azureLocationDropdown.onValueChanged(async (value) => {
|
||||
const selectedIndex = findDropDownItemIndex(this._azureLocationDropdown, value);
|
||||
if (selectedIndex > -1) {
|
||||
this.migrationStateModel._location = this.migrationStateModel.getLocation(selectedIndex);
|
||||
await this.populateResourceInstanceDropdown();
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
const azureResourceGroupLabel = this._view.modelBuilder.text().withProps({
|
||||
value: constants.RESOURCE_GROUP,
|
||||
@@ -342,13 +348,13 @@ export class SKURecommendationPage extends MigrationWizardPage {
|
||||
editable: true,
|
||||
fireOnTextChange: true,
|
||||
}).component();
|
||||
this._azureResourceGroupDropdown.onValueChanged(async (value) => {
|
||||
this._disposables.push(this._azureResourceGroupDropdown.onValueChanged(async (value) => {
|
||||
const selectedIndex = findDropDownItemIndex(this._azureResourceGroupDropdown, value);
|
||||
if (selectedIndex > -1) {
|
||||
this.migrationStateModel._resourceGroup = this.migrationStateModel.getAzureResourceGroup(selectedIndex);
|
||||
await this.populateResourceInstanceDropdown();
|
||||
}
|
||||
});
|
||||
}));
|
||||
this._resourceDropdownLabel = this._view.modelBuilder.text().withProps({
|
||||
value: constants.MANAGED_INSTANCE,
|
||||
width: WIZARD_INPUT_COMPONENT_WIDTH,
|
||||
@@ -364,7 +370,7 @@ export class SKURecommendationPage extends MigrationWizardPage {
|
||||
editable: true,
|
||||
fireOnTextChange: true,
|
||||
}).component();
|
||||
this._resourceDropdown.onValueChanged(value => {
|
||||
this._disposables.push(this._resourceDropdown.onValueChanged(value => {
|
||||
const selectedIndex = findDropDownItemIndex(this._resourceDropdown, value);
|
||||
if (selectedIndex > -1 &&
|
||||
value !== constants.NO_MANAGED_INSTANCE_FOUND &&
|
||||
@@ -376,7 +382,7 @@ export class SKURecommendationPage extends MigrationWizardPage {
|
||||
this.migrationStateModel._targetServerInstance = this.migrationStateModel.getManagedInstance(selectedIndex);
|
||||
}
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
return this._view.modelBuilder.flexContainer().withItems(
|
||||
[
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
import * as vscode from 'vscode';
|
||||
import { MigrationWizardPage } from '../models/migrationWizardPage';
|
||||
import { MigrationSourceAuthenticationType, MigrationStateModel, StateChangeEvent } from '../models/stateMachine';
|
||||
import * as constants from '../constants/strings';
|
||||
@@ -13,6 +14,7 @@ export class SqlSourceConfigurationPage extends MigrationWizardPage {
|
||||
private _view!: azdata.ModelView;
|
||||
private _usernameInput!: azdata.InputBoxComponent;
|
||||
private _password!: azdata.InputBoxComponent;
|
||||
private _disposables: vscode.Disposable[] = [];
|
||||
|
||||
constructor(wizard: azdata.window.Wizard, migrationStateModel: MigrationStateModel) {
|
||||
super(wizard, azdata.window.createWizardPage(constants.SOURCE_CONFIGURATION, 'MigrationModePage'), migrationStateModel);
|
||||
@@ -26,6 +28,12 @@ export class SqlSourceConfigurationPage extends MigrationWizardPage {
|
||||
await this.createSourceCredentialContainer(),
|
||||
]
|
||||
);
|
||||
|
||||
this._disposables.push(this._view.onClosed(e => {
|
||||
this._disposables.forEach(
|
||||
d => { try { d.dispose(); } catch { } });
|
||||
}));
|
||||
|
||||
await view.initializeModel(form.component());
|
||||
}
|
||||
|
||||
@@ -107,9 +115,9 @@ export class SqlSourceConfigurationPage extends MigrationWizardPage {
|
||||
enabled: false,
|
||||
width: WIZARD_INPUT_COMPONENT_WIDTH
|
||||
}).component();
|
||||
this._usernameInput.onTextChanged(value => {
|
||||
this._disposables.push(this._usernameInput.onTextChanged(value => {
|
||||
this.migrationStateModel._sqlServerUsername = value;
|
||||
});
|
||||
}));
|
||||
|
||||
const passwordLabel = this._view.modelBuilder.text().withProps({
|
||||
value: constants.DATABASE_BACKUP_NETWORK_SHARE_PASSWORD_LABEL,
|
||||
@@ -125,9 +133,9 @@ export class SqlSourceConfigurationPage extends MigrationWizardPage {
|
||||
inputType: 'password',
|
||||
width: WIZARD_INPUT_COMPONENT_WIDTH
|
||||
}).component();
|
||||
this._password.onTextChanged(value => {
|
||||
this._disposables.push(this._password.onTextChanged(value => {
|
||||
this.migrationStateModel._sqlServerPassword = value;
|
||||
});
|
||||
}));
|
||||
|
||||
const container = this._view.modelBuilder.flexContainer().withItems(
|
||||
[
|
||||
|
||||
@@ -179,7 +179,7 @@ export class SubscriptionSelectionPage extends MigrationWizardPage {
|
||||
}
|
||||
|
||||
public async onPageLeave(): Promise<void> {
|
||||
this.disposables.forEach(d => d.dispose());
|
||||
this.disposables.forEach(d => { try { d.dispose(); } catch { } });
|
||||
}
|
||||
|
||||
protected async handleStateChange(e: StateChangeEvent): Promise<void> {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
import * as vscode from 'vscode';
|
||||
import { MigrationWizardPage } from '../models/migrationWizardPage';
|
||||
import { MigrationMode, MigrationStateModel, MigrationTargetType, NetworkContainerType, StateChangeEvent } from '../models/stateMachine';
|
||||
import * as constants from '../constants/strings';
|
||||
@@ -14,6 +15,7 @@ import { TargetDatabaseSummaryDialog } from '../dialog/targetDatabaseSummary/tar
|
||||
export class SummaryPage extends MigrationWizardPage {
|
||||
private _view!: azdata.ModelView;
|
||||
private _flexContainer!: azdata.FlexContainer;
|
||||
private _disposables: vscode.Disposable[] = [];
|
||||
|
||||
constructor(wizard: azdata.window.Wizard, migrationStateModel: MigrationStateModel) {
|
||||
super(wizard, azdata.window.createWizardPage(constants.SUMMARY_PAGE_TITLE), migrationStateModel);
|
||||
@@ -32,6 +34,12 @@ export class SummaryPage extends MigrationWizardPage {
|
||||
}
|
||||
]
|
||||
);
|
||||
|
||||
this._disposables.push(this._view.onClosed(e => {
|
||||
this._disposables.forEach(
|
||||
d => { try { d.dispose(); } catch { } });
|
||||
}));
|
||||
|
||||
await view.initializeModel(form.component());
|
||||
}
|
||||
|
||||
@@ -48,9 +56,9 @@ export class SummaryPage extends MigrationWizardPage {
|
||||
}
|
||||
}).component();
|
||||
|
||||
targetDatabaseHyperlink.onDidClick(e => {
|
||||
this._disposables.push(targetDatabaseHyperlink.onDidClick(e => {
|
||||
targetDatabaseSummary.initialize();
|
||||
});
|
||||
}));
|
||||
|
||||
const targetDatabaseRow = this._view.modelBuilder.flexContainer()
|
||||
.withLayout(
|
||||
|
||||
@@ -9,7 +9,6 @@ import { MigrationStateModel } from '../models/stateMachine';
|
||||
import * as loc from '../constants/strings';
|
||||
import { MigrationWizardPage } from '../models/migrationWizardPage';
|
||||
import { SKURecommendationPage } from './skuRecommendationPage';
|
||||
// import { SubscriptionSelectionPage } from './subscriptionSelectionPage';
|
||||
import { DatabaseBackupPage } from './databaseBackupPage';
|
||||
import { AccountsSelectionPage } from './accountsSelectionPage';
|
||||
import { IntergrationRuntimePage } from './integrationRuntimePage';
|
||||
@@ -61,13 +60,13 @@ export class WizardController {
|
||||
wizardSetupPromises.push(...pages.map(p => p.registerWizardContent()));
|
||||
wizardSetupPromises.push(wizard.open());
|
||||
|
||||
wizard.onPageChanged(async (pageChangeInfo: azdata.window.WizardPageChangeInfo) => {
|
||||
this.extensionContext.subscriptions.push(wizard.onPageChanged(async (pageChangeInfo: azdata.window.WizardPageChangeInfo) => {
|
||||
const newPage = pageChangeInfo.newPage;
|
||||
const lastPage = pageChangeInfo.lastPage;
|
||||
|
||||
await pages[lastPage]?.onPageLeave();
|
||||
await pages[newPage]?.onPageEnter();
|
||||
});
|
||||
}));
|
||||
|
||||
wizard.registerNavigationValidator(async validator => {
|
||||
// const lastPage = validator.lastPage;
|
||||
@@ -82,9 +81,9 @@ export class WizardController {
|
||||
await Promise.all(wizardSetupPromises);
|
||||
await pages[0].onPageEnter();
|
||||
|
||||
wizard.doneButton.onClick(async (e) => {
|
||||
this.extensionContext.subscriptions.push(wizard.doneButton.onClick(async (e) => {
|
||||
await stateModel.startMigration();
|
||||
});
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user