Merge branch 'ui-refactoring' of https://gitlab.eudat.eu/dmp/OpenAIRE-EUDAT-DMP-service-pilot into ui-refactoring
This commit is contained in:
commit
498f690f22
|
@ -79,7 +79,7 @@ public class DMPs extends BaseController {
|
|||
}
|
||||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/post"}, consumes = "application/json", produces = "application/json")
|
||||
@RequestMapping(method = RequestMethod.POST, consumes = "application/json", produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<DMP>> createOrUpdate(@RequestBody eu.eudat.models.data.dmp.DataManagementPlan dataManagementPlan, Principal principal) throws Exception {
|
||||
this.dataManagementPlanManager.createOrUpdate(this.getApiContext(), dataManagementPlan, principal);
|
||||
|
|
|
@ -33,79 +33,59 @@ import static eu.eudat.types.Authorities.ANONYMOUS;
|
|||
|
||||
@RestController
|
||||
@CrossOrigin
|
||||
@RequestMapping(value = {"/api"})
|
||||
@RequestMapping(value = {"/api/projects/"})
|
||||
public class Projects extends BaseController {
|
||||
private ProjectManager projectManager;
|
||||
|
||||
@Autowired
|
||||
public Projects(ApiContext apiContext) {
|
||||
public Projects(ApiContext apiContext, ProjectManager projectManager) {
|
||||
super(apiContext);
|
||||
this.projectManager = projectManager;
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/projects/getPaged"}, consumes = "application/json", produces = "application/json")
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/paged"}, consumes = "application/json", produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<DataTableData<ProjectListingModel>>> getPaged(@Valid @RequestBody ProjectTableRequest projectTableRequest, Principal principal) throws Exception {
|
||||
DataTableData<eu.eudat.models.data.project.ProjectListingModel> dataTable = new ProjectManager().getPaged(this.getApiContext().getOperationsContext().getDatabaseRepository().getProjectDao(), projectTableRequest, principal);
|
||||
DataTableData<eu.eudat.models.data.project.ProjectListingModel> dataTable = this.projectManager.getPaged(this.getApiContext().getOperationsContext().getDatabaseRepository().getProjectDao(), projectTableRequest, principal);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<DataTableData<eu.eudat.models.data.project.ProjectListingModel>>().payload(dataTable).status(ApiMessageCode.NO_MESSAGE));
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/projects/getSingle/{id}"}, produces = "application/json")
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"{id}"}, produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<eu.eudat.models.data.project.Project>> getSingle(@PathVariable String id, Principal principal) throws IllegalAccessException, InstantiationException {
|
||||
eu.eudat.models.data.project.Project project = new ProjectManager().getSingle(this.getApiContext().getOperationsContext().getDatabaseRepository().getProjectDao(), id);
|
||||
eu.eudat.models.data.project.Project project = this.projectManager.getSingle(this.getApiContext().getOperationsContext().getDatabaseRepository().getProjectDao(), id);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<eu.eudat.models.data.project.Project>().payload(project).status(ApiMessageCode.NO_MESSAGE));
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/projects/createOrUpdate"}, consumes = "application/json", produces = "application/json")
|
||||
@RequestMapping(method = RequestMethod.POST, consumes = "application/json", produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<Project>> addProject(@Valid @RequestBody eu.eudat.models.data.project.Project project, Principal principal) throws IOException, ParseException {
|
||||
ProjectManager.createOrUpdate(this.getApiContext().getOperationsContext().getFileStorageService(), this.getApiContext().getOperationsContext().getDatabaseRepository().getProjectDao(), this.getApiContext().getOperationsContext().getDatabaseRepository().getContentDao(), this.getApiContext().getOperationsContext().getDatabaseRepository().getUserInfoDao(), project, principal);
|
||||
this.projectManager.createOrUpdate(this.getApiContext().getOperationsContext().getFileStorageService(), this.getApiContext().getOperationsContext().getDatabaseRepository().getProjectDao(), this.getApiContext().getOperationsContext().getDatabaseRepository().getContentDao(), this.getApiContext().getOperationsContext().getDatabaseRepository().getUserInfoDao(), project, principal);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<eu.eudat.data.entities.Project>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Created"));
|
||||
}
|
||||
|
||||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.DELETE, value = {"/projects/inactivate/{id}"}, consumes = "application/json", produces = "application/json")
|
||||
@RequestMapping(method = RequestMethod.DELETE, value = {"{id}"}, consumes = "application/json", produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<Project>> inactivate(@PathVariable String id, Principal principal) throws IllegalAccessException, InstantiationException {
|
||||
Project project = new ProjectManager().inactivate(this.getApiContext().getOperationsContext().getDatabaseRepository().getProjectDao(), id);
|
||||
this.projectManager.inactivate(this.getApiContext().getOperationsContext().getDatabaseRepository().getProjectDao(), id);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<eu.eudat.data.entities.Project>().status(ApiMessageCode.SUCCESS_MESSAGE));
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/projects/getWithExternal"}, consumes = "application/json", produces = "application/json")
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/external"}, consumes = "application/json", produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<List<eu.eudat.models.data.project.Project>>> getWithExternal(@RequestBody ProjectCriteriaRequest projectCriteria, Principal principal) throws NoURLFound, InstantiationException, HugeResultSet, IllegalAccessException {
|
||||
List<eu.eudat.models.data.project.Project> dataTable = new ProjectManager().getCriteriaWithExternal(this.getApiContext(), projectCriteria, this.getApiContext().getOperationsContext().getRemoteFetcher());
|
||||
List<eu.eudat.models.data.project.Project> dataTable = this.projectManager.getCriteriaWithExternal(this.getApiContext(), projectCriteria, this.getApiContext().getOperationsContext().getRemoteFetcher());
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<eu.eudat.models.data.project.Project>>().payload(dataTable).status(ApiMessageCode.NO_MESSAGE));
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"/projects/get"}, consumes = "application/json", produces = "application/json")
|
||||
@RequestMapping(method = RequestMethod.POST, value = {"get"}, consumes = "application/json", produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<List<eu.eudat.models.data.project.Project>>> get(@RequestBody ProjectCriteriaRequest projectCriteria, @ClaimedAuthorities(claims = {ANONYMOUS}) Principal principal) throws NoURLFound, InstantiationException, HugeResultSet, IllegalAccessException {
|
||||
List<eu.eudat.models.data.project.Project> dataTable = new ProjectManager().getCriteria(this.getApiContext().getOperationsContext().getDatabaseRepository().getProjectDao(), projectCriteria, this.getApiContext().getOperationsContext().getRemoteFetcher());
|
||||
List<eu.eudat.models.data.project.Project> dataTable = this.projectManager.getCriteria(this.getApiContext().getOperationsContext().getDatabaseRepository().getProjectDao(), projectCriteria, this.getApiContext().getOperationsContext().getRemoteFetcher());
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<List<eu.eudat.models.data.project.Project>>().payload(dataTable).status(ApiMessageCode.NO_MESSAGE));
|
||||
}
|
||||
|
||||
@RequestMapping(method = RequestMethod.GET, value = {"/external/projects"}, produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<ProjectsExternalSourcesModel>> listExternalProjects(@RequestParam(value = "query", required = false) String query, Principal principal) throws HugeResultSet, NoURLFound {
|
||||
List<Map<String, String>> remoteRepos = this.getApiContext().getOperationsContext().getRemoteFetcher().getProjects(query);
|
||||
ProjectsExternalSourcesModel projectsExternalSourcesModel = new ProjectsExternalSourcesModel().fromExternalItem(remoteRepos);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<ProjectsExternalSourcesModel>().payload(projectsExternalSourcesModel).status(ApiMessageCode.SUCCESS_MESSAGE));
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@RequestMapping(method = RequestMethod.DELETE, value = {"/delete/{id}"}, produces = "application/json")
|
||||
public @ResponseBody
|
||||
ResponseEntity<ResponseItem<Project>> delete(@PathVariable(value = "id") UUID id, Principal principal) throws Exception {
|
||||
try{
|
||||
new ProjectManager().delete(this.getApiContext(), id);
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<Project>().status(ApiMessageCode.SUCCESS_MESSAGE).message("Unlocked"));
|
||||
}catch (ProjectWithDMPsDeleteException exception){
|
||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<Project>().status(ApiMessageCode.ERROR_MESSAGE).message(exception.getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ import eu.eudat.logic.proxy.fetching.RemoteFetcher;
|
|||
import eu.eudat.queryable.QueryableList;
|
||||
import eu.eudat.logic.services.ApiContext;
|
||||
import eu.eudat.logic.services.helpers.FileStorageService;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
|
@ -35,6 +36,7 @@ import java.util.UUID;
|
|||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
public class ProjectManager {
|
||||
|
||||
public DataTableData<eu.eudat.models.data.project.ProjectListingModel> getPaged(ProjectDao projectRepository, ProjectTableRequest projectTableRequest, Principal principal) throws Exception {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Status } from "../../common/enum/Status";
|
||||
import { DmpProfile, DmpProfileDefinition } from "../dmp-profile/dmp-profile";
|
||||
import { OrganizationModel } from "../organisation/organization";
|
||||
import { ProjectModel } from "../project/project";
|
||||
import { ProjectListingModel } from "../project/project-listing";
|
||||
import { ResearcherModel } from "../researcher/researcher";
|
||||
import { UserModel } from "../user/user";
|
||||
import { DmpDynamicField } from "./dmp-dynamic-field";
|
||||
|
@ -16,7 +16,7 @@ export interface DmpModel {
|
|||
lockable: boolean;
|
||||
description: String;
|
||||
profiles: DmpProfile[];
|
||||
project: ProjectModel;
|
||||
project: ProjectListingModel;
|
||||
organisations: OrganizationModel[];
|
||||
researchers: ResearcherModel[];
|
||||
associatedUsers: UserModel[];
|
||||
|
|
|
@ -1,16 +1,26 @@
|
|||
import { UrlListingItem } from "../../../library/url-listing/url-listing-item";
|
||||
import { ContentFile } from "./project";
|
||||
import { ProjectType } from '../../common/enum/project-type';
|
||||
import { Status } from '../../common/enum/Status';
|
||||
|
||||
export interface ProjectListingModel {
|
||||
id: String;
|
||||
label: String;
|
||||
abbreviation: String;
|
||||
reference: String;
|
||||
uri: String;
|
||||
status: String;
|
||||
startDate: Date;
|
||||
endDate: Date;
|
||||
description: String;
|
||||
files: ContentFile[];
|
||||
dmps: UrlListingItem[];
|
||||
id?: string;
|
||||
label?: string;
|
||||
abbreviation?: string;
|
||||
reference?: string;
|
||||
type?: ProjectType;
|
||||
uri?: String;
|
||||
status?: Status;
|
||||
startDate?: Date;
|
||||
endDate?: Date;
|
||||
description?: String;
|
||||
contentUrl?: string;
|
||||
files?: ContentFile[];
|
||||
dmps?: UrlListingItem[];
|
||||
}
|
||||
|
||||
export interface ContentFile {
|
||||
filename?: string;
|
||||
id?: string;
|
||||
location?: string;
|
||||
type?: string;
|
||||
}
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
import { ProjectType } from '../../common/enum/project-type';
|
||||
import { Status } from '../../common/enum/Status';
|
||||
|
||||
export interface ProjectModel {
|
||||
id?: string;
|
||||
label?: string;
|
||||
abbreviation?: string;
|
||||
reference?: string;
|
||||
type?: ProjectType;
|
||||
uri?: String;
|
||||
status?: Status;
|
||||
startDate?: Date;
|
||||
endDate?: Date;
|
||||
description?: String;
|
||||
contentUrl?: string;
|
||||
files?: ContentFile[];
|
||||
}
|
||||
|
||||
export interface ContentFile {
|
||||
filename?: string;
|
||||
id?: string;
|
||||
location?: string;
|
||||
type?: string;
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
import { ProjectModel } from "../../model/project/project";
|
||||
import { ProjectListingModel } from "../../model/project/project-listing";
|
||||
import { BaseCriteria } from "../base-criteria";
|
||||
|
||||
export class DmpCriteria extends BaseCriteria {
|
||||
public projects: ProjectModel[] = [];
|
||||
public projects: ProjectListingModel[] = [];
|
||||
public groupIds: string[];
|
||||
public allVersions: boolean;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ export class DmpService {
|
|||
return this.http.get<DmpModel>(this.actionUrl + id + '/unlock', { headers: this.headers });
|
||||
}
|
||||
createDmp(dataManagementPlanModel: DmpModel): Observable<DmpModel> {
|
||||
return this.http.post<DmpModel>(this.actionUrl + 'post', dataManagementPlanModel, { headers: this.headers });
|
||||
return this.http.post<DmpModel>(this.actionUrl , dataManagementPlanModel, { headers: this.headers });
|
||||
}
|
||||
|
||||
inactivate(id: String): Observable<DmpModel> {
|
||||
|
|
|
@ -20,8 +20,8 @@ export class ExternalDatasetService {
|
|||
return this.http.post<DataTableData<ExternalDatasetModel>>(this.actionUrl + 'getPaged', dataTableRequest);
|
||||
}
|
||||
|
||||
/* get(requestItem: RequestItem<ProjectCriteria>): Observable<ProjectModel[]> {
|
||||
return this.http.post<ProjectModel[]>(this.actionUrl + 'get', requestItem);
|
||||
/* get(requestItem: RequestItem<ProjectCriteria>): Observable<ProjectListingModel[]> {
|
||||
return this.http.post<ProjectListingModel[]>(this.actionUrl + 'get', requestItem);
|
||||
}*/
|
||||
|
||||
getWithExternal(requestItem: RequestItem<ExternalDatasetCriteria>): Observable<ExternalDatasetModel[]> {
|
||||
|
|
|
@ -2,7 +2,7 @@ import { HttpHeaders } from '@angular/common/http';
|
|||
import { Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { environment } from '../../../../environments/environment';
|
||||
import { ContentFile } from '../../model/project/project';
|
||||
import { ContentFile } from '../../model/project/project-listing';
|
||||
import { BaseHttpService } from '../http/base-http.service';
|
||||
|
||||
@Injectable()
|
||||
|
|
|
@ -5,7 +5,6 @@ import { environment } from '../../../../environments/environment';
|
|||
import { RequestItem } from '../../query/request-item';
|
||||
import { DataTableData } from '../../model/data-table/data-table-data';
|
||||
import { DataTableRequest } from '../../model/data-table/data-table-request';
|
||||
import { ProjectModel } from '../../model/project/project';
|
||||
import { ProjectListingModel } from '../../model/project/project-listing';
|
||||
import { ProjectCriteria } from '../../query/project/project-criteria';
|
||||
import { BaseHttpService } from '../http/base-http.service';
|
||||
|
@ -21,30 +20,24 @@ export class ProjectService {
|
|||
}
|
||||
|
||||
getPaged(dataTableRequest: DataTableRequest<ProjectCriteria>): Observable<DataTableData<ProjectListingModel>> {
|
||||
return this.http.post<DataTableData<ProjectListingModel>>(this.actionUrl + 'getPaged', dataTableRequest, { headers: this.headers });
|
||||
return this.http.post<DataTableData<ProjectListingModel>>(this.actionUrl + 'paged', dataTableRequest, { headers: this.headers });
|
||||
}
|
||||
|
||||
get(requestItem: RequestItem<ProjectCriteria>): Observable<ProjectModel[]> {
|
||||
return this.http.post<ProjectModel[]>(this.actionUrl + 'get', requestItem, { headers: this.headers });
|
||||
getWithExternal(requestItem: RequestItem<ProjectCriteria>): Observable<ProjectListingModel[]> {
|
||||
return this.http.post<ProjectListingModel[]>(this.actionUrl + 'external', requestItem, { headers: this.headers });
|
||||
}
|
||||
|
||||
getWithExternal(requestItem: RequestItem<ProjectCriteria>): Observable<ProjectModel[]> {
|
||||
return this.http.post<ProjectModel[]>(this.actionUrl + 'getWithExternal', requestItem, { headers: this.headers });
|
||||
getSingle(id: string): Observable<ProjectListingModel> {
|
||||
return this.http.get<ProjectListingModel>(this.actionUrl + id, { headers: this.headers });
|
||||
}
|
||||
|
||||
getSingle(id: string): Observable<ProjectModel> {
|
||||
return this.http.get<ProjectModel>(this.actionUrl + 'getSingle/' + id, { headers: this.headers });
|
||||
createProject(projectModel: ProjectListingModel): Observable<ProjectListingModel> {
|
||||
return this.http.post<ProjectListingModel>(this.actionUrl, projectModel, { headers: this.headers });
|
||||
}
|
||||
|
||||
createProject(projectModel: ProjectModel): Observable<ProjectModel> {
|
||||
return this.http.post<ProjectModel>(this.actionUrl + 'createOrUpdate', projectModel, { headers: this.headers });
|
||||
// Actually sets it inactive.
|
||||
delete(id: String): Observable<ProjectListingModel> {
|
||||
return this.http.delete<ProjectListingModel>(this.actionUrl + id, { headers: this.headers });
|
||||
}
|
||||
|
||||
inactivate(id: String): Observable<ProjectModel> {
|
||||
return this.http.delete<ProjectModel>(this.actionUrl + 'inactivate/' + id, { headers: this.headers });
|
||||
}
|
||||
|
||||
public delete(id: string): Observable<ProjectModel> {
|
||||
return this.http.delete<ProjectModel>(this.actionUrl + 'delete' + id, { headers: this.headers });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { ValidationErrorModel } from '../../../../../common/forms/validation/error-model/validation-error-model';
|
||||
import { ProjectModel } from '../../../../../core/model/project/project';
|
||||
import { ProjectListingModel } from '../../../../../core/model/project/project-listing';
|
||||
import { DmpCriteria } from '../../../../../core/query/dmp/dmp-criteria';
|
||||
import { DmpProfileCriteria } from '../../../../../core/query/dmp/dmp-profile-criteria';
|
||||
import { BaseCriteriaComponent } from '../../../../misc/criteria/base-criteria.component';
|
||||
|
@ -16,7 +16,7 @@ export class DmpProfileCriteriaComponent extends BaseCriteriaComponent implement
|
|||
showProject: boolean;
|
||||
public criteria: DmpProfileCriteria = new DmpProfileCriteria();
|
||||
filteringProjectsAsync = false;
|
||||
filteredProjects: ProjectModel[];
|
||||
filteredProjects: ProjectListingModel[];
|
||||
|
||||
constructor(
|
||||
) {
|
||||
|
|
|
@ -14,7 +14,7 @@ import { DatasetListingModel } from '../../../core/model/dataset/dataset-listing
|
|||
import { DatasetProfileModel } from '../../../core/model/dataset/dataset-profile';
|
||||
import { DmpModel } from '../../../core/model/dmp/dmp';
|
||||
import { ExternalSourceItemModel } from '../../../core/model/external-sources/external-source-item';
|
||||
import { ProjectModel } from '../../../core/model/project/project';
|
||||
import { ProjectListingModel } from '../../../core/model/project/project-listing';
|
||||
import { UserModel } from '../../../core/model/user/user';
|
||||
import { BaseCriteria } from '../../../core/query/base-criteria';
|
||||
import { DatasetProfileCriteria } from '../../../core/query/dataset-profile/dataset-profile-criteria';
|
||||
|
@ -149,7 +149,7 @@ export class DmpEditorComponent extends BaseComponent implements OnInit, IBreadC
|
|||
});
|
||||
} else if (projectId != null) {
|
||||
this.isNew = true;
|
||||
this.projectService.getSingle(projectId).map(data => data as ProjectModel)
|
||||
this.projectService.getSingle(projectId).map(data => data as ProjectListingModel)
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(data => {
|
||||
this.dmp = new DmpEditorModel();
|
||||
|
|
|
@ -8,7 +8,7 @@ import { DmpModel } from "../../../core/model/dmp/dmp";
|
|||
import { DmpDynamicField } from "../../../core/model/dmp/dmp-dynamic-field";
|
||||
import { DmpDynamicFieldDependency } from "../../../core/model/dmp/dmp-dynamic-field-dependency";
|
||||
import { OrganizationModel } from "../../../core/model/organisation/organization";
|
||||
import { ProjectModel } from "../../../core/model/project/project";
|
||||
import { ProjectListingModel } from "../../../core/model/project/project-listing";
|
||||
import { ResearcherModel } from "../../../core/model/researcher/researcher";
|
||||
import { UserModel } from "../../../core/model/user/user";
|
||||
import { ValidJsonValidator } from "../../../library/auto-complete/auto-complete-custom-validator";
|
||||
|
@ -23,7 +23,7 @@ export class DmpEditorModel {
|
|||
public creator: UserModel;
|
||||
public status: Status = Status.Active;
|
||||
public description: String;
|
||||
public project: ProjectModel;
|
||||
public project: ProjectListingModel;
|
||||
public organisations: OrganizationModel[] = [];
|
||||
public researchers: ResearcherModel[] = [];
|
||||
public profiles: DmpProfile[] = [];
|
||||
|
|
|
@ -3,13 +3,14 @@ import { FormBuilder, FormControl } from '@angular/forms';
|
|||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { takeUntil } from 'rxjs/operators';
|
||||
import { ValidationErrorModel } from '../../../../common/forms/validation/error-model/validation-error-model';
|
||||
import { ProjectModel } from '../../../../core/model/project/project';
|
||||
import { ProjectListingModel } from '../../../../core/model/project/project-listing';
|
||||
import { DmpCriteria } from '../../../../core/query/dmp/dmp-criteria';
|
||||
import { ProjectCriteria } from '../../../../core/query/project/project-criteria';
|
||||
import { ProjectService } from '../../../../core/services/project/project.service';
|
||||
import { MultipleAutoCompleteConfiguration } from '../../../../library/auto-complete/multiple/multiple-auto-complete-configuration';
|
||||
import { RequestItem } from '../../../../core/query/request-item';
|
||||
import { BaseCriteriaComponent } from '../../../misc/criteria/base-criteria.component';
|
||||
import { DataTableRequest } from '../../../../core/model/data-table/data-table-request';
|
||||
|
||||
@Component({
|
||||
selector: 'app-dmp-criteria-component',
|
||||
|
@ -20,7 +21,7 @@ export class DmpCriteriaComponent extends BaseCriteriaComponent implements OnIni
|
|||
|
||||
@Input() showProject: boolean;
|
||||
filteringProjectsAsync = false;
|
||||
filteredProjects: ProjectModel[];
|
||||
filteredProjects: ProjectListingModel[];
|
||||
public formGroup = new FormBuilder().group({
|
||||
like: new FormControl(),
|
||||
projects: new FormControl()
|
||||
|
@ -71,9 +72,11 @@ export class DmpCriteriaComponent extends BaseCriteriaComponent implements OnIni
|
|||
}
|
||||
|
||||
filterProject(query: string) {
|
||||
const projectRequestItem: RequestItem<ProjectCriteria> = new RequestItem();
|
||||
const fields: Array<string> = new Array<string>();
|
||||
fields.push('asc');
|
||||
const projectRequestItem: DataTableRequest<ProjectCriteria> = new DataTableRequest(0, null, { fields: fields });
|
||||
projectRequestItem.criteria = new ProjectCriteria();
|
||||
projectRequestItem.criteria.like = query;
|
||||
return this.projectService.get(projectRequestItem);
|
||||
return this.projectService.getPaged(projectRequestItem).map(x => x.data);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import { BreadcrumbItem } from '../../misc/breadcrumb/definition/breadcrumb-item
|
|||
import { IBreadCrumbComponent } from '../../misc/breadcrumb/definition/IBreadCrumbComponent';
|
||||
import { DmpInvitationDialogComponent } from '../invitation/dmp-invitation.component';
|
||||
import { DmpCriteriaComponent } from './criteria/dmp-criteria.component';
|
||||
import { ProjectModel } from '../../../core/model/project/project';
|
||||
import { ProjectListingModel } from '../../../core/model/project/project-listing';
|
||||
|
||||
@Component({
|
||||
selector: 'app-dmp-listing-component',
|
||||
|
@ -52,7 +52,7 @@ export class DmpListingComponent extends BaseComponent implements OnInit, IBread
|
|||
if (params['projectId']) {
|
||||
this.projectId = params['projectId'];
|
||||
this.showProject = false;
|
||||
const project: ProjectModel = {
|
||||
const project: ProjectListingModel = {
|
||||
id: this.projectId
|
||||
}
|
||||
this.criteria.setCriteria({ like: null, projects: [project], groupIds: null, allVersions: false });
|
||||
|
|
|
@ -8,7 +8,7 @@ import { DmpModel } from "../../../core/model/dmp/dmp";
|
|||
import { DmpDynamicField } from "../../../core/model/dmp/dmp-dynamic-field";
|
||||
import { DmpDynamicFieldDependency } from "../../../core/model/dmp/dmp-dynamic-field-dependency";
|
||||
import { OrganizationModel } from "../../../core/model/organisation/organization";
|
||||
import { ProjectModel } from "../../../core/model/project/project";
|
||||
import { ProjectListingModel } from "../../../core/model/project/project-listing";
|
||||
import { ResearcherModel } from "../../../core/model/researcher/researcher";
|
||||
import { UserModel } from "../../../core/model/user/user";
|
||||
import { ValidJsonValidator } from "../../../library/auto-complete/auto-complete-custom-validator";
|
||||
|
@ -23,7 +23,7 @@ export class DmpWizardEditorModel {
|
|||
public creator: UserModel;
|
||||
public status: Status = Status.Active;
|
||||
public description: String;
|
||||
public project: ProjectModel;
|
||||
public project: ProjectListingModel;
|
||||
public organisations: OrganizationModel[] = [];
|
||||
public researchers: ResearcherModel[] = [];
|
||||
public profiles: DmpProfile[] = [];
|
||||
|
|
|
@ -118,7 +118,7 @@ export class DatasetDataSource extends DataSource<DatasetListingModel> {
|
|||
let fields: Array<string> = new Array();
|
||||
if (this._sort.active) { fields = this._sort.direction === 'asc' ? ['+' + this._sort.active] : ['-' + this._sort.active]; }
|
||||
const request = new DataTableRequest<ExploreDatasetCriteriaModel>(startIndex, this._paginator.pageSize, { fields: fields });
|
||||
request.criteria = this._criteria;
|
||||
request.criteria = new ExploreDatasetCriteriaModel();
|
||||
//if (this.dmpId) request.criteria.allVersions = true;
|
||||
return this._service.getPublicPaged(request);
|
||||
})
|
||||
|
|
|
@ -7,7 +7,7 @@ import { BaseComponent } from '../../../core/common/base/base.component';
|
|||
import { ProjectStateType } from '../../../core/common/enum/project-state-type';
|
||||
import { DatasetProfileModel } from '../../../core/model/dataset/dataset-profile';
|
||||
import { ExternalSourceItemModel } from '../../../core/model/external-sources/external-source-item';
|
||||
import { ProjectModel } from '../../../core/model/project/project';
|
||||
import { ProjectListingModel } from '../../../core/model/project/project-listing';
|
||||
import { ExploreDatasetCriteriaModel } from '../../../core/query/explore-dataset/explore-dataset-criteria';
|
||||
import { ProjectCriteria } from '../../../core/query/project/project-criteria';
|
||||
import { TagCriteria } from '../../../core/query/tag/tag-criteria';
|
||||
|
@ -15,6 +15,7 @@ import { DatasetService } from '../../../core/services/dataset/dataset.service';
|
|||
import { ExternalSourcesService } from '../../../core/services/external-sources/external-sources.service';
|
||||
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';
|
||||
|
||||
@Component({
|
||||
selector: 'app-explore-dataset-filters-component',
|
||||
|
@ -28,10 +29,10 @@ export class ExploreDatasetFiltersComponent extends BaseComponent implements OnI
|
|||
public filteringTagsAsync = false;
|
||||
public filteredTags: ExternalSourceItemModel[];
|
||||
ProjectStateType = ProjectStateType;
|
||||
projects: Observable<ProjectModel[]>;
|
||||
projects: Observable<ProjectListingModel[]>;
|
||||
profiles: Observable<DatasetProfileModel[]>;
|
||||
dmpOrganisations: Observable<ExternalSourceItemModel[]>;
|
||||
projectOptions: Observable<ProjectModel[]>;
|
||||
projectOptions: Observable<ProjectListingModel[]>;
|
||||
projectStateOptions: Observable<any[]>;
|
||||
@ViewChild('facetAccordion') accordion: MatAccordion;
|
||||
|
||||
|
@ -86,11 +87,16 @@ export class ExploreDatasetFiltersComponent extends BaseComponent implements OnI
|
|||
this.facetCriteria.projects = [];
|
||||
}
|
||||
if (event.option.selected) {
|
||||
const projectCriteria = new ProjectCriteria();
|
||||
projectCriteria.projectStateType = this.facetCriteria.projectStatus;
|
||||
projectCriteria['length'] = 10;
|
||||
const dataTableRequest: RequestItem<ProjectCriteria> = { criteria: projectCriteria };
|
||||
this.projects = this.projectService.get(dataTableRequest);
|
||||
// const projectCriteria = new ProjectCriteria();
|
||||
// projectCriteria.projectStateType = this.facetCriteria.projectStatus;
|
||||
//projectCriteria['length'] = 10;
|
||||
const fields: Array<string> = new Array<string>();
|
||||
fields.push('asc');
|
||||
const dataTableRequest: DataTableRequest<ProjectCriteria> = new DataTableRequest(0, null, { fields: fields });
|
||||
dataTableRequest.criteria = new ProjectCriteria();
|
||||
dataTableRequest.criteria.projectStateType = this.facetCriteria.projectStatus;
|
||||
dataTableRequest.criteria['length'] = 10;
|
||||
this.projects = this.projectService.getPaged(dataTableRequest).map(x => x.data);
|
||||
this.facetCriteria.projects = [];
|
||||
}
|
||||
this.facetCriteriaChange.emit(this.facetCriteria);
|
||||
|
@ -138,13 +144,20 @@ export class ExploreDatasetFiltersComponent extends BaseComponent implements OnI
|
|||
this.facetCriteriaChange.emit(this.facetCriteria);
|
||||
}
|
||||
|
||||
public projectSearch(value: string): Observable<ProjectModel[]> {
|
||||
public projectSearch(value: string): Observable<ProjectListingModel[]> {
|
||||
|
||||
const projectCriteria = new ProjectCriteria();
|
||||
projectCriteria.projectStateType = this.facetCriteria.projectStatus;
|
||||
projectCriteria['length'] = 10;
|
||||
projectCriteria.like = value;
|
||||
const dataTableRequest: RequestItem<ProjectCriteria> = { criteria: projectCriteria };
|
||||
return this.projectService.get(dataTableRequest);
|
||||
|
||||
const fields: Array<string> = new Array<string>();
|
||||
fields.push('asc');
|
||||
|
||||
const dataTableRequest: DataTableRequest<ProjectCriteria> = new DataTableRequest(0, null, { fields: fields });
|
||||
dataTableRequest.criteria = projectCriteria;
|
||||
//const dataTableRequest: RequestItem<ProjectCriteria> = { criteria: projectCriteria };
|
||||
return this.projectService.getPaged(dataTableRequest).map(x => x.data);
|
||||
}
|
||||
|
||||
public dmpOrganisationSearch(value: string): Observable<ExternalSourceItemModel[]> {
|
||||
|
|
|
@ -9,7 +9,7 @@ import { environment } from '../../../../environments/environment';
|
|||
import { ValidationErrorModel } from '../../../common/forms/validation/error-model/validation-error-model';
|
||||
import { BaseComponent } from '../../../core/common/base/base.component';
|
||||
import { ProjectType } from '../../../core/common/enum/project-type';
|
||||
import { ProjectModel } from '../../../core/model/project/project';
|
||||
import { ProjectListingModel } from '../../../core/model/project/project-listing';
|
||||
import { ProjectFileUploadService } from '../../../core/services/project/project-file-upload.service';
|
||||
import { ProjectService } from '../../../core/services/project/project.service';
|
||||
import { ConfirmationDialogComponent } from '../../../library/confirmation-dialog/confirmation-dialog.component';
|
||||
|
@ -53,7 +53,7 @@ export class ProjectEditorComponent extends BaseComponent implements OnInit, IBr
|
|||
|
||||
if (itemId != null) {
|
||||
this.isNew = false;
|
||||
this.projectService.getSingle(itemId).map(data => data as ProjectModel)
|
||||
this.projectService.getSingle(itemId).map(data => data as ProjectListingModel)
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(data => {
|
||||
this.project = new ProjectEditorModel().fromModel(data);
|
||||
|
@ -124,7 +124,7 @@ export class ProjectEditorComponent extends BaseComponent implements OnInit, IBr
|
|||
});
|
||||
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
|
||||
if (result) {
|
||||
this.projectService.inactivate(this.project.id)
|
||||
this.projectService.delete(this.project.id)
|
||||
.pipe(takeUntil(this._destroyed))
|
||||
.subscribe(
|
||||
complete => { this.onCallbackSuccess() },
|
||||
|
|
|
@ -4,7 +4,7 @@ import { ValidationErrorModel } from '../../../common/forms/validation/error-mod
|
|||
import { ValidationContext } from '../../../common/forms/validation/validation-context';
|
||||
import { ProjectType } from '../../../core/common/enum/project-type';
|
||||
import { Status } from '../../../core/common/enum/Status';
|
||||
import { ContentFile, ProjectModel } from '../../../core/model/project/project';
|
||||
import { ContentFile, ProjectListingModel } from '../../../core/model/project/project-listing';
|
||||
|
||||
export class ProjectEditorModel {
|
||||
public id: string;
|
||||
|
@ -21,7 +21,7 @@ export class ProjectEditorModel {
|
|||
public files: ContentFile[];
|
||||
public validationErrorModel: ValidationErrorModel = new ValidationErrorModel();
|
||||
|
||||
fromModel(item: ProjectModel): ProjectEditorModel {
|
||||
fromModel(item: ProjectListingModel): ProjectEditorModel {
|
||||
this.id = item.id;
|
||||
this.label = item.label;
|
||||
this.type = item.type;
|
||||
|
|
Loading…
Reference in New Issue