mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-17 09:35:37 -05:00
Migration wizard skeleton setup (#11758)
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user