Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ describe('DownloadReportZipComponent', () => {
expect(openSpy).toHaveBeenCalledWith(DownloadZipModalComponent, {
ariaLabel: 'Download zip',
data: {
hasProfiles: false,
profiles: [],
},
autoFocus: true,
Expand All @@ -105,7 +104,6 @@ describe('DownloadReportZipComponent', () => {
expect(openSpy).toHaveBeenCalledWith(DownloadZipModalComponent, {
ariaLabel: 'Download zip',
data: {
hasProfiles: false,
profiles: [],
},
autoFocus: true,
Expand All @@ -131,7 +129,6 @@ describe('DownloadReportZipComponent', () => {
expect(openSpy).toHaveBeenCalledWith(DownloadZipModalComponent, {
ariaLabel: 'Download zip',
data: {
hasProfiles: false,
profiles: [],
},
autoFocus: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export class DownloadReportZipComponent
implements OnDestroy, OnInit
{
private destroy$: Subject<boolean> = new Subject<boolean>();
@Input() hasProfiles: boolean = false;
@Input() profiles: Profile[] = [];
@Input() url: string | null | undefined = null;

Expand All @@ -61,7 +60,6 @@ export class DownloadReportZipComponent
const dialogRef = this.dialog.open(DownloadZipModalComponent, {
ariaLabel: 'Download zip',
data: {
hasProfiles: this.hasProfiles,
profiles: this.profiles,
},
autoFocus: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
Risk assessment profile for your ZIP report.
</p>

<div *ngIf="data.hasProfiles">
<div *ngIf="profiles.length > 0">
<mat-form-field appearance="outline" class="profile-select">
<mat-select
#select
Expand Down Expand Up @@ -78,7 +78,7 @@
</div>

<mat-dialog-actions
*ngIf="!data.hasProfiles"
*ngIf="profiles.length === 0"
align="end"
class="risk-profile-select-form-actions">
<button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ describe('DownloadZipModalComponent', () => {
{
provide: MAT_DIALOG_DATA,
useValue: {
hasProfiles: true,
profiles: [PROFILE_MOCK_2, PROFILE_MOCK],
},
},
Expand All @@ -44,7 +43,6 @@ describe('DownloadZipModalComponent', () => {
beforeEach(() => {
TestBed.overrideProvider(MAT_DIALOG_DATA, {
useValue: {
hasProfiles: true,
profiles: [PROFILE_MOCK_2, PROFILE_MOCK, PROFILE_MOCK_3],
},
});
Expand Down Expand Up @@ -133,7 +131,6 @@ describe('DownloadZipModalComponent', () => {
beforeEach(() => {
TestBed.overrideProvider(MAT_DIALOG_DATA, {
useValue: {
hasProfiles: false,
profiles: [],
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { MatOptionModule } from '@angular/material/core';
import { TestRunService } from '../../services/test-run.service';

interface DialogData {
hasProfiles: boolean;
profiles: Profile[];
}

Expand Down Expand Up @@ -50,10 +49,10 @@ export class DownloadZipModalComponent extends EscapableDialogComponent {
@Inject(MAT_DIALOG_DATA) public data: DialogData
) {
super(dialogRef);
if (data.hasProfiles) {
this.profiles = data.profiles.filter(
profile => profile.status === ProfileStatus.VALID
);
this.profiles = data.profiles.filter(
profile => profile.status === ProfileStatus.VALID
);
if (this.profiles.length > 0) {
this.profiles.sort((a, b) =>
a.name.toLowerCase().localeCompare(b.name.toLowerCase())
);
Expand Down
1 change: 0 additions & 1 deletion modules/ui/src/app/pages/reports/reports.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ <h2 class="title" tabindex="-1">Reports</h2>
*ngIf="data?.device"
[data]="data"
[url]="data.report"
[hasProfiles]="vm.hasProfiles"
[profiles]="vm.profiles">
<span class="download-report-zip-icon-container">
<mat-icon
Expand Down
1 change: 0 additions & 1 deletion modules/ui/src/app/pages/reports/reports.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ describe('ReportsComponent', () => {
dataLoaded: dataLoaded,
selectedRow: null,
isFiltersEmpty: true,
hasProfiles: false,
profiles: [],
});
};
Expand Down
11 changes: 2 additions & 9 deletions modules/ui/src/app/pages/reports/reports.store.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ import { HttpErrorResponse } from '@angular/common/http';
import { MatRow } from '@angular/material/table';
import { MatSort } from '@angular/material/sort';
import { provideMockStore } from '@ngrx/store/testing';
import {
selectHasRiskProfiles,
selectRiskProfiles,
} from '../../store/selectors';
import { selectRiskProfiles } from '../../store/selectors';

describe('ReportsStore', () => {
let reportsStore: ReportsStore;
Expand All @@ -50,10 +47,7 @@ describe('ReportsStore', () => {
ReportsStore,
{ provide: TestRunService, useValue: mockService },
provideMockStore({
selectors: [
{ selector: selectHasRiskProfiles, value: false },
{ selector: selectRiskProfiles, value: [] },
],
selectors: [{ selector: selectRiskProfiles, value: [] }],
}),
DatePipe,
],
Expand Down Expand Up @@ -151,7 +145,6 @@ describe('ReportsStore', () => {
dataLoaded: false,
selectedRow: null,
isFiltersEmpty: true,
hasProfiles: false,
profiles: [],
});
done();
Expand Down
7 changes: 1 addition & 6 deletions modules/ui/src/app/pages/reports/reports.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ import { catchError, EMPTY, exhaustMap } from 'rxjs';
import { tap, withLatestFrom } from 'rxjs/operators';
import { DatePipe } from '@angular/common';
import { MatSort } from '@angular/material/sort';
import {
selectHasRiskProfiles,
selectRiskProfiles,
} from '../../store/selectors';
import { selectRiskProfiles } from '../../store/selectors';
import { Store } from '@ngrx/store';
import { AppState } from '../../store/state';

Expand Down Expand Up @@ -45,7 +42,6 @@ export class ReportsStore extends ComponentStore<ReportsComponentState> {
private isFiltersEmpty$ = this.select(state => state.isFiltersEmpty);
private history$ = this.select(state => state.history);
private profiles$ = this.store.select(selectRiskProfiles);
private hasProfiles$ = this.store.select(selectHasRiskProfiles);
viewModel$ = this.select({
displayedColumns: this.displayedColumns$,
chips: this.chips$,
Expand All @@ -56,7 +52,6 @@ export class ReportsStore extends ComponentStore<ReportsComponentState> {
dataLoaded: this.dataLoaded$,
selectedRow: this.selectedRow$,
isFiltersEmpty: this.isFiltersEmpty$,
hasProfiles: this.hasProfiles$,
profiles: this.profiles$,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
id="downloadReportZip"
class="download-option zip"
[url]="data.report"
[hasProfiles]="hasProfiles"
[profiles]="profiles">
<mat-option
(onSelectionChange)="onZipSelected($event)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ export enum DownloadOption {
})
export class DownloadOptionsComponent {
@ViewChild('downloadReportZip') downloadReportZip!: ElementRef;
@Input() hasProfiles: boolean = false;
@Input() profiles: Profile[] = [];
@Input() data!: TestrunStatus;
DownloadOption = DownloadOption;
Expand Down
3 changes: 1 addition & 2 deletions modules/ui/src/app/pages/testrun/testrun.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ <h2 class="title progress-title" tabindex="-1">
<app-download-options
*ngIf="data.report"
[data]="data"
[profiles]="vm.profiles"
[hasProfiles]="vm.hasProfiles"></app-download-options>
[profiles]="vm.profiles"></app-download-options>
</div>
</div>
<app-testrun-status-card [systemStatus]="vm.systemStatus">
Expand Down
1 change: 0 additions & 1 deletion modules/ui/src/app/pages/testrun/testrun.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,5 @@ class FakeProgressTableComponent {
})
class FakeDownloadOptionsComponent {
@Input() data!: TestrunStatus;
@Input() hasProfiles!: boolean;
@Input() profiles!: Profile[];
}
3 changes: 0 additions & 3 deletions modules/ui/src/app/pages/testrun/testrun.store.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { skip, take } from 'rxjs';
import {
selectHasConnectionSettings,
selectHasDevices,
selectHasRiskProfiles,
selectIsOpenStartTestrun,
selectRiskProfiles,
selectSystemStatus,
Expand Down Expand Up @@ -66,7 +65,6 @@ describe('TestrunStore', () => {
{ selector: selectSystemStatus, value: null },
{ selector: selectHasConnectionSettings, value: true },
{ selector: selectIsOpenStartTestrun, value: false },
{ selector: selectHasRiskProfiles, value: false },
{ selector: selectRiskProfiles, value: [] },
],
}),
Expand All @@ -90,7 +88,6 @@ describe('TestrunStore', () => {
systemStatus: null,
dataSource: [],
stepsToResolveCount: 0,
hasProfiles: false,
profiles: [],
});
done();
Expand Down
3 changes: 0 additions & 3 deletions modules/ui/src/app/pages/testrun/testrun.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { AppState } from '../../store/state';
import { Store } from '@ngrx/store';
import {
selectHasDevices,
selectHasRiskProfiles,
selectIsOpenStartTestrun,
selectRiskProfiles,
selectSystemStatus,
Expand Down Expand Up @@ -58,15 +57,13 @@ export class TestrunStore extends ComponentStore<TestrunComponentState> {
);
private hasDevices$ = this.store.select(selectHasDevices);
private profiles$ = this.store.select(selectRiskProfiles);
private hasProfiles$ = this.store.select(selectHasRiskProfiles);
private systemStatus$ = this.store.select(selectSystemStatus);
isOpenStartTestrun$ = this.store.select(selectIsOpenStartTestrun);
viewModel$ = this.select({
hasDevices: this.hasDevices$,
systemStatus: this.systemStatus$,
dataSource: this.dataSource$,
stepsToResolveCount: this.stepsToResolveCount$,
hasProfiles: this.hasProfiles$,
profiles: this.profiles$,
});

Expand Down