-
-
- {{ service.name }}
-
-
- {{selectedServices[pattern]?.name}}
-
-
-
-
+
Request {{ pattern }} at the following service
+
+
+
+ {{ service.name }}
+
+
+
+
+
+
+
+
+
Select a service for {{ pattern }} of this item
+
+
+
+
+
+
The selected service is compatible with the item according to its current status.
+
+
+
+
+
{{ selectedServices[pattern].name }}: {{ selectedServices[pattern].description }}
-
Select a service for {{ pattern }} of this item
-
-
-
- The selected service is compatible with the item according to its current status. {{ selectedServices[pattern].name }}: {{ selectedServices[pattern].description }}
-
-
+
+
+
+
+
+
{{ 'ldn-new-service.form.label.addPattern' | translate }}
diff --git a/src/app/submission/sections/section-coar-notify/section-coar-notify.component.scss b/src/app/submission/sections/section-coar-notify/section-coar-notify.component.scss
index c06ef5951c..f1504fdff6 100644
--- a/src/app/submission/sections/section-coar-notify/section-coar-notify.component.scss
+++ b/src/app/submission/sections/section-coar-notify/section-coar-notify.component.scss
@@ -2,14 +2,21 @@
color: #0048ff;
cursor: pointer;
}
-.ds-alert-coar{
+
+.ds-alert-coar {
position: relative
}
-.coar-img-submission{
- position: absolute; top: 0; left: 0; width: 50px; height: 50px;
+.coar-img-submission {
+ max-height: var(--ds-header-logo-height);
}
-.ds-alert-box{
+.icon-check {
+ color: rgba(6, 68, 6, 0.42);
+ font-size: var(--ds-header-logo-height);
+}
+
+
+.ds-alert-box {
}
diff --git a/src/app/submission/sections/section-coar-notify/section-coar-notify.component.ts b/src/app/submission/sections/section-coar-notify/section-coar-notify.component.ts
index 39c8c9753d..3cf040acd9 100644
--- a/src/app/submission/sections/section-coar-notify/section-coar-notify.component.ts
+++ b/src/app/submission/sections/section-coar-notify/section-coar-notify.component.ts
@@ -23,15 +23,14 @@ import { LdnServicesService } from '../../../admin/admin-ldn-services/ldn-servic
import { isLoading } from '../../../core/data/request-entry-state.model';
import { LdnService } from '../../../admin/admin-ldn-services/ldn-services-model/ldn-services.model';
import { SECTION_COAR_FORM_LAYOUT, SECTION_COAR_FORM_MODEL } from './section-coar-notify-model';
-import {
- CoarNotifyConfigDataService
-} from './coar-notify-config-data.service';
+import { CoarNotifyConfigDataService } from './coar-notify-config-data.service';
import { RemoteData } from '../../../core/data/remote-data';
import { PaginatedList } from '../../../core/data/paginated-list.model';
import { SubmissionCoarNotifyConfig } from './submission-coar-notify.config';
import { FormFieldPreviousValueObject } from '../../../shared/form/builder/models/form-field-previous-value-object';
import { UntypedFormGroup } from '@angular/forms';
import { AlertType } from '../../../shared/alert/aletr-type';
+import { filter, map, take } from "rxjs/operators";
export interface CoarNotifyDropdownSelector {
ldnService: LdnService;
@@ -60,8 +59,11 @@ export class SubmissionSectionCoarNotifyComponent extends SectionModelComponent
patterns: string[] = [];
selectedServices: { [key: string]: LdnService } = {};
+ patternServices: { [key: string]: LdnService } = {};
+
patternsLoaded = false;
- selectedService: any;
+ patternObservables: Observable
>[]>;
+
public AlertTypeEnum = AlertType;
@@ -172,7 +174,7 @@ export class SubmissionSectionCoarNotifyComponent extends SectionModelComponent
*/
setCoarNotifyConfig() {
this.coarNotifyConfigRD$ = this.coarNotifyConfigDataService.findAll().pipe(
- getFirstCompletedRemoteData()
+ getFirstCompletedRemoteData()
);
this.coarNotifyConfigRD$.subscribe((data) => {
@@ -202,10 +204,10 @@ export class SubmissionSectionCoarNotifyComponent extends SectionModelComponent
*/
onCustomEvent(event: DynamicFormControlEvent) {
this.formOperationsService.dispatchOperationsFromEvent(
- this.pathCombiner,
- event,
- this.previousValue,
- null);
+ this.pathCombiner,
+ event,
+ this.previousValue,
+ null);
}
/**
@@ -244,10 +246,10 @@ export class SubmissionSectionCoarNotifyComponent extends SectionModelComponent
}
this.formOperationsService.dispatchOperationsFromEvent(
- this.pathCombiner,
- event,
- this.previousValue,
- this.hasStoredValue(fieldId, fieldIndex));
+ this.pathCombiner,
+ event,
+ this.previousValue,
+ this.hasStoredValue(fieldId, fieldIndex));
}
@@ -262,8 +264,8 @@ export class SubmissionSectionCoarNotifyComponent extends SectionModelComponent
hasStoredValue(fieldId, index): boolean {
if (isNotEmpty(this.sectionData.data)) {
return this.sectionData.data.hasOwnProperty(fieldId) &&
- isNotEmpty(this.sectionData.data[fieldId][index]) &&
- !this.isFieldToRemove(fieldId, index);
+ isNotEmpty(this.sectionData.data[fieldId][index]) &&
+ !this.isFieldToRemove(fieldId, index);
} else {
return false;
}
@@ -305,8 +307,8 @@ export class SubmissionSectionCoarNotifyComponent extends SectionModelComponent
*/
onSectionDestroy() {
this.subs
- .filter((subscription) => hasValue(subscription))
- .forEach((subscription) => subscription.unsubscribe());
+ .filter((subscription) => hasValue(subscription))
+ .forEach((subscription) => subscription.unsubscribe());
}
/**
@@ -314,44 +316,73 @@ export class SubmissionSectionCoarNotifyComponent extends SectionModelComponent
* Retriev available NotifyConfigs
*/
fetchLdnServices() {
- this.ldnServicesRD$ = this.ldnServicesService.findAll().pipe(
- getFirstCompletedRemoteData()
- );
+ if (!this.ldnServicesRD$) {
+ this.ldnServicesRD$ = this.ldnServicesService.findAll().pipe(
+ getFirstCompletedRemoteData()
+ );
+ }
this.ldnServicesRD$.subscribe((data) => {
if (this.patternsLoaded) {
this.patterns.forEach((pattern) => {
- this.selectedServices[pattern] = data.payload.page.find((service) =>
- this.hasInboundPattern(service, pattern)
- );
+ const servicesWithPattern = this.getServicesWithPattern(pattern, data?.payload?.page);
- //console.log('Pattern:', pattern);
- //console.log('Service:', this.selectedServices[pattern]);
+ if (servicesWithPattern.length > 0) {
+ this.selectedServices[pattern] = servicesWithPattern[0];
+ }
+
+ console.log('Pattern:', pattern);
+ console.log('Service:', this.selectedServices[pattern]);
if (this.selectedServices[pattern]) {
- //console.log('Name:', this.selectedServices[pattern].name);
- //console.log('Description:', this.selectedServices[pattern].description);
+ console.log('Name:', this.selectedServices[pattern].name);
+ console.log('Description:', this.selectedServices[pattern].description);
}
});
}
});
}
+ getServicesWithPattern(pattern: string, services: LdnService[] | null): LdnService[] {
+ if (services) {
+ return services.filter((service) => this.hasInboundPattern(service, pattern));
+ }
+ return [];
+ }
+
+
+ filterServices(pattern: string): LdnService[] {
+ let ldnServices: LdnService[] = [];
+
+ this.ldnServicesRD$.pipe(
+ filter((rd) => rd.hasSucceeded),
+ map((rd) => rd.payload.page)
+ ).subscribe((services) => {
+ ldnServices = services.filter((service) => this.hasInboundPattern(service, pattern));
+ });
+
+ return ldnServices;
+ }
+
+
+
+
+
+ hasInboundPattern(service: any, patternType: string): boolean {
+ console.log('Pattern Type:', patternType);
+ console.log('Inbound Patterns in Service:', service.notifyServiceInboundPatterns);
+
+ const hasPattern = service.notifyServiceInboundPatterns.some((pattern: { pattern: string; }) => {
+ console.log('Checking Pattern:', pattern.pattern);
+ return pattern.pattern === patternType;
+ });
+
+ console.log('Has Inbound Pattern:', hasPattern);
+ return hasPattern;
+ }
protected getSectionStatus(): Observable {
return undefined;
}
- hasInboundPattern(service: any, patternType: string): boolean {
- //console.log('Pattern Type:', patternType);
- //console.log('Inbound Patterns in Service:', service.notifyServiceInboundPatterns);
-
- const hasPattern = service.notifyServiceInboundPatterns.some((pattern: { pattern: string; }) => {
- //console.log('Checking Pattern:', pattern.pattern);
- return pattern.pattern === patternType;
- });
-
- //console.log('Has Inbound Pattern:', hasPattern);
- return hasPattern;
- }
}
diff --git a/src/app/submission/submission.module.ts b/src/app/submission/submission.module.ts
index f4f479e204..d839565f8d 100644
--- a/src/app/submission/submission.module.ts
+++ b/src/app/submission/submission.module.ts
@@ -10,7 +10,7 @@ import { SubmissionFormFooterComponent } from './form/footer/submission-form-foo
import { SubmissionFormComponent } from './form/submission-form.component';
import { SubmissionFormSectionAddComponent } from './form/section-add/submission-form-section-add.component';
import { SubmissionSectionContainerComponent } from './sections/container/section-container.component';
-import { CommonModule } from '@angular/common';
+import { CommonModule, NgOptimizedImage } from '@angular/common';
import { Action, StoreConfig, StoreModule } from '@ngrx/store';
import { EffectsModule } from '@ngrx/effects';
import { submissionReducers, SubmissionState } from './submission.reducers';
@@ -115,21 +115,22 @@ const DECLARATIONS = [
];
@NgModule({
- imports: [
- CommonModule,
- CoreModule.forRoot(),
- SharedModule,
- StoreModule.forFeature('submission', submissionReducers, storeModuleConfig as StoreConfig),
- EffectsModule.forFeature(),
- EffectsModule.forFeature(submissionEffects),
- JournalEntitiesModule.withEntryComponents(),
- ResearchEntitiesModule.withEntryComponents(),
- FormModule,
- NgbModalModule,
- NgbCollapseModule,
- NgbAccordionModule,
- UploadModule,
- ],
+ imports: [
+ CommonModule,
+ CoreModule.forRoot(),
+ SharedModule,
+ StoreModule.forFeature('submission', submissionReducers, storeModuleConfig as StoreConfig),
+ EffectsModule.forFeature(),
+ EffectsModule.forFeature(submissionEffects),
+ JournalEntitiesModule.withEntryComponents(),
+ ResearchEntitiesModule.withEntryComponents(),
+ FormModule,
+ NgbModalModule,
+ NgbCollapseModule,
+ NgbAccordionModule,
+ UploadModule,
+ NgOptimizedImage,
+ ],
declarations: DECLARATIONS,
exports: [
...DECLARATIONS,