Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
fix(ui): fix refresh of running campaign execution
Browse files Browse the repository at this point in the history
  • Loading branch information
rbenyoussef committed May 12, 2023
1 parent b6f4e5f commit a307923
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
29 changes: 21 additions & 8 deletions ui/src/app/core/model/campaign/campaign-execution-report.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ export interface CampaignExecutionReport {
}

export class CampaignReport {
readonly report: CampaignExecutionReport;
report: CampaignExecutionReport;

readonly passed: number;
readonly running: number;
readonly failed: number;
readonly stopped: number;
readonly notexecuted: number;
readonly pause: number;
readonly total: number;
passed: number;
running: number;
failed: number;
stopped: number;
notexecuted: number;
pause: number;
total: number;

constructor(report: CampaignExecutionReport) {
this.report = report;
Expand Down Expand Up @@ -109,4 +109,17 @@ export class CampaignReport {
isStopped() {
return ExecutionStatus.STOPPED === this.report.status;
}

refresh(campaignReport: CampaignReport) {
if(campaignReport.report.campaignId === this.report.campaignId && campaignReport.report.executionId === this.report.executionId){
this.report = campaignReport.report;
this.notexecuted = campaignReport.notexecuted;
this.running = campaignReport.running;
this.passed = campaignReport.passed;
this.failed = campaignReport.failed;
this.stopped = campaignReport.stopped;
this.pause = campaignReport.pause;
this.total = campaignReport.total;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ export class CampaignExecutionsHistoryComponent implements OnInit, OnDestroy {
private refreshOpenTabs(): void {
for(var i=0; i<this.tabs.length; i++) {
if (this.tabs[i].isRunning()) {
this.tabs[i] = this.campaignReports.find(cr => cr.report.executionId == this.tabs[i].report.executionId)
let campaignReport = this.campaignReports.find(cr => cr.report.executionId == this.tabs[i].report.executionId)
this.tabs[i].refresh(campaignReport);
}
}
}
Expand Down

0 comments on commit a307923

Please sign in to comment.