From 6ffa556aa7b79d700fe4c18d545479ce78163e3f Mon Sep 17 00:00:00 2001 From: Diamadis Tziotzios Date: Tue, 19 Dec 2017 09:31:02 +0200 Subject: [PATCH 1/5] no message --- .../src/app/dmps/dmp-listing.component.css | 20 -- .../src/app/dmps/dmp-listing.component.html | 211 +++--------------- .../src/app/dmps/dmp-listing.component.scss | 23 ++ .../src/app/dmps/dmp-listing.component.ts | 16 +- .../app/dmps/editor/dmp-editor.component.html | 38 ---- .../DataManagementPlanCriteria.ts | 4 +- .../DataManagementPlanCriteriaErrorModel.ts | 3 +- .../DataManagementPlanModel.ts | 15 +- .../models/organisation/OrganisationModel.ts | 20 ++ .../app/models/researcher/ResearcherModel.ts | 17 ++ .../app/projects/project-listing.component.ts | 168 +------------- .../data-management-plan.service.ts | 8 +- .../app/services/project/project.service.ts | 2 +- .../dmp-criteria.component.html | 46 ++-- .../dmp-criteria.component.scss | 2 +- .../dmp-criteria.component.ts | 32 +-- dmp-frontend/src/assets/lang/en.json | 10 +- 17 files changed, 151 insertions(+), 484 deletions(-) delete mode 100644 dmp-frontend/src/app/dmps/dmp-listing.component.css create mode 100644 dmp-frontend/src/app/dmps/dmp-listing.component.scss create mode 100644 dmp-frontend/src/app/models/organisation/OrganisationModel.ts create mode 100644 dmp-frontend/src/app/models/researcher/ResearcherModel.ts diff --git a/dmp-frontend/src/app/dmps/dmp-listing.component.css b/dmp-frontend/src/app/dmps/dmp-listing.component.css deleted file mode 100644 index 957c39499..000000000 --- a/dmp-frontend/src/app/dmps/dmp-listing.component.css +++ /dev/null @@ -1,20 +0,0 @@ -.mat-card { - overflow: auto; - padding: 0px; -} - -.mat-table { - margin: 24px; -} - -.mat-progress-bar { - position: absolute; -} - -.mat-fab-bottom-right { - top: auto !important; - right: 20px !important; - bottom: 10px !important; - left: auto !important; - position: fixed !important; -} diff --git a/dmp-frontend/src/app/dmps/dmp-listing.component.html b/dmp-frontend/src/app/dmps/dmp-listing.component.html index 3086e8b41..9148b0008 100644 --- a/dmp-frontend/src/app/dmps/dmp-listing.component.html +++ b/dmp-frontend/src/app/dmps/dmp-listing.component.html @@ -1,190 +1,39 @@
-

{{'DMP-LISTING.TITLE' | translate}}

+

{{'DMP-LISTING.TITLE' | translate}}

- - - + + + - + - - - {{'DMP-LISTING.COLUMNS.NAME' | translate}} - {{row.name}} - + + + {{'DMP-LISTING.COLUMNS.NAME' | translate}} + {{row.name}} + - - - {{'DMP-LISTING.COLUMNS.ABBREVIATION' | translate}} - {{row.abbreviation}} - + + + {{'DMP-LISTING.COLUMNS.PROJECT' | translate}} + {{row.abbreviation}} + - - - {{'DMP-LISTING.COLUMNS.START' | translate}} - {{row.start}} - + + + {{'DMP-LISTING.COLUMNS.CREATION-TIME' | translate}} + + - - - {{'DMP-LISTING.COLUMNS.END' | translate}} - {{row.end}} - + + - - - {{'DMP-LISTING.COLUMNS.ACTIONS' | translate}} - - + + + + - - - - - - - - - -
- + + \ No newline at end of file diff --git a/dmp-frontend/src/app/dmps/dmp-listing.component.scss b/dmp-frontend/src/app/dmps/dmp-listing.component.scss new file mode 100644 index 000000000..d81a50420 --- /dev/null +++ b/dmp-frontend/src/app/dmps/dmp-listing.component.scss @@ -0,0 +1,23 @@ +.mat-table { + margin: 24px; +} + +.mat-progress-bar { + position: absolute; +} + +.mat-fab-bottom-right { + top: auto !important; + right: 20px !important; + bottom: 10px !important; + left: auto !important; + position: fixed !important; +} + +.full-width { + width: 100%; +} + +.mat-card { + margin: 16px 0; +} \ No newline at end of file diff --git a/dmp-frontend/src/app/dmps/dmp-listing.component.ts b/dmp-frontend/src/app/dmps/dmp-listing.component.ts index d29f9a090..0882f0062 100644 --- a/dmp-frontend/src/app/dmps/dmp-listing.component.ts +++ b/dmp-frontend/src/app/dmps/dmp-listing.component.ts @@ -16,20 +16,20 @@ import { DataManagementPlanListingModel } from "../models/data-managemnt-plans/D @Component({ selector: 'app-dmp-listing-component', templateUrl: 'dmp-listing.component.html', - styleUrls: ['./dmp-listing.component.css'], + styleUrls: ['./dmp-listing.component.scss'], providers: [DataManagementPlanService] }) -export class DataManagementPlanListingComponent implements OnInit, AfterViewInit { +export class DataManagementPlanListingComponent implements OnInit { @ViewChild(MatPaginator) _paginator: MatPaginator; @ViewChild(MatSort) sort: MatSort; @ViewChild(DataManagementPlanCriteriaComponent) criteria: DataManagementPlanCriteriaComponent; dataSource: DataManagementPlanDataSource | null; - displayedColumns: String[] = ['name', 'abbreviation', 'start', 'end']; + displayedColumns: String[] = ['name', 'project', 'creationTime']; constructor( - private projectService: DataManagementPlanService, + private dataManagementPlanService: DataManagementPlanService, private router: Router, private languageService: TranslateService, public snackBar: MatSnackBar, @@ -38,15 +38,13 @@ export class DataManagementPlanListingComponent implements OnInit, AfterViewInit } ngOnInit() { - - } - - ngAfterViewInit() { + this.criteria.setCriteria(this.getDefaultCriteria()); + this.refresh(); this.criteria.setRefreshCallback(() => this.refresh()); } refresh() { - this.dataSource = new DataManagementPlanDataSource(this.projectService, this._paginator, this.sort, this.languageService, this.snackBar, this.criteria, ); + this.dataSource = new DataManagementPlanDataSource(this.dataManagementPlanService, this._paginator, this.sort, this.languageService, this.snackBar, this.criteria, ); } rowClick(rowId: String) { diff --git a/dmp-frontend/src/app/dmps/editor/dmp-editor.component.html b/dmp-frontend/src/app/dmps/editor/dmp-editor.component.html index 177130ba3..7b94fcc67 100644 --- a/dmp-frontend/src/app/dmps/editor/dmp-editor.component.html +++ b/dmp-frontend/src/app/dmps/editor/dmp-editor.component.html @@ -11,44 +11,6 @@ {{'GENERAL.VALIDATION.REQUIRED' | translate}} - - - - diff --git a/dmp-frontend/src/app/models/criteria/data-management-plan/DataManagementPlanCriteria.ts b/dmp-frontend/src/app/models/criteria/data-management-plan/DataManagementPlanCriteria.ts index a26696afe..674a51492 100644 --- a/dmp-frontend/src/app/models/criteria/data-management-plan/DataManagementPlanCriteria.ts +++ b/dmp-frontend/src/app/models/criteria/data-management-plan/DataManagementPlanCriteria.ts @@ -1,6 +1,6 @@ import { BaseCriteria } from "../BaseCriteria"; +import { ProjectModel } from "../../projects/ProjectModel"; export class DataManagementPlanCriteria extends BaseCriteria { - public PeriodStart: Date; - public PeriodEnd: Date; + public projects: ProjectModel[] = []; } diff --git a/dmp-frontend/src/app/models/criteria/data-management-plan/DataManagementPlanCriteriaErrorModel.ts b/dmp-frontend/src/app/models/criteria/data-management-plan/DataManagementPlanCriteriaErrorModel.ts index 6773dbafa..a3a9abfec 100644 --- a/dmp-frontend/src/app/models/criteria/data-management-plan/DataManagementPlanCriteriaErrorModel.ts +++ b/dmp-frontend/src/app/models/criteria/data-management-plan/DataManagementPlanCriteriaErrorModel.ts @@ -1,6 +1,5 @@ import { BaseCriteriaErrorModel } from "../BaseCriteriaErrorModel"; export class DataManagementPlanCriteriaErrorModel extends BaseCriteriaErrorModel{ - public PeriodStart: String; - public PeriodEnd: String; + } diff --git a/dmp-frontend/src/app/models/data-managemnt-plans/DataManagementPlanModel.ts b/dmp-frontend/src/app/models/data-managemnt-plans/DataManagementPlanModel.ts index ba2d6ebeb..86512ab7e 100644 --- a/dmp-frontend/src/app/models/data-managemnt-plans/DataManagementPlanModel.ts +++ b/dmp-frontend/src/app/models/data-managemnt-plans/DataManagementPlanModel.ts @@ -5,6 +5,10 @@ import { BackendErrorValidator } from "../../utilities/validators/BackendErrorVa import { BaseErrorModel } from "../error/BaseErrorModel"; import { AutoCompleteItem } from "../../shared/components/autocomplete/AutoCompleteItem"; import { ExternalSourcesItemModel } from "../external-sources/ExternalSourcesItemModel"; +import { ProjectModel } from "../projects/ProjectModel"; +import { OrganisationModel } from "../organisation/OrganisationModel"; +import { ResearcherModel } from "../researcher/ResearcherModel"; +import { JsonSerializer } from "../../utilities/JsonSerializer"; export class DataManagementPlanModel implements Serializable { public id: String; @@ -13,9 +17,9 @@ export class DataManagementPlanModel implements Serializable().fromJSONObject(item.project, ProjectModel); + this.organisations = new JsonSerializer().fromJSONArray(item.organisations, OrganisationModel); + this.researchers = new JsonSerializer().fromJSONArray(item.researchers, ResearcherModel); return this; } @@ -39,6 +46,7 @@ export class DataManagementPlanModel implements Serializable { + public id: String; + public label: String; + public abbreviation: String; + public reference: String; + public uri: String; + + fromJSONObject(item: any): OrganisationModel { + this.id = item.id; + this.label = item.label; + this.abbreviation = item.abbreviation; + this.reference = item.reference; + this.uri = item.uri; + + return this; + } +} \ No newline at end of file diff --git a/dmp-frontend/src/app/models/researcher/ResearcherModel.ts b/dmp-frontend/src/app/models/researcher/ResearcherModel.ts new file mode 100644 index 000000000..98b547172 --- /dev/null +++ b/dmp-frontend/src/app/models/researcher/ResearcherModel.ts @@ -0,0 +1,17 @@ +import { Serializable } from "../Serializable"; + +export class ResearcherModel implements Serializable { + public id: String; + public label: String; + public uri: String; + public email: String; + + fromJSONObject(item: any): ResearcherModel { + this.id = item.id; + this.label = item.label; + this.email = item.email; + this.uri = item.uri; + + return this; + } +} \ No newline at end of file diff --git a/dmp-frontend/src/app/projects/project-listing.component.ts b/dmp-frontend/src/app/projects/project-listing.component.ts index c4138f97c..f0d033168 100644 --- a/dmp-frontend/src/app/projects/project-listing.component.ts +++ b/dmp-frontend/src/app/projects/project-listing.component.ts @@ -45,7 +45,7 @@ export class ProjectListingComponent implements OnInit { } refresh() { - this.dataSource = new ProjectDataSource(this.projectService, this._paginator, this.sort, this.languageService, this.snackBar, this.criteria ); + this.dataSource = new ProjectDataSource(this.projectService, this._paginator, this.sort, this.languageService, this.snackBar, this.criteria); } rowClick(rowId: String) { @@ -56,19 +56,6 @@ export class ProjectListingComponent implements OnInit { const defaultCriteria = new ProjectCriteria(); return defaultCriteria; } - - // canShowOwner(): boolean { - // const principal: Principal = this.authentication.current(); - // if (principal) { - // const principalRoles = principal.appRoles; - // for (let i = 0; i < principalRoles.length; i++) { - // if (principalRoles[i] === Principal.AppRole.Admin || principalRoles[i] === Principal.AppRole.BudgetManager) { - // return true; - // } - // } - // } - // return false; - // } } export class ProjectDataSource extends DataSource { @@ -138,155 +125,4 @@ export class ProjectDataSource extends DataSource { disconnect() { // No-op } -} -// export class ProjectListingComponent implements OnInit{ - -// // Start ALTERNATIVE -// //whole dmp data model -// tableData : any[] = new Array(); - -// //organisation editor data model -// editingOrganisation: any = {}; -// organisationEditorForm : any; - -// //required by the table -// public filterQuery = ""; -// public rowsOnPage = 10; -// public sortBy = "label"; -// public sortOrder = "asc"; - - -// // for tableIds -// showIDs : boolean = false; - -// statusDropDown: DropdownField; - -// project: any; - -// whoami: any; -// onlyMyProjects : boolean = false; - -// options: DatepickerOptions = { -// minYear: 1900, -// maxYear: 2050, -// displayFormat: 'MMM D[,] YYYY', -// barTitleFormat: 'MMMM YYYY', -// firstCalendarDay: 0 // 0 - Sunday, 1 - Monday -// }; - -// //breadcrumbHome: MenuItem = {icon: 'fa fa-home'}; -// breadcrumbData: MenuItem[] = new Array(); - -// constructor( -// private serverService: ServerService, -// private route: ActivatedRoute, -// private router: Router) { -// this.statusDropDown = new DropdownField(); -// this.statusDropDown.options= [{key:'0', value:"Active"},{key:'1', value:"Inactive"}] -// this.project = this.getEmptyProject(); -// } - -// ngAfterViewInit() { - -// } - -// getEmptyProject(){ -// return { -// label: '', -// abbreviation:'', -// reference:'', -// uri:'', -// description:'', -// enddate:'', -// startdate:'' -// } -// } - - -// ngOnInit() { - -// this.getProjects(); - -// this.serverService.whoami().subscribe( -// response => { -// this.whoami = response; -// console.log(this.whoami) -// }, -// err => { -// simple_notifier("danger",null,"Could not retrieve user config"); -// } -// ); - -// } - - -// getProjects(muted? : boolean){ -// //this.serverService.getProjectsOfUser().subscribe( -// this.serverService.getAllProjects().subscribe( -// response => { -// this.tableData = response; -// if(muted && muted!=true) -// simple_notifier("success",null,"Updated projects table"); -// }, -// err => { -// simple_notifier("danger",null,"Could not retrieve projects"); -// } -// ); -// } - - - -// showDatasets(){ //dmpId, event -// //this.dataSetVisibe = true; - -// } - - -// SaveProject(){ - -// let action : Observable; - -// if(this.project.id == null) //means it's a new one -// action = this.serverService.createProject(this.project); -// else -// action = this.serverService.updateProject(this.project); -// action.subscribe( -// response =>{ -// this.getProjects(); -// simple_notifier("success",null, (this.project.id == null) ? "Created" : "Updated" +" projects table"); -// }, -// error => { -// simple_notifier("danger",null, "Could not "+ (this.project.id == null) ? "create" : "update" + " projects table"); -// } -// ); - -// $("#newEditProjectModal").modal("hide"); -// } - -// newProject(){ -// this.project = this.getEmptyProject(); -// $("#newEditProjectModal").modal("show"); - -// } - -// editRow(item, event){ -// this.project = Object.assign({}, item); //this will have id - that defines whether it's an update or not -// this.project.creationUser = {"id":this.project.creationUser.id}; -// $("#newEditProjectModal").modal("show"); - -// return false; -// } - - -// /* -// markProjectForDelete(project){ -// this.project = project; -// } - -// deleteProject(confirmation){ -// if(confirmation==true) -// this.deleteRow(this.project); -// } -// */ - -// } +} \ No newline at end of file diff --git a/dmp-frontend/src/app/services/data-management-plan/data-management-plan.service.ts b/dmp-frontend/src/app/services/data-management-plan/data-management-plan.service.ts index 147715e75..3aac34474 100644 --- a/dmp-frontend/src/app/services/data-management-plan/data-management-plan.service.ts +++ b/dmp-frontend/src/app/services/data-management-plan/data-management-plan.service.ts @@ -30,10 +30,14 @@ export class DataManagementPlanService { } getSingle(id: string): Observable { - return this.http.get(this.actionUrl + id, { headers: this.headers }); + return this.http.get(this.actionUrl + 'getSingle' + id, { headers: this.headers }); } createDataManagementPlan(dataManagementPlanModel: DataManagementPlanModel): Observable { - return this.http.post(this.actionUrl + 'add', dataManagementPlanModel, { headers: this.headers }); + return this.http.post(this.actionUrl + 'createOrUpdate', dataManagementPlanModel, { headers: this.headers }); + } + + inactivate(id: String): Observable { + return this.http.delete(this.actionUrl + 'inactivate' + id, { headers: this.headers }); } } diff --git a/dmp-frontend/src/app/services/project/project.service.ts b/dmp-frontend/src/app/services/project/project.service.ts index f3c6627a4..4e9719e98 100644 --- a/dmp-frontend/src/app/services/project/project.service.ts +++ b/dmp-frontend/src/app/services/project/project.service.ts @@ -39,6 +39,6 @@ export class ProjectService { } inactivate(id: String): Observable { - return this.http.delete(this.actionUrl + 'inactivate' + id, { headers: this.headers }); + return this.http.delete(this.actionUrl + 'inactivate/' + id, { headers: this.headers }); } } diff --git a/dmp-frontend/src/app/shared/components/criteria/data-management-plan/dmp-criteria.component.html b/dmp-frontend/src/app/shared/components/criteria/data-management-plan/dmp-criteria.component.html index f01d9a8b4..6d55298e6 100644 --- a/dmp-frontend/src/app/shared/components/criteria/data-management-plan/dmp-criteria.component.html +++ b/dmp-frontend/src/app/shared/components/criteria/data-management-plan/dmp-criteria.component.html @@ -1,34 +1,28 @@ -
+
-
+
- - {{baseErrorModel['Criteria.PeriodStart']}} - - + + {{baseErrorModel['Criteria.like']}}
-
- - - {{baseErrorModel['Criteria.PeriodEnd']}} - - - +
+ + +
{{chip.name.substring(0, 1).toUpperCase()}}
+ {{chip.name}} +
+ +
+ {{option.name}} +
+
+ +
- \ No newline at end of file +
\ No newline at end of file diff --git a/dmp-frontend/src/app/shared/components/criteria/data-management-plan/dmp-criteria.component.scss b/dmp-frontend/src/app/shared/components/criteria/data-management-plan/dmp-criteria.component.scss index 263cc1548..0b6d2bc32 100644 --- a/dmp-frontend/src/app/shared/components/criteria/data-management-plan/dmp-criteria.component.scss +++ b/dmp-frontend/src/app/shared/components/criteria/data-management-plan/dmp-criteria.component.scss @@ -1,4 +1,4 @@ -.form-criteria { +.dmp-criteria { mat-form-field { padding-bottom: 5px; width: 100%; diff --git a/dmp-frontend/src/app/shared/components/criteria/data-management-plan/dmp-criteria.component.ts b/dmp-frontend/src/app/shared/components/criteria/data-management-plan/dmp-criteria.component.ts index d6faa2076..765c17502 100644 --- a/dmp-frontend/src/app/shared/components/criteria/data-management-plan/dmp-criteria.component.ts +++ b/dmp-frontend/src/app/shared/components/criteria/data-management-plan/dmp-criteria.component.ts @@ -6,6 +6,7 @@ import { ValidationContext, Validation } from '../../../../utilities/validators/ import { BackendErrorValidator } from '../../../../utilities/validators/BackendErrorValidator'; import { DataManagementPlanCriteria } from '../../../../models/criteria/data-management-plan/DataManagementPlanCriteria'; import { DataManagementPlanCriteriaErrorModel } from '../../../../models/criteria/data-management-plan/DataManagementPlanCriteriaErrorModel'; +import { ProjectModel } from '../../../../models/projects/ProjectModel'; @Component({ selector: 'app-dmp-criteria-component', @@ -17,9 +18,9 @@ import { DataManagementPlanCriteriaErrorModel } from '../../../../models/criteri export class DataManagementPlanCriteriaComponent extends BaseCriteriaComponent implements OnInit { - // public form: DataManagementPlanType; - // public formStatus: DataManagementPlanStatus; public criteria: DataManagementPlanCriteria = new DataManagementPlanCriteria(); + filteringProjectsAsync: boolean = false; + filteredProjects: ProjectModel[]; constructor( public language: TranslateService, @@ -36,31 +37,4 @@ export class DataManagementPlanCriteriaComponent extends BaseCriteriaComponent i setCriteria(criteria: DataManagementPlanCriteria): void { this.criteria = criteria; } - - public fromJSONObject(item: any): DataManagementPlanCriteria { - this.criteria = new DataManagementPlanCriteria(); - this.criteria.PeriodStart = new Date(item.PeriodStart); - this.criteria.PeriodEnd = new Date(item.PeriodEnd); - return this.criteria; - } - - buildForm(): FormGroup { - const context: ValidationContext = this.createValidationContext(); - - return this.formBuilder.group({ - periodStart: [this.criteria.PeriodStart, context.getValidation('periodStart').validators], - periodEnd: [this.criteria.PeriodEnd, context.getValidation('periodEnd').validators], - }); - } - - createValidationContext(): ValidationContext { - const validationContext: ValidationContext = new ValidationContext(); - const validationArray: Validation[] = new Array(); - - validationArray.push({ key: 'periodStart', validators: [BackendErrorValidator(this.errorModel, 'Criteria.PeriodStart')] }); //must add 'Criteria.' because the criteria validator is inside the request validator - validationArray.push({ key: 'periodEnd', validators: [BackendErrorValidator(this.errorModel, 'Criteria.PeriodEnd')] }); - - validationContext.validation = validationArray; - return validationContext; - } } diff --git a/dmp-frontend/src/assets/lang/en.json b/dmp-frontend/src/assets/lang/en.json index 2876089f3..e671c6f08 100644 --- a/dmp-frontend/src/assets/lang/en.json +++ b/dmp-frontend/src/assets/lang/en.json @@ -27,10 +27,8 @@ "TITLE": "Data Management Plans", "COLUMNS": { "NAME": "Name", - "ABBREVIATION": "Abbreviation", - "START": "Start", - "END": "End", - "ACTIONS": "Actions" + "PROJECT": "Project", + "CREATION-TIME": "Created" } }, "DATASET-LISTING": { @@ -92,6 +90,10 @@ "PERIOD-FROM": "Start", "PERIOD-TO": "End", "STATUS": "Status" + }, + "DMP": { + "LIKE": "Search", + "PROJECTS": "Projects" } } } \ No newline at end of file From 72ab2d95137c49adcdbe75dd95cdacd310775819 Mon Sep 17 00:00:00 2001 From: Diamadis Tziotzios Date: Tue, 19 Dec 2017 11:53:52 +0200 Subject: [PATCH 2/5] no message --- .../datasets_new/dataset-listing.component.ts | 2 +- .../src/app/dmps/dmp-listing.component.html | 4 +- .../src/app/dmps/dmp-listing.component.ts | 2 +- .../src/app/models/criteria/RequestItem.ts | 6 +++ .../app/models/data-table/DataTableRequest.ts | 5 ++- .../app/projects/project-listing.component.ts | 2 +- .../data-management-plan.service.ts | 3 +- .../app/services/dataset/dataset.service.ts | 3 +- .../app/services/project/project.service.ts | 8 +++- .../dmp-criteria.component.html | 8 ++-- .../dmp-criteria.component.ts | 43 ++++++++++++++++++- 11 files changed, 70 insertions(+), 16 deletions(-) create mode 100644 dmp-frontend/src/app/models/criteria/RequestItem.ts diff --git a/dmp-frontend/src/app/datasets_new/dataset-listing.component.ts b/dmp-frontend/src/app/datasets_new/dataset-listing.component.ts index c4e41dc1c..2166d0bce 100644 --- a/dmp-frontend/src/app/datasets_new/dataset-listing.component.ts +++ b/dmp-frontend/src/app/datasets_new/dataset-listing.component.ts @@ -95,7 +95,7 @@ export class DatasetDataSource extends DataSource { this.isLoadingResults = true; }); const startIndex = this._paginator.pageIndex * this._paginator.pageSize; - const request = new DataTableRequest(startIndex, this._paginator.pageSize); + const request = new DataTableRequest(startIndex, this._paginator.pageSize); request.criteria = this._criteria.criteria; return this._service.getPaged(request); }) diff --git a/dmp-frontend/src/app/dmps/dmp-listing.component.html b/dmp-frontend/src/app/dmps/dmp-listing.component.html index 9148b0008..a26e043d8 100644 --- a/dmp-frontend/src/app/dmps/dmp-listing.component.html +++ b/dmp-frontend/src/app/dmps/dmp-listing.component.html @@ -10,13 +10,13 @@ {{'DMP-LISTING.COLUMNS.NAME' | translate}} - {{row.name}} + {{row.label}} {{'DMP-LISTING.COLUMNS.PROJECT' | translate}} - {{row.abbreviation}} + {{row.project?.label}} diff --git a/dmp-frontend/src/app/dmps/dmp-listing.component.ts b/dmp-frontend/src/app/dmps/dmp-listing.component.ts index 0882f0062..7cc3030b0 100644 --- a/dmp-frontend/src/app/dmps/dmp-listing.component.ts +++ b/dmp-frontend/src/app/dmps/dmp-listing.component.ts @@ -95,7 +95,7 @@ export class DataManagementPlanDataSource extends DataSource(startIndex, this._paginator.pageSize); request.criteria = this._criteria.criteria; return this._service.getPaged(request); }) diff --git a/dmp-frontend/src/app/models/criteria/RequestItem.ts b/dmp-frontend/src/app/models/criteria/RequestItem.ts new file mode 100644 index 000000000..976e7af91 --- /dev/null +++ b/dmp-frontend/src/app/models/criteria/RequestItem.ts @@ -0,0 +1,6 @@ +import { FormGenerator } from "../../utilities/forms/FormGenerator"; +import { BaseCriteriaErrorModel } from "./BaseCriteriaErrorModel"; + +export class RequestItem { + public criteria: T; +} diff --git a/dmp-frontend/src/app/models/data-table/DataTableRequest.ts b/dmp-frontend/src/app/models/data-table/DataTableRequest.ts index 576c6b89b..b85da378f 100644 --- a/dmp-frontend/src/app/models/data-table/DataTableRequest.ts +++ b/dmp-frontend/src/app/models/data-table/DataTableRequest.ts @@ -1,11 +1,12 @@ import { BaseCriteria } from "../criteria/BaseCriteria"; +import { RequestItem } from "../criteria/RequestItem"; -export class DataTableRequest { +export class DataTableRequest extends RequestItem { offset = 0; length = 0; - criteria: BaseCriteria; constructor(offset: number, length: number) { + super(); this.length = length; this.offset = offset; } diff --git a/dmp-frontend/src/app/projects/project-listing.component.ts b/dmp-frontend/src/app/projects/project-listing.component.ts index f0d033168..faed35e0d 100644 --- a/dmp-frontend/src/app/projects/project-listing.component.ts +++ b/dmp-frontend/src/app/projects/project-listing.component.ts @@ -96,7 +96,7 @@ export class ProjectDataSource extends DataSource { this.isLoadingResults = true; }); const startIndex = this._paginator.pageIndex * this._paginator.pageSize; - const request = new DataTableRequest(startIndex, this._paginator.pageSize); + const request = new DataTableRequest(startIndex, this._paginator.pageSize); request.criteria = this._criteria.criteria; return this._service.getPaged(request); }) diff --git a/dmp-frontend/src/app/services/data-management-plan/data-management-plan.service.ts b/dmp-frontend/src/app/services/data-management-plan/data-management-plan.service.ts index 3aac34474..ae411f7ef 100644 --- a/dmp-frontend/src/app/services/data-management-plan/data-management-plan.service.ts +++ b/dmp-frontend/src/app/services/data-management-plan/data-management-plan.service.ts @@ -8,6 +8,7 @@ import { DataTableRequest } from '../../models/data-table/DataTableRequest'; import { DataTableData } from '../../models/data-table/DataTableData'; import { DataManagementPlanModel } from '../../models/data-managemnt-plans/DataManagementPlanModel'; import { DataManagementPlanListingModel } from '../../models/data-managemnt-plans/DataManagementPlanListingModel'; +import { DataManagementPlanCriteria } from '../../models/criteria/data-management-plan/DataManagementPlanCriteria'; @Injectable() @@ -25,7 +26,7 @@ export class DataManagementPlanService { this.headers = this.headers.set('Accept', 'application/json'); } - getPaged(dataTableRequest: DataTableRequest): Observable> { + getPaged(dataTableRequest: DataTableRequest): Observable> { return this.http.post>(this.actionUrl + 'getPaged', dataTableRequest, { headers: this.headers }); } diff --git a/dmp-frontend/src/app/services/dataset/dataset.service.ts b/dmp-frontend/src/app/services/dataset/dataset.service.ts index 808563f43..83cc1809a 100644 --- a/dmp-frontend/src/app/services/dataset/dataset.service.ts +++ b/dmp-frontend/src/app/services/dataset/dataset.service.ts @@ -8,6 +8,7 @@ import { DataTableRequest } from '../../models/data-table/DataTableRequest'; import { DataTableData } from '../../models/data-table/DataTableData'; import { DatasetListingModel } from '../../models/datasets/DatasetListingModel'; import { DatasetModel } from '../../models/datasets/DatasetModel'; +import { DatasetCriteria } from '../../models/criteria/dataset/DatasetCriteria'; @Injectable() @@ -25,7 +26,7 @@ export class DatasetService { this.headers = this.headers.set('Accept', 'application/json'); } - getPaged(dataTableRequest: DataTableRequest): Observable> { + getPaged(dataTableRequest: DataTableRequest): Observable> { return this.http.post>(this.actionUrl + 'getPaged', dataTableRequest, { headers: this.headers }); } diff --git a/dmp-frontend/src/app/services/project/project.service.ts b/dmp-frontend/src/app/services/project/project.service.ts index 4e9719e98..e2fd4fe0b 100644 --- a/dmp-frontend/src/app/services/project/project.service.ts +++ b/dmp-frontend/src/app/services/project/project.service.ts @@ -9,6 +9,8 @@ import { DataTableData } from '../../models/data-table/DataTableData'; import { ProjectListingModel } from '../../models/projects/ProjectListingModel'; import { ProjectModel } from '../../models/projects/ProjectModel'; import { BaseHttpResponseModel } from '../../models/http/BaseHttpResponseModel'; +import { ProjectCriteria } from '../../models/criteria/project/ProjectCriteria'; +import { RequestItem } from '../../models/criteria/RequestItem'; @Injectable() @@ -26,10 +28,14 @@ export class ProjectService { this.headers = this.headers.set('Accept', 'application/json'); } - getPaged(dataTableRequest: DataTableRequest): Observable> { + getPaged(dataTableRequest: DataTableRequest): Observable> { return this.http.post>(this.actionUrl + 'getPaged', dataTableRequest, { headers: this.headers }); } + get(requestItem: RequestItem): Observable { + return this.http.post(this.actionUrl + 'get', requestItem, { headers: this.headers }); + } + getSingle(id: string): Observable { return this.http.get(this.actionUrl + 'getSingle/' + id, { headers: this.headers }); } diff --git a/dmp-frontend/src/app/shared/components/criteria/data-management-plan/dmp-criteria.component.html b/dmp-frontend/src/app/shared/components/criteria/data-management-plan/dmp-criteria.component.html index 6d55298e6..924f02e6c 100644 --- a/dmp-frontend/src/app/shared/components/criteria/data-management-plan/dmp-criteria.component.html +++ b/dmp-frontend/src/app/shared/components/criteria/data-management-plan/dmp-criteria.component.html @@ -9,15 +9,15 @@
- -
{{chip.name.substring(0, 1).toUpperCase()}}
- {{chip.name}} +
{{chip.label.substring(0, 1).toUpperCase()}}
+ {{chip.label}}
- {{option.name}} + {{option.label}}
diff --git a/dmp-frontend/src/app/shared/components/criteria/data-management-plan/dmp-criteria.component.ts b/dmp-frontend/src/app/shared/components/criteria/data-management-plan/dmp-criteria.component.ts index 765c17502..d9eaf4c07 100644 --- a/dmp-frontend/src/app/shared/components/criteria/data-management-plan/dmp-criteria.component.ts +++ b/dmp-frontend/src/app/shared/components/criteria/data-management-plan/dmp-criteria.component.ts @@ -7,13 +7,16 @@ import { BackendErrorValidator } from '../../../../utilities/validators/BackendE import { DataManagementPlanCriteria } from '../../../../models/criteria/data-management-plan/DataManagementPlanCriteria'; import { DataManagementPlanCriteriaErrorModel } from '../../../../models/criteria/data-management-plan/DataManagementPlanCriteriaErrorModel'; import { ProjectModel } from '../../../../models/projects/ProjectModel'; +import { ProjectService } from '../../../../services/project/project.service'; +import { ProjectCriteria } from '../../../../models/criteria/project/ProjectCriteria'; +import { RequestItem } from '../../../../models/criteria/RequestItem'; +import { create } from 'domain'; @Component({ selector: 'app-dmp-criteria-component', templateUrl: './dmp-criteria.component.html', styleUrls: ['./dmp-criteria.component.scss'], - providers: [ - ] + providers: [ProjectService] }) export class DataManagementPlanCriteriaComponent extends BaseCriteriaComponent implements OnInit { @@ -24,6 +27,7 @@ export class DataManagementPlanCriteriaComponent extends BaseCriteriaComponent i constructor( public language: TranslateService, + public projectService: ProjectService, public formBuilder: FormBuilder ) { super(new DataManagementPlanCriteriaErrorModel()); @@ -37,4 +41,39 @@ export class DataManagementPlanCriteriaComponent extends BaseCriteriaComponent i setCriteria(criteria: DataManagementPlanCriteria): void { this.criteria = criteria; } + + onCallbackError(error: any) { + this.setErrorModel(error.error); + } + + controlModified(): void { + this.clearErrorModel(); + if (this.refreshCallback != null && + (this.criteria.like == null || this.criteria.like.length == 0 || this.criteria.like.length > 2) + ) { + this.refreshCallback(); + } + } + + filterProjects(value: string): void { + + this.filteredProjects = undefined; + if (value) { + this.filteringProjectsAsync = true; + + let requestItem: RequestItem = new RequestItem(); + let criteria: ProjectCriteria = new ProjectCriteria(); + criteria.like = value; + requestItem.criteria = criteria; + this.projectService.get(requestItem).subscribe(items => { + this.filteredProjects = items; + this.filteringProjectsAsync = false; + + // this.filteredProjects = items.filter((filteredObj: any) => { + // return this.objectsModel ? this.objectsModel.indexOf(filteredObj) < 0 : true; + // }); + + }); + } + } } From 8bb591245a5457b4fbe4865412997e8667d8a5c8 Mon Sep 17 00:00:00 2001 From: Diamadis Tziotzios Date: Tue, 19 Dec 2017 12:33:47 +0200 Subject: [PATCH 3/5] no message --- dmp-frontend/src/app/dmps/dmp-listing.component.ts | 2 +- dmp-frontend/src/app/dmps/editor/dmp-editor.component.html | 4 ++-- dmp-frontend/src/app/dmps/editor/dmp-editor.component.scss | 2 +- .../data-management-plan/data-management-plan.service.ts | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dmp-frontend/src/app/dmps/dmp-listing.component.ts b/dmp-frontend/src/app/dmps/dmp-listing.component.ts index 7cc3030b0..0ad6ead17 100644 --- a/dmp-frontend/src/app/dmps/dmp-listing.component.ts +++ b/dmp-frontend/src/app/dmps/dmp-listing.component.ts @@ -48,7 +48,7 @@ export class DataManagementPlanListingComponent implements OnInit { } rowClick(rowId: String) { - this.router.navigate(['/forms/' + rowId]); + this.router.navigate(['/dmp/' + rowId]); } getDefaultCriteria(): DataManagementPlanCriteria { diff --git a/dmp-frontend/src/app/dmps/editor/dmp-editor.component.html b/dmp-frontend/src/app/dmps/editor/dmp-editor.component.html index 7b94fcc67..8d767bfc7 100644 --- a/dmp-frontend/src/app/dmps/editor/dmp-editor.component.html +++ b/dmp-frontend/src/app/dmps/editor/dmp-editor.component.html @@ -1,8 +1,8 @@ -
+
{{'DMP-EDITOR.TITLE.NEW' | translate}} - {{'DMP-EDITOR.TITLE.EDIT' | translate}} {{project.label}} + {{'DMP-EDITOR.TITLE.EDIT' | translate}} {{dataManagementPlan.label}} diff --git a/dmp-frontend/src/app/dmps/editor/dmp-editor.component.scss b/dmp-frontend/src/app/dmps/editor/dmp-editor.component.scss index 31e8a8de3..4921ca203 100644 --- a/dmp-frontend/src/app/dmps/editor/dmp-editor.component.scss +++ b/dmp-frontend/src/app/dmps/editor/dmp-editor.component.scss @@ -10,7 +10,7 @@ background: rgba(0, 0, 0, 0.32); } -.project-editor { +.data-management-plan-editor { mat-form-field { width: 100%; padding: 3px; diff --git a/dmp-frontend/src/app/services/data-management-plan/data-management-plan.service.ts b/dmp-frontend/src/app/services/data-management-plan/data-management-plan.service.ts index ae411f7ef..78709affe 100644 --- a/dmp-frontend/src/app/services/data-management-plan/data-management-plan.service.ts +++ b/dmp-frontend/src/app/services/data-management-plan/data-management-plan.service.ts @@ -31,7 +31,7 @@ export class DataManagementPlanService { } getSingle(id: string): Observable { - return this.http.get(this.actionUrl + 'getSingle' + id, { headers: this.headers }); + return this.http.get(this.actionUrl + 'getSingle/' + id, { headers: this.headers }); } createDataManagementPlan(dataManagementPlanModel: DataManagementPlanModel): Observable { @@ -39,6 +39,6 @@ export class DataManagementPlanService { } inactivate(id: String): Observable { - return this.http.delete(this.actionUrl + 'inactivate' + id, { headers: this.headers }); + return this.http.delete(this.actionUrl + 'inactivate/' + id, { headers: this.headers }); } } From 24b2dfabdc497f6e2e2339df456da43f6497231c Mon Sep 17 00:00:00 2001 From: Diamadis Tziotzios Date: Tue, 19 Dec 2017 13:45:56 +0200 Subject: [PATCH 4/5] no message --- .../dataset-listing.component.css | 0 .../dataset-listing.component.scss | 31 ++++ .../datasets_new/dataset-listing.component.ts | 2 +- .../src/app/dmps/dmp-listing.component.html | 28 +++- .../src/app/dmps/dmp-listing.component.scss | 8 + .../src/app/dmps/dmp-listing.component.ts | 2 +- .../app/dmps/editor/dmp-editor.component.html | 2 +- .../projects/project-listing.component.html | 143 +----------------- .../projects/project-listing.component.scss | 8 + .../app/projects/project-listing.component.ts | 4 +- dmp-frontend/src/index.html | 3 - 11 files changed, 77 insertions(+), 154 deletions(-) delete mode 100644 dmp-frontend/src/app/datasets_new/dataset-listing.component.css create mode 100644 dmp-frontend/src/app/datasets_new/dataset-listing.component.scss diff --git a/dmp-frontend/src/app/datasets_new/dataset-listing.component.css b/dmp-frontend/src/app/datasets_new/dataset-listing.component.css deleted file mode 100644 index e69de29bb..000000000 diff --git a/dmp-frontend/src/app/datasets_new/dataset-listing.component.scss b/dmp-frontend/src/app/datasets_new/dataset-listing.component.scss new file mode 100644 index 000000000..8da81cd62 --- /dev/null +++ b/dmp-frontend/src/app/datasets_new/dataset-listing.component.scss @@ -0,0 +1,31 @@ +.mat-table { + margin: 24px; +} + +.mat-progress-bar { + position: absolute; +} + +.mat-fab-bottom-right { + top: auto !important; + right: 20px !important; + bottom: 10px !important; + left: auto !important; + position: fixed !important; +} + +.full-width { + width: 100%; +} + +.mat-card { + margin: 16px 0; +} + +.mat-row { + cursor: pointer; +} + +mat-row:hover { + background-color: lightgray; +} \ No newline at end of file diff --git a/dmp-frontend/src/app/datasets_new/dataset-listing.component.ts b/dmp-frontend/src/app/datasets_new/dataset-listing.component.ts index 2166d0bce..edec80527 100644 --- a/dmp-frontend/src/app/datasets_new/dataset-listing.component.ts +++ b/dmp-frontend/src/app/datasets_new/dataset-listing.component.ts @@ -17,7 +17,7 @@ import { DatasetListingModel } from "../models/datasets/DatasetListingModel"; @Component({ selector: 'app-dataset-listing-component', templateUrl: 'dataset-listing.component.html', - styleUrls: ['./dataset-listing.component.css'], + styleUrls: ['./dataset-listing.component.scss'], providers: [DatasetService] }) export class DatasetListingComponent implements OnInit, AfterViewInit { diff --git a/dmp-frontend/src/app/dmps/dmp-listing.component.html b/dmp-frontend/src/app/dmps/dmp-listing.component.html index a26e043d8..cc2597633 100644 --- a/dmp-frontend/src/app/dmps/dmp-listing.component.html +++ b/dmp-frontend/src/app/dmps/dmp-listing.component.html @@ -16,13 +16,31 @@ {{'DMP-LISTING.COLUMNS.PROJECT' | translate}} - {{row.project?.label}} + {{row.project}} - - - {{'DMP-LISTING.COLUMNS.CREATION-TIME' | translate}} - + + + {{'DMP-LISTING.COLUMNS.PROFILE' | translate}} + {{row.profile}} + + + + + {{'DMP-LISTING.COLUMNS.RESEARCHERS' | translate}} + {{row.researchers}} + + + + + {{'DMP-LISTING.COLUMNS.ORGANISATIONS' | translate}} + {{row.organisations}} + + + + + {{'DMP-LISTING.COLUMNS.VERSION' | translate}} + {{row.version}} diff --git a/dmp-frontend/src/app/dmps/dmp-listing.component.scss b/dmp-frontend/src/app/dmps/dmp-listing.component.scss index d81a50420..8da81cd62 100644 --- a/dmp-frontend/src/app/dmps/dmp-listing.component.scss +++ b/dmp-frontend/src/app/dmps/dmp-listing.component.scss @@ -20,4 +20,12 @@ .mat-card { margin: 16px 0; +} + +.mat-row { + cursor: pointer; +} + +mat-row:hover { + background-color: lightgray; } \ No newline at end of file diff --git a/dmp-frontend/src/app/dmps/dmp-listing.component.ts b/dmp-frontend/src/app/dmps/dmp-listing.component.ts index 0ad6ead17..564521406 100644 --- a/dmp-frontend/src/app/dmps/dmp-listing.component.ts +++ b/dmp-frontend/src/app/dmps/dmp-listing.component.ts @@ -26,7 +26,7 @@ export class DataManagementPlanListingComponent implements OnInit { @ViewChild(DataManagementPlanCriteriaComponent) criteria: DataManagementPlanCriteriaComponent; dataSource: DataManagementPlanDataSource | null; - displayedColumns: String[] = ['name', 'project', 'creationTime']; + displayedColumns: String[] = ['name', 'project', 'profile', 'researchers', 'organisations', 'version']; constructor( private dataManagementPlanService: DataManagementPlanService, diff --git a/dmp-frontend/src/app/dmps/editor/dmp-editor.component.html b/dmp-frontend/src/app/dmps/editor/dmp-editor.component.html index 8d767bfc7..3edddc208 100644 --- a/dmp-frontend/src/app/dmps/editor/dmp-editor.component.html +++ b/dmp-frontend/src/app/dmps/editor/dmp-editor.component.html @@ -2,7 +2,7 @@ {{'DMP-EDITOR.TITLE.NEW' | translate}} - {{'DMP-EDITOR.TITLE.EDIT' | translate}} {{dataManagementPlan.label}} + {{formGroup.get('label').value}} diff --git a/dmp-frontend/src/app/projects/project-listing.component.html b/dmp-frontend/src/app/projects/project-listing.component.html index b6c115dfb..1340e5919 100644 --- a/dmp-frontend/src/app/projects/project-listing.component.html +++ b/dmp-frontend/src/app/projects/project-listing.component.html @@ -32,10 +32,10 @@ - + @@ -50,141 +50,4 @@ -
- +
\ No newline at end of file diff --git a/dmp-frontend/src/app/projects/project-listing.component.scss b/dmp-frontend/src/app/projects/project-listing.component.scss index d81a50420..8da81cd62 100644 --- a/dmp-frontend/src/app/projects/project-listing.component.scss +++ b/dmp-frontend/src/app/projects/project-listing.component.scss @@ -20,4 +20,12 @@ .mat-card { margin: 16px 0; +} + +.mat-row { + cursor: pointer; +} + +mat-row:hover { + background-color: lightgray; } \ No newline at end of file diff --git a/dmp-frontend/src/app/projects/project-listing.component.ts b/dmp-frontend/src/app/projects/project-listing.component.ts index faed35e0d..6de8cb0de 100644 --- a/dmp-frontend/src/app/projects/project-listing.component.ts +++ b/dmp-frontend/src/app/projects/project-listing.component.ts @@ -11,8 +11,6 @@ import { Observable } from "rxjs/Observable"; import { DataTableRequest } from "../models/data-table/DataTableRequest"; import { SnackBarNotificationComponent } from "../shared/components/notificaiton/snack-bar-notification.component"; - - @Component({ selector: 'app-project-listing-component', templateUrl: 'project-listing.component.html', @@ -27,7 +25,7 @@ export class ProjectListingComponent implements OnInit { @ViewChild(ProjectCriteriaComponent) criteria: ProjectCriteriaComponent; dataSource: ProjectDataSource | null; - displayedColumns: String[] = ['name', 'abbreviation', 'start', 'end', 'actions']; + displayedColumns: String[] = ['name', 'abbreviation', 'start', 'end']; constructor( private projectService: ProjectService, diff --git a/dmp-frontend/src/index.html b/dmp-frontend/src/index.html index 599f1b45a..467b91a55 100644 --- a/dmp-frontend/src/index.html +++ b/dmp-frontend/src/index.html @@ -31,9 +31,6 @@ - From 9b62f914b6a9224f9d5138ce95f0ea87984c26a4 Mon Sep 17 00:00:00 2001 From: Diamadis Tziotzios Date: Tue, 19 Dec 2017 14:06:52 +0200 Subject: [PATCH 5/5] no message --- .../src/app/dmps/dmp-listing.component.html | 2 +- .../DataManagementPlanListingModel.ts | 24 ++++++++----------- dmp-frontend/src/assets/lang/en.json | 5 +++- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/dmp-frontend/src/app/dmps/dmp-listing.component.html b/dmp-frontend/src/app/dmps/dmp-listing.component.html index cc2597633..585e0d16b 100644 --- a/dmp-frontend/src/app/dmps/dmp-listing.component.html +++ b/dmp-frontend/src/app/dmps/dmp-listing.component.html @@ -40,7 +40,7 @@ {{'DMP-LISTING.COLUMNS.VERSION' | translate}} - {{row.version}} + {{row.version}} diff --git a/dmp-frontend/src/app/models/data-managemnt-plans/DataManagementPlanListingModel.ts b/dmp-frontend/src/app/models/data-managemnt-plans/DataManagementPlanListingModel.ts index e8ab737c5..8930e9e09 100644 --- a/dmp-frontend/src/app/models/data-managemnt-plans/DataManagementPlanListingModel.ts +++ b/dmp-frontend/src/app/models/data-managemnt-plans/DataManagementPlanListingModel.ts @@ -3,24 +3,20 @@ import { Serializable } from "../Serializable"; export class DataManagementPlanListingModel implements Serializable { public id: String; public label: String; - public abbreviation: String; - public reference: String; - public uri: String; - public status: String; - public startDate: Date; - public endDate: Date; - public description: String; + public project: String; + public profile: String; + public researchers: String; + public organisations: String; + public version: number; fromJSONObject(item: any): DataManagementPlanListingModel { this.id = item.id; this.label = item.label; - this.abbreviation = item.abbreviation; - this.reference = item.reference; - this.uri = item.uri; - this.status = item.status; - this.startDate = item.startDate; - this.endDate = item.endDate; - this.description = item.description; + this.project = item.project; + this.profile = item.profile; + this.researchers = item.researchers; + this.organisations = item.organisations; + this.version = item.version; return this; } diff --git a/dmp-frontend/src/assets/lang/en.json b/dmp-frontend/src/assets/lang/en.json index e671c6f08..20adf8928 100644 --- a/dmp-frontend/src/assets/lang/en.json +++ b/dmp-frontend/src/assets/lang/en.json @@ -28,7 +28,10 @@ "COLUMNS": { "NAME": "Name", "PROJECT": "Project", - "CREATION-TIME": "Created" + "PROFILE": "Profile", + "RESEARCHERS": "Researchers", + "ORGANISATIONS": "Organisations", + "VERSION": "Version" } }, "DATASET-LISTING": {