sqlAssessment sync display fix (#14574)

* sqlAssessment sync display fix

* making append data Thenable<void>
This commit is contained in:
Vladimir Chernov
2021-03-05 23:42:07 +03:00
committed by GitHub
parent a17a4a585e
commit 89c3207c94
6 changed files with 11 additions and 10 deletions

View File

@@ -2,7 +2,7 @@
"name": "sql-assessment", "name": "sql-assessment",
"displayName": "%displayName%", "displayName": "%displayName%",
"description": "%description%", "description": "%description%",
"version": "0.6.0", "version": "0.6.1",
"publisher": "Microsoft", "publisher": "Microsoft",
"preview": true, "preview": true,
"license": "https://raw.githubusercontent.com/Microsoft/azuredatastudio/main/LICENSE.txt", "license": "https://raw.githubusercontent.com/Microsoft/azuredatastudio/main/LICENSE.txt",

View File

@@ -159,8 +159,9 @@ export class AssessmentResultGrid implements vscode.Disposable {
let filteredValues = this.filterOutNotSupportedKind(asmtResult.items); let filteredValues = this.filterOutNotSupportedKind(asmtResult.items);
if (this.dataItems) { if (this.dataItems) {
this.dataItems.push(...filteredValues); this.dataItems.push(...filteredValues);
} }
this.table.appendData(filteredValues.map(item => this.convertToDataView(item))); await this.table.appendData(filteredValues.map(item => this.convertToDataView(item)));
} }
private async showDetails(rowNumber: number) { private async showDetails(rowNumber: number) {

View File

@@ -135,7 +135,7 @@ export class SqlAssessmentMainTab extends SqlAssessmentTab {
if (append) { if (append) {
await this.resultGrid.appendResult(result); await this.resultGrid.appendResult(result);
} else { } else {
this.displayResults(result, assessmentType); await this.displayResults(result, assessmentType);
} }
}); });
} }
@@ -168,7 +168,7 @@ export class SqlAssessmentMainTab extends SqlAssessmentTab {
if (append) { if (append) {
await this.resultGrid.appendResult(result); await this.resultGrid.appendResult(result);
} else { } else {
this.displayResults(result, assessmentType); await this.displayResults(result, assessmentType);
} }
}); });
} }
@@ -299,11 +299,11 @@ export class SqlAssessmentMainTab extends SqlAssessmentTab {
).component(); ).component();
} }
private displayResults(result: azdata.SqlAssessmentResult, assessmentType: AssessmentType): void { private async displayResults(result: azdata.SqlAssessmentResult, assessmentType: AssessmentType): Promise<void> {
this.apiVersionPropItem.value = result.apiVersion; this.apiVersionPropItem.value = result.apiVersion;
this.defaultRulesetPropItem.value = result.items?.length > 0 ? result.items[0].rulesetVersion : ''; this.defaultRulesetPropItem.value = result.items?.length > 0 ? result.items[0].rulesetVersion : '';
this.resultGrid.displayResult(result, assessmentType); await this.resultGrid.displayResult(result, assessmentType);
this.btnExportAsScript.enabled = this.btnHTMLExport.enabled = assessmentType === AssessmentType.InvokeAssessment; this.btnExportAsScript.enabled = this.btnHTMLExport.enabled = assessmentType === AssessmentType.InvokeAssessment;
} }
} }

View File

@@ -47,7 +47,7 @@ export async function readHistoryFileNames(targetName: string): Promise<TargetWi
}; };
const datePart = `_${targetFile.split('_')[1]}`; const datePart = `_${targetFile.split('_')[1]}`;
result.children.push(...files.filter(f => f.endsWith(datePart))); result.children.push(...files.filter(f => f.endsWith(datePart) && f !== targetFile));
result.children = result.children.map(c => path.join(dirPath, c)); result.children = result.children.map(c => path.join(dirPath, c));
return result; return result;

View File

@@ -970,7 +970,7 @@ declare module 'azdata' {
/** /**
* Append data to an existing table data. * Append data to an existing table data.
*/ */
appendData(data: any[][]): void; appendData(data: any[][]): Thenable<void>;
} }
export interface IconColumnCellValue { export interface IconColumnCellValue {

View File

@@ -1440,8 +1440,8 @@ class TableComponentWrapper extends ComponentWrapper implements azdata.TableComp
return emitter && emitter.event; return emitter && emitter.event;
} }
public appendData(v: any[][]): void { public appendData(v: any[][]): Thenable<void> {
this.doAction(ModelViewAction.AppendData, v); return this.doAction(ModelViewAction.AppendData, v);
} }
} }