Merge branch 'dmp-refactoring' of https://code-repo.d4science.org/MaDgiK-CITE/argos into dmp-refactoring
This commit is contained in:
commit
abb7aca6da
|
@ -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));
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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'),
|
||||
|
|
|
@ -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."
|
||||
}
|
||||
|
|
|
@ -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())) {
|
||||
|
|
Loading…
Reference in New Issue