Skip to content

Commit

Permalink
feat(eua): Improved EUA preview
Browse files Browse the repository at this point in the history
  • Loading branch information
jrassa committed Nov 22, 2024
1 parent f0a3874 commit c36b0cc
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/app/core/admin/end-user-agreement/eua.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ export class EuaService extends AbstractEntityService<EndUserAgreement> {
}

publish(eua: EndUserAgreement): Observable<EndUserAgreement | null> {
return this.updateAction('publish', eua);
return this.updateAction('publish', eua, {});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ import {
} from '../../../../common/table';
import { EndUserAgreement } from '../../../auth';
import { EuaService } from '../eua.service';
import {
PreviewEuaModalComponent,
PreviewEuaModalData
} from '../preview-eua-modal/preview-eua-modal.component';

@Component({
templateUrl: './admin-list-euas.component.html',
Expand Down Expand Up @@ -163,8 +167,9 @@ export class AdminListEuasComponent implements OnInit {
/**
* Opens a preview modal containing the text and title of this end user agreement.
*/
previewEndUserAgreement(endUserAgreement: EndUserAgreement) {
const { text, title } = endUserAgreement;
this.#dialogService.alert(title, text);
previewEndUserAgreement(eua: EndUserAgreement) {
this.#dialogService.open<unknown, PreviewEuaModalData>(PreviewEuaModalComponent, {
data: { eua }
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import { DialogService } from '../../../../common/dialog';
import { SystemAlertComponent, SystemAlertService } from '../../../../common/system-alert';
import { EndUserAgreement } from '../../../auth';
import { EuaService } from '../eua.service';
import {
PreviewEuaModalComponent,
PreviewEuaModalData
} from '../preview-eua-modal/preview-eua-modal.component';

@Component({
standalone: true,
Expand Down Expand Up @@ -44,6 +48,8 @@ export class ManageEuaComponent {
}

previewEua(): void {
this.#dialogService.alert(this.eua().title, this.eua().text);
this.#dialogService.open<unknown, PreviewEuaModalData>(PreviewEuaModalComponent, {
data: { eua: this.eua() }
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<asy-modal title="EUA Preview" (cancel)="close()" (ok)="close()">
<div class="card">
<div class="card-header">
<h2>{{ data.eua.title }}</h2>
</div>
<div class="card-body" [innerHtml]="data.eua.text"></div>
</div>
</asy-modal>
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { DIALOG_DATA, DialogRef } from '@angular/cdk/dialog';
import { Component, inject } from '@angular/core';
import { FormsModule } from '@angular/forms';

import { ModalComponent } from '../../../../common';
import { DialogAction } from '../../../../common/dialog';
import { EndUserAgreement } from '../../../auth';

export type PreviewEuaModalData = {
eua: EndUserAgreement;
};

@Component({
selector: 'app-preview-eua-modal',
standalone: true,
imports: [FormsModule, ModalComponent],
templateUrl: './preview-eua-modal.component.html',
styleUrl: './preview-eua-modal.component.scss'
})
export class PreviewEuaModalComponent {
readonly #dialogRef = inject(DialogRef);

readonly data: PreviewEuaModalData = inject(DIALOG_DATA);

close() {
this.#dialogRef.close({ action: DialogAction.CANCEL });
}
}
4 changes: 2 additions & 2 deletions src/app/core/eua/user-eua.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<div class="row g-0">
@if (eua$ | async; as eua) {
<div class="col-xl-8 offset-xl-2">
<h1>
<h2>
End User Agreement (EUA)<br />
@if (!alreadyAccepted()) {
<small> Please review and acknowledge the end user agreement </small>
}
</h1>
</h2>
<!-- Alert Notifications -->
<system-alert />
<form name="userForm" role="form" autocomplete="off">
Expand Down

0 comments on commit c36b0cc

Please sign in to comment.