mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-03-12 20:11:39 -04:00
Added validations to configure dialog (#24418)
* Added validations to configure dialog * Improved validations messages text * Addressed PR feedback * Addressed PR feedback * Fixed build issue * Version bump * Changed to single quotes
This commit is contained in:
@@ -17,7 +17,7 @@ import { hashString, deepClone, getBlobContainerNameWithFolder, Blob, getLastBac
|
||||
import { SKURecommendationPage } from '../wizard/skuRecommendationPage';
|
||||
import { excludeDatabases, getEncryptConnectionValue, getSourceConnectionId, getSourceConnectionProfile, getSourceConnectionServerInfo, getSourceConnectionString, getSourceConnectionUri, getTrustServerCertificateValue, SourceDatabaseInfo, TargetDatabaseInfo } from '../api/sqlUtils';
|
||||
import { LoginMigrationModel } from './loginMigrationModel';
|
||||
import { TdeMigrationDbResult, TdeMigrationModel } from './tdeModels';
|
||||
import { TdeMigrationDbResult, TdeMigrationModel, TdeValidationResult } from './tdeModels';
|
||||
import { NetworkInterfaceModel } from '../api/dataModels/azure/networkInterfaceModel';
|
||||
const localize = nls.loadMessageBundle();
|
||||
|
||||
@@ -1000,6 +1000,55 @@ export class MigrationStateModel implements Model, vscode.Disposable {
|
||||
return opResult;
|
||||
}
|
||||
|
||||
public async getTdeValidationTitles(): Promise<OperationResult<string[]>> {
|
||||
const opResult: OperationResult<string[]> = {
|
||||
success: false,
|
||||
result: [],
|
||||
errors: []
|
||||
};
|
||||
|
||||
try {
|
||||
opResult.result = await this.migrationService.getTdeValidationTitles() ?? [];
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
|
||||
return opResult;
|
||||
}
|
||||
|
||||
public async runTdeValidation(networkSharePath: string): Promise<OperationResult<TdeValidationResult[]>> {
|
||||
const opResult: OperationResult<TdeValidationResult[]> = {
|
||||
success: false,
|
||||
result: [],
|
||||
errors: []
|
||||
};
|
||||
|
||||
const connectionString = await getSourceConnectionString();
|
||||
|
||||
try {
|
||||
let tdeValidationResult = await this.migrationService.runTdeValidation(
|
||||
connectionString,
|
||||
networkSharePath);
|
||||
|
||||
if (tdeValidationResult !== undefined) {
|
||||
opResult.result = tdeValidationResult?.map((e) => {
|
||||
return {
|
||||
validationTitle: e.validationTitle,
|
||||
validationDescription: e.validationDescription,
|
||||
validationTroubleshootingTips: e.validationTroubleshootingTips,
|
||||
validationErrorMessage: e.validationErrorMessage,
|
||||
validationStatus: e.validationStatus,
|
||||
validationStatusString: e.validationStatusString
|
||||
};
|
||||
});
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
}
|
||||
|
||||
return opResult;
|
||||
}
|
||||
|
||||
public async startMigration() {
|
||||
const currentConnection = await getSourceConnectionProfile();
|
||||
const isOfflineMigration = this._databaseBackup.migrationMode === MigrationMode.OFFLINE;
|
||||
|
||||
@@ -41,6 +41,15 @@ export interface TdeMigrationDbResult {
|
||||
message: string;
|
||||
}
|
||||
|
||||
export interface TdeValidationResult {
|
||||
validationTitle: string;
|
||||
validationDescription: string;
|
||||
validationTroubleshootingTips: string;
|
||||
validationErrorMessage: string;
|
||||
validationStatus: number;
|
||||
validationStatusString: string;
|
||||
}
|
||||
|
||||
export class TdeMigrationModel {
|
||||
|
||||
// Settings for which the user has clicked the apply button
|
||||
@@ -53,6 +62,9 @@ export class TdeMigrationModel {
|
||||
private _pendingExportCertUserConsent: boolean;
|
||||
private _pendingNetworkPath: string;
|
||||
|
||||
// Last network path for which all validations succeeded
|
||||
private _lastValidatedNetworkPath: string;
|
||||
|
||||
private _configurationCompleted: boolean;
|
||||
private _shownBefore: boolean;
|
||||
private _encryptedDbs: string[];
|
||||
@@ -75,6 +87,7 @@ export class TdeMigrationModel {
|
||||
this._appliedExportCertUserConsent = false;
|
||||
this._pendingExportCertUserConsent = false;
|
||||
this._tdeMigrationCompleted = false;
|
||||
this._lastValidatedNetworkPath = '';
|
||||
|
||||
this._tdeMigrationCompleted = this._tdeMigrationCompleted;
|
||||
}
|
||||
@@ -176,7 +189,12 @@ export class TdeMigrationModel {
|
||||
}
|
||||
|
||||
if (this._pendingConfigDialogSetting === ConfigDialogSetting.ExportCertificates) {
|
||||
return this._pendingExportCertUserConsent;
|
||||
if (this._pendingNetworkPath !== this._lastValidatedNetworkPath) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return this._pendingNetworkPath.length > 0 &&
|
||||
this._pendingExportCertUserConsent;
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -213,4 +231,12 @@ export class TdeMigrationModel {
|
||||
public setPendingExportCertUserConsent(pendingExportCertUserConsent: boolean) {
|
||||
this._pendingExportCertUserConsent = pendingExportCertUserConsent;
|
||||
}
|
||||
|
||||
public setLastValidatedNetworkPath(validatedNetworkPath: string) {
|
||||
this._lastValidatedNetworkPath = validatedNetworkPath;
|
||||
}
|
||||
|
||||
public getLastValidatedNetworkPath() {
|
||||
return this._lastValidatedNetworkPath;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user