Added functionality to disable COAR notify support link in footer

Also fixed error that showed a blank page instead of a 404 when disabling EULA/Privacy Policy pages
This commit is contained in:
Alexandre Vryghem
2024-04-12 01:38:34 +02:00
parent 2ef2e9b334
commit e10630f131
15 changed files with 83 additions and 59 deletions

View File

@@ -0,0 +1,56 @@
import { AsyncPipe } from '@angular/common';
import {
Component,
OnInit,
} from '@angular/core';
import { RouterLink } from '@angular/router';
import { TranslateModule } from '@ngx-translate/core';
import {
map,
Observable,
of,
} from 'rxjs';
import { NotifyInfoService } from '../../core/coar-notify/notify-info/notify-info.service';
@Component({
selector: 'ds-notify-info',
templateUrl: './notify-info.component.html',
styleUrls: ['./notify-info.component.scss'],
imports: [
RouterLink,
TranslateModule,
AsyncPipe,
],
standalone: true,
})
/**
* Component for displaying COAR notification information.
*/
export class NotifyInfoComponent implements OnInit {
/**
* Observable containing the COAR REST INBOX API URLs.
*/
coarRestApiUrl: Observable<string[]> = of([]);
constructor(private notifyInfoService: NotifyInfoService) {}
ngOnInit() {
this.coarRestApiUrl = this.notifyInfoService.getCoarLdnLocalInboxUrls();
}
/**
* Generates HTML code for COAR REST API links.
* @returns An Observable that emits the generated HTML code.
*/
generateCoarRestApiLinksHTML() {
return this.coarRestApiUrl.pipe(
// transform the data into HTML
map((urls) => {
return urls.map(url => `
<code><a href="${url}" target="_blank"><span class="api-url">${url}</span></a></code>
`).join(',');
}),
);
}
}