CST-11012 Dynamically retrieving rest URL for the coar-notify-page

This commit is contained in:
Sondissimo
2023-08-29 13:32:03 +02:00
parent fc4a44cc83
commit d3fb5bf686
4 changed files with 21 additions and 5 deletions

View File

@@ -8,7 +8,7 @@
<p [innerHTML]="('coar-notify-support-title.content' | translate)"></p>
<h2>{{ 'coar-notify-support.ldn-inbox.title' | translate }}</h2>
<p [innerHTML]="('coar-notify-support.ldn-inbox.content' | translate)"></p>
<p [innerHTML]="('coar-notify-support.ldn-inbox.content' | translate).replace('{restApiUrl}', coarRestApiUrl)"></p>
<h2>{{ 'coar-notify-support.message-moderation.title' | translate }}</h2>
<p [innerHTML]="('coar-notify-support.message-moderation.content' | translate)"></p>

View File

@@ -1,23 +1,26 @@
import { Component, OnInit } from '@angular/core';
import { NotifyInfoService } from './notify-info.service';
@Component({
selector: 'ds-notify-info',
templateUrl: './notify-info.component.html',
styleUrls: ['./notify-info.component.scss']
})
export class NotifyInfoComponent implements OnInit {
coarLdnEnabled: boolean;
coarRestApiUrl: string;
constructor(
public notifyInfoService: NotifyInfoService,
) { }
) {
}
ngOnInit() {
this.coarRestApiUrl = this.notifyInfoService.getCoarLdnRestApiUrl();
this.notifyInfoService.isCoarConfigEnabled().subscribe(value => {
this.coarLdnEnabled = value;
});
}
}

View File

@@ -2,6 +2,7 @@ import { Injectable } from '@angular/core';
import { getFirstSucceededRemoteData } from '../../shared/operators';
import { ConfigurationDataService } from '../../data/configuration-data.service';
import { map, Observable } from 'rxjs';
import { DefaultAppConfig } from '../../../../config/default-app-config';
@Injectable({
providedIn: 'root'
@@ -22,4 +23,16 @@ export class NotifyInfoService {
})
);
}
getCoarLdnRestApiUrl(): string {
const appConfig = new DefaultAppConfig();
const restConfig = appConfig.rest;
const ssl = restConfig.ssl;
const host = restConfig.host;
const port = restConfig.port;
const namespace = restConfig.nameSpace;
return `${ssl ? 'https' : 'http'}://${host}:${port}${namespace}`;
}
}

View File

@@ -873,7 +873,7 @@
"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 <code>${restApiUrl}/ldn/inbox</code>. 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 <code>{restApiUrl}ldn/inbox</code>. The LDN InBox enables seamless communication and data exchange, ensuring efficient and effective collaboration.",
"coar-notify-support.message-moderation.title": "Message Moderation",