mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -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:
@@ -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(
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user