mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
Merge remote-tracking branch 'remotes/origin/coar-notify-7' into HEAD
This commit is contained in:
29
qodana.yaml
Normal file
29
qodana.yaml
Normal file
@@ -0,0 +1,29 @@
|
||||
#-------------------------------------------------------------------------------#
|
||||
# Qodana analysis is configured by qodana.yaml file #
|
||||
# https://www.jetbrains.com/help/qodana/qodana-yaml.html #
|
||||
#-------------------------------------------------------------------------------#
|
||||
version: "1.0"
|
||||
|
||||
#Specify inspection profile for code analysis
|
||||
profile:
|
||||
name: qodana.starter
|
||||
|
||||
#Enable inspections
|
||||
#include:
|
||||
# - name: <SomeEnabledInspectionId>
|
||||
|
||||
#Disable inspections
|
||||
#exclude:
|
||||
# - name: <SomeDisabledInspectionId>
|
||||
# paths:
|
||||
# - <path/where/not/run/inspection>
|
||||
|
||||
#Execute shell command before Qodana execution (Applied in CI/CD pipeline)
|
||||
#bootstrap: sh ./prepare-qodana.sh
|
||||
|
||||
#Install IDE plugins before Qodana execution (Applied in CI/CD pipeline)
|
||||
#plugins:
|
||||
# - id: <plugin.id> #(plugin id can be found at https://plugins.jetbrains.com)
|
||||
|
||||
#Specify Qodana linter for analysis (Applied in CI/CD pipeline)
|
||||
linter: jetbrains/qodana-js:latest
|
@@ -14,46 +14,40 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-2">
|
||||
<div class="mb-5">
|
||||
<label for="name">{{ 'ldn-new-service.form.label.name' | translate }}</label>
|
||||
<input [class.invalid-field]="formModel.get('name').invalid && formModel.get('name').touched"
|
||||
[placeholder]="'ldn-new-service.form.placeholder.name' | translate" formControlName="name" id="name"
|
||||
name="name"
|
||||
type="text"
|
||||
class="form-control">
|
||||
<div *ngIf="formModel.get('name').invalid && formModel.get('name').touched" class="error-text">
|
||||
{{ 'ldn-new-service.form.error.name' | translate }}
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
|
||||
</div>
|
||||
|
||||
<!-- In the description section -->
|
||||
<div class="mb-2 d-flex flex-column">
|
||||
<div class="mb-5 mt-5 d-flex flex-column">
|
||||
<label for="description">{{ 'ldn-new-service.form.label.description' | translate }}</label>
|
||||
<textarea [placeholder]="'ldn-new-service.form.placeholder.description' | translate"
|
||||
formControlName="description" id="description" name="description" class="form-control"></textarea>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
|
||||
</div>
|
||||
|
||||
<!-- In the url section -->
|
||||
<div class="mb-2">
|
||||
<div class="mb-5 mt-5">
|
||||
<label for="url">{{ 'ldn-new-service.form.label.url' | translate }}</label>
|
||||
<input [class.invalid-field]="formModel.get('url').invalid && formModel.get('url').touched"
|
||||
[placeholder]="'ldn-new-service.form.placeholder.url' | translate" formControlName="url" id="url"
|
||||
name="url"
|
||||
type="text"
|
||||
class="form-control">
|
||||
<div *ngIf="formModel.get('url').invalid && formModel.get('url').touched" class="error-text">
|
||||
{{ 'ldn-new-service.form.error.url' | translate }}
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
|
||||
</div>
|
||||
|
||||
<!-- In the ldnUrl section -->
|
||||
<div class="mb-2">
|
||||
<div class="mb-5 mt-5">
|
||||
<label for="ldnUrl">{{ 'ldn-new-service.form.label.ldnUrl' | translate }}</label>
|
||||
<input [class.invalid-field]="formModel.get('ldnUrl').invalid && formModel.get('ldnUrl').touched"
|
||||
[placeholder]="'ldn-new-service.form.placeholder.ldnUrl' | translate" formControlName="ldnUrl"
|
||||
@@ -61,13 +55,26 @@
|
||||
name="ldnUrl"
|
||||
type="text"
|
||||
class="form-control">
|
||||
<div *ngIf="formModel.get('ldnUrl').invalid && formModel.get('ldnUrl').touched" class="error-text">
|
||||
{{ 'ldn-new-service.form.error.ldnurl' | translate }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
|
||||
<!-- In the score section -->
|
||||
<div class="mb-2">
|
||||
<label for="score">{{ 'ldn-new-service.form.label.score' | translate }}</label>
|
||||
<input [class.invalid-field]="formModel.get('score').invalid && formModel.get('score').touched"
|
||||
[placeholder]="'ldn-new-service.form.placeholder.score' | translate" formControlName="score"
|
||||
id="score"
|
||||
name="score"
|
||||
type="text">
|
||||
<div *ngIf="formModel.get('score').invalid && formModel.get('score').touched" class="error-text">
|
||||
{{ 'ldn-new-service.form.error.score' | translate }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
|
||||
<div class="row mb-1 mt-5">
|
||||
<div class="col">
|
||||
<label>{{ 'ldn-new-service.form.label.inboundPattern' | translate }} </label>
|
||||
</div>
|
||||
@@ -171,20 +178,21 @@
|
||||
|
||||
|
||||
<div class="col-sm-2">
|
||||
<button (click)="markForInboundPatternDeletion(i)" class="btn btn-outline-dark"
|
||||
<div class="btn-group">
|
||||
<button (click)="markForInboundPatternDeletion(i)" class="btn btn-outline-dark trash-button"
|
||||
type="button">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
|
||||
|
||||
<button (click)="unmarkForInboundPatternDeletion(i)" *ngIf="markedForDeletionInboundPattern.includes(i)"
|
||||
class="btn btn-warning ml-2"
|
||||
class="btn btn-warning "
|
||||
type="button">
|
||||
<i class="fas fa-undo"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</ng-container>
|
||||
</div>
|
||||
|
||||
@@ -192,23 +200,22 @@
|
||||
<span (click)="addInboundPattern()"
|
||||
class="add-pattern-link mb-2">{{ 'ldn-new-service.form.label.addPattern' | translate }}</span>
|
||||
|
||||
<div class="mb-4">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="row mb-1 mt-5">
|
||||
<div class="col">
|
||||
<label>{{ 'ldn-new-service.form.label.outboundPattern' | translate }}</label>
|
||||
<label>{{ 'ldn-new-service.form.label.outboundPattern' | translate }} </label>
|
||||
</div>
|
||||
<ng-container *ngIf="!!(formModel.get('notifyServiceOutboundPatterns')['controls'][0]?.value?.pattern)">
|
||||
<ng-container *ngIf="!!(formModel.get('notifyServiceOutboundPatterns')['controls'][0]?.value?.pattern)">
|
||||
<div class="col">
|
||||
<label class="">{{ 'ldn-new-service.form.label.ItemFilter' | translate }}</label>
|
||||
</div>
|
||||
</ng-container>
|
||||
<div class="col-sm-1 ">
|
||||
<label class="label-box-2"></label>
|
||||
<label>{{ 'ldn-new-service.form.label.ItemFilter' | translate }}</label>
|
||||
</div>
|
||||
<div class="col-sm-2 ">
|
||||
</ng-container>
|
||||
<div class="col-sm-1 ">
|
||||
<label class="label-box-2" style="visibility: hidden;">
|
||||
{{ 'ldn-new-service.form.label.automatic' | translate }}
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-sm-2 ">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -295,14 +302,15 @@
|
||||
</div>
|
||||
|
||||
<div class="col-sm-2">
|
||||
<button (click)="markForOutboundPatternDeletion(i)" class="btn btn-outline-dark trash-button" type="button">
|
||||
<div class="btn-group">
|
||||
<button (click)="markForOutboundPatternDeletion(i)" class="btn btn-outline-dark trash-button" type="button">
|
||||
<i class="fas fa-trash"></i>
|
||||
</button>
|
||||
<button (click)="unmarkForOutboundPatternDeletion(i)" *ngIf="markedForDeletionOutboundPattern.includes(i)"
|
||||
class="btn btn-warning ml-2"
|
||||
class="btn btn-warning "
|
||||
type="button">
|
||||
<i class="fas fa-undo"></i>
|
||||
</button>
|
||||
</button></div>
|
||||
</div>
|
||||
</div>
|
||||
</ng-container>
|
||||
@@ -313,9 +321,7 @@
|
||||
class="add-pattern-link mb-2">{{ 'ldn-new-service.form.label.addPattern' | translate }}
|
||||
</span>
|
||||
|
||||
<div class="mb-5">
|
||||
|
||||
</div>
|
||||
|
||||
<div aria-label="Basic example" class="submission-form-footer mt-1 mb-1 position-sticky" role="group">
|
||||
<button class="btn btn-primary" type="submit">
|
||||
<span><i class="fas fa-save"></i> {{ 'ldn-new-service.form.label.submit' | translate }}</span>
|
||||
|
@@ -49,6 +49,12 @@ textarea {
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.error-text {
|
||||
color: red;
|
||||
font-size: 0.8em;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.toggle-switch {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
@@ -52,7 +52,8 @@ export class LdnServiceFormEditComponent implements OnInit {
|
||||
@Input() public description: string;
|
||||
@Input() public url: string;
|
||||
@Input() public ldnUrl: string;
|
||||
@Input() public inboundPattern: string;
|
||||
@Input() public score: number;
|
||||
@Input() public inboundPattern: string;
|
||||
@Input() public outboundPattern: string;
|
||||
@Input() public constraint: string;
|
||||
@Input() public automatic: boolean;
|
||||
@@ -88,7 +89,7 @@ export class LdnServiceFormEditComponent implements OnInit {
|
||||
description: ['', Validators.required],
|
||||
url: ['', Validators.required],
|
||||
ldnUrl: ['', Validators.required],
|
||||
inboundPattern: [''],
|
||||
score: ['', [Validators.required, Validators.pattern('^0*(\.[0-9]+)?$|^1(\.0+)?$')]],inboundPattern: [''],
|
||||
outboundPattern: [''],
|
||||
constraintPattern: [''],
|
||||
enabled: [''],
|
||||
@@ -127,7 +128,7 @@ export class LdnServiceFormEditComponent implements OnInit {
|
||||
name: this.service.name,
|
||||
description: this.service.description,
|
||||
url: this.service.url,
|
||||
ldnUrl: this.service.ldnUrl,
|
||||
score: this.service.score,ldnUrl: this.service.ldnUrl,
|
||||
type: this.service.type,
|
||||
enabled: this.service.enabled
|
||||
});
|
||||
@@ -198,6 +199,7 @@ export class LdnServiceFormEditComponent implements OnInit {
|
||||
this.createReplaceOperation(patchOperations, 'description', '/description');
|
||||
this.createReplaceOperation(patchOperations, 'ldnUrl', '/ldnurl');
|
||||
this.createReplaceOperation(patchOperations, 'url', '/url');
|
||||
this.createReplaceOperation(patchOperations, 'score', '/score');
|
||||
|
||||
this.handlePatterns(patchOperations, 'notifyServiceInboundPatterns');
|
||||
this.handlePatterns(patchOperations, 'notifyServiceOutboundPatterns');
|
||||
@@ -315,15 +317,18 @@ export class LdnServiceFormEditComponent implements OnInit {
|
||||
this.ldnServicesService.patch(this.service, patchOperations).pipe(
|
||||
getFirstCompletedRemoteData()
|
||||
).subscribe(
|
||||
() => {
|
||||
|
||||
(rd: RemoteData<LdnService>) => {
|
||||
if (rd.hasSucceeded) {
|
||||
this.closeModal();
|
||||
this.sendBack();
|
||||
this.notificationService.success(this.translateService.get('admin.registries.services-formats.modify.success.head'),
|
||||
this.translateService.get('admin.registries.services-formats.modify.success.content'));
|
||||
}
|
||||
);
|
||||
|
||||
}else {
|
||||
this.notificationService.error(this.translateService.get('admin.registries.services-formats.modify.failure.head'),
|
||||
this.translateService.get('admin.registries.services-formats.modify.failure.content'));
|
||||
this.closeModal();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
resetFormAndLeave() {
|
||||
|
@@ -4,61 +4,69 @@
|
||||
<h2 class="flex-grow-1">{{ 'ldn-create-service.title' | translate }}</h2>
|
||||
</div>
|
||||
<!-- In the name section -->
|
||||
<div class="mb-2 ">
|
||||
<div class="mb-5 ">
|
||||
<label for="name">{{ 'ldn-new-service.form.label.name' | translate }}</label>
|
||||
<input [class.invalid-field]="formModel.get('name').invalid && formModel.get('name').touched"
|
||||
[placeholder]="'ldn-new-service.form.placeholder.name' | translate" formControlName="name" id="name"
|
||||
name="name"
|
||||
type="text"
|
||||
class="form-control">
|
||||
<div *ngIf="formModel.get('name').invalid && formModel.get('name').touched" class="error-text">
|
||||
{{ 'ldn-new-service.form.error.name' | translate }}
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
|
||||
</div>
|
||||
|
||||
<!-- In the description section -->
|
||||
<div class="mb-2 d-flex flex-column">
|
||||
<div class="mb-5 mt-5 d-flex flex-column">
|
||||
<label for="description">{{ 'ldn-new-service.form.label.description' | translate }}</label>
|
||||
<textarea [placeholder]="'ldn-new-service.form.placeholder.description' | translate"
|
||||
formControlName="description" id="description" name="description" class="form-control"></textarea>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<!-- In the url section -->
|
||||
<div class="mb-2">
|
||||
<div class="mb-5 mt-5">
|
||||
<label for="url">{{ 'ldn-new-service.form.label.url' | translate }}</label>
|
||||
<input [class.invalid-field]="formModel.get('url').invalid && formModel.get('url').touched"
|
||||
[placeholder]="'ldn-new-service.form.placeholder.url' | translate" formControlName="url" id="url"
|
||||
name="url"
|
||||
type="text"
|
||||
class="form-control">
|
||||
<div *ngIf="formModel.get('url').invalid && formModel.get('url').touched" class="error-text">
|
||||
{{ 'ldn-new-service.form.error.url' | translate }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
|
||||
</div>
|
||||
|
||||
<!-- In the ldnUrl section -->
|
||||
<div class="mb-2">
|
||||
<label for="ldnUrl">{{ 'ldn-new-service.form.label.ldnUrl' | translate }}</label>
|
||||
<input [class.invalid-field]="formModel.get('ldnUrl').invalid && formModel.get('ldnUrl').touched"
|
||||
[placeholder]="'ldn-new-service.form.placeholder.ldnUrl' | translate" formControlName="ldnUrl"
|
||||
id="ldnUrl"
|
||||
name="ldnUrl"
|
||||
type="text"
|
||||
class="form-control">
|
||||
<div class="mb-5 mt-5">
|
||||
<label for="ldnUrl">{{ 'ldn-new-service.form.label.ldnUrl' | translate }}</label>
|
||||
<input [class.invalid-field]="formModel.get('ldnUrl').invalid && formModel.get('ldnUrl').touched"
|
||||
[placeholder]="'ldn-new-service.form.placeholder.ldnUrl' | translate" formControlName="ldnUrl"
|
||||
id="ldnUrl"
|
||||
name="ldnUrl"
|
||||
type="text"
|
||||
class="form-control">
|
||||
<div *ngIf="formModel.get('ldnUrl').invalid && formModel.get('ldnUrl').touched" class="error-text">
|
||||
{{ 'ldn-new-service.form.error.ldnurl' | translate }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
|
||||
<!-- In the score section -->
|
||||
<div class="mb-2">
|
||||
<label for="score">{{ 'ldn-new-service.form.label.score' | translate }}</label>
|
||||
<input [class.invalid-field]="formModel.get('score').invalid && formModel.get('score').touched"
|
||||
[placeholder]="'ldn-new-service.form.placeholder.score' | translate" formControlName="score"
|
||||
id="score"
|
||||
name="score"
|
||||
type="text">
|
||||
<div *ngIf="formModel.get('score').invalid && formModel.get('score').touched" class="error-text">
|
||||
{{ 'ldn-new-service.form.error.score' | translate }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- In the Inbound Patterns section -->
|
||||
<div class="row">
|
||||
<div class="rowmb-2 mt-5">
|
||||
<div class="col">
|
||||
<label>{{ 'ldn-new-service.form.label.inboundPattern' | translate }} </label>
|
||||
</div>
|
||||
@@ -70,7 +78,7 @@
|
||||
<label class="">{{ 'ldn-new-service.form.label.automatic' | translate }}</label>
|
||||
</div>
|
||||
</ng-container>
|
||||
<div class="col-sm-1">
|
||||
<div class="col-sm-2">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -82,37 +90,14 @@
|
||||
|
||||
<div class="row mb-1">
|
||||
<div class="col">
|
||||
<div #inboundPatternDropdown="ngbDropdown" class="w-100" id="additionalInboundPattern{{i}}" ngbDropdown
|
||||
placement="bottom-start">
|
||||
<div class="position-relative right-addon" role="combobox">
|
||||
<i aria-hidden="true" class="position-absolute scrollable-dropdown-toggle"
|
||||
ngbDropdownToggle>
|
||||
|
||||
</i>
|
||||
<input
|
||||
(click)="inboundPatternDropdown.open();"
|
||||
[readonly]="true"
|
||||
[value]="selectedInboundPatterns"
|
||||
class="form-control w-100 scrollable-dropdown-input"
|
||||
formControlName="patternLabel"
|
||||
id="inboundPatternDropdownButton"
|
||||
ngbDropdownAnchor
|
||||
type="text"
|
||||
/>
|
||||
<div aria-labelledby="inboundPatternDropdownButton" ngbDropdownMenu class="dropdown-menu scrollable-dropdown-menu w-100 " >
|
||||
<div class="scrollable-menu" role="listbox">
|
||||
<button (click)="selectInboundPattern(pattern, i); $event.stopPropagation()" class="dropdown-item collection-item text-truncate w-100"
|
||||
*ngFor="let pattern of inboundPatterns"
|
||||
ngbDropdownItem
|
||||
type="button"
|
||||
[title]="'ldn-service.form.pattern.' + pattern + '.description' | translate">
|
||||
<div>{{ 'ldn-service.form.pattern.' + pattern + '.label' | translate }}</div>
|
||||
<div
|
||||
class="small-text">{{ 'ldn-service.form.pattern.' + pattern + '.description' | translate }}</div>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<select #inboundPattern formControlName="pattern" id="additionalInboundPattern{{i}}"
|
||||
name="additionalInboundPattern{{i}}" required>
|
||||
<option value="">{{ 'ldn-new-service.form.label.placeholder.inboundPattern' | translate }}</option>
|
||||
<option *ngFor="let pattern of inboundPatterns"
|
||||
[value]="pattern">{{ 'ldn-service.form.pattern.' + pattern + '.label' | translate }} </option>
|
||||
</select>
|
||||
<div *ngIf="!patternSelected()" class="error-text">
|
||||
{{ 'ldn-new-service.form.error.patterns' | translate }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -173,15 +158,13 @@
|
||||
</div>
|
||||
|
||||
<span (click)="addInboundPattern()"
|
||||
class="add-pattern-link mb-2">{{ 'ldn-new-service.form.label.addPattern' | translate }}</span>
|
||||
class="add-pattern-link mb-4">{{ 'ldn-new-service.form.label.addPattern' | translate }}</span>
|
||||
|
||||
|
||||
|
||||
<div class="mb-4">
|
||||
|
||||
</div>
|
||||
|
||||
<!-- In the Outbound Patterns section -->
|
||||
<div class="row">
|
||||
<div class="rowmb-1 mt-5">
|
||||
<div class="col">
|
||||
<label>{{ 'ldn-new-service.form.label.outboundPattern' | translate }}</label>
|
||||
</div>
|
||||
@@ -190,9 +173,12 @@
|
||||
<label class="">{{ 'ldn-new-service.form.label.ItemFilter' | translate }}</label>
|
||||
</div>
|
||||
</ng-container>
|
||||
<div class="col-sm-1 ">
|
||||
<div class="col-sm1 ">
|
||||
<label class="label-box-2" style="visibility: hidden;">
|
||||
{{ 'ldn-new-service.form.label.automatic' | translate }}
|
||||
</label>
|
||||
</div>
|
||||
<div class="col-sm-1 ">
|
||||
<div class="col-sm-2 ">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -289,7 +275,7 @@
|
||||
</div>
|
||||
|
||||
<span (click)="addOutboundPattern()"
|
||||
class="add-pattern-link">{{ 'ldn-new-service.form.label.addPattern' | translate }}
|
||||
class="add-pattern-link mb-4">{{ 'ldn-new-service.form.label.addPattern' | translate }}
|
||||
</span>
|
||||
<div class="mb-4">
|
||||
|
||||
|
@@ -58,6 +58,12 @@ textarea {
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.error-text {
|
||||
color: red;
|
||||
font-size: 0.8em;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.toggle-switch {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
@@ -49,7 +49,8 @@ export class LdnServiceFormComponent implements OnInit {
|
||||
@Input() public name: string;
|
||||
@Input() public description: string;
|
||||
@Input() public url: string;
|
||||
@Input() public ldnUrl: string;
|
||||
@Input() public score: string;
|
||||
@Input() public ldnUrl: string;
|
||||
@Input() public inboundPattern: string;
|
||||
@Input() public outboundPattern: string;
|
||||
@Input() public constraint: string;
|
||||
@@ -62,6 +63,9 @@ export class LdnServiceFormComponent implements OnInit {
|
||||
selectedInboundItemfilters: string[];
|
||||
selectedOutboundItemfilters: string[];
|
||||
private modalRef: any;
|
||||
hasInboundPattern: boolean;
|
||||
hasOutboundPattern: boolean;
|
||||
isScoreValid: boolean;
|
||||
|
||||
constructor(
|
||||
private ldnServicesService: LdnServicesService,
|
||||
@@ -80,7 +84,7 @@ export class LdnServiceFormComponent implements OnInit {
|
||||
name: ['', Validators.required],
|
||||
description: [''],
|
||||
url: ['', Validators.required],
|
||||
ldnUrl: ['', Validators.required],
|
||||
score: ['', [Validators.required, Validators.pattern('^0*(\.[0-9]+)?$|^1(\.0+)?$')]],ldnUrl: ['', Validators.required],
|
||||
inboundPattern: [''],
|
||||
outboundPattern: [''],
|
||||
constraintPattern: [''],
|
||||
@@ -115,14 +119,19 @@ export class LdnServiceFormComponent implements OnInit {
|
||||
|
||||
createService() {
|
||||
this.formModel.get('name').markAsTouched();
|
||||
this.formModel.get('url').markAsTouched();
|
||||
this.formModel.get('ldnUrl').markAsTouched();
|
||||
this.formModel.get('score').markAsTouched();this.formModel.get('url').markAsTouched();
|
||||
this.formModel.get('ldnUrl').markAsTouched();this.formModel.get('notifyServiceInboundPatterns').markAsTouched();
|
||||
this.formModel.get('notifyServiceOutboundPatterns').markAsTouched();
|
||||
|
||||
const name = this.formModel.get('name').value;
|
||||
const url = this.formModel.get('url').value;
|
||||
const score = this.formModel.get('score').value;
|
||||
const ldnUrl = this.formModel.get('ldnUrl').value;
|
||||
|
||||
if (!name || !url || !ldnUrl) {
|
||||
const hasInboundPattern = this.checkPatterns(this.formModel.get('notifyServiceInboundPatterns') as FormArray);
|
||||
const hasOutboundPattern = this.checkPatterns(this.formModel.get('notifyServiceOutboundPatterns') as FormArray);
|
||||
|
||||
if (!name || !url || !ldnUrl || !score || (!hasInboundPattern && !hasOutboundPattern)) {
|
||||
this.closeModal();
|
||||
return;
|
||||
}
|
||||
@@ -157,9 +166,20 @@ export class LdnServiceFormComponent implements OnInit {
|
||||
this.sendBack();
|
||||
this.closeModal();
|
||||
} else {
|
||||
this.notificationsService.error(this.translateService.get('notification.created.failure'));
|
||||
}
|
||||
});
|
||||
this.notificationsService.error(this.translateService.get('ldn-service-notification.created.failure.title'),
|
||||
this.translateService.get('ldn-service-notification.created.failure.body'));
|
||||
this.closeModal();
|
||||
}
|
||||
});
|
||||
}
|
||||
checkPatterns(formArray: FormArray): boolean {
|
||||
for (let i = 0; i < formArray.length; i++) {
|
||||
const pattern = formArray.at(i).get('pattern').value;
|
||||
if (pattern) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -33,6 +33,9 @@ export class LdnService extends CacheableObject {
|
||||
url: string;
|
||||
|
||||
@autoserialize
|
||||
score: number;
|
||||
|
||||
@autoserialize
|
||||
enabled: boolean;
|
||||
|
||||
@autoserialize
|
||||
|
@@ -4,13 +4,19 @@
|
||||
<h2 class="border-bottom pb-2">
|
||||
<div class="d-flex justify-content-between">
|
||||
{{'notifications.events.title'| translate}}
|
||||
<a class="btn btn-outline-secondary" [routerLink]="['/admin/notifications/quality-assurance']">
|
||||
<a class="btn btn-outline-secondary" (click)="goBack()">
|
||||
<i class="fas fa-angle-double-left"></i>
|
||||
{{'quality-assurance.events.back' | translate}}
|
||||
</a>
|
||||
</div>
|
||||
</h2>
|
||||
<ds-alert [type]="'alert-info'" [content]="'quality-assurance.events.description'"></ds-alert>
|
||||
<ds-alert *ngIf="!targetId" [type]="'alert-info'">
|
||||
<span [innerHTML]="'quality-assurance.events.description' | translate : {topic: selectedTopicName, source: sourceId}"></span>
|
||||
</ds-alert>
|
||||
<ds-alert *ngIf="targetId" [type]="'alert-info'">
|
||||
<span [innerHTML]="'quality-assurance.events.description-with-topic-and-target' | translate : {topic: selectedTopicName, source: sourceId}"></span>
|
||||
<a [routerLink]="itemPageUrl" target="_blank">{{(getTargetItemTitle() | async)}}</a>
|
||||
</ds-alert>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
@@ -157,7 +163,7 @@
|
||||
</div>
|
||||
<div class="row text-right">
|
||||
<div class="col-md-12">
|
||||
<a class="btn btn-outline-secondary" [routerLink]="['/admin/notifications/quality-assurance']">
|
||||
<a class="btn btn-outline-secondary" (click)="goBack()">
|
||||
<i class="fas fa-angle-double-left"></i>
|
||||
{{'quality-assurance.events.back' | translate}}
|
||||
</a>
|
||||
|
@@ -42,6 +42,7 @@ import { SortDirection, SortOptions } from '../../../core/cache/models/sort-opti
|
||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||
import { PaginationServiceStub } from '../../../shared/testing/pagination-service.stub';
|
||||
import { FindListOptions } from '../../../core/data/find-list-options.model';
|
||||
import { ItemDataService } from 'src/app/core/data/item-data.service';
|
||||
|
||||
describe('QualityAssuranceEventsComponent test suite', () => {
|
||||
let fixture: ComponentFixture<QualityAssuranceEventsComponent>;
|
||||
@@ -118,6 +119,7 @@ describe('QualityAssuranceEventsComponent test suite', () => {
|
||||
{ provide: NotificationsService, useValue: new NotificationsServiceStub() },
|
||||
{ provide: TranslateService, useValue: getMockTranslateService() },
|
||||
{ provide: PaginationService, useValue: paginationService },
|
||||
{ provide: ItemDataService, useValue: {} },
|
||||
QualityAssuranceEventsComponent
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
|
@@ -1,5 +1,6 @@
|
||||
import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
import { Location } from '@angular/common';
|
||||
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
@@ -26,10 +27,12 @@ import {
|
||||
ProjectEntryImportModalComponent,
|
||||
QualityAssuranceEventData
|
||||
} from '../project-entry-import-modal/project-entry-import-modal.component';
|
||||
import { getFirstCompletedRemoteData } from '../../../core/shared/operators';
|
||||
import { getFirstCompletedRemoteData, getRemoteDataPayload } from '../../../core/shared/operators';
|
||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||
import { Item } from '../../../core/shared/item.model';
|
||||
import { FindListOptions } from '../../../core/data/find-list-options.model';
|
||||
import { getItemPageRoute } from '../../../item-page/item-page-routing-paths';
|
||||
import { ItemDataService } from '../../../core/data/item-data.service';
|
||||
|
||||
/**
|
||||
* Component to display the Quality Assurance event list.
|
||||
@@ -105,6 +108,26 @@ export class QualityAssuranceEventsComponent implements OnInit, OnDestroy {
|
||||
*/
|
||||
protected subs: Subscription[] = [];
|
||||
|
||||
/**
|
||||
* The target item id, retrieved from the topic-id composition.
|
||||
*/
|
||||
public targetId: string;
|
||||
|
||||
/**
|
||||
* The URL of the item page/target.
|
||||
*/
|
||||
public itemPageUrl: string;
|
||||
|
||||
/**
|
||||
* Plain topic name (without the source id)
|
||||
*/
|
||||
public selectedTopicName: string;
|
||||
|
||||
/**
|
||||
* The source id, retrieved from the topic-id composition.
|
||||
*/
|
||||
public sourceId: string;
|
||||
|
||||
/**
|
||||
* Initialize the component variables.
|
||||
* @param {ActivatedRoute} activatedRoute
|
||||
@@ -120,7 +143,9 @@ export class QualityAssuranceEventsComponent implements OnInit, OnDestroy {
|
||||
private notificationsService: NotificationsService,
|
||||
private qualityAssuranceEventRestService: QualityAssuranceEventDataService,
|
||||
private paginationService: PaginationService,
|
||||
private translateService: TranslateService
|
||||
private translateService: TranslateService,
|
||||
private itemService: ItemDataService,
|
||||
private _location: Location
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -137,6 +162,10 @@ export class QualityAssuranceEventsComponent implements OnInit, OnDestroy {
|
||||
const regEx = /!/g;
|
||||
this.showTopic = id.replace(regEx, '/');
|
||||
this.topic = id;
|
||||
const splitList = this.showTopic?.split(':');
|
||||
this.targetId = splitList.length > 2 ? splitList.pop() : null;
|
||||
this.sourceId = splitList[0];
|
||||
this.selectedTopicName = splitList[1];
|
||||
return this.getQualityAssuranceEvents();
|
||||
})
|
||||
).subscribe((events: QualityAssuranceEventData[]) => {
|
||||
@@ -423,4 +452,37 @@ export class QualityAssuranceEventsComponent implements OnInit, OnDestroy {
|
||||
last()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the page route for the given item.
|
||||
* @param item The item to get the page route for.
|
||||
* @returns The page route for the given item.
|
||||
*/
|
||||
public getItemPageRoute(item: Item): string {
|
||||
return getItemPageRoute(item);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an Observable that emits the title of the target item.
|
||||
* The target item is retrieved by its ID using the itemService.
|
||||
* The title is extracted from the first metadata value of the item.
|
||||
* The item page URL is also set in the component.
|
||||
* @returns An Observable that emits the title of the target item.
|
||||
*/
|
||||
public getTargetItemTitle(): Observable<string> {
|
||||
return this.itemService.findById(this.targetId).pipe(
|
||||
take(1),
|
||||
getFirstCompletedRemoteData(),
|
||||
getRemoteDataPayload(),
|
||||
tap((item: Item) => this.itemPageUrl = getItemPageRoute(item)),
|
||||
map((item: Item) => item.firstMetadataValue('dc.title'))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Navigates back to the previous location in the browser's history stack.
|
||||
*/
|
||||
public goBack() {
|
||||
this._location.back();
|
||||
}
|
||||
}
|
||||
|
@@ -44,7 +44,7 @@
|
||||
<button
|
||||
class="btn btn-outline-primary btn-sm"
|
||||
title="{{'quality-assurance.button.detail' | translate }}"
|
||||
[routerLink]="['/admin/notifications/quality-assurance',sourceId, topicElement.id]">
|
||||
[routerLink]="['/admin/notifications/quality-assurance', sourceId, topicElement.id]">
|
||||
<span class="badge badge-info">{{topicElement.totalEvents}}</span>
|
||||
<i class="fas fa-info fa-fw"></i>
|
||||
</button>
|
||||
|
@@ -994,6 +994,12 @@
|
||||
"ldn-new-service.form.label.placeholder.selectedItemFilter": "No Item Filter Selected",
|
||||
"ldn-new-service.form.label.ItemFilter": "Item Filter",
|
||||
"ldn-new-service.form.label.automatic": "Automatic",
|
||||
"ldn-new-service.form.error.name": "Name is required",
|
||||
"ldn-new-service.form.error.url": "URL is required",
|
||||
"ldn-new-service.form.error.ldnurl": "LDN URL is required",
|
||||
"ldn-new-service.form.error.patterns": "At least a pattern is required",
|
||||
"ldn-new-service.form.error.score": "Please enter a valid score (between 0 and 1). Use the “.” as decimal separator",
|
||||
|
||||
"ldn-new-service.form.label.outboundPattern": "Outbound Patterns",
|
||||
"ldn-new-service.form.label.placeholder.outboundPattern": "Select an Outbound Pattern",
|
||||
"ldn-new-service.form.label.addPattern": "+ Add more",
|
||||
@@ -3313,7 +3319,9 @@
|
||||
|
||||
"quality-assurance.source.error.service.retrieve": "An error occurred while loading the Quality Assurance source",
|
||||
|
||||
"quality-assurance.events.description": "Below the list of all the suggestions for the selected topic.",
|
||||
"quality-assurance.events.description": "Below the list of all the suggestions for the selected topic <b>{{topic}}</b>, related to <b>{{source}}</b>.",
|
||||
|
||||
"quality-assurance.events.description-with-topic-and-target": "Below the list of all the suggestions for the selected topic <b>{{topic}}</b>, related to <b>{{source}}</b> and ",
|
||||
|
||||
"quality-assurance.loading": "Loading ...",
|
||||
|
||||
|
Reference in New Issue
Block a user