1
0

CST-11045 Improved css and remove console log and interpolation, added small notify regarding service compatibility

This commit is contained in:
Mattia Vianelli
2023-10-26 18:47:25 +02:00
parent 0682b7b45f
commit 5ed9f46096
8 changed files with 85 additions and 23 deletions

View File

@@ -84,6 +84,10 @@ export class LdnServicesService extends IdentifiableDataService<LdnService> impl
return this.findAllData.findAll(options, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow); return this.findAllData.findAll(options, useCachedVersionIfAvailable, reRequestOnStale, ...linksToFollow);
} }
/*findByPattern(options?: FindListOptions, useCachedVersionIfAvailable?: boolean, reRequestOnStale?: boolean, ...linksToFollow: FollowLinkConfig<LdnService>[]): Observable<RemoteData<PaginatedList<LdnService>>> {
return this.findAllData.find
}*/
public delete(objectId: string, copyVirtualMetadata?: string[]): Observable<RemoteData<NoContent>> { public delete(objectId: string, copyVirtualMetadata?: string[]): Observable<RemoteData<NoContent>> {
return this.deleteData.delete(objectId, copyVirtualMetadata); return this.deleteData.delete(objectId, copyVirtualMetadata);
} }

View File

@@ -1,7 +1,6 @@
<div class="container-fluid"> <div class="container-fluid">
<div *ngIf="!(isLoading() | async)" class="submission-form-header mb-3 d-flex flex-wrap position-sticky"> <div *ngIf="!(isLoading() | async)" class="submission-form-header mb-3 d-flex flex-wrap position-sticky">
<div *ngIf="(uploadEnabled$ | async)" class="w-100"> <div *ngIf="(uploadEnabled$ | async)" class="w-100">
<p>ds-submission-upload-files</p>
<ds-submission-upload-files [submissionId]="submissionId" <ds-submission-upload-files [submissionId]="submissionId"
[collectionId]="collectionId" [collectionId]="collectionId"
[uploadFilesOptions]="uploadFilesOptions"></ds-submission-upload-files> [uploadFilesOptions]="uploadFilesOptions"></ds-submission-upload-files>
@@ -10,7 +9,6 @@
<div class="submission-form-header-item mb-3 mb-sm-0 flex-sm-grow-1 flex-md-grow-0"> <div class="submission-form-header-item mb-3 mb-sm-0 flex-sm-grow-1 flex-md-grow-0">
<ng-container *ngIf="!isSectionHidden"> <ng-container *ngIf="!isSectionHidden">
<p>ds-submission-form-collection </p>
<ds-submission-form-collection <ds-submission-form-collection
[currentCollectionId]="collectionId" [currentCollectionId]="collectionId"
[currentDefinition]="definitionId" [currentDefinition]="definitionId"
@@ -22,7 +20,6 @@
</ng-container> </ng-container>
</div> </div>
<div class="submission-form-header-item text-right"> <div class="submission-form-header-item text-right">
<p>ds-submission-form-section-add </p>
<ds-submission-form-section-add [collectionId]="collectionId" <ds-submission-form-section-add [collectionId]="collectionId"
[submissionId]="submissionId"> [submissionId]="submissionId">
</ds-submission-form-section-add> </ds-submission-form-section-add>
@@ -32,7 +29,6 @@
<div class="submission-form-content"> <div class="submission-form-content">
<ds-themed-loading *ngIf="(isLoading() | async)" message="Loading..."></ds-themed-loading> <ds-themed-loading *ngIf="(isLoading() | async)" message="Loading..."></ds-themed-loading>
<ng-container *ngFor="let object of (submissionSections | async)"> <ng-container *ngFor="let object of (submissionSections | async)">
<p>ds-submission-section-container</p>
<ds-submission-section-container [collectionId]="collectionId" <ds-submission-section-container [collectionId]="collectionId"
[submissionId]="submissionId" [submissionId]="submissionId"
[sectionData]="object"> [sectionData]="object">
@@ -44,7 +40,6 @@
</ds-submission-section-container--> </ds-submission-section-container-->
</div> </div>
<div *ngIf="!(isLoading() | async)" class="submission-form-footer mt-3 mb-3 position-sticky"> <div *ngIf="!(isLoading() | async)" class="submission-form-footer mt-3 mb-3 position-sticky">
<p>ds-submission-form-footer</p>
<ds-submission-form-footer [submissionId]="submissionId"></ds-submission-form-footer> <ds-submission-form-footer [submissionId]="submissionId"></ds-submission-form-footer>
</div> </div>
</div> </div>

View File

@@ -42,7 +42,7 @@
<ds-alert *ngFor="let error of sectionRef.getErrors(); let i = index" [content]="error" [dismissible]="true" <ds-alert *ngFor="let error of sectionRef.getErrors(); let i = index" [content]="error" [dismissible]="true"
[type]="AlertTypeEnum.Error" (close)="sectionRef.removeError(i)"></ds-alert> [type]="AlertTypeEnum.Error" (close)="sectionRef.removeError(i)"></ds-alert>
</div> </div>
<div id="sectionContent_{{sectionData.id}}" (click)="sectionRef.setFocus($event)">aaaaaaaaa <div id="sectionContent_{{sectionData.id}}" (click)="sectionRef.setFocus($event)">
<ng-container *ngComponentOutlet="getSectionContent(); injector: objectInjector;"></ng-container> <ng-container *ngComponentOutlet="getSectionContent(); injector: objectInjector;"></ng-container>
</div> </div>
</ng-template> </ng-template>

View File

@@ -1,15 +1,29 @@
<div class="container"> <div>
<ds-alert [content]="'submission.sections.notify.info'" [dismissible]="true" [type]="AlertTypeEnum.Info"></ds-alert> <ng-container *ngIf="patternsLoaded">
<div class="dropdown-section"> <div *ngFor="let pattern of patterns; let i = index" class="col mt-3">
<ng-container *ngIf="patternsLoaded"> <label class="mt-2 row">Request {{ pattern }} at the following service</label>
<div class="dropdown" *ngFor="let pattern of patterns"> <div class="row">
<label>Request a {{ pattern }} at the following service</label> <select [(ngModel)]="selectedServices[pattern]" class="form-control col">
<select [(ngModel)]="selectedServices[pattern]"> <option *ngFor="let service of (ldnServicesRD$ | async)?.payload?.page" [value]="service">
<option *ngFor="let service of (ldnServicesRD$ | async)?.payload?.page" [value]="service"> {{ service.name }}
{{ service.name }} </option>
</option> </select>
</select> {{selectedServices[pattern]?.name}}
</div> <div class="col-sm-1">
</ng-container> <button (click)="removeService(i)" class="btn btn-outline-dark trash-button">
</div> <i class="fas fa-trash"></i>
</button>
</div>
</div>
<small class="row">Select a service for {{ pattern }} of this item</small>
<ds-alert *ngIf="selectedServices[pattern]" class="row ds-alert-box" [dismissible]="false" [type]="AlertTypeEnum.Success">
<img class="coar-img-submission" src="../../../../assets/images/notify_logo.png" alt="Coar-Notify-Pattern">
<ng-container >
The selected service is compatible with the item according to its current status. {{ selectedServices[pattern].name }}: {{ selectedServices[pattern].description }}
</ng-container>
</ds-alert>
<span (click)="addService()"
class="add-pattern-link mb-2 row">{{ 'ldn-new-service.form.label.addPattern' | translate }}</span>
</div>
</ng-container>
</div> </div>

View File

@@ -0,0 +1,15 @@
.add-pattern-link {
color: #0048ff;
cursor: pointer;
}
.ds-alert-coar{
position: relative
}
.coar-img-submission{
position: absolute; top: 0; left: 0; width: 50px; height: 50px;
}
.ds-alert-box{
}

View File

@@ -61,6 +61,8 @@ export class SubmissionSectionCoarNotifyComponent extends SectionModelComponent
patterns: string[] = []; patterns: string[] = [];
selectedServices: { [key: string]: LdnService } = {}; selectedServices: { [key: string]: LdnService } = {};
patternsLoaded = false; patternsLoaded = false;
selectedService: any;
public AlertTypeEnum = AlertType; public AlertTypeEnum = AlertType;
/** /**
@@ -181,6 +183,18 @@ export class SubmissionSectionCoarNotifyComponent extends SectionModelComponent
}); });
} }
addService() {
this.patterns.push('');
}
removeService(index: number) {
if (index >= 0 && index < this.patterns.length) {
this.patterns.splice(index, 1);
}
}
/** /**
* Handle the customEvent (ex. drag-drop move event). * Handle the customEvent (ex. drag-drop move event).
* The customEvent is stored inside event.$event * The customEvent is stored inside event.$event
@@ -301,25 +315,43 @@ export class SubmissionSectionCoarNotifyComponent extends SectionModelComponent
*/ */
fetchLdnServices() { fetchLdnServices() {
this.ldnServicesRD$ = this.ldnServicesService.findAll().pipe( this.ldnServicesRD$ = this.ldnServicesService.findAll().pipe(
getFirstCompletedRemoteData() getFirstCompletedRemoteData()
); );
this.ldnServicesRD$.subscribe((data) => { this.ldnServicesRD$.subscribe((data) => {
if (this.patternsLoaded) { if (this.patternsLoaded) {
this.patterns.forEach((pattern) => { this.patterns.forEach((pattern) => {
this.selectedServices[pattern] = data.payload.page.find((service) => this.selectedServices[pattern] = data.payload.page.find((service) =>
this.hasInboundPattern(service, `Request ${pattern}`) this.hasInboundPattern(service, pattern)
); );
//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);
}
}); });
} }
}); });
} }
protected getSectionStatus(): Observable<boolean> { protected getSectionStatus(): Observable<boolean> {
return undefined; return undefined;
} }
hasInboundPattern(service: any, patternType: string): boolean { hasInboundPattern(service: any, patternType: string): boolean {
return service.notifyServiceInboundPatterns.some(pattern => pattern.pattern === patternType); //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;
} }
} }

View File

@@ -1982,6 +1982,8 @@
"info.coar-notify.breadcrumbs": "Notify Support", "info.coar-notify.breadcrumbs": "Notify Support",
"submission.sections.notify.info": "The selected service is compatible with the item according to its current status. {{ service.name }}: {{ service.description }}",
"info.feedback.head": "Feedback", "info.feedback.head": "Feedback",
"info.feedback.title": "Feedback", "info.feedback.title": "Feedback",

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB