Removed new version from file on dmp blueprint listing options, added version column, fixed header and save button disabled conditions on dmp blueprint editor

This commit is contained in:
Thomas Georgios Giannos 2024-02-07 13:03:47 +02:00
parent bc9691fa5d
commit 176d13d443
6 changed files with 23 additions and 15 deletions

View File

@ -10,6 +10,7 @@ export interface DmpBlueprint extends BaseEntity {
label: string;
definition: DmpBlueprintDefinition;
status: DmpBlueprintStatus;
version: number;
}
export interface DmpBlueprintDefinition {
@ -55,12 +56,6 @@ export interface DmpBlueprintPersist extends BaseEntityPersist {
status: DmpBlueprintStatus;
}
export interface CloneDmpBlueprintPersist {
label: string;
definition: DmpBlueprintDefinitionPersist;
status: DmpBlueprintStatus;
}
export interface NewVersionDmpBlueprintPersist {
label: string;
definition: DmpBlueprintDefinitionPersist;

View File

@ -2,7 +2,8 @@
<div class="container-fluid dmp-blueprint-editor">
<div class="row align-items-center mb-4" *ngIf="formGroup">
<div class="col-auto">
<h3 *ngIf="isNew">{{'DMP-BLUEPRINT-EDITOR.TITLE.NEW' | translate}}</h3>
<h3 *ngIf="!isFinalized && !isNewVersion">{{'DMP-BLUEPRINT-EDITOR.TITLE.NEW' | translate}}</h3>
<h3 *ngIf="isFinalized && !isNewVersion">{{formGroup.get('label').value}}</h3>
<h3 *ngIf="isClone">
<span>{{'DMP-BLUEPRINT-EDITOR.TITLE.CLONE' | translate}}</span>
{{formGroup.get('label').value}}
@ -11,7 +12,6 @@
<span>{{'DMP-BLUEPRINT-EDITOR.TITLE.NEW-VERSION' | translate}}</span>
{{formGroup.get('label').value}}
</h3>
<!-- <h3 *ngIf="!isNew">{{formGroup.get('label').value}}</h3> -->
</div>
<div class="col"></div>
<div class="col-auto" *ngIf="!isNew">
@ -256,7 +256,7 @@
</div>
<div class="col"></div>
<div class="col-auto">
<button mat-button class="action-btn" [disabled]="formGroup.disabled" type="submit">
<button mat-button class="action-btn" [disabled]="!canSave" type="submit">
{{'DMP-BLUEPRINT-EDITOR.ACTIONS.SAVE' | translate}}
</button>
</div>

View File

@ -78,13 +78,22 @@ export class DmpBlueprintEditorComponent extends BaseEditor<DmpBlueprintEditorMo
}
protected get canSave(): boolean {
return !this.isDeleted && this.hasPermission(this.authService.permissionEnum.EditDmpBlueprint);
if (this.isDeleted || !this.hasPermission(this.authService.permissionEnum.EditDmpBlueprint)) return false;
if (this.isNewVersion) return this.canCreateNewVersion;
return !this.formGroup.disabled;
}
protected get canFinalize(): boolean {
return !this.isDeleted && this.hasPermission(this.authService.permissionEnum.EditDmpBlueprint);
}
protected get canCreateNewVersion(): boolean {
return this.isFinalized;
}
protected get isFinalized(): boolean {
return this.editorModel.status == DmpBlueprintStatus.Finalized;
}
private hasPermission(permission: AppPermission): boolean {
return this.authService.hasPermission(permission) || this.editorModel?.permissions?.includes(permission);

View File

@ -96,9 +96,6 @@
<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 (click)="newVersionFromFile(row.id, row.label)">
<mat-icon>file_copy</mat-icon>{{'DMP-BLUEPRINT-LISTING.ACTIONS.NEW-VERSION-FROM-FILE' | translate}}
</button>
<button mat-menu-item [routerLink]="['./clone/' + row.id]">
<mat-icon>content_copy</mat-icon>{{'DMP-BLUEPRINT-LISTING.ACTIONS.CLONE' | translate}}
</button>

View File

@ -49,6 +49,7 @@ export class DmpBlueprintListingComponent extends BaseListingComponent<DmpBluepr
nameof<DmpBlueprint>(x => x.id),
nameof<DmpBlueprint>(x => x.label),
nameof<DmpBlueprint>(x => x.status),
nameof<DmpBlueprint>(x => x.version),
nameof<DmpBlueprint>(x => x.updatedAt),
nameof<DmpBlueprint>(x => x.createdAt),
nameof<DmpBlueprint>(x => x.hash),
@ -103,12 +104,18 @@ export class DmpBlueprintListingComponent extends BaseListingComponent<DmpBluepr
prop: nameof<DmpBlueprint>(x => x.label),
sortable: true,
languageName: 'DMP-BLUEPRINT-LISTING.FIELDS.NAME'
}, {
},
{
prop: nameof<DmpBlueprint>(x => x.status),
sortable: true,
languageName: 'DMP-BLUEPRINT-LISTING.FIELDS.STATUS',
cellTemplate: this.dmpBlueprintStatus
},
{
prop: nameof<DmpBlueprint>(x => x.version),
sortable: true,
languageName: 'DMP-BLUEPRINT-LISTING.FIELDS.VERSION'
},
{
prop: nameof<DmpBlueprint>(x => x.createdAt),
sortable: true,

View File

@ -1900,6 +1900,7 @@
"FIELDS": {
"NAME": "Name",
"STATUS": "Status",
"VERSION": "Version",
"UPDATED-AT": "Updated",
"CREATED-AT": "Created",
"PUBLISHED-AT": "Published",
@ -1922,7 +1923,6 @@
"EDIT": "Edit",
"CLONE": "Clone",
"NEW-VERSION": "New Version",
"NEW-VERSION-FROM-FILE": "New Version from File",
"DOWNLOAD-XML": "Download XML"
},
"IMPORT": {