Commit f5773589 authored by George Kalampokis's avatar George Kalampokis

When selecting profiles from DMP editor or DMP wizard. All templates will be...

When selecting profiles from DMP editor or DMP wizard. All templates will be sorted alphabetically (ref #268)
parent da7f90eb
......@@ -2,12 +2,14 @@ package eu.eudat.data.query.items.item.datasetprofile;
import eu.eudat.data.dao.criteria.DatasetProfileCriteria;
import eu.eudat.data.entities.DatasetProfile;
import eu.eudat.data.query.PaginationService;
import eu.eudat.data.query.definition.Query;
import eu.eudat.data.query.definition.TableQuery;
import eu.eudat.queryable.QueryableList;
import java.util.UUID;
public class DatasetProfileAutocompleteRequest extends Query<DatasetProfileCriteria,DatasetProfile> {
public class DatasetProfileAutocompleteRequest extends TableQuery<DatasetProfileCriteria,DatasetProfile, UUID> {
@Override
public QueryableList<DatasetProfile> applyCriteria() {
QueryableList<DatasetProfile> query = this.getQuery();
......@@ -15,4 +17,9 @@ public class DatasetProfileAutocompleteRequest extends Query<DatasetProfileCrite
query.where((builder, root) -> builder.like(builder.upper(root.get("label")), "%" + this.getCriteria().getLike().toUpperCase() + "%"));
return query;
}
@Override
public QueryableList<DatasetProfile> applyPaging(QueryableList<DatasetProfile> items) {
return PaginationService.applyPaging(items, this);
}
}
......@@ -66,7 +66,8 @@ public class DatasetProfileManager {
public List<DatasetProfileAutocompleteItem> getWithCriteria(DatasetProfileAutocompleteRequest datasetProfileAutocompleteRequest) throws IllegalAccessException, InstantiationException {
QueryableList<DatasetProfile> items = databaseRepository.getDatasetProfileDao().getWithCriteria(datasetProfileAutocompleteRequest.getCriteria());
List<DatasetProfileAutocompleteItem> datasetProfiles = items.select(item -> new DatasetProfileAutocompleteItem().fromDataModel(item));
QueryableList<DatasetProfile> pagedItems = datasetProfileAutocompleteRequest.applyPaging(items);
List<DatasetProfileAutocompleteItem> datasetProfiles = pagedItems.select(item -> new DatasetProfileAutocompleteItem().fromDataModel(item));
return datasetProfiles;
}
......
......@@ -145,7 +145,7 @@ export class GeneralTabComponent extends BaseComponent implements OnInit {
filterProfiles(value: string): Observable<DatasetProfileModel[]> {
const request = new RequestItem<DatasetProfileCriteria>();
const request = new DataTableRequest<DatasetProfileCriteria>(null, null, {fields: ['+label']});
const criteria = new DatasetProfileCriteria();
criteria.like = value;
request.criteria = criteria;
......
......@@ -177,7 +177,7 @@ export class DmpCriteriaComponent extends BaseCriteriaComponent implements OnIni
filterDatasetTemplate(query: string): Observable<any> {
const fields: Array<string> = new Array<string>();
fields.push('asc');
fields.push('+label');
const datasetTemplateRequestItem: DataTableRequest<DatasetProfileCriteria> = new DataTableRequest(0, null, { fields: fields });
datasetTemplateRequestItem.criteria = new DatasetProfileCriteria();
datasetTemplateRequestItem.criteria.like = query;
......
......@@ -20,6 +20,8 @@ import { BaseComponent } from '@common/base/base.component';
import { TranslateService } from '@ngx-translate/core';
import { Observable } from 'rxjs';
import { map, takeUntil } from 'rxjs/operators';
import { DataTableData } from '@app/core/model/data-table/data-table-data';
import { DataTableRequest } from '@app/core/model/data-table/data-table-request';
@Component({
selector: 'app-dmp-wizard-editor-component',
......@@ -166,7 +168,7 @@ export class DmpWizardEditorComponent extends BaseComponent implements OnInit {
this.filteredProfiles = undefined;
this.filteredProfilesAsync = true;
const request = new RequestItem<DatasetProfileCriteria>();
const request = new DataTableRequest<DatasetProfileCriteria>(null, null, { fields: ['+label'] });
const criteria = new DatasetProfileCriteria();
criteria.like = value;
request.criteria = criteria;
......
......@@ -19,7 +19,6 @@ export class ZenodoComponent extends BaseComponent implements OnInit {
ngOnInit() {
this.route.paramMap.pipe(takeUntil(this._destroyed)).subscribe((params: Params) => {
const id = params.params.id;
console.log(params.params);
this.router.navigate([`/explore-plans/publicOverview/${id}`]);
});
}
......
......@@ -17,6 +17,7 @@ import { ValidationErrorModel } from '@common/forms/validation/error-model/valid
import { TranslateService } from '@ngx-translate/core';
import { Observable, of as observableOf } from 'rxjs';
import { DmpEditorWizardModel } from './dmp-editor-wizard-model';
import { DataTableRequest } from '@app/core/model/data-table/data-table-request';
@Component({
......@@ -116,7 +117,7 @@ export class DmpEditorWizardComponent extends BaseComponent implements OnInit, I
this.filteredProfiles = undefined;
this.filteredProfilesAsync = true;
const request = new RequestItem<DatasetProfileCriteria>();
const request = new DataTableRequest<DatasetProfileCriteria>(null, null, { fields: ['+label']});
const criteria = new DatasetProfileCriteria();
criteria.like = value;
request.criteria = criteria;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment