Merge branch 'dmp-refactoring' of https://code-repo.d4science.org/MaDgiK-CITE/argos into dmp-refactoring

This commit is contained in:
Sofia Papacharalampous 2024-04-30 15:19:24 +03:00
commit 95e78705df
11 changed files with 35 additions and 30 deletions

View File

@ -476,6 +476,7 @@ public class PrefillingSourceServiceImpl implements PrefillingSourceService {
Tag tag = new Tag(); Tag tag = new Tag();
tag.setLabel(tagString.trim()); tag.setLabel(tagString.trim());
descriptionTag.setTag(tag); descriptionTag.setTag(tag);
descriptionTag.setIsActive(IsActive.Active);
description.getDescriptionTags().add(descriptionTag); description.getDescriptionTags().add(descriptionTag);
} }
} }

View File

@ -403,12 +403,6 @@ permissions:
allowAuthenticated: false allowAuthenticated: false
# Dmp # Dmp
BrowseDmp: BrowseDmp:
roles:
- TenantAdmin
clients: [ ]
allowAnonymous: false
allowAuthenticated: false
EditDmp:
roles: roles:
- TenantAdmin - TenantAdmin
dmp: dmp:
@ -420,7 +414,7 @@ permissions:
clients: [ ] clients: [ ]
allowAnonymous: false allowAnonymous: false
allowAuthenticated: false allowAuthenticated: false
ReviewDmp: EditDmp:
roles: roles:
- TenantAdmin - TenantAdmin
dmp: dmp:

File diff suppressed because one or more lines are too long

View File

@ -71,7 +71,6 @@ export enum AppPermission {
//Dmp //Dmp
BrowseDmp = "BrowseDmp", BrowseDmp = "BrowseDmp",
EditDmp = "EditDmp", EditDmp = "EditDmp",
ReviewDmp = "ReviewDmp",
NewDmp = "NewDmp", NewDmp = "NewDmp",
DepositDmp = "DepositDmp", DepositDmp = "DepositDmp",
DeleteDmp = "DeleteDmp", DeleteDmp = "DeleteDmp",

View File

@ -17,7 +17,7 @@
<button [disabled]="saving" *ngIf="isNew" mat-raised-button type="button" (click)="formSubmit()" class="save-btn"> <button [disabled]="saving" *ngIf="isNew" mat-raised-button type="button" (click)="formSubmit()" class="save-btn">
{{'DMP-EDITOR.ACTIONS.SAVE' | translate}} {{'DMP-EDITOR.ACTIONS.SAVE' | translate}}
</button> </button>
<div *ngIf="!isNew && formGroup.enabled && !lockStatus"> <div *ngIf="!isNew && formGroup.enabled && !lockStatus && canSave">
<button [disabled]="saving" *ngIf="!isFinalized" mat-raised-button (click)="formSubmit()" class="save-btn"> <button [disabled]="saving" *ngIf="!isFinalized" mat-raised-button (click)="formSubmit()" class="save-btn">
{{'DMP-EDITOR.ACTIONS.SAVE' | translate}} {{'DMP-EDITOR.ACTIONS.SAVE' | translate}}
</button> </button>
@ -162,7 +162,7 @@
</mat-form-field> </mat-form-field>
</div> </div>
<div *ngIf="field.systemFieldType == dmpBlueprintSystemFieldTypeEnum.Description"> <div *ngIf="field.systemFieldType == dmpBlueprintSystemFieldTypeEnum.Description">
<rich-text-editor-component [form]="formGroup.get('description')" [placeholder]="field.placeholder ?? 'DMP-EDITOR.PLACEHOLDER.DESCRIPTION'" [required]="field.required"> <rich-text-editor-component [form]="formGroup.get('description')" [editable]="formGroup.get('description').status !== 'DISABLED'" [placeholder]="field.placeholder ?? 'DMP-EDITOR.PLACEHOLDER.DESCRIPTION'" [required]="field.required">
</rich-text-editor-component> </rich-text-editor-component>
</div> </div>
<div *ngIf="field.systemFieldType == dmpBlueprintSystemFieldTypeEnum.Language"> <div *ngIf="field.systemFieldType == dmpBlueprintSystemFieldTypeEnum.Language">
@ -228,8 +228,8 @@
</ng-container> </ng-container>
</div> </div>
</div> </div>
<div class="col-12 col-xl-auto"> <div *ngIf="canSave" class="col-12 col-xl-auto">
<button [disabled]="formGroup.disabled" mat-icon-button class="action-list-icon" matTooltip="{{'DMP-EDITOR.ACTIONS.REMOVE-CONTACT' | translate}}" (click)="removeContact(contactIndex)" [disabled]="formGroup.disabled"> <button [disabled]="!this.canSave" mat-icon-button class="action-list-icon" matTooltip="{{'DMP-EDITOR.ACTIONS.REMOVE-CONTACT' | translate}}" (click)="removeContact(contactIndex)" [disabled]="formGroup.disabled">
<mat-icon>delete</mat-icon> <mat-icon>delete</mat-icon>
</button> </button>
</div> </div>
@ -239,7 +239,7 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col"> <div class="col">
<button mat-icon-button (click)="addContact()" [disabled]="formGroup.disabled"> <button mat-icon-button (click)="addContact()" [disabled]="!this.canSave">
<mat-icon>add</mat-icon> <mat-icon>add</mat-icon>
</button> </button>
</div> </div>
@ -263,6 +263,7 @@
</div> </div>
</div> </div>
<div *ngIf="field.category === dmpBlueprintSectionFieldCategoryEnum.ReferenceType"> <div *ngIf="field.category === dmpBlueprintSectionFieldCategoryEnum.ReferenceType">
{{formGroup.get('properties').get('dmpBlueprintValues').get(field.id)?.get('reference')?.status }}
<ng-container *ngIf="field.multipleSelect"> <ng-container *ngIf="field.multipleSelect">
<app-reference-field-component [form]="formGroup.get('properties').get('dmpBlueprintValues').get(field.id).get('references')" [dependencies]="formGroup.get('properties').get('dmpBlueprintValues')" [label]= "field.label" [placeholder]="field.placeholder ?? field.label" [referenceType]="field.referenceType" [multiple]="true"></app-reference-field-component> <app-reference-field-component [form]="formGroup.get('properties').get('dmpBlueprintValues').get(field.id).get('references')" [dependencies]="formGroup.get('properties').get('dmpBlueprintValues')" [label]= "field.label" [placeholder]="field.placeholder ?? field.label" [referenceType]="field.referenceType" [multiple]="true"></app-reference-field-component>
</ng-container> </ng-container>

View File

@ -224,7 +224,7 @@ export class DmpEditorComponent extends BaseEditor<DmpEditorModel, Dmp> implemen
.pipe(takeUntil(this._destroyed)).subscribe( .pipe(takeUntil(this._destroyed)).subscribe(
complete => { complete => {
this.permissionPerSection = complete, this.permissionPerSection = complete,
this.buildForm(); this.buildForm();
}, },
error => this.onCallbackError(error) error => this.onCallbackError(error)
); );

View File

@ -87,7 +87,8 @@ export class DmpEditorModel extends BaseEditorModel implements DmpPersist {
label: [{ value: this.label, disabled: disabled }, context.getValidation('label').validators], label: [{ value: this.label, disabled: disabled }, context.getValidation('label').validators],
status: [{ value: this.status, disabled: disabled }, context.getValidation('status').validators], status: [{ value: this.status, disabled: disabled }, context.getValidation('status').validators],
properties: this.properties.buildForm({ properties: this.properties.buildForm({
rootPath: `properties.` rootPath: `properties.`,
disabled: disabled
}), }),
users: this.formBuilder.array( users: this.formBuilder.array(
(this.users ?? []).map( (this.users ?? []).map(
@ -242,7 +243,8 @@ export class DmpPropertiesEditorModel implements DmpPropertiesPersist {
contacts: this.formBuilder.array( contacts: this.formBuilder.array(
(this.contacts ?? []).map( (this.contacts ?? []).map(
(item, index) => item.buildForm({ (item, index) => item.buildForm({
rootPath: `${rootPath}contacts[${index}].` rootPath: `${rootPath}contacts[${index}].`,
disabled: disabled
}) })
), context.getValidation('contacts').validators ), context.getValidation('contacts').validators
), ),
@ -252,7 +254,8 @@ export class DmpPropertiesEditorModel implements DmpPropertiesPersist {
const dmpBlueprintValuesFormGroup = this.formBuilder.group({}); const dmpBlueprintValuesFormGroup = this.formBuilder.group({});
this.dmpBlueprintValues.forEach((value, key) => dmpBlueprintValuesFormGroup.addControl(key.toString(), value.buildForm({ this.dmpBlueprintValues.forEach((value, key) => dmpBlueprintValuesFormGroup.addControl(key.toString(), value.buildForm({
rootPath: `${rootPath}dmpBlueprintValues[${key}].` rootPath: `${rootPath}dmpBlueprintValues[${key}].`,
disabled: disabled
})), context.getValidation('dmpBlueprintValues') })), context.getValidation('dmpBlueprintValues')
) )
formGroup.addControl('dmpBlueprintValues', dmpBlueprintValuesFormGroup); formGroup.addControl('dmpBlueprintValues', dmpBlueprintValuesFormGroup);

View File

@ -43,9 +43,9 @@
</div> </div>
</div> </div>
</div> </div>
<div class="row" *ngIf="(canEditDmp() && !isLocked) || canCloneDmp() || (canDeleteDmp() && !isLocked)"> <div class="row" *ngIf="(isDraftDmp(dmp) && !lockStatus) || canCloneDmp() || (canDeleteDmp() && !isLocked)">
<!-- <button *ngIf="isDraftDmp(dmp) && isDmpOwner(dmp) && !isLocked" (click)="editClicked(dmp)" mat-mini-fab class="mr-3 d-flex justify-content-center align-items-center" matTooltip="{{'DMP-OVERVIEW.ACTIONS.EDIT' | translate}}" matTooltipPosition="above"> --> <!-- <button *ngIf="isDraftDmp(dmp) && isDmpOwner(dmp) && !isLocked" (click)="editClicked(dmp)" mat-mini-fab class="mr-3 d-flex justify-content-center align-items-center" matTooltip="{{'DMP-OVERVIEW.ACTIONS.EDIT' | translate}}" matTooltipPosition="above"> -->
<div *ngIf="canEditDmp() && !isLocked" class="col-auto pr-0"> <div *ngIf="isDraftDmp(dmp) && !lockStatus" class="col-auto pr-0">
<button (click)="editClicked()" mat-mini-fab class="d-flex justify-content-center align-items-center" matTooltip="{{'DMP-OVERVIEW.ACTIONS.EDIT' | translate}}" matTooltipPosition="above"> <button (click)="editClicked()" mat-mini-fab class="d-flex justify-content-center align-items-center" matTooltip="{{'DMP-OVERVIEW.ACTIONS.EDIT' | translate}}" matTooltipPosition="above">
<mat-icon class="mat-mini-fab-icon">create</mat-icon> <mat-icon class="mat-mini-fab-icon">create</mat-icon>
</button> </button>

View File

@ -313,7 +313,7 @@ export class ResultFieldsMappingConfigurationEditorModel implements ResultFields
} }
return this.formBuilder.group({ return this.formBuilder.group({
code: [{ value: this.code, disabled: true }, context.getValidation('code').validators], code: [{ value: this.code, disabled: disabled }, context.getValidation('code').validators],
responsePath: [{ value: this.responsePath, disabled: disabled }, context.getValidation('responsePath').validators], responsePath: [{ value: this.responsePath, disabled: disabled }, context.getValidation('responsePath').validators],
}); });
} }
@ -722,7 +722,7 @@ export class StaticOptionEditorModel implements StaticOptionPersist {
} }
return this.formBuilder.group({ return this.formBuilder.group({
code: [{ value: this.code, disabled: true }, context.getValidation('code').validators], code: [{ value: this.code, disabled: disabled }, context.getValidation('code').validators],
value: [{ value: this.value, disabled: disabled }, context.getValidation('value').validators], value: [{ value: this.value, disabled: disabled }, context.getValidation('value').validators],
}); });
} }

View File

@ -141,7 +141,7 @@
<div class="col"> <div class="col">
<mat-form-field class="w-100"> <mat-form-field class="w-100">
<mat-label>{{'EXTERNAL-FETCHER-SOURCE-EDITOR.FIELDS.CODE' | translate}}</mat-label> <mat-label>{{'EXTERNAL-FETCHER-SOURCE-EDITOR.FIELDS.CODE' | translate}}</mat-label>
<input matInput type="text" [readonly]="field.get('code').disabled" name="code" [formControl]="field.get('code')" [readOnly]="true"> <input matInput type="text" [readonly]="true" name="code" [formControl]="field.get('code')">
<mat-error *ngIf="field.get('code').hasError('backendError')">{{field.get('code').getError('backendError').message}}</mat-error> <mat-error *ngIf="field.get('code').hasError('backendError')">{{field.get('code').getError('backendError').message}}</mat-error>
<mat-error *ngIf="field.get('code').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error> <mat-error *ngIf="field.get('code').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field> </mat-form-field>
@ -372,7 +372,7 @@
<div class="col-6"> <div class="col-6">
<mat-form-field class="w-100"> <mat-form-field class="w-100">
<mat-label>{{'EXTERNAL-FETCHER-SOURCE-EDITOR.FIELDS.CODE' | translate}}</mat-label> <mat-label>{{'EXTERNAL-FETCHER-SOURCE-EDITOR.FIELDS.CODE' | translate}}</mat-label>
<input matInput type="text" [readonly]="option.get('code').disabled" name="code" [formControl]="option.get('code')"> <input matInput type="text" [readonly]="true" name="code" [formControl]="option.get('code')">
<mat-error *ngIf="option.get('code').hasError('backendError')">{{option.get('code').getError('backendError').message}}</mat-error> <mat-error *ngIf="option.get('code').hasError('backendError')">{{option.get('code').getError('backendError').message}}</mat-error>
<mat-error *ngIf="option.get('code').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error> <mat-error *ngIf="option.get('code').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field> </mat-form-field>

View File

@ -1,5 +1,5 @@
import { COMMA, ENTER } from '@angular/cdk/keycodes'; import { COMMA, ENTER } from '@angular/cdk/keycodes';
import { Component, ElementRef, Input, OnInit, ViewChild } from '@angular/core'; import { Component, ElementRef, Input, OnInit, SimpleChanges, ViewChild } from '@angular/core';
import { UntypedFormControl } from '@angular/forms'; import { UntypedFormControl } from '@angular/forms';
import { MatAutocompleteSelectedEvent } from '@angular/material/autocomplete'; import { MatAutocompleteSelectedEvent } from '@angular/material/autocomplete';
import { MatChipInputEvent } from '@angular/material/chips'; import { MatChipInputEvent } from '@angular/material/chips';
@ -30,8 +30,15 @@ export class TagsComponent extends BaseComponent implements OnInit {
) { ) {
super(); super();
} }
ngOnChanges(changes: SimpleChanges) {
if(changes['form']) this.applyTags();
}
ngOnInit(): void { ngOnInit(): void {
this.applyTags();
}
applyTags(){
this.tags = this.form.value || []; this.tags = this.form.value || [];
this.filteredTags = this.form.valueChanges.pipe( this.filteredTags = this.form.valueChanges.pipe(
startWith(null), startWith(null),