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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -23,7 +23,7 @@
</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)" />
@ -90,16 +90,20 @@
<mat-icon>more_horiz</mat-icon>
</button>
<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}}
</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}}
</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}}
</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}}
</button>
<button mat-menu-item (click)="delete(row.id)">

View File

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

View File

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