[CST-12700] fixes

This commit is contained in:
Alisa Ismailati
2023-11-20 13:52:13 +01:00
parent 2386bb86b9
commit 21d9785ca7
9 changed files with 81 additions and 108 deletions

View File

@@ -5,7 +5,7 @@
</div>
<!-- In the toggle section -->
<div class="toggle-switch-container">
<label class="status-label" for="enabled">{{ 'ldn-service-status' | translate }}</label>
<label class="status-label font-weight-bold" for="enabled">{{ 'ldn-service-status' | translate }}</label>
<div>
<input formControlName="enabled" hidden id="enabled" name="enabled" type="checkbox">
<div (click)="toggleEnabled()" [class.checked]="formModel.get('enabled').value" class="toggle-switch">
@@ -15,7 +15,7 @@
</div>
<!-- In the Name section -->
<div class="mb-5">
<label for="name">{{ 'ldn-new-service.form.label.name' | translate }}</label>
<label for="name" class="font-weight-bold">{{ '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" class="form-control"
formControlName="name"
@@ -29,14 +29,14 @@
<!-- In the description section -->
<div class="mb-5 mt-5 d-flex flex-column">
<label for="description">{{ 'ldn-new-service.form.label.description' | translate }}</label>
<label for="description" class="font-weight-bold">{{ 'ldn-new-service.form.label.description' | translate }}</label>
<textarea [placeholder]="'ldn-new-service.form.placeholder.description' | translate"
class="form-control" formControlName="description" id="description" name="description"></textarea>
</div>
<!-- In the url section -->
<div class="mb-5 mt-5">
<label for="url">{{ 'ldn-new-service.form.label.url' | translate }}</label>
<label for="url" class="font-weight-bold">{{ '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" class="form-control"
formControlName="url"
@@ -50,7 +50,7 @@
<!-- In the ldnUrl section -->
<div class="mb-5 mt-5">
<label for="ldnUrl">{{ 'ldn-new-service.form.label.ldnUrl' | translate }}</label>
<label for="ldnUrl" class="font-weight-bold">{{ '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" class="form-control"
formControlName="ldnUrl"
@@ -64,11 +64,12 @@
<!-- In the score section -->
<div class="mb-2">
<label for="score">{{ 'ldn-new-service.form.label.score' | translate }}</label>
<label for="score" class="font-weight-bold">{{ '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"
class="form-control"
type="text">
<div *ngIf="formModel.get('score').invalid && formModel.get('score').touched" class="error-text">
{{ 'ldn-new-service.form.error.score' | translate }}
@@ -78,14 +79,14 @@
<!-- In the Inbound Patterns Labels section -->
<div class="row mb-1 mt-5">
<div class="col">
<label>{{ 'ldn-new-service.form.label.inboundPattern' | translate }} </label>
<label class="font-weight-bold">{{ 'ldn-new-service.form.label.inboundPattern' | translate }} </label>
</div>
<ng-container *ngIf="!!(formModel.get('notifyServiceInboundPatterns')['controls'][0]?.value?.pattern)">
<div class="col">
<label>{{ 'ldn-new-service.form.label.ItemFilter' | translate }}</label>
<label class="font-weight-bold">{{ 'ldn-new-service.form.label.ItemFilter' | translate }}</label>
</div>
<div class="col-sm-1">
<label class="">{{ 'ldn-new-service.form.label.automatic' | translate }}</label>
<label class="font-weight-bold">{{ 'ldn-new-service.form.label.automatic' | translate }}</label>
</div>
</ng-container>
<div class="col-sm-2">
@@ -213,11 +214,11 @@
<!-- In the Outbound Patterns Labels section -->
<div class="row mb-1 mt-5">
<div class="col">
<label>{{ 'ldn-new-service.form.label.outboundPattern' | translate }} </label>
<label class="font-weight-bold">{{ 'ldn-new-service.form.label.outboundPattern' | translate }} </label>
</div>
<ng-container *ngIf="!!(formModel.get('notifyServiceOutboundPatterns')['controls'][0]?.value?.pattern)">
<div class="col">
<label>{{ 'ldn-new-service.form.label.ItemFilter' | translate }}</label>
<label class="font-weight-bold">{{ 'ldn-new-service.form.label.ItemFilter' | translate }}</label>
</div>
</ng-container>
<div class="col-sm-1 ">
@@ -336,28 +337,23 @@
</ng-container>
</div>
<span
<div
(click)="addOutboundPattern()"
class="add-pattern-link mb-2">{{ 'ldn-new-service.form.label.addPattern' | translate }}
</span>
<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>
</button>
<div class="d-flex">
<button (click)="openResetFormModal(resetFormModal)" class="btn btn-danger" type="button">
<span><i class="fas fa-trash"></i> {{ 'submission.general.discard.submit' | translate }}</span>
</button>
class="add-pattern-link mb-4">{{ 'ldn-new-service.form.label.addPattern' | translate }}
</div>
<div class="submission-form-footer my-1 position-sticky d-flex justify-content-between" role="group">
<button (click)="openResetFormModal(resetFormModal)" class="btn btn-danger" type="button">
<span><i class="fas fa-trash"></i>&nbsp;{{ 'submission.general.discard.submit' | translate }}</span>
</button>
<button class="btn btn-primary" type="submit">
<span><i class="fas fa-save"></i>&nbsp;{{ 'ldn-new-service.form.label.submit' | translate }}</span>
</button>
</div>
</form>
</div>
<ng-template #confirmModal>
<div>
<div class="modal-header">
<div>
<h4>{{'service.overview.edit.modal' | translate }}</h4>
@@ -377,11 +373,10 @@
id="delete-confirm">{{ 'service.detail.return' | translate }}
</button>
<button (click)="patchService()"
class="btn btn-primary custom-btn">{{ 'service.detail.update' | translate }}
class="btn btn-primary">{{ 'service.detail.update' | translate }}
</button>
</div>
</div>
</div>
</ng-template>
<ng-template #resetFormModal>
@@ -407,7 +402,7 @@
id="reset-delete">{{ 'service.overview.reset-form.reset-confirm' | translate }}
</button>
<button (click)="resetFormAndLeave()"
class="btn btn-primary custom-btn"
class="btn btn-primary"
id="reset-confirm">{{ 'service.overview.reset-form.reset-return' | translate }}
</button>
</div>

View File

@@ -124,11 +124,6 @@ textarea {
margin-left: 5px;
}
form button.btn.btn-primary[type="submit"] {
position: absolute;
right: 8px;
}
.submission-form-footer {
border-radius: var(--bs-card-border-radius);
bottom: 0;

View File

@@ -19,7 +19,7 @@ import {Observable} from 'rxjs';
import {PaginationService} from '../../../core/pagination/pagination.service';
import {FindListOptions} from '../../../core/data/find-list-options.model';
import {PaginationComponentOptions} from '../../../shared/pagination/pagination-component-options.model';
import {NotifyServicePattern} from "../ldn-services-model/ldn-service-patterns.model";
import {NotifyServicePattern} from '../ldn-services-model/ldn-service-patterns.model';
@Component({
selector: 'ds-ldn-service-form-edit',
@@ -69,6 +69,7 @@ export class LdnServiceFormEditComponent implements OnInit {
private deletedOutboundPatterns: number[] = [];
private modalRef: any;
private service: LdnService;
private selectPatternDefaultLabeli18Key = 'ldn-service.form.label.placeholder.default-select';
constructor(
protected ldnServicesService: LdnServicesService,
@@ -132,8 +133,8 @@ export class LdnServiceFormEditComponent implements OnInit {
type: this.service.type,
enabled: this.service.enabled
});
this.filterPatternObjectsAndPickLabel('notifyServiceInboundPatterns', false)
this.filterPatternObjectsAndPickLabel('notifyServiceOutboundPatterns', true)
this.filterPatternObjectsAndPickLabel('notifyServiceInboundPatterns', false);
this.filterPatternObjectsAndPickLabel('notifyServiceOutboundPatterns', true);
}
},
);
@@ -144,9 +145,9 @@ export class LdnServiceFormEditComponent implements OnInit {
PatternsArray.clear();
let servicesToUse;
if (isOutbound) {
servicesToUse = this.service.notifyServiceOutboundPatterns
servicesToUse = this.service.notifyServiceOutboundPatterns;
} else {
servicesToUse = this.service.notifyServiceInboundPatterns
servicesToUse = this.service.notifyServiceInboundPatterns;
}
servicesToUse.forEach((patternObj: NotifyServicePattern) => {
@@ -159,12 +160,12 @@ export class LdnServiceFormEditComponent implements OnInit {
const newPatternObjWithLabel = Object.assign(new NotifyServicePattern(), {
...patternObj,
patternLabel: this.translateService.instant('ldn-service.form.pattern.' + patternObj?.pattern + '.label')
})
});
patternFormGroup.patchValue(newPatternObjWithLabel);
PatternsArray.push(patternFormGroup);
this.cdRef.detectChanges();
})
});
}
@@ -217,26 +218,26 @@ export class LdnServiceFormEditComponent implements OnInit {
selectOutboundPattern(patternValue: string, index: number): void {
const patternArray = (this.formModel.get('notifyServiceOutboundPatterns') as FormArray)
patternArray.controls[index].patchValue({pattern: patternValue})
patternArray.controls[index].patchValue({patternLabel: this.translateService.instant('ldn-service.form.pattern.' + patternValue + '.label')})
const patternArray = (this.formModel.get('notifyServiceOutboundPatterns') as FormArray);
patternArray.controls[index].patchValue({pattern: patternValue});
patternArray.controls[index].patchValue({patternLabel: this.translateService.instant('ldn-service.form.pattern.' + patternValue + '.label')});
}
selectOutboundItemFilter(filterValue: string, index: number) {
const filterArray = (this.formModel.get('notifyServiceOutboundPatterns') as FormArray)
filterArray.controls[index].patchValue({constraint: filterValue})
const filterArray = (this.formModel.get('notifyServiceOutboundPatterns') as FormArray);
filterArray.controls[index].patchValue({constraint: filterValue});
}
selectInboundPattern(patternValue: string, index: number): void {
const patternArray = (this.formModel.get('notifyServiceInboundPatterns') as FormArray)
patternArray.controls[index].patchValue({pattern: patternValue})
patternArray.controls[index].patchValue({patternLabel: this.translateService.instant('ldn-service.form.pattern.' + patternValue + '.label')})
const patternArray = (this.formModel.get('notifyServiceInboundPatterns') as FormArray);
patternArray.controls[index].patchValue({pattern: patternValue});
patternArray.controls[index].patchValue({patternLabel: this.translateService.instant('ldn-service.form.pattern.' + patternValue + '.label')});
}
selectInboundItemFilter(filterValue: string, index: number): void {
const filterArray = (this.formModel.get('notifyServiceInboundPatterns') as FormArray)
filterArray.controls[index].patchValue({constraint: filterValue})
const filterArray = (this.formModel.get('notifyServiceInboundPatterns') as FormArray);
filterArray.controls[index].patchValue({constraint: filterValue});
}
toggleAutomatic(i: number) {
@@ -387,7 +388,7 @@ export class LdnServiceFormEditComponent implements OnInit {
}
private handlePatterns(patchOperations: any[], formArrayName: string): void {
const patternsArray = this.formModel.get(formArrayName) as FormArray
const patternsArray = this.formModel.get(formArrayName) as FormArray;
for (let i = 0; i < patternsArray.length; i++) {
@@ -423,7 +424,7 @@ export class LdnServiceFormEditComponent implements OnInit {
private createOutboundPatternFormGroup(): FormGroup {
return this.formBuilder.group({
pattern: '',
patternLabel: 'Select a pattern',
patternLabel: this.translateService.instant(this.selectPatternDefaultLabeli18Key),
constraint: '',
isNew: true,
});
@@ -432,7 +433,7 @@ export class LdnServiceFormEditComponent implements OnInit {
private createInboundPatternFormGroup(): FormGroup {
return this.formBuilder.group({
pattern: '',
patternLabel: 'Select a pattern',
patternLabel: this.translateService.instant(this.selectPatternDefaultLabeli18Key),
constraint: '',
automatic: false,
isNew: true

View File

@@ -1,6 +1,6 @@
<div class="container">
<form (ngSubmit)="onSubmit()" [formGroup]="formModel">
<div class="d-flex">
<div class="d-flex mb-5">
<h2 class="flex-grow-1">{{ 'ldn-create-service.title' | translate }}</h2>
</div>
<!-- In the name section -->
@@ -60,6 +60,7 @@
[placeholder]="'ldn-new-service.form.placeholder.score' | translate" formControlName="score"
id="score"
name="score"
class="form-control"
type="text">
<div *ngIf="formModel.get('score').invalid && formModel.get('score').touched" class="error-text">
{{ 'ldn-new-service.form.error.score' | translate }}
@@ -79,7 +80,7 @@
<label class="">{{ 'ldn-new-service.form.label.automatic' | translate }}</label>
</div>
</ng-container>
<div class="col-sm-2">
<div class="col-sm-1">
</div>
</div>
@@ -202,11 +203,6 @@
<label class="">{{ 'ldn-new-service.form.label.ItemFilter' | translate }}</label>
</div>
</ng-container>
<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-2">
</div>
</div>
@@ -311,24 +307,18 @@
</div>
<span (click)="addOutboundPattern()"
<div (click)="addOutboundPattern()"
class="add-pattern-link mb-4">{{ 'ldn-new-service.form.label.addPattern' | translate }}
</span>
<div class="mb-4">
&nbsp;
</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>
</button>
<div class="d-flex">
<div class="submission-form-footer my-1 position-sticky d-flex justify-content-between" role="group">
<button (click)="this.openResetFormModal(this.resetFormModal)" class="btn btn-danger" type="button">
<span><i class="fas fa-trash"></i> {{ 'submission.general.discard.submit' | translate }}</span>
<span><i class="fas fa-trash"></i>&nbsp;{{ 'submission.general.discard.submit' | translate }}</span>
</button>
<button class="btn btn-primary" type="submit">
<span><i class="fas fa-save"></i>&nbsp;{{ 'ldn-new-service.form.label.submit' | translate }}</span>
</button>
</div>
</div>
</form>
</div>
@@ -348,14 +338,14 @@
<div class="modal-body">
<div>
{{ 'service.create.body' | translate }}
{{ 'service.overview.create.body' | translate }}
</div>
<div class="mt-4">
<button (click)="closeModal()" class="btn btn-danger"
<button (click)="closeModal()" class="btn btn-danger mr-2 "
id="delete-confirm">{{ 'service.refuse.create' | translate }}
</button>
<button (click)="createService()"
class="btn btn-primary mr-2 custom-btn">{{ 'service.confirm.create' | translate }}
class="btn btn-primary">{{ 'service.confirm.create' | translate }}
</button>
</div>
</div>
@@ -368,7 +358,7 @@
<div class="modal-header">
<div>
<h4>{{'service.create.reset-form.modal' | translate }}</h4>
<h4>{{'service.overview.reset-form.modal' | translate }}</h4>
</div>
<button (click)="closeModal()" aria-label="Close"
class="close" type="button">
@@ -378,11 +368,11 @@
<div class="modal-body">
<div>
{{ 'service.create.reset-form.body' | translate }}
{{ 'service.overview.reset-form.body' | translate }}
</div>
<div class="mt-4">
<button (click)="resetFormAndLeave()"
class="btn btn-primary mr-2 custom-btn"
class="btn btn-primary mr-2"
id="reset-confirm">{{ 'service.overview.reset-form.reset-return' | translate }}
</button>
<button (click)="closeModal()" class="btn btn-danger"

View File

@@ -114,12 +114,6 @@ textarea {
cursor: pointer;
}
form button.btn.btn-primary[type="submit"] {
position: absolute;
bottom: 0;
right: -10px;
}
.submission-form-footer {
border-radius: var(--bs-card-border-radius);
bottom: 0;

View File

@@ -66,6 +66,7 @@ export class LdnServiceFormComponent implements OnInit {
hasOutboundPattern: boolean;
isScoreValid: boolean;
private modalRef: any;
private selectPatternDefaultLabeli18Key = 'ldn-service.form.label.placeholder.default-select';
constructor(
private ldnServicesService: LdnServicesService,
@@ -225,27 +226,27 @@ export class LdnServiceFormComponent implements OnInit {
selectOutboundPattern(patternValue: string, index: number): void {
const patternArray = (this.formModel.get('notifyServiceOutboundPatterns') as FormArray)
patternArray.controls[index].patchValue({pattern: patternValue})
patternArray.controls[index].patchValue({patternLabel: this.translateService.instant('ldn-service.form.pattern.' + patternValue + '.label')})
const patternArray = (this.formModel.get('notifyServiceOutboundPatterns') as FormArray);
patternArray.controls[index].patchValue({pattern: patternValue});
patternArray.controls[index].patchValue({patternLabel: this.translateService.instant('ldn-service.form.pattern.' + patternValue + '.label')});
}
selectInboundPattern(patternValue: string, index: number): void {
const patternArray = (this.formModel.get('notifyServiceInboundPatterns') as FormArray)
patternArray.controls[index].patchValue({pattern: patternValue})
patternArray.controls[index].patchValue({patternLabel: this.translateService.instant('ldn-service.form.pattern.' + patternValue + '.label')})
const patternArray = (this.formModel.get('notifyServiceInboundPatterns') as FormArray);
patternArray.controls[index].patchValue({pattern: patternValue});
patternArray.controls[index].patchValue({patternLabel: this.translateService.instant('ldn-service.form.pattern.' + patternValue + '.label')});
}
selectInboundItemFilter(filterValue: string, index: number): void {
const filterArray = (this.formModel.get('notifyServiceInboundPatterns') as FormArray)
filterArray.controls[index].patchValue({constraint: filterValue})
const filterArray = (this.formModel.get('notifyServiceInboundPatterns') as FormArray);
filterArray.controls[index].patchValue({constraint: filterValue});
}
selectOutboundItemFilter(filterValue: string, index: number) {
const filterArray = (this.formModel.get('notifyServiceOutboundPatterns') as FormArray)
filterArray.controls[index].patchValue({constraint: filterValue})
const filterArray = (this.formModel.get('notifyServiceOutboundPatterns') as FormArray);
filterArray.controls[index].patchValue({constraint: filterValue});
}
private sendBack() {
@@ -257,7 +258,7 @@ export class LdnServiceFormComponent implements OnInit {
return this.formBuilder.group({
pattern: [''],
constraint: [''],
patternLabel: 'Select a Pattern',
patternLabel: this.translateService.instant(this.selectPatternDefaultLabeli18Key),
});
}
@@ -266,7 +267,7 @@ export class LdnServiceFormComponent implements OnInit {
pattern: [''],
constraint: [''],
automatic: false,
patternLabel: 'Select a Pattern',
patternLabel: this.translateService.instant(this.selectPatternDefaultLabeli18Key),
});
}

View File

@@ -1,7 +1,6 @@
import { DSpaceObject } from '../../core/shared/dspace-object.model';
import { Item } from '../../core/shared/item.model';
import { SearchResult } from '../search/models/search-result.model';
import { SuggestionsService } from '../../suggestion-notifications/reciter-suggestions/suggestions.service';
// REST Mock ---------------------------------------------------------------------
// -------------------------------------------------------------------------------

View File

@@ -5,7 +5,6 @@ import { SuggestionsPageResolver } from './suggestions-page.resolver';
import { SuggestionsPageComponent } from './suggestions-page.component';
import { AuthenticatedGuard } from '../core/auth/authenticated.guard';
import { I18nBreadcrumbResolver } from '../core/breadcrumbs/i18n-breadcrumb.resolver';
import { SiteAdministratorGuard } from '../core/data/feature-authorization/feature-authorization-guard/site-administrator.guard';
@NgModule({
imports: [

View File

@@ -920,7 +920,7 @@
"ldn-edit-registered-service.title": "Edit Service",
"ldn-create-service.title": "Create service",
"service.overview.create.modal": "Create Service",
"service.overview.create.body": "Please confirm the creation of this service",
"service.overview.create.body": "Please confirm the creation of this service.",
"ldn-service-status": "Status",
"service.confirm.create": "Create",
"service.refuse.create": "Discard",
@@ -936,8 +936,7 @@
"ldn-new-service.form.placeholder.url": "Please input the URL for users to check out more information about the service",
"ldn-new-service.form.placeholder.ldnUrl": "Please specify the URL of the LDN Inbox",
"ldn-new-service.form.placeholder.score": "Please enter a value between 0 and 1. Use the “.” as decimal separator",
"ldn-new-service.form.label.inboundPattern": "Inbound Patterns",
"ldn-new-service.form.label.placeholder.inboundPattern": "Select an Inbound Pattern",
"ldn-service.form.label.placeholder.default-select": "Select a pattern",
"ldn-service.form.pattern.ack-accept.label": "Acknowledge and Accept",
"ldn-service.form.pattern.ack-accept.description": "This pattern is used to acknowledge and accept a request (offer). It implies an intention to act on the request.",