mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-28 09:35:38 -05:00
Migration wizard Refresh 11th Feb 2021 (#14257)
* Adding summary page, Storing ongoing migrations, localizing some string, made changes to how dropdowns work updated database backup page * Moved classes into different files Fixed a lot of typos Fixed some UI margins
This commit is contained in:
@@ -4,23 +4,19 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
import * as vscode from 'vscode';
|
||||
import { MigrationWizardPage } from '../models/migrationWizardPage';
|
||||
import { MigrationStateModel, StateChangeEvent } from '../models/stateMachine';
|
||||
import { CreateMigrationControllerDialog } from './createMigrationControllerDialog';
|
||||
import * as constants from '../models/strings';
|
||||
import * as os from 'os';
|
||||
import { WIZARD_INPUT_COMPONENT_WIDTH } from './wizardController';
|
||||
|
||||
export class IntergrationRuntimePage extends MigrationWizardPage {
|
||||
|
||||
private migrationControllerDropdown!: azdata.DropDownComponent;
|
||||
private defaultSetupRadioButton!: azdata.RadioButtonComponent;
|
||||
private customSetupRadioButton!: azdata.RadioButtonComponent;
|
||||
private startSetupButton!: azdata.ButtonComponent;
|
||||
private cancelSetupButton!: azdata.ButtonComponent;
|
||||
private _connectionStatus!: azdata.TextComponent;
|
||||
private createMigrationContainer!: azdata.FlexContainer;
|
||||
private _connectionStatus!: azdata.InfoBoxComponent;
|
||||
private _view!: azdata.ModelView;
|
||||
private _form!: azdata.FormBuilder;
|
||||
|
||||
constructor(wizard: azdata.window.Wizard, migrationStateModel: MigrationStateModel) {
|
||||
super(wizard, azdata.window.createWizardPage(constants.IR_PAGE_TITLE), migrationStateModel);
|
||||
@@ -29,79 +25,19 @@ export class IntergrationRuntimePage extends MigrationWizardPage {
|
||||
protected async registerContent(view: azdata.ModelView): Promise<void> {
|
||||
this._view = view;
|
||||
|
||||
const createNewController = view.modelBuilder.button().withProps({
|
||||
label: constants.NEW,
|
||||
width: '100px',
|
||||
secondary: true
|
||||
const createNewController = view.modelBuilder.hyperlink().withProps({
|
||||
label: constants.CREATE_NEW,
|
||||
url: ''
|
||||
}).component();
|
||||
|
||||
createNewController.onDidClick((e) => {
|
||||
this.createMigrationContainer.display = 'inline';
|
||||
const dialog = new CreateMigrationControllerDialog(this.migrationStateModel, this);
|
||||
dialog.initialize();
|
||||
});
|
||||
|
||||
const setupButtonGroup = 'setupOptions';
|
||||
this._connectionStatus = view.modelBuilder.infoBox().component();
|
||||
|
||||
this.defaultSetupRadioButton = view.modelBuilder.radioButton().withProps({
|
||||
label: constants.DEFAULT_SETUP_BUTTON,
|
||||
name: setupButtonGroup
|
||||
}).component();
|
||||
this.defaultSetupRadioButton.checked = true;
|
||||
|
||||
this.customSetupRadioButton = view.modelBuilder.radioButton().withProps({
|
||||
label: constants.CUSTOM_SETUP_BUTTON,
|
||||
name: setupButtonGroup
|
||||
}).component();
|
||||
|
||||
this.startSetupButton = view.modelBuilder.button().withProps({
|
||||
label: constants.CREATE,
|
||||
width: '100px',
|
||||
secondary: true
|
||||
}).component();
|
||||
|
||||
this.startSetupButton.onDidClick((e) => {
|
||||
if (this.defaultSetupRadioButton.checked) {
|
||||
vscode.window.showInformationMessage(constants.FEATURE_NOT_AVAILABLE);
|
||||
} else {
|
||||
this.createMigrationContainer.display = 'none';
|
||||
const dialog = new CreateMigrationControllerDialog(this.migrationStateModel, this);
|
||||
dialog.initialize();
|
||||
}
|
||||
});
|
||||
|
||||
this.cancelSetupButton = view.modelBuilder.button().withProps({
|
||||
label: constants.CANCEL,
|
||||
width: '100px',
|
||||
secondary: true
|
||||
}).component();
|
||||
|
||||
this.cancelSetupButton.onDidClick((e) => {
|
||||
this.createMigrationContainer.display = 'none';
|
||||
});
|
||||
|
||||
const setupButtonsContainer = view.modelBuilder.flexContainer().withItems([
|
||||
this.startSetupButton,
|
||||
this.cancelSetupButton
|
||||
],
|
||||
{ CSSStyles: { 'margin': '10px', } }
|
||||
).withLayout({
|
||||
flexFlow: 'row'
|
||||
}).component();
|
||||
|
||||
this.createMigrationContainer = view.modelBuilder.flexContainer().withItems(
|
||||
[
|
||||
this.defaultSetupRadioButton,
|
||||
this.customSetupRadioButton,
|
||||
setupButtonsContainer
|
||||
]
|
||||
).withLayout({
|
||||
flexFlow: 'column'
|
||||
}).component();
|
||||
|
||||
this._connectionStatus = view.modelBuilder.text().component();
|
||||
|
||||
this.createMigrationContainer.display = 'none';
|
||||
|
||||
const form = view.modelBuilder.formContainer()
|
||||
this._form = view.modelBuilder.formContainer()
|
||||
.withFormItems(
|
||||
[
|
||||
{
|
||||
@@ -110,16 +46,13 @@ export class IntergrationRuntimePage extends MigrationWizardPage {
|
||||
{
|
||||
component: createNewController
|
||||
},
|
||||
{
|
||||
component: this.createMigrationContainer
|
||||
},
|
||||
{
|
||||
component: this._connectionStatus
|
||||
}
|
||||
|
||||
]
|
||||
);
|
||||
await view.initializeModel(form.component());
|
||||
await view.initializeModel(this._form.component());
|
||||
}
|
||||
|
||||
public async onPageEnter(): Promise<void> {
|
||||
@@ -148,6 +81,9 @@ export class IntergrationRuntimePage extends MigrationWizardPage {
|
||||
}
|
||||
|
||||
public async onPageLeave(): Promise<void> {
|
||||
this.wizard.registerNavigationValidator((pageChangeInfo) => {
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
protected async handleStateChange(e: StateChangeEvent): Promise<void> {
|
||||
@@ -164,16 +100,22 @@ export class IntergrationRuntimePage extends MigrationWizardPage {
|
||||
]
|
||||
}).component();
|
||||
|
||||
const noteText = this._view.modelBuilder.text().withProps({
|
||||
value: constants.IR_PAGE_NOTE
|
||||
}).component();
|
||||
|
||||
const migrationControllerDropdownLabel = this._view.modelBuilder.text().withProps({
|
||||
value: constants.SELECT_A_MIGRATION_CONTROLLER
|
||||
}).component();
|
||||
|
||||
this.migrationControllerDropdown = this._view.modelBuilder.dropDown().withProps({
|
||||
required: true,
|
||||
width: WIZARD_INPUT_COMPONENT_WIDTH
|
||||
}).component();
|
||||
|
||||
const flexContainer = this._view.modelBuilder.flexContainer().withItems([
|
||||
descriptionText,
|
||||
noteText,
|
||||
migrationControllerDropdownLabel,
|
||||
this.migrationControllerDropdown
|
||||
]).withLayout({
|
||||
@@ -183,16 +125,34 @@ export class IntergrationRuntimePage extends MigrationWizardPage {
|
||||
}
|
||||
|
||||
public async populateMigrationController(controllerStatus?: string): Promise<void> {
|
||||
this.migrationControllerDropdown.loading = true;
|
||||
let migrationContollerValues: azdata.CategoryValue[] = [];
|
||||
|
||||
// TODO: Replace with this code when APIs are deployed.
|
||||
// try{
|
||||
// this.migrationControllerDropdown.values = await this.migrationStateModel.getMigrationControllerValues(this.migrationStateModel._targetSubscription, this.migrationStateModel._targetManagedInstance);
|
||||
// this.migrationStateModel.migrationController = this.migrationStateModel.getMigrationController(0);
|
||||
// } catch (e) {
|
||||
|
||||
// } finally {
|
||||
// this.migrationControllerDropdown.loading = false;
|
||||
// }
|
||||
|
||||
if (this.migrationStateModel.migrationController) {
|
||||
|
||||
this._connectionStatus.updateProperties(<azdata.InfoBoxComponentProperties>{
|
||||
text: constants.CONTROLLER_READY(this.migrationStateModel.migrationController!.name, this.migrationStateModel._nodeNames.join(', ')),
|
||||
style: 'success'
|
||||
});
|
||||
this._form.addFormItem({
|
||||
component: this._connectionStatus
|
||||
});
|
||||
migrationContollerValues = [
|
||||
{
|
||||
displayName: this.migrationStateModel.migrationController.name,
|
||||
name: this.migrationStateModel.migrationController.name
|
||||
name: ''
|
||||
}
|
||||
];
|
||||
|
||||
this._connectionStatus.value = constants.CONTRLLER_READY(this.migrationStateModel.migrationController!.name, os.hostname());
|
||||
}
|
||||
else {
|
||||
migrationContollerValues = [
|
||||
@@ -201,7 +161,9 @@ export class IntergrationRuntimePage extends MigrationWizardPage {
|
||||
name: ''
|
||||
}
|
||||
];
|
||||
this._connectionStatus.value = '';
|
||||
this._form.removeFormItem({
|
||||
component: this._connectionStatus
|
||||
});
|
||||
}
|
||||
this.migrationControllerDropdown.values = migrationContollerValues;
|
||||
this.migrationControllerDropdown.loading = false;
|
||||
|
||||
Reference in New Issue
Block a user