coar-notify-7 item submission coar section show label if no inbound pattern are configured on LDN Notify Services

This commit is contained in:
frabacche
2024-02-27 20:59:56 +01:00
parent 6be10a81f4
commit aaf0ce24e0
3 changed files with 13 additions and 8 deletions

View File

@@ -2,8 +2,7 @@
<ng-container *ngIf="patterns?.length > 0 "> <ng-container *ngIf="patterns?.length > 0 ">
<div *ngFor="let ldnPattern of patterns; let i = index" class="col"> <div *ngFor="let ldnPattern of patterns; let i = index" class="col">
<div *ngIf="(filterServices(ldnPattern.pattern ) | async)?.length > 0"> <div *ngIf="(filterServices(ldnPattern.pattern ) | async)?.length > 0">
<label class="row col-form-label" <label class="row col-form-label">
>
{{'submission.section.section-coar-notify.control.' + ldnPattern.pattern + '.label' | translate }} {{'submission.section.section-coar-notify.control.' + ldnPattern.pattern + '.label' | translate }}
</label </label
> >
@@ -16,13 +15,14 @@
> >
<div class="row"> <div class="row">
<div ngbDropdown #myDropdown="ngbDropdown" [class.mt-2]="serviceIndex > 0" class="flex-grow-1"> <div ngbDropdown #myDropdown="ngbDropdown" [class.mt-2]="serviceIndex > 0" class="flex-grow-1">
<div class="position-relative right-addon" role="combobox"> <div class="position-relative right-addon"
[attr.aria-label]="ldnPattern.pattern + '.dropdown'">
<i ngbDropdownToggle class="position-absolute scrollable-dropdown-toggle" <i ngbDropdownToggle class="position-absolute scrollable-dropdown-toggle"
aria-hidden="true"></i> aria-hidden="true"></i>
<input <input
[attr.aria-label]="ldnPattern.pattern+'.dropdownanchor'"
type="text" type="text"
[readonly]="true" [readonly]="true"
ngbDropdownAnchor
[ngClass]="{'border-danger': (getShownSectionErrors$(ldnPattern.pattern, serviceIndex) | async)?.length > 0}" [ngClass]="{'border-danger': (getShownSectionErrors$(ldnPattern.pattern, serviceIndex) | async)?.length > 0}"
class="form-control w-100 scrollable-dropdown-input" class="form-control w-100 scrollable-dropdown-input"
[value]="ldnServiceByPattern[ldnPattern.pattern].services[serviceIndex]?.name" [value]="ldnServiceByPattern[ldnPattern.pattern].services[serviceIndex]?.name"
@@ -141,7 +141,7 @@
</div> </div>
</div> </div>
</ng-container> </ng-container>
<ng-container *ngIf="patterns?.length === 0"> <ng-container *ngIf="!hasSectionData">
<p> <p>
{{ 'submission.section.section-coar-notify.info.no-pattern' | translate }} {{ 'submission.section.section-coar-notify.info.no-pattern' | translate }}
</p> </p>

View File

@@ -34,6 +34,7 @@ import { LdnPattern } from './submission-coar-notify.config';
@renderSectionFor(SectionsType.CoarNotify) @renderSectionFor(SectionsType.CoarNotify)
export class SubmissionSectionCoarNotifyComponent extends SectionModelComponent { export class SubmissionSectionCoarNotifyComponent extends SectionModelComponent {
hasSectionData = false;
/** /**
* Contains an array of string patterns. * Contains an array of string patterns.
*/ */
@@ -238,8 +239,12 @@ export class SubmissionSectionCoarNotifyComponent extends SectionModelComponent
filter((rd) => rd.hasSucceeded), filter((rd) => rd.hasSucceeded),
getRemoteDataPayload(), getRemoteDataPayload(),
getPaginatedListPayload(), getPaginatedListPayload(),
map((res: LdnService[]) => res.filter((service) => map((res: LdnService[]) => res.filter((service) => {
this.hasInboundPattern(service, pattern))) if (!this.hasSectionData){
this.hasSectionData = this.hasInboundPattern(service, pattern);
}
return this.hasInboundPattern(service, pattern);
}))
); );
} }

View File

@@ -5972,7 +5972,7 @@
"submission.section.section-coar-notify.notification.error": "The selected service is not suitable for the current item. Please check the description for details about which record can be managed by this service.", "submission.section.section-coar-notify.notification.error": "The selected service is not suitable for the current item. Please check the description for details about which record can be managed by this service.",
"submission.section.section-coar-notify.info.no-pattern": "No patterns found in the submission.", "submission.section.section-coar-notify.info.no-pattern": "No configurable patterns found.",
"error.validation.coarnotify.invalidfilter": "Invalid filter, try to select another service or none.", "error.validation.coarnotify.invalidfilter": "Invalid filter, try to select another service or none.",