Adding windows auth support to sql-migration and misc bug fixes. (#14816)

* - Added coming soon message for learn more.
- Potential fix for learn more message

* Renaming of controller to sqlMigrationService

* Surfacing some errors
-Azure account is stale error
-Migration Service creation error.

* Adding refresh azure token validation.

* Fixing some errors pointed during PR
-Fixing property names
-Fixing count

* Fixing migration status
- Adding special error handling for resource not found error
- Deleting unfound migrations from local cache
- Using prefetched migration status for view all

Misc fixes:
- Using SQL server version name instead of number
- Fixing Icons on sku recommendation page
- Fixing table column width in cutover dialog
- Adding spinner button to refresh.

* Fixing all strings in migration service page and dialog

* fixed a string error in create service dialog

* Adding source config page to migration to support windows auth
Some refactorings for sqlDatabaseTree (still WIP)

* refactoring assessments code 1
introducing new interface for server assessments

* Filtering out non windows sql vms
Retaining selections made by user on assessments dialog

* Fix compile errors on sqlDatabaseTree

* Exposing migration status errors in cutover dialog

* Updating extension verion

* Correcting typos
Fixing compilation erros
Removing en-us from url
Fixing function names
Make UI calls unblocking

* Unblocking dialog in case of failed assessments
Localizing string
removing blocking code from UI
Fixing comments

* Fixed broken assessment page logic
This commit is contained in:
Aasim Khan
2021-03-23 07:48:26 -07:00
committed by GitHub
parent 780ca84f9a
commit 339d908d1d
20 changed files with 652 additions and 630 deletions

View File

@@ -0,0 +1,115 @@
/*---------------------------------------------------------------------------------------------
* 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 * as os from 'os';
import { MigrationWizardPage } from '../models/migrationWizardPage';
import { MigrationStateModel, StateChangeEvent } from '../models/stateMachine';
import * as constants from '../constants/strings';
import { createLabelTextComponent, createHeadingTextComponent } from './wizardController';
export class SqlSourceConfigurationPage extends MigrationWizardPage {
private _view!: azdata.ModelView;
constructor(wizard: azdata.window.Wizard, migrationStateModel: MigrationStateModel) {
super(wizard, azdata.window.createWizardPage(constants.SOURCE_CONFIGURATION, 'MigrationModePage'), migrationStateModel);
}
protected async registerContent(view: azdata.ModelView): Promise<void> {
this._view = view;
const form = view.modelBuilder.formContainer()
.withFormItems(
[
await this.createSourceCredentialContainer(),
]
);
await view.initializeModel(form.component());
}
public async onPageEnter(): Promise<void> {
this.wizard.registerNavigationValidator((pageChangeInfo) => {
return true;
});
}
public async onPageLeave(): Promise<void> {
this.wizard.registerNavigationValidator((pageChangeInfo) => {
return true;
});
}
protected async handleStateChange(e: StateChangeEvent): Promise<void> {
}
private async createSourceCredentialContainer(): Promise<azdata.FormComponent> {
const connectionProfile = await this.migrationStateModel.getSourceConnectionProfile();
let username;
switch (connectionProfile.authenticationType) {
case 'SqlLogin':
username = connectionProfile.userName;
this.migrationStateModel._authenticationType = 'SqlAuthentication';
break;
case 'Integrated':
username = os.userInfo().username;
this.migrationStateModel._authenticationType = 'WindowsAuthentication';
break;
default:
username = '';
}
const sourceCredText = createHeadingTextComponent(this._view, constants.SOURCE_CREDENTIALS);
const enterYourCredText = createLabelTextComponent(
this._view,
constants.ENTER_YOUR_SQL_CREDS(connectionProfile.serverName),
{
'width': '400px'
}
);
const usernameLable = this._view.modelBuilder.text().withProps({
value: constants.USERNAME,
requiredIndicator: true
}).component();
const usernameInput = this._view.modelBuilder.inputBox().withProps({
value: username,
required: true
}).component();
usernameInput.onTextChanged(value => {
this.migrationStateModel._sqlServerUsername = value;
});
const passwordLabel = this._view.modelBuilder.text().withProps({
value: constants.DATABASE_BACKUP_NETWORK_SHARE_PASSWORD_LABEL,
requiredIndicator: true
}).component();
const passwordInput = this._view.modelBuilder.inputBox().withProps({
value: (await azdata.connection.getCredentials(this.migrationStateModel.sourceConnectionId)).password,
required: true,
inputType: 'password'
}).component();
passwordInput.onTextChanged(value => {
this.migrationStateModel._sqlServerPassword = value;
});
const container = this._view.modelBuilder.flexContainer().withItems(
[
sourceCredText,
enterYourCredText,
usernameLable,
usernameInput,
passwordLabel,
passwordInput
]
).withLayout({
flexFlow: 'column'
}).component();
return {
component: container
};
}
}