Adds Tags functionality on Dataset listing with mockup data. (Ticket #76)
This commit is contained in:
parent
4a1b9984c7
commit
f71d02613a
|
@ -16,6 +16,8 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -39,8 +41,27 @@ public class TagController extends BaseController {
|
||||||
public @ResponseBody
|
public @ResponseBody
|
||||||
ResponseEntity<ResponseItem<TagExternalSourcesModel>> listExternalTagModel(
|
ResponseEntity<ResponseItem<TagExternalSourcesModel>> listExternalTagModel(
|
||||||
@RequestParam(value = "query", required = false) String query, @RequestParam(value = "type", required = false) String type) throws HugeResultSet, NoURLFound {
|
@RequestParam(value = "query", required = false) String query, @RequestParam(value = "type", required = false) String type) throws HugeResultSet, NoURLFound {
|
||||||
List<Map<String, String>> remoteRepos = this.getApiContext().getOperationsContext().getRemoteFetcher().getTags(query, type);
|
/*List<Map<String, String>> remoteRepos = this.getApiContext().getOperationsContext().getRemoteFetcher().getTags(query, type);
|
||||||
TagExternalSourcesModel researchersExternalSourcesModel = new TagExternalSourcesModel().fromExternalItem(remoteRepos);
|
TagExternalSourcesModel researchersExternalSourcesModel = new TagExternalSourcesModel().fromExternalItem(remoteRepos);*/
|
||||||
|
|
||||||
|
List<Map<String, String>> myListOfMaps = new ArrayList<>();
|
||||||
|
Map<String, String> map1 = new HashMap<>();
|
||||||
|
map1.put("pid", "1");
|
||||||
|
map1.put("name", "Tag1");
|
||||||
|
map1.put("label", "");
|
||||||
|
myListOfMaps.add(map1);
|
||||||
|
Map<String, String> map2 = new HashMap<>();
|
||||||
|
map2.put("pid", "2");
|
||||||
|
map2.put("name", "Tag2");
|
||||||
|
map2.put("label", "");
|
||||||
|
myListOfMaps.add(map2);
|
||||||
|
Map<String, String> map3 = new HashMap<>();
|
||||||
|
map3.put("pid", "3");
|
||||||
|
map3.put("name", "Tag3");
|
||||||
|
map3.put("label", "");
|
||||||
|
myListOfMaps.add(map3);
|
||||||
|
TagExternalSourcesModel researchersExternalSourcesModel = new TagExternalSourcesModel().fromExternalItem(myListOfMaps);
|
||||||
|
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<TagExternalSourcesModel>().payload(researchersExternalSourcesModel).status(ApiMessageCode.NO_MESSAGE));
|
return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem<TagExternalSourcesModel>().payload(researchersExternalSourcesModel).status(ApiMessageCode.NO_MESSAGE));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,17 +40,17 @@ export class ExternalSourcesService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public searchDatasetTags(requestItem: RequestItem<TagCriteria>): Observable<ExternalSourceItemModel[]> {
|
public searchDatasetTags(requestItem: RequestItem<TagCriteria>): Observable<ExternalSourceItemModel[]> {
|
||||||
return Observable.of([
|
// return Observable.of([
|
||||||
{ id: '1', name: 'Tag 1', description: '' },
|
// { id: '1', name: 'Tag 1', description: '' },
|
||||||
{ id: '2', name: 'Tag 2', description: '' },
|
// { id: '2', name: 'Tag 2', description: '' },
|
||||||
{ id: '3', name: 'Tag 3', description: '' },
|
// { id: '3', name: 'Tag 3', description: '' },
|
||||||
{ id: '4', name: 'Tag 4', description: '' },
|
// { id: '4', name: 'Tag 4', description: '' },
|
||||||
{ id: '5', name: 'Tag 5', description: '' },
|
// { id: '5', name: 'Tag 5', description: '' },
|
||||||
{ id: '6', name: 'Tag 6', description: '' },
|
// { id: '6', name: 'Tag 6', description: '' },
|
||||||
{ id: '7', name: 'Tag 7', description: '' },
|
// { id: '7', name: 'Tag 7', description: '' },
|
||||||
{ id: '8', name: 'Tag 8', description: '' },
|
// { id: '8', name: 'Tag 8', description: '' },
|
||||||
]);
|
// ]);
|
||||||
//return this.http.get<ExternalSourceItemModel[]>(this.actionUrl + "tags" + "?query=" + requestItem.criteria.like + "&type=" + requestItem.criteria.type, { headers: this.headers });
|
return this.http.get<ExternalSourceItemModel[]>(this.actionUrl + "tags" + "?query=" + requestItem.criteria.like + "&type=" + requestItem.criteria.type, { headers: this.headers });
|
||||||
}
|
}
|
||||||
|
|
||||||
public searchDatasetSExternalDatasetservice(requestItem: RequestItem<ExternalDatasetCriteria>): Observable<ExternalSourceItemModel[]> {
|
public searchDatasetSExternalDatasetservice(requestItem: RequestItem<ExternalDatasetCriteria>): Observable<ExternalSourceItemModel[]> {
|
||||||
|
|
|
@ -92,6 +92,19 @@
|
||||||
</div>
|
</div>
|
||||||
<!-- End of Related Organization Filter -->
|
<!-- End of Related Organization Filter -->
|
||||||
|
|
||||||
|
<!-- Tags Filter -->
|
||||||
|
<div class="col-10 gray-container">
|
||||||
|
<h6 class="category-title">{{'CRITERIA.DATA-SETS.TAGS' | translate }}</h6>
|
||||||
|
<mat-form-field>
|
||||||
|
<app-multiple-auto-complete [formControl]="formGroup.get('tags')"
|
||||||
|
placeholder="{{'CRITERIA.DATA-SETS.SELECT-TAGS' | translate}}"
|
||||||
|
[configuration]="tagsAutoCompleteConfiguration">
|
||||||
|
</app-multiple-auto-complete>
|
||||||
|
<mat-icon matSuffix class="style-icon">arrow_drop_down</mat-icon>
|
||||||
|
</mat-form-field>
|
||||||
|
</div>
|
||||||
|
<!-- End of Tags Filter -->
|
||||||
|
|
||||||
<!-- Import Button -->
|
<!-- Import Button -->
|
||||||
<!-- <div class="col-10 import">
|
<!-- <div class="col-10 import">
|
||||||
<button class="importButton" mat-raised-button color="primary" (click)="fileSave($event)"
|
<button class="importButton" mat-raised-button color="primary" (click)="fileSave($event)"
|
||||||
|
|
|
@ -56,6 +56,7 @@ export class DatasetCriteriaComponent extends BaseCriteriaComponent implements O
|
||||||
role: new FormControl(),
|
role: new FormControl(),
|
||||||
organisations: new FormControl(),
|
organisations: new FormControl(),
|
||||||
collaborators: new FormControl(),
|
collaborators: new FormControl(),
|
||||||
|
tags: new FormControl()
|
||||||
});
|
});
|
||||||
|
|
||||||
tagsAutoCompleteConfiguration = {
|
tagsAutoCompleteConfiguration = {
|
||||||
|
|
|
@ -85,8 +85,11 @@ export class DatasetListingComponent extends BaseComponent implements OnInit, IB
|
||||||
allVersions: value.allVersions,
|
allVersions: value.allVersions,
|
||||||
role: value.role
|
role: value.role
|
||||||
}
|
}
|
||||||
|
if (value.tags) {
|
||||||
|
request.criteria.tags = value.tags.map(x => x.id);
|
||||||
|
}
|
||||||
if (value.collaborators) {
|
if (value.collaborators) {
|
||||||
request.criteria.collaborators = value.collaborators.map(x => x.id)
|
request.criteria.collaborators = value.collaborators.map(x => x.id);
|
||||||
}
|
}
|
||||||
if (value.dmpIds) {
|
if (value.dmpIds) {
|
||||||
request.criteria.dmpIds = value.dmpIds.map(x => x.id);
|
request.criteria.dmpIds = value.dmpIds.map(x => x.id);
|
||||||
|
|
|
@ -485,6 +485,7 @@
|
||||||
"STATUS": "Status",
|
"STATUS": "Status",
|
||||||
"NONE": "-",
|
"NONE": "-",
|
||||||
"TAGS": "Tags",
|
"TAGS": "Tags",
|
||||||
|
"SELECT-TAGS": "Select Tags",
|
||||||
"LIKE": "Search Datasets",
|
"LIKE": "Search Datasets",
|
||||||
"SELECT-PROJECTS": "Select Projects",
|
"SELECT-PROJECTS": "Select Projects",
|
||||||
"ROLE": "Role",
|
"ROLE": "Role",
|
||||||
|
|
Loading…
Reference in New Issue