mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-19 17:22:48 -05:00
Migration wizard skeleton setup (#11758)
This commit is contained in:
17
extensions/sql-migration/src/models/migrationWizardPage.ts
Normal file
17
extensions/sql-migration/src/models/migrationWizardPage.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
import { MigrationStateModel } from './stateMachine';
|
||||
export abstract class MigrationWizardPage {
|
||||
constructor(protected readonly wizardPage: azdata.window.WizardPage, protected readonly migrationStateModel: MigrationStateModel) { }
|
||||
|
||||
public abstract async registerWizardContent(): Promise<void>;
|
||||
|
||||
public getwizardPage(): azdata.window.WizardPage {
|
||||
return this.wizardPage;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,11 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
import * as vscode from 'vscode';
|
||||
|
||||
export enum State {
|
||||
INIT,
|
||||
COLLECTING_SOURCE_INFO,
|
||||
COLLECTION_SOURCE_INFO_ERROR,
|
||||
TARGET_SELECTION,
|
||||
@@ -20,3 +24,45 @@ export enum State {
|
||||
EXIT,
|
||||
}
|
||||
|
||||
export interface Model {
|
||||
readonly sourceConnection: azdata.IConnectionProfile;
|
||||
readonly currentState: State;
|
||||
}
|
||||
|
||||
export interface StateChangeEvent {
|
||||
oldState: State;
|
||||
newState: State;
|
||||
}
|
||||
|
||||
export class MigrationStateModel implements Model, vscode.Disposable {
|
||||
private _stateChangeEventEmitter = new vscode.EventEmitter<StateChangeEvent>();
|
||||
private _currentState: State;
|
||||
|
||||
constructor(private readonly _sourceConnection: azdata.IConnectionProfile) {
|
||||
this._currentState = State.INIT;
|
||||
}
|
||||
|
||||
public get sourceConnection(): azdata.IConnectionProfile {
|
||||
return this._sourceConnection;
|
||||
}
|
||||
|
||||
public get currentState(): State {
|
||||
return this._currentState;
|
||||
}
|
||||
|
||||
public set currentState(newState: State) {
|
||||
const oldState = this.currentState;
|
||||
|
||||
this._currentState = newState;
|
||||
|
||||
this._stateChangeEventEmitter.fire({ oldState, newState: this.currentState });
|
||||
}
|
||||
|
||||
public get stateChangeEvent(): vscode.Event<StateChangeEvent> {
|
||||
return this._stateChangeEventEmitter.event;
|
||||
}
|
||||
|
||||
dispose() {
|
||||
this._stateChangeEventEmitter.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
11
extensions/sql-migration/src/models/strings.ts
Normal file
11
extensions/sql-migration/src/models/strings.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as nls from 'vscode-nls';
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
|
||||
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");
|
||||
Reference in New Issue
Block a user