mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-02 09:35:40 -05:00
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:
@@ -3,21 +3,26 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { ExtensionContext, Disposable, commands, window } from 'vscode';
|
||||
import * as vscode from 'vscode';
|
||||
import * as azdata from 'azdata';
|
||||
import { WizardController } from './wizard/wizardController';
|
||||
|
||||
class SQLMigration {
|
||||
|
||||
constructor(private readonly context: ExtensionContext) {
|
||||
constructor(private readonly context: vscode.ExtensionContext) {
|
||||
}
|
||||
|
||||
async start(): Promise<void> {
|
||||
|
||||
await this.registerCommands();
|
||||
}
|
||||
|
||||
async registerCommands(): Promise<void> {
|
||||
const commandDisposables: Disposable[] = [ // Array of disposables returned by registerCommand
|
||||
commands.registerCommand('sqlmigration.start', () => {
|
||||
window.showInformationMessage('Command ran');
|
||||
const commandDisposables: vscode.Disposable[] = [ // Array of disposables returned by registerCommand
|
||||
vscode.commands.registerCommand('sqlmigration.start', async () => {
|
||||
const connection = await azdata.connection.openConnectionDialog();
|
||||
|
||||
const wizardController = new WizardController(this.context);
|
||||
wizardController.openWizard(connection);
|
||||
}),
|
||||
];
|
||||
|
||||
@@ -30,8 +35,9 @@ class SQLMigration {
|
||||
}
|
||||
|
||||
let sqlMigration: SQLMigration;
|
||||
export async function activate(context: ExtensionContext) {
|
||||
export async function activate(context: vscode.ExtensionContext) {
|
||||
sqlMigration = new SQLMigration(context);
|
||||
await sqlMigration.registerCommands();
|
||||
}
|
||||
|
||||
export function deactivate(): void {
|
||||
|
||||
@@ -25,7 +25,7 @@ export enum State {
|
||||
}
|
||||
|
||||
export interface Model {
|
||||
readonly sourceConnection: azdata.IConnectionProfile;
|
||||
readonly sourceConnection: azdata.connection.Connection;
|
||||
readonly currentState: State;
|
||||
}
|
||||
|
||||
@@ -38,11 +38,11 @@ export class MigrationStateModel implements Model, vscode.Disposable {
|
||||
private _stateChangeEventEmitter = new vscode.EventEmitter<StateChangeEvent>();
|
||||
private _currentState: State;
|
||||
|
||||
constructor(private readonly _sourceConnection: azdata.IConnectionProfile) {
|
||||
constructor(private readonly _sourceConnection: azdata.connection.Connection) {
|
||||
this._currentState = State.INIT;
|
||||
}
|
||||
|
||||
public get sourceConnection(): azdata.IConnectionProfile {
|
||||
public get sourceConnection(): azdata.connection.Connection {
|
||||
return this._sourceConnection;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,5 +7,10 @@ import * as nls from 'vscode-nls';
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
|
||||
// #region wizard
|
||||
export const WIZARD_TITLE = localize('sql-migration.wizard.title', "SQL Migration Wizard");
|
||||
export const SOURCE_CONFIGURATION_PAGE_TITLE = localize('sql.migration.wizard.source_configuration.title', "SQL Source Configuration");
|
||||
// //#endregion
|
||||
|
||||
export const COLLECTING_SOURCE_CONFIGURATIONS = localize('sql.migration.collecting_source_configurations', "Collecting source configurations");
|
||||
export const COLLECTING_SOURCE_CONFIGURATIONS_INFO = localize('sql.migration.collecting_source_configurations.info', "We need to collect some information about how your data is configured currently.\nThis may take some time.");
|
||||
|
||||
@@ -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
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user