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

This commit is contained in:
Efstratios Giannopoulos 2024-03-21 15:37:06 +02:00
commit 37e128ec15
23 changed files with 136 additions and 124 deletions

View File

@ -2,6 +2,7 @@ package eu.eudat.query;
import eu.eudat.authorization.AuthorizationFlags;
import eu.eudat.commons.enums.LockTargetType;
import eu.eudat.convention.ConventionService;
import eu.eudat.data.LockEntity;
import eu.eudat.model.Lock;
import gr.cite.tools.data.query.FieldResolver;
@ -35,6 +36,8 @@ public class LockQuery extends QueryBase<LockEntity> {
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
private ConventionService conventionService;
public LockQuery like(String value) {
this.like = value;
return this;
@ -135,7 +138,8 @@ public class LockQuery extends QueryBase<LockEntity> {
return this;
}
public LockQuery() {
public LockQuery(ConventionService conventionService) {
this.conventionService = conventionService;
}
@Override
@ -152,7 +156,12 @@ public class LockQuery extends QueryBase<LockEntity> {
protected <X, Y> Predicate applyFilters(QueryContext<X, Y> queryContext) {
List<Predicate> predicates = new ArrayList<>();
if (this.like != null && !this.like.isEmpty()) {
predicates.add(queryContext.CriteriaBuilder.like(queryContext.Root.get(LockEntity._id), this.like));
this.like = this.like.replaceAll("%", "");
if (this.conventionService.isValidUUID(like)){
CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(LockEntity._id));
inClause.value(UUID.fromString(this.like));
predicates.add(inClause);
}
}
if (this.ids != null) {
CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(LockEntity._id));

View File

@ -28,7 +28,8 @@
// text-overflow: ellipsis;
// white-space: nowrap;
// overflow: hidden;
white-space: normal;
// white-space: normal;
white-space: nowrap;
word-break: break-word;
}
@ -128,3 +129,16 @@
color: transparent;
}
}
:host ::ng-deep .mdc-evolution-chip-set__chips {
max-width: 100%;
text-overflow: ellipsis;
flex-flow: nowrap;
overflow-x: scroll;
}
:host ::ng-deep .mat-mdc-standard-chip .mdc-evolution-chip__cell--primary,
:host ::ng-deep .mat-mdc-standard-chip .mdc-evolution-chip__action--primary,
:host ::ng-deep .mat-mdc-standard-chip .mat-mdc-chip-action-label {
overflow: hidden;
}

View File

@ -231,7 +231,7 @@
<li class="list-inline-item">
<mat-checkbox class="fieldset-checkbox-action-description-template-editor" [formControl]="this.form.get('hasCommentField')" [matTooltip]="'DESCRIPTION-TEMPLATE-EDITOR.ACTIONS.FIELDSET.INCLUDE-COMMENT-FIELD' | translate">{{'DESCRIPTION-TEMPLATE-EDITOR.ACTIONS.FIELDSET.COMMENT-FIELD' | translate}}</mat-checkbox>
<mat-checkbox class="fieldset-checkbox-action-description-template-editor" [formControl]="this.form.get('hasCommentField')" [matTooltip]="'DESCRIPTION-TEMPLATE-EDITOR.ACTIONS.FIELDSET.INCLUDE-COMMENT-FIELD' | translate" [disabled]="viewOnly">{{'DESCRIPTION-TEMPLATE-EDITOR.ACTIONS.FIELDSET.COMMENT-FIELD' | translate}}</mat-checkbox>
<mat-error *ngIf="form.get('hasCommentField').hasError('backendError')">{{form.get('hasCommentField').getError('backendError').message}}</mat-error>
</li>
<li class="list-inline-item">

View File

@ -7,12 +7,12 @@
<div class="col-auto">
<ul class="list-unstyled list-inline d-flex align-items-center">
<li class="list-inline-item">
<mat-slide-toggle class="field-toggler" [checked]="isRequired" (change)="toggleRequired($event)" labelPosition="before" [matTooltip]="'DESCRIPTION-TEMPLATE-EDITOR.ACTIONS.FIELD.MAKE-IT-REQUIRED' | translate" [disabled]="!fieldType">
<mat-slide-toggle class="field-toggler" [checked]="isRequired" (change)="toggleRequired($event)" labelPosition="before" [matTooltip]="'DESCRIPTION-TEMPLATE-EDITOR.ACTIONS.FIELD.MAKE-IT-REQUIRED' | translate" [disabled]="!fieldType || form.disabled">
{{'GENERAL.VALIDATION.REQUIRED' | translate}}
</mat-slide-toggle>
</li>
<li *ngIf="fieldType === descriptionTemplateFieldTypeEnum.FREE_TEXT" class="list-inline-item">
<mat-slide-toggle class="field-toggler" [checked]="isURL" (change)="toggleURL($event)" labelPosition="before" [matTooltip]="'DESCRIPTION-TEMPLATE-EDITOR.ACTIONS.FIELD.MAKE-IT-REQUIRED' | translate" [disabled]="!fieldType">
<mat-slide-toggle class="field-toggler" [checked]="isURL" (change)="toggleURL($event)" labelPosition="before" [matTooltip]="'DESCRIPTION-TEMPLATE-EDITOR.ACTIONS.FIELD.MAKE-IT-REQUIRED' | translate" [disabled]="!fieldType || form.disabled">
{{'GENERAL.VALIDATION.URL.LABEL' | translate}}
</mat-slide-toggle>
</li>

View File

@ -119,7 +119,7 @@
<td>{{usersMap.get(user?.get('userId')?.value)?.name}}</td>
<td>{{enumUtils.toUserDescriptionTemplateRoleString(user?.get('role')?.value)}}</td>
<td>
<button mat-button class="delete-btn" (click)="verifyAndRemoveUser(i)" [matTooltip]="'DESCRIPTION-TEMPLATE-EDITOR.STEPS.GENERAL-INFO.DATASET-TEMPLATE-REMOVE-USER'| translate"><mat-icon>person_remove</mat-icon></button>
<button [disabled]="formGroup.disabled" mat-button class="delete-btn" (click)="verifyAndRemoveUser(i)" [matTooltip]="'DESCRIPTION-TEMPLATE-EDITOR.STEPS.GENERAL-INFO.DATASET-TEMPLATE-REMOVE-USER'| translate"><mat-icon>person_remove</mat-icon></button>
</td>
</tr>
<tr *ngIf="formGroup.get('users')?.controls?.length === 0">
@ -141,7 +141,7 @@
</mat-form-field> -->
<mat-form-field class="full-width basic-info-input">
<mat-label>{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.GENERAL-INFO.DATASET-TEMPLATE-USERS' | translate}}</mat-label>
<app-single-auto-complete [required]="false" [formControl]="userFormControl" (optionSelected)="addUser($event)" placeholder="{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.GENERAL-INFO.DATASET-TEMPLATE-USERS' | translate}}" [configuration]="userService.singleAutocompleteConfiguration">
<app-single-auto-complete [disabled]="formGroup.disabled" [required]="false" [formControl]="userFormControl" (optionSelected)="addUser($event)" placeholder="{{'DESCRIPTION-TEMPLATE-EDITOR.STEPS.GENERAL-INFO.DATASET-TEMPLATE-USERS' | translate}}" [configuration]="userService.singleAutocompleteConfiguration">
</app-single-auto-complete>
<mat-error *ngIf="formGroup.get('type').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>

View File

@ -163,7 +163,7 @@ export class DescriptionTemplateEditorComponent extends BaseEditor<DescriptionTe
this.isDeleted = data ? data.isActive === IsActive.Inactive : false;
this.buildForm();
if (data && data.id) this.checkLock(data.id, LockTargetType.DescriptionTemplate);
if (data && data.id) this.checkLock(data.id, LockTargetType.DescriptionTemplate, 'DESCRIPTION-TEMPLATE-EDITOR.LOCKED-DIALOG.TITLE', 'DESCRIPTION-TEMPLATE-EDITOR.LOCKED-DIALOG.MESSAGE');
setTimeout(() => {
this.steps = this.stepper.steps;

View File

@ -15,7 +15,7 @@
</div>
<div class="col"></div>
<div class="col-auto" *ngIf="!isNew">
<button mat-button class="action-btn" type="button" (click)="delete()">
<button [disabled]="!isLockedByUser" mat-button class="action-btn" type="button" (click)="delete()">
<mat-icon>delete</mat-icon>
{{'DMP-BLUEPRINT-EDITOR.ACTIONS.DELETE' | translate}}
</button>
@ -89,11 +89,10 @@
<div class="col-auto mb-3">
<button mat-button class="action-btn" type="button" (click)="addField(sectionIndex)" [disabled]="formGroup.disabled">{{'DMP-BLUEPRINT-EDITOR.ACTIONS.ADD-FIELD' | translate}}</button>
</div>
</div>
<div class="row">
<div cdkDropList class="col-12 mt-3" (cdkDropListDropped)="dropFields($event, sectionIndex)">
<ng-container *ngFor="let field of section.get('fields').controls; let fieldIndex=index;" cdkDrag class="" [cdkDragDisabled]="formGroup.disabled">
<div class="section-fields-wrapper row" (mouseenter)="onSectionHover(fieldIndex)" (mouseleave)="clearHoveredSection()">
<div *ngFor="let field of section.get('fields').controls; let fieldIndex=index;" cdkDrag class="section-fields-wrapper row" [cdkDragDisabled]="formGroup.disabled" (mouseenter)="onSectionHover(fieldIndex)" (mouseleave)="clearHoveredSection()">
<div class="col-auto section-options-vertical">
<div class="row justify-content-center">
<div class="col-auto">
@ -107,12 +106,10 @@
</div>
</div>
</div>
<div class="col-auto section-field section-options-horizontal">
<div class="w-1">
<div class="col-auto pr-0 section-field section-options-horizontal">
<span *ngIf="!isSectionSelected(fieldIndex)" style="font-size: 18px; box-sizing: border-box; display: inline-block; padding: 0.85rem 0.45rem;">{{fieldIndex + 1}}</span>
<mat-icon *ngIf="isSectionSelected(fieldIndex)" [ngClass]="{'drag-handle-disabled': formGroup.disabled}" cdkDragHandle class="drag-handle">drag_indicator</mat-icon>
</div>
</div>
<div class="col">
<div class="row">
@ -206,15 +203,15 @@
</div>
</div>
</div>
</ng-container>
<mat-error *ngIf="section.get('fields').dirty && section.get('fields').hasError('required')">{{'DMP-BLUEPRINT-EDITOR.FIELDS-REQUIRED' | translate}}</mat-error>
<mat-error *ngIf="section.get('fields').hasError('backendError')">{{section.get('fields').getError('backendError').message}}</mat-error>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="row d-flex flex-column">
<div class="col-auto pl-2">
<div class="col-auto">
<mat-checkbox [formControl]="section.get('hasTemplates')" (change)="removeAllDescriptionTemplates($event, sectionIndex)">
{{'DMP-BLUEPRINT-EDITOR.FIELDS.DESCRIPTION-TEMPLATES' | translate}}
</mat-checkbox>
@ -226,6 +223,7 @@
</div>
</div>
</div>
</div>
<div cdkDropList class="col-12" (cdkDropListDropped)="dropDescriptionTemplates($event, sectionIndex)">
<div *ngFor="let descriptionTemplate of section.get('descriptionTemplates').controls; let descriptionTemplateIndex=index;" cdkDrag class="row align-items-center" [cdkDragDisabled]="formGroup.disabled">

View File

@ -150,35 +150,7 @@
display: initial;
}
@media (min-width: 2060px) and (max-width:2215px) {
.section-field {
padding-left: 0;
}
}
@media (min-width: 2000px) and (max-width: 2060px) {
.section-field {
padding-left: 0;
padding-right: 0.6rem;
}
}
@media (min-width: 1950px) and (max-width: 2000px) {
.section-field {
padding-left: 0;
padding-right: 0.3rem;
}
}
// @media (min-width: 1900px) and (max-width: 1950px) {
// .section-field {
// padding-left: 0;
// padding-right: 0.05rem;
// }
// }
@media (max-width: 1900px) {
@media (max-width: 1200px) {
flex-direction: column;
align-items: flex-start;

View File

@ -180,7 +180,7 @@ export class DmpBlueprintEditorComponent extends BaseEditor<DmpBlueprintEditorMo
this.isDeleted = data ? data.isActive === IsActive.Inactive : false;
this.buildForm();
if (data && data.id) this.checkLock(data.id, LockTargetType.DmpBlueprint);
if (data && data.id) this.checkLock(data.id, LockTargetType.DmpBlueprint, 'DMP-BLUEPRINT-EDITOR.LOCKED-DIALOG.TITLE', 'DMP-BLUEPRINT-EDITOR.LOCKED-DIALOG.MESSAGE');
} catch (error) {
this.logger.error('Could not parse dmpBlueprint item: ' + data + error);

View File

@ -42,7 +42,7 @@
<button type="button" class="col-auto align-self-center normal-btn" (click)="openNewDmpDialog()">{{'DASHBOARD.START-YOUR-FIRST-DMP' | translate}}</button>
</div>
<div *ngIf="this.hasDmps()" class="new-dataset-tour add-dataset-btn col-auto d-flex">
<button mat-raised-button type="button" class="col-auto align-self-center yellow-btn" (click)="addNewDataset()">{{'DASHBOARD.ACTIONS.ADD-DESCRIPTION' | translate}}</button>
<button mat-raised-button type="button" class="col-auto align-self-center yellow-btn" (click)="addNewDescription()">{{'DASHBOARD.ACTIONS.ADD-DESCRIPTION' | translate}}</button>
</div>
<span class="col-auto ml-auto">
<img class="laptop-img\6" src="../../../assets/images/dashboard-popup.png">
@ -70,7 +70,7 @@
<app-recent-edited-description-activity (totalCountDatasets)="onCountDatasets($event)" [isActive]="currentType == 'descriptions'"></app-recent-edited-description-activity>
<div *ngIf="totalDatasets === 0" class="empty-list">{{'DASHBOARD.EMPTY-LIST' | translate}}</div>
<div *ngIf="totalDatasets === 0" class="col-auto d-flex justify-content-center">
<button mat-raised-button class="add-dataset" (click)="addNewDataset()">
<button mat-raised-button class="add-dataset" (click)="addNewDescription()">
<mat-icon>add</mat-icon> {{'DASHBOARD.ACTIONS.ADD-DESCRIPTION' | translate}}
</button>
</div>

View File

@ -352,8 +352,6 @@ input[type="text"] {
}
.add-dataset {
width: 142px;
height: 40px;
background: var(--secondary-color) 0% 0% no-repeat padding-box;
box-shadow: 0px 3px 6px #1e202029;
border-radius: 30px;

View File

@ -47,7 +47,7 @@
</mat-menu>
</div>
<mat-divider *ngIf="formGroup.get('id').value && (!viewOnly || (!lockStatus && !viewOnly) || lockStatus || (hasReversableStatus() && !lockStatus))" [vertical]="true" class="ml-2 mr-2"></mat-divider>
<mat-divider *ngIf="formGroup.get('id').value && (!viewOnly || (isLockedByUser && !viewOnly) || !isLockedByUser || (hasReversableStatus() && isLockedByUser))" [vertical]="true" class="ml-2 mr-2"></mat-divider>
<div *ngIf="isDirty() && !viewOnly" class="col-auto d-flex align-items-center pr-0">
<button [disabled]="saving" type="button" mat-raised-button class="description-discard-btn" (click)="discardChanges()">
@ -55,7 +55,7 @@
</button>
</div>
<div class="col-auto d-flex align-items-center">
<button [disabled]="saving" *ngIf="!lockStatus && !viewOnly && hasReversableStatus() == false" mat-raised-button class="description-save-btn mr-2" type="button">
<button [disabled]="saving" *ngIf="isLockedByUser && !viewOnly && hasReversableStatus() == false" mat-raised-button class="description-save-btn mr-2" type="button">
<span class="d-flex flex-row row">
<span (click)="!saving?formSubmit():null" class="col">{{ 'DESCRIPTION-EDITOR.ACTIONS.SAVE' | translate }}</span>
<mat-divider [vertical]="true"></mat-divider>
@ -73,9 +73,9 @@
<button [disabled]="saving" mat-menu-item (click)="save()" type="button">{{ 'DESCRIPTION-EDITOR.ACTIONS.SAVE-AND-CONTINUE' | translate }}</button>
</mat-menu>
<button [disabled]="saving" *ngIf="!lockStatus && !viewOnly && hasReversableStatus() == false" mat-raised-button class="description-save-btn mr-2" type="button" (click)="finalize()">{{ 'DESCRIPTION-EDITOR.ACTIONS.FINALIZE' | translate }}</button>
<button [disabled]="saving" *ngIf="lockStatus" mat-raised-button disabled class="description-save-btn cursor-default" type="button">{{ 'DMP-OVERVIEW.LOCKED' | translate}}</button>
<button [disabled]="saving" *ngIf="hasReversableStatus() && !lockStatus" mat-raised-button class="description-save-btn mr-2" (click)="reverse()" type="button">{{ 'DESCRIPTION-EDITOR.ACTIONS.REVERSE' | translate }}</button>
<button [disabled]="saving" *ngIf="isLockedByUser && !viewOnly && hasReversableStatus() == false" mat-raised-button class="description-save-btn mr-2" type="button" (click)="finalize()">{{ 'DESCRIPTION-EDITOR.ACTIONS.FINALIZE' | translate }}</button>
<button [disabled]="saving" *ngIf="!isLockedByUser" mat-raised-button disabled class="description-save-btn cursor-default" type="button">{{ 'DMP-OVERVIEW.LOCKED' | translate}}</button>
<button [disabled]="saving" *ngIf="hasReversableStatus() && isLockedByUser" mat-raised-button class="description-save-btn mr-2" (click)="reverse()" type="button">{{ 'DESCRIPTION-EDITOR.ACTIONS.REVERSE' | translate }}</button>
</div>
</div>
</div>
@ -116,7 +116,7 @@
<div>{{'DESCRIPTION-EDITOR.TOC.NEXT' | translate}}</div>
<span class="material-icons">chevron_right</span>
</div>
<button [disabled]="saving" (click)="save(saveAnd.addNew)" *ngIf="(step === maxStep) && !lockStatus && formGroup.get('descriptionTemplateId').value && !viewOnly" mat-raised-button type="button" class="col-auto stepper-btn add-description-btn ml-auto">
<button [disabled]="saving" (click)="save(saveAnd.addNew)" *ngIf="(step === maxStep) && isLockedByUser && formGroup.get('descriptionTemplateId').value && !viewOnly" mat-raised-button type="button" class="col-auto stepper-btn add-description-btn ml-auto">
{{ 'DESCRIPTION-EDITOR.ACTIONS.SAVE-AND-ADD-NEW' | translate }}
</button>
</div>

View File

@ -195,7 +195,7 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
//Regular Editor case
if (itemId != null && newDmpId == null) {
this.checkLock(this.item.id, LockTargetType.Description);
this.checkLock(this.item.id, LockTargetType.Description, 'DESCRIPTION-EDITOR.LOCKED-DIALOG.TITLE', 'DESCRIPTION-EDITOR.LOCKED-DIALOG.MESSAGE');
} else if (dmpId != null && dmpSectionId != null) {
this.isNew = true;

View File

@ -23,11 +23,11 @@
{{'DESCRIPTION-OVERVIEW.PUBLIC' | translate}}
</div>
<span *ngIf="description.status === descriptionStatusEnum.Finalized && description.dmp.accessType === dmpAccessTypeEnum.Public" class="ml-2 mr-2">.</span>
<div *ngIf="lockStatus" class="d-flex flex-row">
<div *ngIf="isLocked" class="d-flex flex-row">
<mat-icon class="status-icon">lock_outline</mat-icon>
{{'DESCRIPTION-OVERVIEW.LOCKED' | translate}}
</div>
<span *ngIf="lockStatus" class="ml-2 mr-2">.</span>
<span *ngIf="isLocked" class="ml-2 mr-2">.</span>
<div class="d-flex mr-2">{{'DESCRIPTION-OVERVIEW.EDITED' | translate}} :
{{description.updatedAt | dateTimeCultureFormatter: "d MMMM y"}}
</div>
@ -39,13 +39,13 @@
</div>
</div>
<div class="row mb-4 pb-3">
<button *ngIf="canEdit && isDraftDescription(description) && !lockStatus" (click)="editClicked(description)" mat-mini-fab class="mr-3 actions-btn" matTooltip="{{'DESCRIPTION-OVERVIEW.ACTIONS.EDIT' | translate}}" matTooltipPosition="above">
<button *ngIf="canEdit && isDraftDescription(description) && !isLocked" (click)="editClicked(description)" mat-mini-fab class="mr-3 actions-btn" matTooltip="{{'DESCRIPTION-OVERVIEW.ACTIONS.EDIT' | translate}}" matTooltipPosition="above">
<mat-icon class="mat-mini-fab-icon">create</mat-icon>
</button>
<button *ngIf="canEdit" (click)="openCopyToDmpDialog()" mat-mini-fab class="mr-3 actions-btn" matTooltip="{{'DESCRIPTION-OVERVIEW.ACTIONS.CLONE' | translate}}" matTooltipPosition="above">
<mat-icon class="mat-mini-fab-icon">content_copy</mat-icon>
</button>
<button *ngIf="canDelete && !lockStatus" (click)="deleteClicked()" mat-mini-fab class="mr-3 actions-btn" matTooltip="{{'DESCRIPTION-OVERVIEW.ACTIONS.DELETE' | translate}}" matTooltipPosition="above">
<button *ngIf="canDelete && !isLocked" (click)="deleteClicked()" mat-mini-fab class="mr-3 actions-btn" matTooltip="{{'DESCRIPTION-OVERVIEW.ACTIONS.DELETE' | translate}}" matTooltipPosition="above">
<mat-icon class="mat-mini-fab-icon">delete</mat-icon>
</button>
</div>
@ -92,7 +92,7 @@
</div>
<div class="col-md-4 col-lg-4 p-0">
<div class="frame mb-3 pt-4 pl-3 pr-5 pb-1" *ngIf="isAuthenticated()">
<div *ngIf="canFinalize && isDraftDescription(description) && !lockStatus">
<div *ngIf="canFinalize && isDraftDescription(description) && !isLocked">
<div class="row ml-0 mr-0 pl-4 d-flex align-items-center" (click)="finalize(description)">
<button mat-mini-fab class="finalize-btn">
<mat-icon class="mat-mini-fab-icon check-icon">check</mat-icon>

View File

@ -35,6 +35,8 @@ import { DescriptionCopyDialogComponent } from '../description-copy-dialog/descr
import { ReferenceType } from '@app/core/model/reference-type/reference-type';
import { AppPermission } from '@app/core/common/enum/permission.enum';
import { DescriptionValidationOutput } from '@app/ui/dmp/dmp-finalize-dialog/dmp-finalize-dialog.component';
import { LockService } from '@app/core/services/lock/lock.service';
import { PopupNotificationDialogComponent } from '@app/library/notification/popup/popup-notification.component';
@Component({
@ -52,7 +54,7 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni
hasPublishButton: boolean = true;
// breadCrumbs: Observable<BreadcrumbItem[]> = observableOf();
expand = false;
lockStatus: Boolean;
isLocked: Boolean;
descriptionStatusEnum = DescriptionStatus;
dmpAccessTypeEnum = DmpAccessType;
dmpStatusEnum = DmpStatus;
@ -82,6 +84,7 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni
public fileTransformerService: FileTransformerService,
private referenceTypeService: ReferenceTypeService,
private fb: UntypedFormBuilder,
private lockService: LockService
) {
super();
}
@ -160,19 +163,18 @@ export class DescriptionOverviewComponent extends BaseComponent implements OnIni
}
checkLockStatus(id: Guid) {
// TODO: add this
// this.lockService.checkLockStatus(id).pipe(takeUntil(this._destroyed))
// .subscribe(lockStatus => {
// this.lockStatus = lockStatus
// if (lockStatus) {
// this.dialog.open(PopupNotificationDialogComponent, {
// data: {
// title: this.language.instant('DESCRIPTION-OVERVIEW.LOCKED-DIALOG.TITLE'),
// message: this.language.instant('DESCRIPTION-OVERVIEW.LOCKED-DIALOG.MESSAGE')
// }, maxWidth: '30em'
// });
// }
// });
this.lockService.checkLockStatus(id).pipe(takeUntil(this._destroyed))
.subscribe(lockStatus => {
this.isLocked = lockStatus.status;
if (this.isLocked) {
this.dialog.open(PopupNotificationDialogComponent, {
data: {
title: this.language.instant('DESCRIPTION-OVERVIEW.LOCKED-DIALOG.TITLE'),
message: this.language.instant('DESCRIPTION-OVERVIEW.LOCKED-DIALOG.MESSAGE')
}, maxWidth: '30em'
});
}
});
}
onFetchingDeletedCallbackError(redirectRoot: string) {

View File

@ -1,11 +1,15 @@
<div class="form-container">
<div mat-dialog-title class="pl-0 pr-0 row d-flex justify-content-between m-0">
<div mat-dialog-title class="row d-flex p-0 mb-4">
<div class="col p-0">
<span class="title">{{'DASHBOARD.SELECT-DMP' | translate}}</span>
</div>
<div class="col-auto p-0">
<mat-icon class="close-icon" (click)="close()">close</mat-icon>
</div>
<div class="row content">
<div class="col dmp-form p-0">
<mat-form-field>
</div>
<div class="row mt-2 mb-4">
<div class="col-12">
<mat-form-field class="w-100">
<app-single-auto-complete [required]="true" [formControl]="formGroup.get('dmpId')" placeholder="{{'START-NEW-DESCRIPTION-DIALOG.SELECT-DMP' | translate}}" [configuration]="dmpAutoCompleteConfiguration"></app-single-auto-complete>
</mat-form-field>
</div>
@ -18,7 +22,7 @@
</mat-form-field>
</div>
</div>
<div class="row">
<div class="row mt-2">
<div class="col-auto pb-4">
<span>{{'DASHBOARD.ADD-NEW-DATASET.OPTIONS-NOT-ENOUGH' | translate}}</span>&nbsp;<span class="new-dmp" (click)="startNewDmp()">{{'DASHBOARD.ADD-NEW-DATASET.START-NEW-DMP' | translate}}</span>
</div>

View File

@ -5,7 +5,7 @@
.form-container {
width: 33rem;
min-height: 14rem;
padding: 1.0rem;
padding: 2.0rem;
}
.logo {
@ -101,10 +101,10 @@ min-width: 101px;
}
::ng-deep .dmp-form .mat-form-field-appearance-outline .mat-form-field-outline {
background: #fafafa !important;
// background: #fafafa !important;
}
::ng-deep .dmp-form .mat-form-field-appearance-outline .mat-form-field-infix {
font-size: 1rem;
padding: 0.6em 0 1em 0 !important;
// font-size: 1rem;
// padding: 0.6em 0 1em 0 !important;
}

View File

@ -90,12 +90,12 @@
<li *ngFor="let description of descriptionsInSection(section.id); let descriptionIndex = index" (click)="editDescription(description.id, false)" class="active-description">
<div class="d-flex flex-direction-row">
<div class="label" matTooltip="{{description.label}}">{{'DMP-EDITOR.DESCRIPTION' | translate}}: {{ description.label }}</div>
<mat-icon *ngIf="description.status !== descriptionStatusEnum.Finalized && canDeleteSection(section.id)" class="ml-2 mr-2 remove-description size-16" matTooltip="{{'DMP-EDITOR.ACTIONS.DELETE' | translate}}" (click)="$event.stopPropagation(); removeDescription(description.id)">close</mat-icon>
<mat-icon *ngIf="description.status !== descriptionStatusEnum.Finalized && canDeleteSection(section.id)" [ngClass]="{'drag-handle-disabled': formGroup.disabled}" class="ml-2 mr-2 remove-description size-16" matTooltip="{{'DMP-EDITOR.ACTIONS.DELETE' | translate}}" (click)="$event.stopPropagation(); removeDescription(description.id)">close</mat-icon>
<mat-icon *ngIf="description.status === descriptionStatusEnum.Finalized" class="ml-2 mr-2 status-icon check-icon size-16" matTooltip="{{'TYPES.DESCRIPTION-STATUS.FINALISED' | translate}}">check</mat-icon>
</div>
</li>
</ol>
<ul *ngIf="item.id && section.hasTemplates && canEditSection(section.id)" class="add-description-option">
<ul *ngIf="item.id && section.hasTemplates && canEditSection(section.id) && !formGroup.disabled" class="add-description-option">
<li>
<a class="add-description-action" [routerLink]="['/descriptions/edit/' + item.id + '/' + section.id]">
<mat-icon>add</mat-icon>{{'DMP-EDITOR.ACTIONS.ADD-DESCRIPTION-IN-SECTION' | translate}}
@ -215,7 +215,7 @@
</div>
</div>
<div class="col-auto">
<button mat-icon-button class="action-list-icon" matTooltip="{{'DMP-EDITOR.ACTIONS1.REMOVE-CONTACT' | translate}}" (click)="removeContact(contactIndex)" [disabled]="formGroup.disabled">
<button [disabled]="formGroup.disabled" mat-icon-button class="action-list-icon" matTooltip="{{'DMP-EDITOR.ACTIONS1.REMOVE-CONTACT' | translate}}" (click)="removeContact(contactIndex)" [disabled]="formGroup.disabled">
<mat-icon>delete</mat-icon>
</button>
</div>

View File

@ -198,7 +198,7 @@ export class DmpEditorComponent extends BaseEditor<DmpEditorModel, Dmp> implemen
}
if (this.item.id != null) {
this.checkLock(this.item.id, LockTargetType.Dmp);
this.checkLock(this.item.id, LockTargetType.Dmp, 'DMP-EDITOR.LOCKED-DIALOG.TITLE', 'DMP-EDITOR.LOCKED-DIALOG.MESSAGE');
}
} catch (error) {
this.logger.error('Could not parse Dmp item: ' + data + error);

View File

@ -16,13 +16,13 @@
<p class="ml-0 mb-0 label2-txt">
{{ enumUtils.toDmpUserRolesString(dmpService.getCurrentUserRolesInDmp(dmp?.dmpUsers)) }}
</div>
<span *ngIf="isUserDmpRelated() && (isPublishedDmp() || lockStatus)" class="ml-2 mr-2">.</span>
<span *ngIf="isUserDmpRelated() && (isPublishedDmp() || isLocked)" class="ml-2 mr-2">.</span>
<div *ngIf="isPublishedDmp()" class="d-flex flex-row">
<mat-icon class="status-icon">public</mat-icon>
{{'DMP-OVERVIEW.PUBLIC' | translate}}
</div>
<span *ngIf="isPublishedDmp() && lockStatus" class="ml-2 mr-2">.</span>
<div *ngIf="lockStatus" class="d-flex flex-row">
<span *ngIf="isPublishedDmp() && isLocked" class="ml-2 mr-2">.</span>
<div *ngIf="isLocked" class="d-flex flex-row">
<mat-icon class="status-icon">lock_outline</mat-icon>
{{'DMP-OVERVIEW.LOCKED' | translate}}
</div>
@ -43,14 +43,14 @@
</div>
</div>
<div class="row">
<!-- <button *ngIf="isDraftDmp(dmp) && isDmpOwner(dmp) && !lockStatus" (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="canEditDmp() && !lockStatus" (click)="editClicked()" 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"> -->
<button *ngIf="canEditDmp() && !isLocked" (click)="editClicked()" mat-mini-fab class="mr-3 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>
</button>
<button *ngIf="canCloneDmp()" (click)="cloneClicked()" mat-mini-fab class="mr-3 d-flex justify-content-center align-items-center" matTooltip="{{'DMP-OVERVIEW.ACTIONS.CLONE' | translate}}" matTooltipPosition="above">
<mat-icon class="mat-mini-fab-icon">content_copy</mat-icon>
</button>
<button *ngIf="canDeleteDmp() && !lockStatus" (click)="deleteClicked()" mat-mini-fab class="mr-3 d-flex justify-content-center align-items-center" matTooltip="{{'DMP-OVERVIEW.ACTIONS.DELETE' | translate}}" matTooltipPosition="above">
<button *ngIf="canDeleteDmp() && !isLocked" (click)="deleteClicked()" mat-mini-fab class="mr-3 d-flex justify-content-center align-items-center" matTooltip="{{'DMP-OVERVIEW.ACTIONS.DELETE' | translate}}" matTooltipPosition="above">
<mat-icon class="mat-mini-fab-icon">delete</mat-icon>
</button>
</div>
@ -98,7 +98,7 @@
<span class="material-icons">horizontal_rule</span>
</div>
</div>
<div class="row mt-2 add-description-txt" *ngIf="!lockStatus">
<div class="row mt-2 add-description-txt" *ngIf="!isLocked">
<a class="add-description-btn" *ngIf="canEditDmp()" [routerLink]="['/plans/edit/' + dmp.id]" target="_blank">
<mat-icon>add</mat-icon>
{{'DMP-OVERVIEW.ACTIONS.ADD-DESCRIPTION' | translate}}
@ -133,7 +133,7 @@
</div>
</div>
<div class="frame mb-3 pt-4 pl-3 pr-5 pb-1" *ngIf="isAuthenticated()">
<div *ngIf="isDraftDmp() && canFinalizeDmp() && !lockStatus">
<div *ngIf="isDraftDmp() && canFinalizeDmp() && !isLocked">
<div class="row ml-0 mr-0 pl-4 d-flex align-items-center" (click)="finalize(dmp)">
<button mat-mini-fab class="finalize-btn">
<mat-icon class="mat-mini-fab-icon">check</mat-icon>

View File

@ -63,7 +63,7 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
hasPublishButton: boolean = true;
// breadCrumbs: Observable<BreadcrumbItem[]> = observableOf();
// isUserOwner: boolean;
lockStatus: Boolean;
isLocked: Boolean;
textMessage: any;
pastVersions: Dmp[]; //TODO: get these from the backend
selectedModel: EntityDoi;
@ -709,8 +709,8 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
checkLockStatus(id: Guid) {
this.lockService.checkLockStatus(Guid.parse(id.toString())).pipe(takeUntil(this._destroyed))
.subscribe(lockStatus => {
this.lockStatus = lockStatus.status;
if (this.lockStatus) {
this.isLocked = lockStatus.status;
if (this.isLocked) {
this.dialog.open(PopupNotificationDialogComponent, {
data: {
title: this.language.instant('DMP-OVERVIEW.LOCKED-DIALOG.TITLE'),

View File

@ -736,6 +736,10 @@
"CONFIRM-NO": "No, keep them.",
"REMOVE-SUCCESS": "Invalid visibility rules were removed successfully."
}
},
"LOCKED-DIALOG": {
"TITLE": "Description Template is locked",
"MESSAGE": "Somebody else is modifying the description template at this moment. You may view the description template but you cannot make any changes. If you would like to modify it please come back later."
}
},
"GRANT-LISTING": {
@ -1041,8 +1045,8 @@
"NEGATIVE": "No"
},
"LOCKED-DIALOG": {
"TITLE": "Dataset is locked",
"MESSAGE": "Somebody else is modifying the dataset at this moment. If you would like to modify or view it, please come back later."
"TITLE": "Description is locked",
"MESSAGE": "Somebody else is modifying the description at this moment. If you would like to modify or view it, please come back later."
},
"FINALISE-POPUP": {
"MESSAGE": "You will be directed to Dataset Editor where you can finalize the selected dataset. Would you like to proceed?",
@ -1125,6 +1129,10 @@
},
"MESSAGES":{
"MISSING-FIELDS": "There are some required fields left unfilled. Please check the DMP and make sure that all required questions are answered and URLs are provided with valid input. (Missing fields are marked in red color)"
},
"LOCKED-DIALOG": {
"TITLE": "Description is locked",
"MESSAGE": "Somebody else is modifying the description at this moment. You may view the description but you cannot make any changes. If you would like to modify it please come back later."
}
},
"DESCRIPTION-COPY-DIALOG": {
@ -1824,6 +1832,10 @@
"MESSAGE": "Would you like to delete this DMP template?",
"CONFIRM-BUTTON": "Yes, delete",
"CANCEL-BUTTON": "No"
},
"LOCKED-DIALOG": {
"TITLE": "Dmp Blueprint is locked",
"MESSAGE": "Somebody else is modifying the dmp blueprint at this moment. You may view the dmp blueprint but you cannot make any changes. If you would like to modify it please come back later."
}
},
"GRANT-EDITOR": {
@ -2020,7 +2032,7 @@
"SAVE": "Save",
"CANCEL": "Cancel"
},
"LOCKED1": {
"LOCKED-DIALOG": {
"TITLE": "DMP is locked",
"MESSAGE": "Somebody else is modifying the DMP at this moment. You may view the dataset but you cannot make any changes."
}

View File

@ -34,6 +34,7 @@ export abstract class BaseEditor<EditorModelType extends BaseEditorModel, Entity
isNew = true;
isDeleted = false;
isLocked: Boolean = false;
isLockedByUser: Boolean = false;
formGroup: UntypedFormGroup = null;
lookupParams: any;
@ -171,7 +172,7 @@ export abstract class BaseEditor<EditorModelType extends BaseEditorModel, Entity
// Lock
//
//
protected checkLock(itemId: Guid, targetType: LockTargetType) {
protected checkLock(itemId: Guid, targetType: LockTargetType, title: string, message: string) {
if (itemId != null) {
this.isNew = false;
// check if locked.
@ -181,10 +182,12 @@ export abstract class BaseEditor<EditorModelType extends BaseEditorModel, Entity
this.formGroup.disable();
this.dialog.open(PopupNotificationDialogComponent, {
data: {
title: this.language.instant('DATASET-WIZARD.LOCKED.TITLE'),
message: this.language.instant('DATASET-WIZARD.LOCKED.MESSAGE')
title: this.language.instant(title),
message: this.language.instant(message)
}, maxWidth: '30em'
});
} else{
this.isLockedByUser = true;
}
if (!this.isLocked && !isNullOrUndefined(this.authService.currentAccountIsAuthenticated())) {