diff --git a/modules/ui/src/app/components/download-report-zip/download-report-zip.component.spec.ts b/modules/ui/src/app/components/download-report-zip/download-report-zip.component.spec.ts index ae35a64bc..4965779de 100644 --- a/modules/ui/src/app/components/download-report-zip/download-report-zip.component.spec.ts +++ b/modules/ui/src/app/components/download-report-zip/download-report-zip.component.spec.ts @@ -25,6 +25,7 @@ import { import { RouterTestingModule } from '@angular/router/testing'; import { Component } from '@angular/core'; import { MOCK_PROGRESS_DATA_COMPLIANT } from '../../mocks/testrun.mock'; +import { DeviceStatus } from '../../model/device'; describe('DownloadReportZipComponent', () => { let component: DownloadReportZipComponent; @@ -68,6 +69,14 @@ describe('DownloadReportZipComponent', () => { report: 'localhost:8080', export: 'localhost:8080', isPilot: false, + device: { + status: DeviceStatus.VALID, + manufacturer: 'Delta', + model: '03-DIN-CPU', + mac_addr: '01:02:03:04:05:06', + firmware: '1.2.2', + }, + started: '2023-06-22T09:20:00.123Z', }, autoFocus: true, hasBackdrop: true, diff --git a/modules/ui/src/app/components/download-report-zip/download-report-zip.component.ts b/modules/ui/src/app/components/download-report-zip/download-report-zip.component.ts index 010a13990..5460b087e 100644 --- a/modules/ui/src/app/components/download-report-zip/download-report-zip.component.ts +++ b/modules/ui/src/app/components/download-report-zip/download-report-zip.component.ts @@ -64,6 +64,8 @@ export class DownloadReportZipComponent report: this.report, export: this.export, isPilot: this.data?.device.test_pack === TestingType.Pilot, + device: this.data?.device, + started: this.data?.started, }, autoFocus: true, hasBackdrop: true, diff --git a/modules/ui/src/app/components/download-zip-modal/download-zip-modal.component.spec.ts b/modules/ui/src/app/components/download-zip-modal/download-zip-modal.component.spec.ts index 0b111010e..90a9aa3dd 100644 --- a/modules/ui/src/app/components/download-zip-modal/download-zip-modal.component.spec.ts +++ b/modules/ui/src/app/components/download-zip-modal/download-zip-modal.component.spec.ts @@ -25,6 +25,7 @@ import { FocusManagerService } from '../../services/focus-manager.service'; import { BehaviorSubject } from 'rxjs/internal/BehaviorSubject'; import { RouterTestingModule } from '@angular/router/testing'; import { Component } from '@angular/core'; +import { device } from '../../mocks/device.mock'; describe('DownloadZipModalComponent', () => { // @ts-expect-error data layer should be defined @@ -67,6 +68,8 @@ describe('DownloadZipModalComponent', () => { profiles: [PROFILE_MOCK_2, PROFILE_MOCK], report: 'localhost:8080', export: 'localhost:8080', + device: device, + started: '2026-02-02 17:24:52', }, }, { provide: TestRunService, useValue: testRunServiceMock }, @@ -83,6 +86,8 @@ describe('DownloadZipModalComponent', () => { report: 'localhost:8080', export: 'localhost:8080', isPilot: true, + device: device, + started: '2026-02-02 17:24:52', }, }); @@ -225,6 +230,8 @@ describe('DownloadZipModalComponent', () => { profiles: [], report: 'localhost:8080', export: 'localhost:8080', + device: device, + started: '2026-02-02 17:24:52', }, }); diff --git a/modules/ui/src/app/components/download-zip-modal/download-zip-modal.component.ts b/modules/ui/src/app/components/download-zip-modal/download-zip-modal.component.ts index 11800b374..93d3e6ccd 100644 --- a/modules/ui/src/app/components/download-zip-modal/download-zip-modal.component.ts +++ b/modules/ui/src/app/components/download-zip-modal/download-zip-modal.component.ts @@ -33,6 +33,7 @@ import { import { DownloadReportComponent } from '../download-report/download-report.component'; import { Subject, takeUntil, timer } from 'rxjs'; import { FocusManagerService } from '../../services/focus-manager.service'; +import { Device } from '../../model/device'; interface DialogData { profiles: Profile[]; @@ -41,6 +42,8 @@ interface DialogData { report: string | null; export: string | null; isPilot?: boolean; + device: Device; + started: string | null; } export enum DialogCloseAction { @@ -56,7 +59,6 @@ export interface DialogCloseResult { @Component({ selector: 'app-download-zip-modal', - imports: [ CommonModule, MatDialogActions, @@ -133,7 +135,8 @@ export class DownloadZipModalComponent ) { this.testRunService.downloadZip( this.getZipLink(this.data), - result.profile + result.profile, + this.getZipName(this.data) ); if (this.data.isPilot) { // @ts-expect-error data layer is not null @@ -189,4 +192,8 @@ export class DownloadZipModalComponent data.export || data.report!.replace('report', 'export') ); } + + private getZipName(data: DialogData) { + return `${data.device.manufacturer}_${data.device.model}_${data.device.firmware}_${data.started}`; + } } diff --git a/modules/ui/src/app/components/testing-complete/testing-complete.component.spec.ts b/modules/ui/src/app/components/testing-complete/testing-complete.component.spec.ts index 909613b0f..0ba990846 100644 --- a/modules/ui/src/app/components/testing-complete/testing-complete.component.spec.ts +++ b/modules/ui/src/app/components/testing-complete/testing-complete.component.spec.ts @@ -17,6 +17,7 @@ import { DownloadZipModalComponent, } from '../download-zip-modal/download-zip-modal.component'; import { FocusManagerService } from '../../services/focus-manager.service'; +import { DeviceStatus } from '../../model/device'; describe('TestingCompleteComponent', () => { let component: TestingCompleteComponent; @@ -68,6 +69,14 @@ describe('TestingCompleteComponent', () => { report: '/report/123', export: '', isPilot: false, + device: { + status: DeviceStatus.VALID, + manufacturer: 'Delta', + model: '03-DIN-CPU', + mac_addr: '01:02:03:04:05:06', + firmware: '1.2.2', + }, + started: '2023-06-22T09:20:00.123Z', }, autoFocus: 'first-tabbable', ariaDescribedBy: 'testing-result-main-info', diff --git a/modules/ui/src/app/components/testing-complete/testing-complete.component.ts b/modules/ui/src/app/components/testing-complete/testing-complete.component.ts index e8d04d149..a0122d90f 100644 --- a/modules/ui/src/app/components/testing-complete/testing-complete.component.ts +++ b/modules/ui/src/app/components/testing-complete/testing-complete.component.ts @@ -54,6 +54,8 @@ export class TestingCompleteComponent implements OnDestroy, OnInit { report: this.data?.report, export: this.data?.export, isPilot: this.data?.device.test_pack === TestingType.Pilot, + device: this.data?.device, + started: this.data?.started, }, autoFocus: 'first-tabbable', ariaDescribedBy: 'testing-result-main-info', diff --git a/modules/ui/src/app/services/test-run.service.spec.ts b/modules/ui/src/app/services/test-run.service.spec.ts index ba886d9b1..df25d9db2 100644 --- a/modules/ui/src/app/services/test-run.service.spec.ts +++ b/modules/ui/src/app/services/test-run.service.spec.ts @@ -616,7 +616,7 @@ describe('TestRunService', () => { const spyObj = jasmine.createSpyObj('a', ['click', 'dispatchEvent']); spyOn(document, 'createElement').and.returnValue(spyObj); - service.downloadZip('localhost:8080/export/test', ''); + service.downloadZip('localhost:8080/export/test', '', 'report'); const req = httpTestingController.expectOne('localhost:8080/export/test'); req.flush(new Blob()); tick(); diff --git a/modules/ui/src/app/services/test-run.service.ts b/modules/ui/src/app/services/test-run.service.ts index 789a36c15..adf081032 100644 --- a/modules/ui/src/app/services/test-run.service.ts +++ b/modules/ui/src/app/services/test-run.service.ts @@ -301,7 +301,7 @@ export class TestRunService { .pipe(map(() => true)); } - downloadZip(url: string, profile: string) { + downloadZip(url: string, profile: string, name: string) { this.http .post(url, JSON.stringify({ profile }), { responseType: 'blob', @@ -319,7 +319,7 @@ export class TestRunService { const link = document.createElement('a'); link.href = URL.createObjectURL(blob); link.target = '_blank'; - link.download = fileName ?? 'report.zip'; + link.download = fileName ?? `${name}.zip`; link.dispatchEvent(new MouseEvent('click')); }); }