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 @@ -55,11 +55,17 @@
[(value)]="selectedProfile"
aria-label="Please choose a Risk Profile from the list">
<mat-select-trigger>
{{ selectedProfile }}
{{ selectedProfile.name }}
<span
*ngIf="selectedProfile.risk"
class="profile-item-risk"
[ngClass]="getRiskClass(selectedProfile.risk)">
{{ selectedProfile.risk }} risk
</span>
</mat-select-trigger>
<mat-option
*ngFor="let profile of profiles"
[value]="profile.name"
[value]="profile"
class="profile-item-option">
<div class="select-container">
<span
Expand All @@ -82,7 +88,7 @@

<mat-dialog-actions align="end" class="risk-profile-select-form-actions">
<button
(click)="cancel()"
(click)="cancel(null)"
class="cancel-button"
color="primary"
mat-button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,15 @@
display: inline-block;
width: fit-content;
}

::ng-deep mat-select-trigger {
display: inline-flex;
width: 100%;
justify-content: space-between;
}

::ng-deep mat-select-trigger .profile-item-risk {
vertical-align: middle;
align-self: center;
margin-right: 16px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,7 @@ describe('DownloadZipModalComponent', () => {
});

it('should preselect "no profile" option', async () => {
const select = fixture.nativeElement.querySelector(
'mat-select'
) as HTMLElement;

expect(select.getAttribute('ng-reflect-value')).toEqual(
expect(component.selectedProfile.name).toEqual(
'No Risk Profile selected'
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class DownloadZipModalComponent extends EscapableDialogComponent {
} as Profile;
public readonly Routes = Routes;
profiles: Profile[] = [];
selectedProfile: string = '';
selectedProfile: Profile;
constructor(
private readonly testRunService: TestRunService,
public override dialogRef: MatDialogRef<DownloadZipModalComponent>,
Expand All @@ -69,14 +69,18 @@ export class DownloadZipModalComponent extends EscapableDialogComponent {
);
}
this.profiles.unshift(this.NO_PROFILE);
this.selectedProfile = this.profiles[0].name;
this.selectedProfile = this.profiles[0];
}

cancel(profile?: string | null) {
if (profile === this.NO_PROFILE.name) {
profile = '';
cancel(profile?: Profile | null) {
if (profile === null) {
this.dialogRef.close(null);
}
this.dialogRef.close(profile);
let value = profile?.name;
if (profile && profile?.name === this.NO_PROFILE.name) {
value = '';
}
this.dialogRef.close(value);
}

public getRiskClass(riskResult: string): RiskResultClassName {
Expand Down