mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
CST-11045 Dynamically creating dropdowns based on the coarconfig
This commit is contained in:
@@ -1,31 +1,15 @@
|
||||
<div class="container">
|
||||
|
||||
<ds-alert [content]="'submission.sections.notify.info'"
|
||||
[dismissible]="true"
|
||||
[type]="AlertTypeEnum.Info"></ds-alert>
|
||||
<ds-alert [content]="'submission.sections.notify.info'" [dismissible]="true" [type]="AlertTypeEnum.Info"></ds-alert>
|
||||
<div class="dropdown-section">
|
||||
<div class="dropdown">
|
||||
<label>Request a Review at the following service</label>
|
||||
<select [(ngModel)]="requestReview">
|
||||
<option *ngFor="let reviewPatternService of (ldnServicesRD$ | async)?.payload?.page"
|
||||
[value]="reviewPatternService">{{ reviewPatternService.name }}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="dropdown">
|
||||
<label>Request an Endorsement at the following service</label>
|
||||
<select [(ngModel)]="requestEndorsement">
|
||||
<option *ngFor="let endorsementPatternService of (coarNotifyConfigRD$ | async)?.payload?.page"
|
||||
[value]="endorsementPatternService">{{ endorsementPatternService.patterns }}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="dropdown">
|
||||
<label>Dropdown 3</label>
|
||||
<select [(ngModel)]="requestIngest">
|
||||
<option *ngFor="let ingestPatternService of (ldnServicesRD$ | async)?.payload?.page"
|
||||
[value]="ingestPatternService">{{ ingestPatternService.name }}</option>
|
||||
<ng-container *ngIf="patternsLoaded">
|
||||
<div class="dropdown" *ngFor="let pattern of patterns">
|
||||
<label>Request a {{ pattern }} at the following service</label>
|
||||
<select [(ngModel)]="selectedServices[pattern]">
|
||||
<option *ngFor="let service of (ldnServicesRD$ | async)?.payload?.page" [value]="service">
|
||||
{{ service.name }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</ng-container>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -57,12 +57,11 @@ export class SubmissionSectionCoarNotifyComponent extends SectionModelComponent
|
||||
|
||||
ldnServicesRD$: Observable<RemoteData<PaginatedList<LdnService>>>;
|
||||
|
||||
selectedServiceValues: any[] = [];
|
||||
|
||||
/**
|
||||
* The AlertType enumeration
|
||||
* @type {AlertType}
|
||||
*/
|
||||
patterns: string[] = [];
|
||||
selectedServices: { [key: string]: LdnService } = {};
|
||||
patternsLoaded = false;
|
||||
|
||||
public AlertTypeEnum = AlertType;
|
||||
/**
|
||||
* The form model
|
||||
@@ -171,7 +170,15 @@ export class SubmissionSectionCoarNotifyComponent extends SectionModelComponent
|
||||
*/
|
||||
setCoarNotifyConfig() {
|
||||
this.coarNotifyConfigRD$ = this.coarNotifyConfigDataService.findAll().pipe(
|
||||
getFirstCompletedRemoteData());
|
||||
getFirstCompletedRemoteData()
|
||||
);
|
||||
|
||||
this.coarNotifyConfigRD$.subscribe((data) => {
|
||||
if (data.hasSucceeded) {
|
||||
this.patterns = data.payload.page[0].patterns;
|
||||
this.patternsLoaded = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -296,6 +303,16 @@ export class SubmissionSectionCoarNotifyComponent extends SectionModelComponent
|
||||
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, `Request ${pattern}`)
|
||||
);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected getSectionStatus(): Observable<boolean> {
|
||||
|
Reference in New Issue
Block a user