Sets up the first page with some filler information (#11762)

* Sets up the first page with some filler information

* Add some valid information

* move to its own method
This commit is contained in:
Amir Omidi
2020-08-11 17:12:05 -07:00
committed by GitHub
parent 6e26261149
commit 207a9a6a25
5 changed files with 66 additions and 19 deletions

View File

@@ -5,7 +5,7 @@
import * as azdata from 'azdata';
import { MigrationWizardPage } from '../models/migrationWizardPage';
import { SOURCE_CONFIGURATION_PAGE_TITLE } from '../models/strings';
import { SOURCE_CONFIGURATION_PAGE_TITLE, COLLECTING_SOURCE_CONFIGURATIONS, COLLECTING_SOURCE_CONFIGURATIONS_INFO } from '../models/strings';
import { MigrationStateModel } from '../models/stateMachine';
export class SourceConfigurationPage extends MigrationWizardPage {
@@ -29,6 +29,30 @@ export class SourceConfigurationPage extends MigrationWizardPage {
}
private async registerContent(view: azdata.ModelView) {
const gatheringInfoComponent = this.createGatheringInfoComponent(view);
const form = view.modelBuilder.formContainer().withFormItems(
[
gatheringInfoComponent
],
{
titleFontSize: '20px'
}
).component();
await view.initializeModel(form);
}
private createGatheringInfoComponent(view: azdata.ModelView): azdata.FormComponent {
let explaination = view.modelBuilder.text().withProperties<azdata.TextComponentProperties>({
value: COLLECTING_SOURCE_CONFIGURATIONS_INFO,
CSSStyles: {
'font-size': '14px'
}
});
return {
component: explaination.component(),
title: COLLECTING_SOURCE_CONFIGURATIONS
};
}
}

View File

@@ -3,22 +3,34 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as azdata from 'azdata';
import { WIZARD_TITLE } from '../models/strings';
import { SourceConfigurationPage } from './sourceConfigurationPage';
import * as vscode from 'vscode';
import { MigrationStateModel } from '../models/stateMachine';
import { SourceConfigurationPage } from './sourceConfigurationPage';
import { WIZARD_TITLE } from '../models/strings';
export class WizardController {
constructor() {
constructor(private readonly extensionContext: vscode.ExtensionContext) {
}
public async openWizard(): Promise<void> {
public async openWizard(profile: azdata.connection.Connection): Promise<void> {
const stateModel = new MigrationStateModel(profile);
this.extensionContext.subscriptions.push(stateModel);
this.createWizard(stateModel);
}
public async createWizard(): Promise<void> {
azdata.window.createWizard(WIZARD_TITLE, 'wide');
const stateModel = new MigrationStateModel({} as azdata.IConnectionProfile);
new SourceConfigurationPage(stateModel);
private async createWizard(stateModel: MigrationStateModel): Promise<void> {
const wizard = azdata.window.createWizard(WIZARD_TITLE, 'wide');
wizard.generateScriptButton.enabled = false;
const sourceConfigurationPage = new SourceConfigurationPage(stateModel);
wizard.pages = [sourceConfigurationPage.getwizardPage()];
const wizardSetupPromises: Thenable<void>[] = [];
wizardSetupPromises.push(sourceConfigurationPage.registerWizardContent());
wizardSetupPromises.push(wizard.open());
await Promise.all(wizardSetupPromises);
}
}