mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-11 02:32:35 -05:00
Updating assessment api response object in SQL Migration (#16334)
* Modifying the get assessments api to match the new specs * fixing property name * Updating sts version
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"downloadUrl": "https://github.com/Microsoft/sqltoolsservice/releases/download/v{#version#}/microsoft.sqltools.servicelayer-{#fileName#}",
|
||||
"version": "3.0.0-release.111",
|
||||
"version": "3.0.0-release.115",
|
||||
"downloadFileNames": {
|
||||
"Windows_86": "win-x86-net5.0.zip",
|
||||
"Windows_64": "win-x64-net5.0.zip",
|
||||
|
||||
@@ -1014,17 +1014,12 @@ export namespace ProfilerSessionCreatedNotification {
|
||||
// ------------------------------- < SQL Profiler > ------------------------------------
|
||||
|
||||
/// ------------------------------- <Sql Migration> -----------------------------
|
||||
|
||||
export interface SqlAssessmentResult extends azdata.ResultStatus {
|
||||
items: mssql.SqlMigrationAssessmentResultItem[];
|
||||
}
|
||||
|
||||
export interface SqlMigrationAssessmentParams {
|
||||
ownerUri: string;
|
||||
}
|
||||
|
||||
export namespace GetSqlMigrationAssessmentItemsRequest {
|
||||
export const type = new RequestType<SqlAssessmentParams, SqlAssessmentResult, void, void>('migration/getassessments');
|
||||
export const type = new RequestType<SqlAssessmentParams, mssql.AssessmentResult, void, void>('migration/getassessments');
|
||||
}
|
||||
|
||||
// ------------------------------- <Sql Migration> -----------------------------
|
||||
|
||||
66
extensions/mssql/src/mssql.d.ts
vendored
66
extensions/mssql/src/mssql.d.ts
vendored
@@ -444,7 +444,7 @@ export interface ICmsService {
|
||||
/**
|
||||
* Connects to or creates a Central management Server
|
||||
*/
|
||||
createCmsServer(name: string, description:string, connectiondetails: azdata.ConnectionInfo, ownerUri: string): Thenable<ListRegisteredServersResult>;
|
||||
createCmsServer(name: string, description: string, connectiondetails: azdata.ConnectionInfo, ownerUri: string): Thenable<ListRegisteredServersResult>;
|
||||
|
||||
/**
|
||||
* gets all Registered Servers inside a CMS on a particular level
|
||||
@@ -454,22 +454,22 @@ export interface ICmsService {
|
||||
/**
|
||||
* Adds a Registered Server inside a CMS on a particular level
|
||||
*/
|
||||
addRegisteredServer (ownerUri: string, relativePath: string, registeredServerName: string, registeredServerDescription:string, connectionDetails:azdata.ConnectionInfo): Thenable<boolean>;
|
||||
addRegisteredServer(ownerUri: string, relativePath: string, registeredServerName: string, registeredServerDescription: string, connectionDetails: azdata.ConnectionInfo): Thenable<boolean>;
|
||||
|
||||
/**
|
||||
* Removes a Registered Server inside a CMS on a particular level
|
||||
*/
|
||||
removeRegisteredServer (ownerUri: string, relativePath: string, registeredServerName: string): Thenable<boolean>;
|
||||
removeRegisteredServer(ownerUri: string, relativePath: string, registeredServerName: string): Thenable<boolean>;
|
||||
|
||||
/**
|
||||
* Adds a Server Group inside a CMS on a particular level
|
||||
*/
|
||||
addServerGroup (ownerUri: string, relativePath: string, groupName: string, groupDescription:string): Thenable<boolean>;
|
||||
addServerGroup(ownerUri: string, relativePath: string, groupName: string, groupDescription: string): Thenable<boolean>;
|
||||
|
||||
/**
|
||||
* Removes a Server Group inside a CMS on a particular level
|
||||
*/
|
||||
removeServerGroup (ownerUri: string, relativePath: string, groupName: string): Thenable<boolean>;
|
||||
removeServerGroup(ownerUri: string, relativePath: string, groupName: string): Thenable<boolean>;
|
||||
}
|
||||
/**
|
||||
* CMS Result interfaces as passed back to Extensions
|
||||
@@ -542,10 +542,62 @@ export interface SqlMigrationAssessmentResultItem {
|
||||
impactedObjects: SqlMigrationImpactedObjectInfo[];
|
||||
}
|
||||
|
||||
export interface SqlMigrationAssessmentResult extends azdata.ResultStatus {
|
||||
export interface ServerTargetReadiness {
|
||||
numberOfDatabasesReadyForMigration: number;
|
||||
numberOfNonOnlineDatabases: number;
|
||||
totalNumberOfDatabases: number;
|
||||
}
|
||||
|
||||
export interface ErrorModel {
|
||||
errorId: number;
|
||||
message: string;
|
||||
errorSummary: string;
|
||||
possibleCauses: string;
|
||||
guidance: string;
|
||||
}
|
||||
|
||||
export interface DatabaseTargetReadiness {
|
||||
noSelectionForMigration: boolean;
|
||||
numOfBlockerIssues: number;
|
||||
}
|
||||
|
||||
export interface DatabaseAssessmentProperties {
|
||||
compatibilityLevel: string;
|
||||
databaseSize: number;
|
||||
isReplicationEnabled: boolean;
|
||||
assessmentTimeInMilliseconds: number;
|
||||
items: SqlMigrationAssessmentResultItem[];
|
||||
errors: ErrorModel[];
|
||||
sqlManagedInstanceTargetReadiness: DatabaseTargetReadiness;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface ServerAssessmentProperties {
|
||||
cpuCoreCount: number;
|
||||
physicalServerMemory: number;
|
||||
serverHostPlatform: string;
|
||||
serverVersion: string;
|
||||
serverEngineEdition: string;
|
||||
serverEdition: string;
|
||||
isClustered: boolean;
|
||||
numberOfUserDatabases: number;
|
||||
sqlAssessmentStatus: number;
|
||||
assessedDatabaseCount: number;
|
||||
sqlManagedInstanceTargetReadiness: ServerTargetReadiness;
|
||||
items: SqlMigrationAssessmentResultItem[];
|
||||
errors: ErrorModel[];
|
||||
databases: DatabaseAssessmentProperties[];
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface AssessmentResult {
|
||||
startedOn: string;
|
||||
endedOn: string;
|
||||
assessmentResult: ServerAssessmentProperties;
|
||||
rawAssessmentResult: any;
|
||||
errors: ErrorModel[];
|
||||
}
|
||||
|
||||
export interface ISqlMigrationService {
|
||||
getAssessments(ownerUri: string): Promise<SqlMigrationAssessmentResult | undefined>;
|
||||
getAssessments(ownerUri: string): Promise<AssessmentResult | undefined>;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ export class SqlMigrationService implements mssql.ISqlMigrationService {
|
||||
context.registerService(constants.SqlMigrationService, this);
|
||||
}
|
||||
|
||||
async getAssessments(ownerUri: string): Promise<mssql.SqlMigrationAssessmentResult | undefined> {
|
||||
async getAssessments(ownerUri: string): Promise<mssql.AssessmentResult | undefined> {
|
||||
let params: contracts.SqlMigrationAssessmentParams = { ownerUri: ownerUri };
|
||||
try {
|
||||
return this.client.sendRequest(contracts.GetSqlMigrationAssessmentItemsRequest.type, params);
|
||||
|
||||
@@ -176,30 +176,17 @@ export class MigrationStateModel implements Model, vscode.Disposable {
|
||||
const assessmentResults = await this.migrationService.getAssessments(
|
||||
ownerUri
|
||||
);
|
||||
|
||||
this._serverDatabases = await (await azdata.connection.listDatabases(this.sourceConnectionId)).filter((name) => !excludeDbs.includes(name));
|
||||
const serverLevelAssessments: mssql.SqlMigrationAssessmentResultItem[] = [];
|
||||
const databaseLevelAssessments = this._serverDatabases.map(db => {
|
||||
const dbAssessments = assessmentResults?.assessmentResult.databases.filter(d => !excludeDbs.includes(d.name)).map(d => {
|
||||
return {
|
||||
name: db,
|
||||
issues: <mssql.SqlMigrationAssessmentResultItem[]>[]
|
||||
name: d.name,
|
||||
issues: d.items.filter(i => i.appliesToMigrationTargetPlatform === MigrationTargetType.SQLMI) ?? []
|
||||
};
|
||||
});
|
||||
|
||||
assessmentResults?.items.forEach((item) => {
|
||||
if (item.appliesToMigrationTargetPlatform === MigrationTargetType.SQLMI) {
|
||||
const dbIndex = this._serverDatabases.indexOf(item.databaseName);
|
||||
if (dbIndex === -1) {
|
||||
serverLevelAssessments.push(item);
|
||||
} else {
|
||||
databaseLevelAssessments[dbIndex].issues.push(item);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this._assessmentResults = {
|
||||
issues: serverLevelAssessments,
|
||||
databaseAssessments: databaseLevelAssessments
|
||||
issues: assessmentResults?.assessmentResult.items?.filter(i => i.appliesToMigrationTargetPlatform === MigrationTargetType.SQLMI) ?? [],
|
||||
databaseAssessments: dbAssessments! ?? []
|
||||
};
|
||||
|
||||
return this._assessmentResults;
|
||||
|
||||
Reference in New Issue
Block a user