Fix COAR notify link on the info component

This commit is contained in:
Alexandre Vryghem
2024-04-22 22:27:00 +02:00
parent c2c832eff9
commit 83bbb98e4f
7 changed files with 30 additions and 38 deletions

View File

@@ -84,7 +84,7 @@
</div> </div>
<div *ngIf="coarLdnEnabled$ | async" class="notify-enabled text-white"> <div *ngIf="coarLdnEnabled$ | async" class="notify-enabled text-white">
<a class="coar-notify-support-route" routerLink="info/coar-notify-support"> <a class="coar-notify-support-route" routerLink="info/coar-notify-support">
<img class="n-coar" src="assets/images/n-coar.png" [attr.alt]="'menu.header.image.logo' | translate" /> <img class="n-coar" src="assets/images/n-coar.svg" [attr.alt]="'menu.header.image.logo' | translate" />
{{ 'footer.link.coar-notify-support' | translate }} {{ 'footer.link.coar-notify-support' | translate }}
</a> </a>
</div> </div>

View File

@@ -1,18 +1,13 @@
<div class="container"> <div class="container">
<head> <h1>{{ 'coar-notify-support.title' | translate }}</h1>
<title>{{ 'coar-notify-support.title' | translate }}</title> <p [innerHTML]="'coar-notify-support-title.content' | translate"></p>
</head>
<body>
<h1>{{ 'coar-notify-support.title' | translate }}</h1>
<p [innerHTML]="('coar-notify-support-title.content' | translate)"></p>
<h2>{{ 'coar-notify-support.ldn-inbox.title' | translate }}</h2> <h2>{{ 'coar-notify-support.ldn-inbox.title' | translate }}</h2>
<p [innerHTML]="('coar-notify-support.ldn-inbox.content' | translate).replace('{ldnInboxUrl}', generateCoarRestApiLinksHTML() | async)"></p> <p [innerHTML]="'coar-notify-support.ldn-inbox.content' | translate:{ ldnInboxUrl: coarRestApiUrls$ | async }"></p>
<h2>{{ 'coar-notify-support.message-moderation.title' | translate }}</h2> <h2>{{ 'coar-notify-support.message-moderation.title' | translate }}</h2>
<p> <p>
{{ 'coar-notify-support.message-moderation.content' | translate }} {{ 'coar-notify-support.message-moderation.content' | translate }}
<a routerLink="/info/feedback" >{{ 'coar-notify-support.message-moderation.feedback-form' | translate }}</a> <a routerLink="/info/feedback">{{ 'coar-notify-support.message-moderation.feedback-form' | translate }}</a>
</p> </p>
</body>
</div> </div>

View File

@@ -16,7 +16,9 @@ describe('NotifyInfoComponent', () => {
let notifyInfoServiceSpy: any; let notifyInfoServiceSpy: any;
beforeEach(async () => { beforeEach(async () => {
notifyInfoServiceSpy = jasmine.createSpyObj('NotifyInfoService', ['getCoarLdnLocalInboxUrls']); notifyInfoServiceSpy = jasmine.createSpyObj('NotifyInfoService', {
getCoarLdnLocalInboxUrls: of([]),
});
await TestBed.configureTestingModule({ await TestBed.configureTestingModule({
imports: [TranslateModule.forRoot(), NotifyInfoComponent], imports: [TranslateModule.forRoot(), NotifyInfoComponent],
@@ -31,8 +33,7 @@ describe('NotifyInfoComponent', () => {
beforeEach(() => { beforeEach(() => {
fixture = TestBed.createComponent(NotifyInfoComponent); fixture = TestBed.createComponent(NotifyInfoComponent);
component = fixture.componentInstance; component = fixture.componentInstance;
component.coarRestApiUrl = of([]); component.coarRestApiUrls$ = of('');
spyOn(component, 'generateCoarRestApiLinksHTML').and.returnValue(of(''));
fixture.detectChanges(); fixture.detectChanges();
}); });

View File

@@ -8,7 +8,6 @@ import { TranslateModule } from '@ngx-translate/core';
import { import {
map, map,
Observable, Observable,
of,
} from 'rxjs'; } from 'rxjs';
import { NotifyInfoService } from '../../core/coar-notify/notify-info/notify-info.service'; import { NotifyInfoService } from '../../core/coar-notify/notify-info/notify-info.service';
@@ -31,26 +30,17 @@ export class NotifyInfoComponent implements OnInit {
/** /**
* Observable containing the COAR REST INBOX API URLs. * Observable containing the COAR REST INBOX API URLs.
*/ */
coarRestApiUrl: Observable<string[]> = of([]); coarRestApiUrls$: Observable<string>;
constructor(private notifyInfoService: NotifyInfoService) {} constructor(
protected notifyInfoService: NotifyInfoService,
) {
}
ngOnInit() { ngOnInit() {
this.coarRestApiUrl = this.notifyInfoService.getCoarLdnLocalInboxUrls(); this.coarRestApiUrls$ = this.notifyInfoService.getCoarLdnLocalInboxUrls().pipe(
} map((urls: string[]) => urls.map((url: string) => `<a href="${url}" target="_blank">${url}</a>`).join(', ')),
/**
* 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(',');
}),
); );
} }
} }

View File

@@ -6092,11 +6092,11 @@
"coar-notify-support.title": "COAR Notify Protocol", "coar-notify-support.title": "COAR Notify Protocol",
"coar-notify-support-title.content": "Here, we fully support the COAR Notify protocol, which is designed to enhance the communication between repositories. To learn more about the COAR Notify protocol, visit the <a href=\\\"https://notify.coar-repositories.org/\\\">COAR Notify website</a>.", "coar-notify-support-title.content": "Here, we fully support the COAR Notify protocol, which is designed to enhance the communication between repositories. To learn more about the COAR Notify protocol, visit the <a href=\"https://notify.coar-repositories.org/\" rel=\"noopener noreferrer\">COAR Notify website</a>.",
"coar-notify-support.ldn-inbox.title": "LDN InBox", "coar-notify-support.ldn-inbox.title": "LDN InBox",
"coar-notify-support.ldn-inbox.content": "For your convenience, our LDN (Linked Data Notifications) InBox is easily accessible at {ldnInboxUrl}. The LDN InBox enables seamless communication and data exchange, ensuring efficient and effective collaboration.", "coar-notify-support.ldn-inbox.content": "For your convenience, our LDN (Linked Data Notifications) InBox is easily accessible at {{ ldnInboxUrl }}. The LDN InBox enables seamless communication and data exchange, ensuring efficient and effective collaboration.",
"coar-notify-support.message-moderation.title": "Message Moderation", "coar-notify-support.message-moderation.title": "Message Moderation",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

View File

@@ -0,0 +1,6 @@
<svg width="367" height="352" viewBox="1 8 367 352" xmlns="http://www.w3.org/2000/svg">
<path
d="M1.000000,112.468658 C28.460188,112.000000 55.920376,112.000000 83.861267,112.000000 C83.861267,120.100616 83.861267,127.838646 83.861267,136.716187 C88.158173,133.530884 91.644302,131.017258 95.055443,128.405685 C109.562279,117.299171 126.044762,111.190887 144.069199,108.990402 C161.729889,106.834335 179.232635,107.440422 196.517853,112.003220 C199.855698,112.884315 201.765640,114.390289 203.238235,118.011223 C211.607788,138.590958 225.554047,154.635437 244.578156,166.145599 C248.466110,168.497910 252.836349,170.062042 256.679718,172.474686 C258.202148,173.430389 259.582550,175.605087 259.851746,177.401047 C261.428253,187.918213 263.677734,198.473038 263.828400,209.041840 C264.537628,258.791290 264.639313,308.549377 264.948181,358.304474 C264.950165,358.622345 264.817322,358.941071 264.666168,359.629364 C235.702515,359.629364 206.659607,359.629364 177.000198,359.629364 C177.000198,357.688354 177.000198,355.750732 177.000198,353.813110 C177.000168,311.991974 177.177307,270.169556 176.873703,228.350601 C176.799194,218.088516 174.846802,208.071838 169.533707,198.749969 C163.338669,187.880661 153.487213,183.232407 142.134903,182.210815 C123.545181,180.537918 107.253761,186.390671 97.170731,202.814651 C92.813103,209.912674 89.559502,218.904343 89.347443,227.127167 C88.262466,269.196838 88.332520,311.296265 88.001801,353.385315 C87.986267,355.362061 87.999809,357.338989 87.999809,360.000397 C59.107670,360.000397 30.522491,360.000397 1.468657,360.000183 C1.000000,277.645782 1.000000,195.291550 1.000000,112.468658z"
fill="#7DC34B"/>
<circle cx="296" cy="80" fill="#7DC34B" r="72"/>
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB