Added all versions listing on dmp blueprints, actions menu on that listing not yet functional

This commit is contained in:
Thomas Georgios Giannos 2024-02-07 17:13:13 +02:00
parent 02cd51b751
commit 6e767f1e5e
9 changed files with 60 additions and 22 deletions

View File

@ -21,6 +21,8 @@ public class DmpBlueprintLookup extends Lookup {
private List<UUID> excludedIds; private List<UUID> excludedIds;
private List<UUID> groupIds;
public String getLike() { public String getLike() {
return like; return like;
} }
@ -37,6 +39,14 @@ public class DmpBlueprintLookup extends Lookup {
this.isActive = isActive; this.isActive = isActive;
} }
public List<DmpBlueprintStatus> getStatuses() {
return statuses;
}
public void setStatuses(List<DmpBlueprintStatus> statuses) {
this.statuses = statuses;
}
public List<UUID> getIds() { public List<UUID> getIds() {
return ids; return ids;
} }
@ -49,25 +59,32 @@ public class DmpBlueprintLookup extends Lookup {
return excludedIds; return excludedIds;
} }
public void setExcludedIds(List<UUID> excludeIds) { public void setExcludedIds(List<UUID> excludedIds) {
this.excludedIds = excludeIds; this.excludedIds = excludedIds;
} }
public List<DmpBlueprintStatus> getStatuses() { public List<UUID> getGroupIds() {
return statuses; return groupIds;
} }
public void setStatuses(List<DmpBlueprintStatus> statuses) { public void setGroupIds(List<UUID> groupIds) {
this.statuses = statuses; this.groupIds = groupIds;
} }
public DmpBlueprintQuery enrich(QueryFactory queryFactory) { public DmpBlueprintQuery enrich(QueryFactory queryFactory) {
DmpBlueprintQuery query = queryFactory.query(DmpBlueprintQuery.class); DmpBlueprintQuery query = queryFactory.query(DmpBlueprintQuery.class);
if (this.like != null) query.like(this.like); if (this.like != null)
if (this.isActive != null) query.isActive(this.isActive); query.like(this.like);
if (this.statuses != null) query.statuses(this.statuses); if (this.isActive != null)
if (this.ids != null) query.ids(this.ids); query.isActive(this.isActive);
if (this.excludedIds != null) query.excludedIds(this.excludedIds); if (this.statuses != null)
query.statuses(this.statuses);
if (this.ids != null)
query.ids(this.ids);
if (this.excludedIds != null)
query.excludedIds(this.excludedIds);
if (this.groupIds != null)
query.groupIds(this.groupIds);
this.enrichCommon(query); this.enrichCommon(query);

View File

@ -407,7 +407,7 @@ public class DmpBlueprintServiceImpl implements DmpBlueprintService {
DmpBlueprintEntity data = new DmpBlueprintEntity(); DmpBlueprintEntity data = new DmpBlueprintEntity();
data.setId(UUID.randomUUID()); data.setId(UUID.randomUUID());
data.setLabel(model.getLabel()); data.setLabel(model.getLabel());
data.setStatus(model.getStatus()); data.setStatus(DmpBlueprintStatus.Draft);
data.setDefinition(this.xmlHandlingService.toXml(this.buildDefinitionEntity(model.getDefinition()))); data.setDefinition(this.xmlHandlingService.toXml(this.buildDefinitionEntity(model.getDefinition())));
data.setGroupId(oldDmpBlueprintEntity.getGroupId()); data.setGroupId(oldDmpBlueprintEntity.getGroupId());
data.setVersion((short) (oldDmpBlueprintEntity.getVersion() + 1)); data.setVersion((short) (oldDmpBlueprintEntity.getVersion() + 1));

View File

@ -11,6 +11,7 @@ export interface DmpBlueprint extends BaseEntity {
definition: DmpBlueprintDefinition; definition: DmpBlueprintDefinition;
status: DmpBlueprintStatus; status: DmpBlueprintStatus;
version: number; version: number;
groupId: Guid;
} }
export interface DmpBlueprintDefinition { export interface DmpBlueprintDefinition {

View File

@ -9,6 +9,7 @@ export class DmpBlueprintLookup extends Lookup implements DmpBlueprintFilter {
like: string; like: string;
isActive: IsActive[]; isActive: IsActive[];
statuses: DmpBlueprintStatus[]; statuses: DmpBlueprintStatus[];
groupIds: Guid[];
constructor() { constructor() {
super(); super();

View File

@ -14,6 +14,14 @@ const routes: Routes = [
component: DmpBlueprintListingComponent, component: DmpBlueprintListingComponent,
canActivate: [AuthGuard] canActivate: [AuthGuard]
}, },
{
path: 'versions/:groupid',
component: DmpBlueprintListingComponent,
canActivate: [AuthGuard],
data: {
mode: 'versions-listing'
}
},
{ {
path: 'new', path: 'new',
canActivate: [AuthGuard], canActivate: [AuthGuard],
@ -45,7 +53,6 @@ const routes: Routes = [
}, },
action: 'clone' action: 'clone'
} }
}, },
{ {
path: 'new-version/:newversionid', path: 'new-version/:newversionid',
@ -64,7 +71,6 @@ const routes: Routes = [
}, },
action: 'new-version' action: 'new-version'
} }
}, },
{ {
path: ':id', path: ':id',

View File

@ -84,7 +84,7 @@ export class DmpBlueprintEditorComponent extends BaseEditor<DmpBlueprintEditorMo
} }
protected get canFinalize(): boolean { protected get canFinalize(): boolean {
return !this.isDeleted && this.hasPermission(this.authService.permissionEnum.EditDmpBlueprint); return !this.isNewVersion && !this.isDeleted && this.hasPermission(this.authService.permissionEnum.EditDmpBlueprint);
} }
protected get canCreateNewVersion(): boolean { protected get canCreateNewVersion(): boolean {
@ -171,9 +171,13 @@ export class DmpBlueprintEditorComponent extends BaseEditor<DmpBlueprintEditorMo
this.formGroup = this.editorModel.buildForm(null, this.isDeleted || !this.authService.hasPermission(AppPermission.EditDmpBlueprint)); this.formGroup = this.editorModel.buildForm(null, this.isDeleted || !this.authService.hasPermission(AppPermission.EditDmpBlueprint));
this.selectedSystemFields = this.selectedSystemFieldDisabled(); this.selectedSystemFields = this.selectedSystemFieldDisabled();
this.dmpBlueprintEditorService.setValidationErrorModel(this.editorModel.validationErrorModel); this.dmpBlueprintEditorService.setValidationErrorModel(this.editorModel.validationErrorModel);
if (this.editorModel.status == DmpBlueprintStatus.Finalized || this.isDeleted) { if (this.isFinalized || this.isDeleted) {
this.formGroup.disable(); this.formGroup.disable();
} }
const action = this.route.snapshot.data['action'];
if (action && action == 'new-version') {
this.formGroup.enable();
}
} }
refreshData(id?: Guid): void { refreshData(id?: Guid): void {

View File

@ -23,7 +23,7 @@
</div> </div>
</div> </div>
<app-hybrid-listing [rows]="gridRows" [columns]="gridColumns" [visibleColumns]="visibleColumns" [count]="totalElements" [offset]="currentPageNumber" [limit]="lookup.page.size" [defaultSort]="lookup.order?.items" [externalSorting]="true" (rowActivated)="onRowActivated($event)" (pageLoad)="alterPage($event)" (columnSort)="onColumnSort($event)" (columnsChanged)="onColumnsChanged($event)" [listItemTemplate]="listItemTemplate"> <app-hybrid-listing [rows]="gridRows" [columns]="gridColumns" [visibleColumns]="visibleColumns" [count]="totalElements" [offset]="currentPageNumber" [limit]="lookup.page.size" [defaultSort]="lookup.order?.items" [externalSorting]="true" (rowActivated)="onRowActivated($event, '/dmp-blueprints')" (pageLoad)="alterPage($event)" (columnSort)="onColumnSort($event)" (columnsChanged)="onColumnsChanged($event)" [listItemTemplate]="listItemTemplate">
<app-dmp-blueprint-listing-filters hybrid-listing-filters [(filter)]="lookup" (filterChange)="filterChanged($event)" /> <app-dmp-blueprint-listing-filters hybrid-listing-filters [(filter)]="lookup" (filterChange)="filterChanged($event)" />
@ -90,16 +90,20 @@
<mat-icon>more_horiz</mat-icon> <mat-icon>more_horiz</mat-icon>
</button> </button>
<mat-menu #actionsMenu="matMenu"> <mat-menu #actionsMenu="matMenu">
<button mat-menu-item [routerLink]="['./' + row.id]"> <button mat-menu-item [routerLink]="[row.id]">
<mat-icon>edit</mat-icon>{{'DMP-BLUEPRINT-LISTING.ACTIONS.EDIT' | translate}} <mat-icon>edit</mat-icon>{{'DMP-BLUEPRINT-LISTING.ACTIONS.EDIT' | translate}}
</button> </button>
<button mat-menu-item [routerLink]="['./new-version/' + row.id]"> <button mat-menu-item [routerLink]="['new-version' , row.id]">
<mat-icon>queue</mat-icon>{{'DMP-BLUEPRINT-LISTING.ACTIONS.NEW-VERSION' | translate}} <mat-icon>queue</mat-icon>{{'DMP-BLUEPRINT-LISTING.ACTIONS.NEW-VERSION' | translate}}
</button> </button>
<button mat-menu-item [routerLink]="['./clone/' + row.id]"> <button mat-menu-item [routerLink]="['clone' , row.id]">
<mat-icon>content_copy</mat-icon>{{'DMP-BLUEPRINT-LISTING.ACTIONS.CLONE' | translate}} <mat-icon>content_copy</mat-icon>{{'DMP-BLUEPRINT-LISTING.ACTIONS.CLONE' | translate}}
</button> </button>
<button mat-menu-item (click)="export(row.id)" [routerLink]="['./' + row.id]"> <button mat-menu-item [routerLink]="['versions' , row.groupId]">
<mat-icon>library_books</mat-icon>
{{'DMP-BLUEPRINT-LISTING.ACTIONS.VIEW-VERSIONS' | translate}}
</button>
<button mat-menu-item (click)="export(row.id)" [routerLink]="[row.id]">
<mat-icon>download</mat-icon>{{'DMP-BLUEPRINT-LISTING.ACTIONS.DOWNLOAD-XML' | translate}} <mat-icon>download</mat-icon>{{'DMP-BLUEPRINT-LISTING.ACTIONS.DOWNLOAD-XML' | translate}}
</button> </button>
<button mat-menu-item (click)="delete(row.id)"> <button mat-menu-item (click)="delete(row.id)">

View File

@ -40,6 +40,7 @@ export class DmpBlueprintListingComponent extends BaseListingComponent<DmpBluepr
userSettingsKey = { key: 'DmpBlueprintListingUserSettings' }; userSettingsKey = { key: 'DmpBlueprintListingUserSettings' };
propertiesAvailableForOrder: ColumnDefinition[]; propertiesAvailableForOrder: ColumnDefinition[];
dmpBlueprintStatuses = DmpBlueprintStatus; dmpBlueprintStatuses = DmpBlueprintStatus;
mode;
@ViewChild('dmpBlueprintStatus', { static: true }) dmpBlueprintStatus?: TemplateRef<any>; @ViewChild('dmpBlueprintStatus', { static: true }) dmpBlueprintStatus?: TemplateRef<any>;
@ViewChild('actions', { static: true }) actions?: TemplateRef<any>; @ViewChild('actions', { static: true }) actions?: TemplateRef<any>;
@ -50,6 +51,7 @@ export class DmpBlueprintListingComponent extends BaseListingComponent<DmpBluepr
nameof<DmpBlueprint>(x => x.label), nameof<DmpBlueprint>(x => x.label),
nameof<DmpBlueprint>(x => x.status), nameof<DmpBlueprint>(x => x.status),
nameof<DmpBlueprint>(x => x.version), nameof<DmpBlueprint>(x => x.version),
nameof<DmpBlueprint>(x => x.groupId),
nameof<DmpBlueprint>(x => x.updatedAt), nameof<DmpBlueprint>(x => x.updatedAt),
nameof<DmpBlueprint>(x => x.createdAt), nameof<DmpBlueprint>(x => x.createdAt),
nameof<DmpBlueprint>(x => x.hash), nameof<DmpBlueprint>(x => x.hash),
@ -76,6 +78,7 @@ export class DmpBlueprintListingComponent extends BaseListingComponent<DmpBluepr
super(router, route, uiNotificationService, httpErrorHandlingService, queryParamsService); super(router, route, uiNotificationService, httpErrorHandlingService, queryParamsService);
// Lookup setup // Lookup setup
// Default lookup values are defined in the user settings class. // Default lookup values are defined in the user settings class.
this.mode = this.route.snapshot?.data['mode'];
this.lookup = this.initializeLookup(); this.lookup = this.initializeLookup();
} }
@ -90,6 +93,7 @@ export class DmpBlueprintListingComponent extends BaseListingComponent<DmpBluepr
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.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'))]
this.updateOrderUiFields(lookup.order); this.updateOrderUiFields(lookup.order);
lookup.project = { lookup.project = {

View File

@ -1923,7 +1923,8 @@
"EDIT": "Edit", "EDIT": "Edit",
"CLONE": "Clone", "CLONE": "Clone",
"NEW-VERSION": "New Version", "NEW-VERSION": "New Version",
"DOWNLOAD-XML": "Download XML" "DOWNLOAD-XML": "Download XML",
"VIEW-VERSIONS": "All Dmp Blueprint Versions"
}, },
"IMPORT": { "IMPORT": {
"UPLOAD-XML": "Import", "UPLOAD-XML": "Import",