Show status on dataset profile listing and filter them based on status (ref #265)

This commit is contained in:
George Kalampokis 2020-05-08 18:27:16 +03:00
parent b539544075
commit 50c45b7271
8 changed files with 53 additions and 3 deletions

View File

@ -33,6 +33,7 @@ public class DatasetProfileCriteria extends Criteria<DatasetProfile> {
private Short filter; private Short filter;
private UUID userId; private UUID userId;
private boolean finalized; private boolean finalized;
private Integer status;
public boolean getAllVersions() { return allVersions; } public boolean getAllVersions() { return allVersions; }
public void setAllVersions(boolean allVersions) { this.allVersions = allVersions; } public void setAllVersions(boolean allVersions) { this.allVersions = allVersions; }
@ -60,4 +61,12 @@ public class DatasetProfileCriteria extends Criteria<DatasetProfile> {
public void setFinalized(boolean finalized) { public void setFinalized(boolean finalized) {
this.finalized = finalized; this.finalized = finalized;
} }
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
} }

View File

@ -52,6 +52,9 @@ public class DatasetProfileDaoImpl extends DatabaseAccess<DatasetProfile> implem
builder.notEqual(root.get("id"), criteria.getUserId()))); builder.notEqual(root.get("id"), criteria.getUserId())));
} }
} }
if (criteria.getStatus() != null) {
query.where(((builder, root) -> builder.equal(root.get("status"), criteria.getStatus())));
}
if (criteria.getFinalized()) { if (criteria.getFinalized()) {
query.where(((builder, root) -> builder.equal(root.get("status"), DatasetProfile.Status.FINALIZED.getValue()))); query.where(((builder, root) -> builder.equal(root.get("status"), DatasetProfile.Status.FINALIZED.getValue())));
} else { } else {

View File

@ -27,6 +27,7 @@ import { DialodConfirmationUploadDatasetProfiles } from '@app/ui/admin/dataset-p
import { DatasetProfileListingComponent } from '@app/ui/admin/dataset-profile/listing/dataset-profile-listing.component'; import { DatasetProfileListingComponent } from '@app/ui/admin/dataset-profile/listing/dataset-profile-listing.component';
import { CommonFormsModule } from '@common/forms/common-forms.module'; import { CommonFormsModule } from '@common/forms/common-forms.module';
import { CommonUiModule } from '@common/ui/common-ui.module'; import { CommonUiModule } from '@common/ui/common-ui.module';
import { ParseStatus } from './listing/pipe/parse-status.pipe';
@NgModule({ @NgModule({
imports: [ imports: [
@ -59,7 +60,8 @@ import { CommonUiModule } from '@common/ui/common-ui.module';
DatasetProfileEditorInternalDmpEntitiesFieldComponent, DatasetProfileEditorInternalDmpEntitiesFieldComponent,
DatasetProfileEditorResearchersAutoCompleteFieldComponent, DatasetProfileEditorResearchersAutoCompleteFieldComponent,
DatasetProfileEditorDatasetsAutoCompleteFieldComponent, DatasetProfileEditorDatasetsAutoCompleteFieldComponent,
DatasetProfileEditorDmpsAutoCompleteFieldComponent DatasetProfileEditorDmpsAutoCompleteFieldComponent,
ParseStatus
], ],
entryComponents: [ entryComponents: [
DialodConfirmationUploadDatasetProfiles DialodConfirmationUploadDatasetProfiles

View File

@ -5,6 +5,13 @@
<input matInput placeholder=" {{'CRITERIA.DATASET-PROFILE.LIKE'| translate}}" name="datasetProfileLike" <input matInput placeholder=" {{'CRITERIA.DATASET-PROFILE.LIKE'| translate}}" name="datasetProfileLike"
[(ngModel)]="criteria.like" (ngModelChange)="controlModified()"> [(ngModel)]="criteria.like" (ngModelChange)="controlModified()">
</mat-form-field> </mat-form-field>
<mat-form-field class="col-md-6">
<mat-select [(ngModel)]="criteria.status" (ngModelChange)="controlModified()" placeholder=" {{'CRITERIA.DATASET-PROFILE.STATUS' | translate}}">
<mat-option [value]="null">{{'DATASET-PROFILE-STATUS.NONE' | translate}}</mat-option>
<mat-option [value]="0">{{'DATASET-PROFILE-STATUS.DRAFT' | translate}}</mat-option>
<mat-option [value]="1">{{'DATASET-PROFILE-STATUS.FINALIZED' | translate}}</mat-option>
</mat-select>
</mat-form-field>
<div class="col"></div> <div class="col"></div>
<div class="col-auto"> <div class="col-auto">
<!-- imgFileInput.click() && --> <!-- imgFileInput.click() && -->

View File

@ -27,6 +27,13 @@
<mat-cell *matCellDef="let row">{{row.created | date:'shortDate'}}</mat-cell> <mat-cell *matCellDef="let row">{{row.created | date:'shortDate'}}</mat-cell>
</ng-container> </ng-container>
<!-- Column Definition: Status -->
<ng-container cdkColumnDef="status">
<mat-header-cell *matHeaderCellDef mat-sort-header="status">{{'DATASET-PROFILE-LISTING.COLUMNS.STATUS' |
translate}}</mat-header-cell>
<mat-cell *matCellDef="let row">{{ (row.status | parseStatus) | translate}}</mat-cell>
</ng-container>
<!-- Column Definition: Submission Time --> <!-- Column Definition: Submission Time -->
<ng-container cdkColumnDef="actions"> <ng-container cdkColumnDef="actions">
<mat-header-cell *matHeaderCellDef>{{'DATASET-PROFILE-LISTING.COLUMNS.ACTIONS' | translate}} <mat-header-cell *matHeaderCellDef>{{'DATASET-PROFILE-LISTING.COLUMNS.ACTIONS' | translate}}

View File

@ -30,7 +30,7 @@ export class DatasetProfileListingComponent extends BaseComponent implements OnI
breadCrumbs: Observable<BreadcrumbItem[]>; breadCrumbs: Observable<BreadcrumbItem[]>;
dataSource: DatasetDataSource | null; dataSource: DatasetDataSource | null;
displayedColumns: String[] = ['label', 'description', 'created', 'actions']; displayedColumns: String[] = ['label', 'description', 'created', 'status', 'actions'];
pageEvent: PageEvent; pageEvent: PageEvent;
titlePrefix: String; titlePrefix: String;
dmpId: String; dmpId: String;

View File

@ -0,0 +1,16 @@
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'parseStatus',
pure: true
})
export class ParseStatus implements PipeTransform {
transform(value: any, ...args: any[]) {
return this.parseStatus(value);
}
parseStatus(status: number): string {
return status != 0 ? 'DATASET-PROFILE-STATUS.FINALIZED' : 'DATASET-PROFILE-STATUS.DRAFT';
}
}

View File

@ -765,7 +765,8 @@
} }
}, },
"DATASET-PROFILE": { "DATASET-PROFILE": {
"LIKE": "Search" "LIKE": "Search",
"STATUS": "Status"
}, },
"DATA-SETS": { "DATA-SETS": {
"PERIOD-FROM": "Start", "PERIOD-FROM": "Start",
@ -1261,5 +1262,10 @@
} }
}, },
"HINT": "(Suggested Default Name)" "HINT": "(Suggested Default Name)"
},
"DATASET-PROFILE-STATUS": {
"NONE": "None",
"DRAFT": "Draft",
"FINALIZED": "Finalized"
} }
} }