ui fixes and add dmpBlueprintVersionStatus lookup field

This commit is contained in:
amentis 2024-03-06 11:53:40 +02:00
parent 043d4d2e96
commit 5851c2ff26
11 changed files with 51 additions and 14 deletions

View File

@ -274,7 +274,7 @@ public class DescriptionTemplateQuery extends QueryBase<DescriptionTemplateEntit
predicates.add(inClause); predicates.add(inClause);
} }
if (this.like != null && !this.like.isEmpty()) { if (this.like != null && !this.like.isEmpty()) {
predicates.add(queryContext.CriteriaBuilder.or(queryContext.CriteriaBuilder.like(queryContext.Root.get(DescriptionTemplateEntity._description), this.like), predicates.add(queryContext.CriteriaBuilder.or(queryContext.CriteriaBuilder.like(queryContext.Root.get(DescriptionTemplateEntity._label), this.like),
queryContext.CriteriaBuilder.like(queryContext.Root.get(DescriptionTemplateEntity._description), this.like) queryContext.CriteriaBuilder.like(queryContext.Root.get(DescriptionTemplateEntity._description), this.like)
)); ));
} }

View File

@ -1,6 +1,7 @@
package eu.eudat.query.lookup; package eu.eudat.query.lookup;
import eu.eudat.commons.enums.DmpBlueprintStatus; import eu.eudat.commons.enums.DmpBlueprintStatus;
import eu.eudat.commons.enums.DmpBlueprintVersionStatus;
import eu.eudat.commons.enums.IsActive; import eu.eudat.commons.enums.IsActive;
import eu.eudat.query.DmpBlueprintQuery; import eu.eudat.query.DmpBlueprintQuery;
import gr.cite.tools.data.query.Lookup; import gr.cite.tools.data.query.Lookup;
@ -23,6 +24,8 @@ public class DmpBlueprintLookup extends Lookup {
private List<UUID> groupIds; private List<UUID> groupIds;
private List<DmpBlueprintVersionStatus> versionStatuses;
public String getLike() { public String getLike() {
return like; return like;
} }
@ -63,6 +66,14 @@ public class DmpBlueprintLookup extends Lookup {
this.excludedIds = excludedIds; this.excludedIds = excludedIds;
} }
public List<DmpBlueprintVersionStatus> getVersionStatuses() {
return versionStatuses;
}
public void setVersionStatuses(List<DmpBlueprintVersionStatus> versionStatuses) {
this.versionStatuses = versionStatuses;
}
public List<UUID> getGroupIds() { public List<UUID> getGroupIds() {
return groupIds; return groupIds;
} }
@ -85,6 +96,8 @@ public class DmpBlueprintLookup extends Lookup {
query.excludedIds(this.excludedIds); query.excludedIds(this.excludedIds);
if (this.groupIds != null) if (this.groupIds != null)
query.groupIds(this.groupIds); query.groupIds(this.groupIds);
if (this.versionStatuses != null)
query.versionStatuses(this.versionStatuses);
this.enrichCommon(query); this.enrichCommon(query);

View File

@ -1,4 +1,5 @@
export enum DescriptionTemplateVersionStatus { export enum DescriptionTemplateVersionStatus {
Current = 0, Current = 0,
Previous = 1 Previous = 1,
NotFinalized = 2
} }

View File

@ -0,0 +1,5 @@
export enum DmpBlueprintVersionStatus {
Current = 0,
Previous = 1,
NotFinalized = 2
}

View File

@ -2,6 +2,7 @@ import { Lookup } from '@common/model/lookup';
import { Guid } from '@common/types/guid'; import { Guid } from '@common/types/guid';
import { IsActive } from '../common/enum/is-active.enum'; import { IsActive } from '../common/enum/is-active.enum';
import { DmpBlueprintStatus } from '../common/enum/dmp-blueprint-status'; import { DmpBlueprintStatus } from '../common/enum/dmp-blueprint-status';
import { DmpBlueprintVersionStatus } from '../common/enum/dmp-blueprint-version-status';
export class DmpBlueprintLookup extends Lookup implements DmpBlueprintFilter { export class DmpBlueprintLookup extends Lookup implements DmpBlueprintFilter {
ids: Guid[]; ids: Guid[];
@ -10,6 +11,7 @@ export class DmpBlueprintLookup extends Lookup implements DmpBlueprintFilter {
isActive: IsActive[]; isActive: IsActive[];
statuses: DmpBlueprintStatus[]; statuses: DmpBlueprintStatus[];
groupIds: Guid[]; groupIds: Guid[];
versionStatuses: DmpBlueprintVersionStatus[];
constructor() { constructor() {
super(); super();
@ -22,4 +24,5 @@ export interface DmpBlueprintFilter {
like: string; like: string;
isActive: IsActive[]; isActive: IsActive[];
statuses: DmpBlueprintStatus[]; statuses: DmpBlueprintStatus[];
versionStatuses: DmpBlueprintVersionStatus[];
} }

View File

@ -28,6 +28,7 @@ import { DescriptionTemplateService } from '@app/core/services/description-templ
import { DescriptionTemplateStatus } from '@app/core/common/enum/description-template-status'; import { DescriptionTemplateStatus } from '@app/core/common/enum/description-template-status';
import { DescriptionTemplateLookup } from '@app/core/query/description-template.lookup'; import { DescriptionTemplateLookup } from '@app/core/query/description-template.lookup';
import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe'; import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe';
import { DescriptionTemplateVersionStatus } from '@app/core/common/enum/description-template-version-status';
@Component({ @Component({
@ -93,8 +94,12 @@ export class DescriptionTemplateListingComponent extends BaseListingComponent<De
lookup.metadata = { countAll: true }; lookup.metadata = { countAll: true };
lookup.page = { offset: 0, size: this.ITEMS_PER_PAGE }; lookup.page = { offset: 0, size: this.ITEMS_PER_PAGE };
lookup.isActive = [IsActive.Active]; lookup.isActive = [IsActive.Active];
lookup.versionStatuses = [DescriptionTemplateVersionStatus.Current, DescriptionTemplateVersionStatus.NotFinalized];
lookup.order = { items: [this.toDescSortField(nameof<DescriptionTemplate>(x => x.createdAt))] }; lookup.order = { items: [this.toDescSortField(nameof<DescriptionTemplate>(x => x.createdAt))] };
if (this.mode && this.mode == 'versions-listing') lookup.groupIds = [Guid.parse(this.route.snapshot.paramMap.get('groupid'))] if (this.mode && this.mode == 'versions-listing') {
lookup.groupIds = [Guid.parse(this.route.snapshot.paramMap.get('groupid'))];
lookup.versionStatuses = null;
}
this.updateOrderUiFields(lookup.order); this.updateOrderUiFields(lookup.order);
lookup.project = { lookup.project = {

View File

@ -28,6 +28,7 @@ import { takeUntil } from 'rxjs/operators';
import { nameof } from 'ts-simple-nameof'; import { nameof } from 'ts-simple-nameof';
import { ImportDmpBlueprintDialogComponent } from './import-dmp-blueprint/import-dmp-blueprint.dialog.component'; import { ImportDmpBlueprintDialogComponent } from './import-dmp-blueprint/import-dmp-blueprint.dialog.component';
import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe'; import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe';
import { DmpBlueprintVersionStatus } from '@app/core/common/enum/dmp-blueprint-version-status';
@Component({ @Component({
@ -92,8 +93,12 @@ export class DmpBlueprintListingComponent extends BaseListingComponent<DmpBluepr
lookup.metadata = { countAll: true }; lookup.metadata = { countAll: true };
lookup.page = { offset: 0, size: this.ITEMS_PER_PAGE }; lookup.page = { offset: 0, size: this.ITEMS_PER_PAGE };
lookup.isActive = [IsActive.Active]; lookup.isActive = [IsActive.Active];
lookup.versionStatuses = [DmpBlueprintVersionStatus.Current, DmpBlueprintVersionStatus.NotFinalized];
lookup.order = { items: [this.toDescSortField(nameof<DmpBlueprint>(x => x.createdAt))] }; lookup.order = { items: [this.toDescSortField(nameof<DmpBlueprint>(x => x.createdAt))] };
if (this.mode && this.mode == 'versions-listing') lookup.groupIds = [Guid.parse(this.route.snapshot.paramMap.get('groupid'))] if (this.mode && this.mode == 'versions-listing') {
lookup.groupIds = [Guid.parse(this.route.snapshot.paramMap.get('groupid'))];
lookup.versionStatuses = null;
}
this.updateOrderUiFields(lookup.order); this.updateOrderUiFields(lookup.order);
lookup.project = { lookup.project = {

View File

@ -14,6 +14,7 @@ import { Description } from '@app/core/model/description/description';
import { Dmp, DmpUser } from '@app/core/model/dmp/dmp'; import { Dmp, DmpUser } from '@app/core/model/dmp/dmp';
import { DmpReference } from '@app/core/model/dmp/dmp-reference'; import { DmpReference } from '@app/core/model/dmp/dmp-reference';
import { FileFormat } from '@app/core/model/file/file-format.model'; import { FileFormat } from '@app/core/model/file/file-format.model';
import { ReferenceType } from '@app/core/model/reference-type/reference-type';
import { Reference } from '@app/core/model/reference/reference'; import { Reference } from '@app/core/model/reference/reference';
import { DescriptionLookup } from '@app/core/query/description.lookup'; import { DescriptionLookup } from '@app/core/query/description.lookup';
import { DmpLookup } from '@app/core/query/dmp.lookup'; import { DmpLookup } from '@app/core/query/dmp.lookup';
@ -197,7 +198,7 @@ export class DescriptionListingComponent extends BaseComponent implements OnInit
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.id)].join('.'), [nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.id)].join('.'),
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.id)].join('.'), [nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.id)].join('.'),
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.label)].join('.'), [nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.label)].join('.'),
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.type)].join('.'), [nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.type), nameof<ReferenceType>(x => x.id)].join('.'),
[nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.reference)].join('.'), [nameof<Description>(x => x.dmp), nameof<Dmp>(x => x.dmpReferences), nameof<DmpReference>(x => x.reference), nameof<Reference>(x => x.reference)].join('.'),
] ]
}; };

View File

@ -29,10 +29,10 @@
</div> </div>
<span *ngIf="lockStatus" class="ml-2 mr-2">.</span> <span *ngIf="lockStatus" class="ml-2 mr-2">.</span>
<div class="d-flex mr-2">{{'DESCRIPTION-OVERVIEW.EDITED' | translate}} : <div class="d-flex mr-2">{{'DESCRIPTION-OVERVIEW.EDITED' | translate}} :
{{description.modified | dateTimeCultureFormatter: "d MMMM y"}} {{description.updatedAt | dateTimeCultureFormatter: "d MMMM y"}}
</div> </div>
<div class="d-flex ml-2 mr-4"> <div class="d-flex ml-2 mr-4">
<div *ngIf="description.status === descriptionStatusEnum.Draft" class="d-flex flex-row uppercase"> <div *ngIf="description.status === descriptionStatusEnum.Finalized" class="d-flex flex-row uppercase">
<mat-icon class="status-icon check-icon">check</mat-icon> <mat-icon class="status-icon check-icon">check</mat-icon>
{{'DESCRIPTION-OVERVIEW.FINALISED' | translate}} {{'DESCRIPTION-OVERVIEW.FINALISED' | translate}}
</div> </div>

View File

@ -44,7 +44,7 @@
</div> </div>
<div class="row"> <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="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="isDraftDmp(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">
<mat-icon class="mat-mini-fab-icon">create</mat-icon> <mat-icon class="mat-mini-fab-icon">create</mat-icon>
</button> </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"> <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">
@ -99,7 +99,7 @@
</div> </div>
</div> </div>
<div class="row mt-2 add-description-txt" *ngIf="!lockStatus"> <div class="row mt-2 add-description-txt" *ngIf="!lockStatus">
<a class="add-description-btn" *ngIf="isDraftDmp(dmp)" [routerLink]="['/plans/edit/' + dmp.id]" target="_blank"> <a class="add-description-btn" *ngIf="canEditDmp()" [routerLink]="['/plans/edit/' + dmp.id]" target="_blank">
<mat-icon>add</mat-icon> <mat-icon>add</mat-icon>
{{'DMP-OVERVIEW.ACTIONS.ADD-DESCRIPTION' | translate}} {{'DMP-OVERVIEW.ACTIONS.ADD-DESCRIPTION' | translate}}
</a> </a>
@ -133,7 +133,7 @@
</div> </div>
</div> </div>
<div class="frame mb-3 pt-4 pl-3 pr-5 pb-1"> <div class="frame mb-3 pt-4 pl-3 pr-5 pb-1">
<div *ngIf="isDraftDmp(dmp) && canFinalizeDmp() && !lockStatus"> <div *ngIf="isDraftDmp() && canFinalizeDmp() && !lockStatus">
<div class="row ml-0 mr-0 pl-4 d-flex align-items-center" (click)="finalize(dmp)"> <div class="row ml-0 mr-0 pl-4 d-flex align-items-center" (click)="finalize(dmp)">
<button mat-mini-fab class="finalize-btn"> <button mat-mini-fab class="finalize-btn">
<mat-icon class="mat-mini-fab-icon">check</mat-icon> <mat-icon class="mat-mini-fab-icon">check</mat-icon>

View File

@ -193,6 +193,10 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
if (principalId) return !!this.dmp.dmpUsers?.find(x => (x.role === DmpUserRole.Owner) && (principalId === x.id)); if (principalId) return !!this.dmp.dmpUsers?.find(x => (x.role === DmpUserRole.Owner) && (principalId === x.id));
} }
canEditDmp(): boolean{
return (this.isDraftDmp()) && (this.isDmpOwner() || this.authentication.hasPermission(AppPermission.EditDmp));
}
canCreateNewVersion(): boolean { canCreateNewVersion(): boolean {
return this.isDmpOwner() || this.authentication.hasPermission(AppPermission.CreateNewVersionDmp); return this.isDmpOwner() || this.authentication.hasPermission(AppPermission.CreateNewVersionDmp);
} }
@ -221,8 +225,8 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
return this.isDmpOwner() || this.authentication.hasPermission(AppPermission.AssignDmpUsers); return this.isDmpOwner() || this.authentication.hasPermission(AppPermission.AssignDmpUsers);
} }
editClicked(dmp: Dmp) { editClicked() {
this.router.navigate(['/plans/edit/', dmp.id]); this.router.navigate(['/plans/edit/', this.dmp.id]);
} }
cloneClicked() { cloneClicked() {
@ -442,8 +446,8 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
return this.dmp.dmpUsers?.some(x => (x.user.id === principalId)); return this.dmp.dmpUsers?.some(x => (x.user.id === principalId));
} }
isDraftDmp(dmp: Dmp) { isDraftDmp() {
return dmp.status == DmpStatus.Draft; return this.dmp.status == DmpStatus.Draft;
} }
isFinalizedDmp(dmp: Dmp) { isFinalizedDmp(dmp: Dmp) {