diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/Projects.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/Projects.java index a1bd460a9..2e603fa1c 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/Projects.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/Projects.java @@ -46,11 +46,17 @@ public class Projects extends BaseController { @RequestMapping(method = RequestMethod.POST, value = {"/paged"}, consumes = "application/json", produces = "application/json") public @ResponseBody ResponseEntity>> getPaged(@Valid @RequestBody ProjectTableRequest projectTableRequest, @RequestParam String fieldsGroup, Principal principal) throws Exception { - System.out.println(fieldsGroup); DataTableData dataTable = this.projectManager.getPaged(projectTableRequest, principal, fieldsGroup); return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>().payload(dataTable).status(ApiMessageCode.NO_MESSAGE)); } + @RequestMapping(method = RequestMethod.POST, value = {"public/paged"}, consumes = "application/json", produces = "application/json") + public @ResponseBody + ResponseEntity>> getPaged(@Valid @RequestBody ProjectTableRequest projectTableRequest) throws Exception { + DataTableData dataTable = this.projectManager.getPublicPaged(projectTableRequest); + return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem>().payload(dataTable).status(ApiMessageCode.NO_MESSAGE)); + } + @RequestMapping(method = RequestMethod.GET, value = {"{id}"}, produces = "application/json") public @ResponseBody ResponseEntity> getSingle(@PathVariable String id, Principal principal) throws IllegalAccessException, InstantiationException { diff --git a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/ProjectManager.java b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/ProjectManager.java index 29aaa494d..5db1b6c6c 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/logic/managers/ProjectManager.java +++ b/dmp-backend/web/src/main/java/eu/eudat/logic/managers/ProjectManager.java @@ -88,6 +88,22 @@ public class ProjectManager { return dataTable; } + public DataTableData getPublicPaged(ProjectTableRequest projectTableRequest) throws Exception { + ProjectDao projectRepository = databaseRepository.getProjectDao(); + QueryableList items = projectRepository.getWithCriteria(projectTableRequest.getCriteria()); + QueryableList pagedItems = PaginationManager.applyPaging(items, projectTableRequest); + DataTableData dataTable = new DataTableData<>(); + CompletableFuture projectsFuture; + projectsFuture = pagedItems.selectAsync(item -> new ProjectListingModel().fromDataModel(item)) + .whenComplete((results, throwable) -> { + dataTable.setData(results); + }); + CompletableFuture countFuture = pagedItems.countAsync().whenComplete((count, throwable) -> dataTable.setTotalCount(count)); + + CompletableFuture.allOf(projectsFuture, countFuture).join(); + return dataTable; + } + public eu.eudat.models.data.project.Project getSingle(String id) throws InstantiationException, IllegalAccessException { eu.eudat.models.data.project.Project project = new eu.eudat.models.data.project.Project(); project.fromDataModel(databaseRepository.getProjectDao().find(UUID.fromString(id))); diff --git a/dmp-frontend/src/app/core/services/project/project.service.ts b/dmp-frontend/src/app/core/services/project/project.service.ts index 6abe04a98..d7af200d7 100644 --- a/dmp-frontend/src/app/core/services/project/project.service.ts +++ b/dmp-frontend/src/app/core/services/project/project.service.ts @@ -29,6 +29,10 @@ export class ProjectService { } } + getPublicPaged(dataTableRequest: DataTableRequest): Observable> { + return this.http.post>(this.actionUrl + 'public/paged', dataTableRequest, { headers: this.headers }); + } + getWithExternal(requestItem: RequestItem): Observable { return this.http.post(this.actionUrl + 'external', requestItem, { headers: this.headers }); } @@ -45,5 +49,4 @@ export class ProjectService { delete(id: String): Observable { return this.http.delete(this.actionUrl + id, { headers: this.headers }); } - } diff --git a/dmp-frontend/src/app/ui/dataset-create-wizard/dmp-selector/dataset-dmp-selector.component.html b/dmp-frontend/src/app/ui/dataset-create-wizard/dmp-selector/dataset-dmp-selector.component.html index ea786844c..70f480dda 100644 --- a/dmp-frontend/src/app/ui/dataset-create-wizard/dmp-selector/dataset-dmp-selector.component.html +++ b/dmp-frontend/src/app/ui/dataset-create-wizard/dmp-selector/dataset-dmp-selector.component.html @@ -2,7 +2,7 @@
- diff --git a/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.html b/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.html index 283c7e03b..2c0c41de9 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.html +++ b/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.component.html @@ -67,12 +67,12 @@ - + placeholder="{{'DMP-EDITOR.FIELDS.DESCRIPTION' | translate}}" formControlName="description"> + + - + @@ -180,4 +180,4 @@ -
\ No newline at end of file + diff --git a/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.model.ts b/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.model.ts index 8ddd60265..c366d5b17 100644 --- a/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.model.ts +++ b/dmp-frontend/src/app/ui/dmp/editor/dmp-editor.model.ts @@ -62,7 +62,7 @@ export class DmpEditorModel { groupId: [{ value: this.groupId, disabled: disabled }, context.getValidation('groupId').validators], version: [{ value: this.version, disabled: disabled }, context.getValidation('version').validators], status: [{ value: this.status, disabled: disabled }, context.getValidation('status').validators], - description: [{ value: this.description, disabled: disabled }, context.getValidation('description').validators], + description: [{ value: this.description, disabled: disabled }], project: [{ value: this.project, disabled: disabled }, context.getValidation('project').validators], organisations: [{ value: this.organisations, disabled: disabled }, context.getValidation('organisations').validators], researchers: [{ value: this.researchers, disabled: disabled }, context.getValidation('researchers').validators], diff --git a/dmp-frontend/src/app/ui/dmp/wizard/dmp-wizard-editor.model.ts b/dmp-frontend/src/app/ui/dmp/wizard/dmp-wizard-editor.model.ts index dcaa915c9..91c1b7d90 100644 --- a/dmp-frontend/src/app/ui/dmp/wizard/dmp-wizard-editor.model.ts +++ b/dmp-frontend/src/app/ui/dmp/wizard/dmp-wizard-editor.model.ts @@ -62,7 +62,7 @@ export class DmpWizardEditorModel { groupId: [{ value: this.groupId, disabled: disabled }, context.getValidation('groupId').validators], version: [{ value: this.version, disabled: disabled }, context.getValidation('version').validators], status: [{ value: this.status, disabled: disabled }, context.getValidation('status').validators], - description: [{ value: this.description, disabled: disabled }, context.getValidation('description').validators], + description: [{ value: this.description, disabled: disabled }], project: [{ value: this.project, disabled: disabled }, context.getValidation('project').validators], organisations: [{ value: this.organisations, disabled: disabled }, context.getValidation('organisations').validators], researchers: [{ value: this.researchers, disabled: disabled }, context.getValidation('researchers').validators], diff --git a/dmp-frontend/src/app/ui/dmp/wizard/editor/dmp-wizard-editor.component.html b/dmp-frontend/src/app/ui/dmp/wizard/editor/dmp-wizard-editor.component.html index 768d1df14..bc2f4e72b 100644 --- a/dmp-frontend/src/app/ui/dmp/wizard/editor/dmp-wizard-editor.component.html +++ b/dmp-frontend/src/app/ui/dmp/wizard/editor/dmp-wizard-editor.component.html @@ -24,8 +24,8 @@ + placeholder="{{'DMP-EDITOR.FIELDS.DESCRIPTION' | translate}}" formControlName="description"> + {{formGroup.get('description').getError('backendError').message}} @@ -83,4 +83,4 @@
- \ No newline at end of file + diff --git a/dmp-frontend/src/app/ui/explore-dataset/filters/explore-dataset-filters.component.ts b/dmp-frontend/src/app/ui/explore-dataset/filters/explore-dataset-filters.component.ts index def4be3a3..38529b52a 100644 --- a/dmp-frontend/src/app/ui/explore-dataset/filters/explore-dataset-filters.component.ts +++ b/dmp-frontend/src/app/ui/explore-dataset/filters/explore-dataset-filters.component.ts @@ -16,6 +16,7 @@ import { ExternalSourcesService } from '../../../core/services/external-sources/ import { ProjectService } from '../../../core/services/project/project.service'; import { RequestItem } from '../../../core/query/request-item'; import { DataTableRequest } from '../../../core/model/data-table/data-table-request'; +import { AuthService } from '../../../core/services/auth/auth.service'; @Component({ selector: 'app-explore-dataset-filters-component', @@ -60,7 +61,8 @@ export class ExploreDatasetFiltersComponent extends BaseComponent implements OnI public projectService: ProjectService, public languageService: TranslateService, public datasetProfileService: DatasetService, - public externalSourcesService: ExternalSourcesService + public externalSourcesService: ExternalSourcesService, + private authentication: AuthService, ) { super(); } ngOnInit() { @@ -96,7 +98,8 @@ export class ExploreDatasetFiltersComponent extends BaseComponent implements OnI dataTableRequest.criteria = new ProjectCriteria(); dataTableRequest.criteria.projectStateType = this.facetCriteria.projectStatus; dataTableRequest.criteria['length'] = 10; - this.projects = this.projectService.getPaged(dataTableRequest, "autocomplete").map(x => x.data); + + this.projects = this.projectService.getPublicPaged(dataTableRequest).map(x => x.data); this.facetCriteria.projects = []; } this.facetCriteriaChange.emit(this.facetCriteria); @@ -157,7 +160,8 @@ export class ExploreDatasetFiltersComponent extends BaseComponent implements OnI const dataTableRequest: DataTableRequest = new DataTableRequest(0, null, { fields: fields }); dataTableRequest.criteria = projectCriteria; //const dataTableRequest: RequestItem = { criteria: projectCriteria }; - return this.projectService.getPaged(dataTableRequest, "autocomplete").map(x => x.data); + //return this.projectService.getPaged(dataTableRequest, "autocomplete").map(x => x.data); + return this.projectService.getPublicPaged(dataTableRequest).map(x => x.data); } public dmpOrganisationSearch(value: string): Observable { diff --git a/dmp-frontend/src/assets/i18n/en.json b/dmp-frontend/src/assets/i18n/en.json index 0feb06388..bc1383403 100644 --- a/dmp-frontend/src/assets/i18n/en.json +++ b/dmp-frontend/src/assets/i18n/en.json @@ -482,7 +482,8 @@ "SAVE": "Save" }, "FIRST-STEP": { - "TITLE": "DMP" + "TITLE": "DMP", + "PLACEHOLDER": "Pick an existing DMP" } }, "INVITATION-EDITOR": {