ui fixes and add dmpBlueprintVersionStatus lookup field
This commit is contained in:
parent
043d4d2e96
commit
5851c2ff26
|
@ -274,7 +274,7 @@ public class DescriptionTemplateQuery extends QueryBase<DescriptionTemplateEntit
|
|||
predicates.add(inClause);
|
||||
}
|
||||
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)
|
||||
));
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package eu.eudat.query.lookup;
|
||||
|
||||
import eu.eudat.commons.enums.DmpBlueprintStatus;
|
||||
import eu.eudat.commons.enums.DmpBlueprintVersionStatus;
|
||||
import eu.eudat.commons.enums.IsActive;
|
||||
import eu.eudat.query.DmpBlueprintQuery;
|
||||
import gr.cite.tools.data.query.Lookup;
|
||||
|
@ -23,6 +24,8 @@ public class DmpBlueprintLookup extends Lookup {
|
|||
|
||||
private List<UUID> groupIds;
|
||||
|
||||
private List<DmpBlueprintVersionStatus> versionStatuses;
|
||||
|
||||
public String getLike() {
|
||||
return like;
|
||||
}
|
||||
|
@ -63,6 +66,14 @@ public class DmpBlueprintLookup extends Lookup {
|
|||
this.excludedIds = excludedIds;
|
||||
}
|
||||
|
||||
public List<DmpBlueprintVersionStatus> getVersionStatuses() {
|
||||
return versionStatuses;
|
||||
}
|
||||
|
||||
public void setVersionStatuses(List<DmpBlueprintVersionStatus> versionStatuses) {
|
||||
this.versionStatuses = versionStatuses;
|
||||
}
|
||||
|
||||
public List<UUID> getGroupIds() {
|
||||
return groupIds;
|
||||
}
|
||||
|
@ -85,6 +96,8 @@ public class DmpBlueprintLookup extends Lookup {
|
|||
query.excludedIds(this.excludedIds);
|
||||
if (this.groupIds != null)
|
||||
query.groupIds(this.groupIds);
|
||||
if (this.versionStatuses != null)
|
||||
query.versionStatuses(this.versionStatuses);
|
||||
|
||||
this.enrichCommon(query);
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
export enum DescriptionTemplateVersionStatus {
|
||||
Current = 0,
|
||||
Previous = 1
|
||||
Previous = 1,
|
||||
NotFinalized = 2
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
export enum DmpBlueprintVersionStatus {
|
||||
Current = 0,
|
||||
Previous = 1,
|
||||
NotFinalized = 2
|
||||
}
|
|
@ -2,6 +2,7 @@ import { Lookup } from '@common/model/lookup';
|
|||
import { Guid } from '@common/types/guid';
|
||||
import { IsActive } from '../common/enum/is-active.enum';
|
||||
import { DmpBlueprintStatus } from '../common/enum/dmp-blueprint-status';
|
||||
import { DmpBlueprintVersionStatus } from '../common/enum/dmp-blueprint-version-status';
|
||||
|
||||
export class DmpBlueprintLookup extends Lookup implements DmpBlueprintFilter {
|
||||
ids: Guid[];
|
||||
|
@ -10,6 +11,7 @@ export class DmpBlueprintLookup extends Lookup implements DmpBlueprintFilter {
|
|||
isActive: IsActive[];
|
||||
statuses: DmpBlueprintStatus[];
|
||||
groupIds: Guid[];
|
||||
versionStatuses: DmpBlueprintVersionStatus[];
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
|
@ -22,4 +24,5 @@ export interface DmpBlueprintFilter {
|
|||
like: string;
|
||||
isActive: IsActive[];
|
||||
statuses: DmpBlueprintStatus[];
|
||||
versionStatuses: DmpBlueprintVersionStatus[];
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ import { DescriptionTemplateService } from '@app/core/services/description-templ
|
|||
import { DescriptionTemplateStatus } from '@app/core/common/enum/description-template-status';
|
||||
import { DescriptionTemplateLookup } from '@app/core/query/description-template.lookup';
|
||||
import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe';
|
||||
import { DescriptionTemplateVersionStatus } from '@app/core/common/enum/description-template-version-status';
|
||||
|
||||
|
||||
@Component({
|
||||
|
@ -93,8 +94,12 @@ export class DescriptionTemplateListingComponent extends BaseListingComponent<De
|
|||
lookup.metadata = { countAll: true };
|
||||
lookup.page = { offset: 0, size: this.ITEMS_PER_PAGE };
|
||||
lookup.isActive = [IsActive.Active];
|
||||
lookup.versionStatuses = [DescriptionTemplateVersionStatus.Current, DescriptionTemplateVersionStatus.NotFinalized];
|
||||
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);
|
||||
|
||||
lookup.project = {
|
||||
|
|
|
@ -28,6 +28,7 @@ import { takeUntil } from 'rxjs/operators';
|
|||
import { nameof } from 'ts-simple-nameof';
|
||||
import { ImportDmpBlueprintDialogComponent } from './import-dmp-blueprint/import-dmp-blueprint.dialog.component';
|
||||
import { IsActiveTypePipe } from '@common/formatting/pipes/is-active-type.pipe';
|
||||
import { DmpBlueprintVersionStatus } from '@app/core/common/enum/dmp-blueprint-version-status';
|
||||
|
||||
|
||||
@Component({
|
||||
|
@ -92,8 +93,12 @@ export class DmpBlueprintListingComponent extends BaseListingComponent<DmpBluepr
|
|||
lookup.metadata = { countAll: true };
|
||||
lookup.page = { offset: 0, size: this.ITEMS_PER_PAGE };
|
||||
lookup.isActive = [IsActive.Active];
|
||||
lookup.versionStatuses = [DmpBlueprintVersionStatus.Current, DmpBlueprintVersionStatus.NotFinalized];
|
||||
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);
|
||||
|
||||
lookup.project = {
|
||||
|
|
|
@ -14,6 +14,7 @@ import { Description } from '@app/core/model/description/description';
|
|||
import { Dmp, DmpUser } from '@app/core/model/dmp/dmp';
|
||||
import { DmpReference } from '@app/core/model/dmp/dmp-reference';
|
||||
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 { DescriptionLookup } from '@app/core/query/description.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.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.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('.'),
|
||||
]
|
||||
};
|
||||
|
|
|
@ -29,10 +29,10 @@
|
|||
</div>
|
||||
<span *ngIf="lockStatus" class="ml-2 mr-2">.</span>
|
||||
<div class="d-flex mr-2">{{'DESCRIPTION-OVERVIEW.EDITED' | translate}} :
|
||||
{{description.modified | dateTimeCultureFormatter: "d MMMM y"}}
|
||||
{{description.updatedAt | dateTimeCultureFormatter: "d MMMM y"}}
|
||||
</div>
|
||||
<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>
|
||||
{{'DESCRIPTION-OVERVIEW.FINALISED' | translate}}
|
||||
</div>
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
</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="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>
|
||||
</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">
|
||||
|
@ -99,7 +99,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<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>
|
||||
{{'DMP-OVERVIEW.ACTIONS.ADD-DESCRIPTION' | translate}}
|
||||
</a>
|
||||
|
@ -133,7 +133,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<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)">
|
||||
<button mat-mini-fab class="finalize-btn">
|
||||
<mat-icon class="mat-mini-fab-icon">check</mat-icon>
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
||||
canEditDmp(): boolean{
|
||||
return (this.isDraftDmp()) && (this.isDmpOwner() || this.authentication.hasPermission(AppPermission.EditDmp));
|
||||
}
|
||||
|
||||
canCreateNewVersion(): boolean {
|
||||
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);
|
||||
}
|
||||
|
||||
editClicked(dmp: Dmp) {
|
||||
this.router.navigate(['/plans/edit/', dmp.id]);
|
||||
editClicked() {
|
||||
this.router.navigate(['/plans/edit/', this.dmp.id]);
|
||||
}
|
||||
|
||||
cloneClicked() {
|
||||
|
@ -442,8 +446,8 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
|
|||
return this.dmp.dmpUsers?.some(x => (x.user.id === principalId));
|
||||
}
|
||||
|
||||
isDraftDmp(dmp: Dmp) {
|
||||
return dmp.status == DmpStatus.Draft;
|
||||
isDraftDmp() {
|
||||
return this.dmp.status == DmpStatus.Draft;
|
||||
}
|
||||
|
||||
isFinalizedDmp(dmp: Dmp) {
|
||||
|
|
Loading…
Reference in New Issue