Tidy up some functions in the model evaluator (#3529)

* Rename model evaluator's updateVariantAnalysis -> setVariantAnalysis

* Merge updateRepoResults and updateReposResults into single setReposResults function
This commit is contained in:
Charis Kyriakou
2024-04-02 12:32:50 +01:00
committed by GitHub
parent ff6f6cdf8a
commit 3508dc6d8c
2 changed files with 6 additions and 19 deletions

View File

@@ -58,7 +58,7 @@ export class ModelAlertsView extends AbstractWebview<
await this.waitForPanelLoaded();
await this.setViewState();
await this.updateReposResults(reposResults);
await this.setReposResults(reposResults);
}
protected async getPanelConfig(): Promise<WebviewPanelConfig> {
@@ -121,7 +121,7 @@ export class ModelAlertsView extends AbstractWebview<
});
}
public async updateVariantAnalysis(
public async setVariantAnalysis(
variantAnalysis: VariantAnalysis,
): Promise<void> {
if (!this.isShowingPanel) {
@@ -134,20 +134,7 @@ export class ModelAlertsView extends AbstractWebview<
});
}
public async updateRepoResults(
repositoryResult: VariantAnalysisScannedRepositoryResult,
): Promise<void> {
if (!this.isShowingPanel) {
return;
}
await this.postMessage({
t: "setRepoResults",
repoResults: [repositoryResult],
});
}
public async updateReposResults(
public async setReposResults(
repoResults: VariantAnalysisScannedRepositoryResult[],
): Promise<void> {
if (!this.isShowingPanel) {

View File

@@ -155,7 +155,7 @@ export class ModelEvaluator extends DisposableObject {
);
await this.modelAlertsView.showView(reposResults);
await this.modelAlertsView.updateVariantAnalysis(variantAnalysis);
await this.modelAlertsView.setVariantAnalysis(variantAnalysis);
}
}
@@ -271,7 +271,7 @@ export class ModelEvaluator extends DisposableObject {
});
// Update model alerts view
await this.modelAlertsView?.updateVariantAnalysis(variantAnalysis);
await this.modelAlertsView?.setVariantAnalysis(variantAnalysis);
}
},
),
@@ -295,7 +295,7 @@ export class ModelEvaluator extends DisposableObject {
this.push(
this.variantAnalysisManager.onRepoResultsLoaded(async (e) => {
if (e.variantAnalysisId === variantAnalysisId) {
await this.modelAlertsView?.updateRepoResults(e);
await this.modelAlertsView?.setReposResults([e]);
}
}),
);