diff --git a/dmp-frontend/src/app/services/external-sources/external-sources.service.ts b/dmp-frontend/src/app/services/external-sources/external-sources.service.ts index 1b8e12523..acd404778 100644 --- a/dmp-frontend/src/app/services/external-sources/external-sources.service.ts +++ b/dmp-frontend/src/app/services/external-sources/external-sources.service.ts @@ -23,53 +23,53 @@ export class ExternalSourcesService { constructor(private http: BaseHttpService) { - this.actionUrl = HostConfiguration.Server + 'external/'; + this.actionUrl = HostConfiguration.Server + 'external/'; - this.headers = new HttpHeaders(); - this.headers = this.headers.set('Content-Type', 'application/json'); - this.headers = this.headers.set('Accept', 'application/json'); + this.headers = new HttpHeaders(); + this.headers = this.headers.set('Content-Type', 'application/json'); + this.headers = this.headers.set('Accept', 'application/json'); } public searchDatasetRegistry(requestItem: RequestItem): Observable { - return this.http.get(this.actionUrl + "registries" + "?query=" + requestItem.criteria.like + "&type=" + requestItem.criteria.type, { headers: this.headers }); + return this.http.get(this.actionUrl + 'registries' + '?query=' + requestItem.criteria.like + '&type=' + requestItem.criteria.type, { headers: this.headers }); } public searchDatasetRepository(requestItem: RequestItem): Observable { - return this.http.get(this.actionUrl + "datarepos" + "?query=" + requestItem.criteria.like + "&type=" + requestItem.criteria.type, { headers: this.headers }); + return this.http.get(this.actionUrl + 'datarepos' + '?query=' + requestItem.criteria.like + '&type=' + requestItem.criteria.type, { headers: this.headers }); } public searchDatasetService(requestItem: RequestItem): Observable { - return this.http.get(this.actionUrl + "services" + "?query=" + requestItem.criteria.like + "&type=" + requestItem.criteria.type, { headers: this.headers }); + return this.http.get(this.actionUrl + 'services' + '?query=' + requestItem.criteria.like + '&type=' + requestItem.criteria.type, { headers: this.headers }); } public searchDatasetTags(requestItem: RequestItem): Observable { - return Observable.of([ - { id: "1", name: "Tag 1", description: "" }, - { id: "2", name: "Tag 2", description: "" }, - { id: "3", name: "Tag 3", description: "" }, - { id: "4", name: "Tag 4", description: "" }, - { id: "5", name: "Tag 5", description: "" }, - { id: "6", name: "Tag 6", description: "" }, - { id: "7", name: "Tag 7", description: "" }, - { id: "8", name: "Tag 8", description: "" }, - ]) - //return this.http.get(this.actionUrl + "tags" + "?query=" + requestItem.criteria.like + "&type=" + requestItem.criteria.type, { headers: this.headers }); + return Observable.of([ + { id: '1', name: 'Tag 1', description: '' }, + { id: '2', name: 'Tag 2', description: '' }, + { id: '3', name: 'Tag 3', description: '' }, + { id: '4', name: 'Tag 4', description: '' }, + { id: '5', name: 'Tag 5', description: '' }, + { id: '6', name: 'Tag 6', description: '' }, + { id: '7', name: 'Tag 7', description: '' }, + { id: '8', name: 'Tag 8', description: '' }, + ]); + //return this.http.get(this.actionUrl + "tags" + "?query=" + requestItem.criteria.like + "&type=" + requestItem.criteria.type, { headers: this.headers }); } public searchDatasetSExternalDatasetservice(requestItem: RequestItem): Observable { - return this.http.get(this.actionUrl + "datasets" + "?query=" + requestItem.criteria.like + "&type=" + requestItem.criteria.type, { headers: this.headers }); + return this.http.get(this.actionUrl + 'datasets' + '?query=' + requestItem.criteria.like + '&type=' + requestItem.criteria.type, { headers: this.headers }); } public searchDMPResearchers(requestItem: RequestItem): Observable { - return this.http.post(HostConfiguration.Server + "/researchers/getWithExternal", requestItem, { headers: this.headers }); + return this.http.post(HostConfiguration.Server + '/researchers/getWithExternal', requestItem, { headers: this.headers }); } public searchDMPOrganizations(like: string): Observable { - return this.http.get(this.actionUrl + "organisations" + "?query=" + like, { headers: this.headers }); + return this.http.get(this.actionUrl + 'organisations' + '?query=' + like, { headers: this.headers }); }//organizationscriteria.criteria.like public searchDMPProfiles(like: string): Observable { - return this.http.get(this.actionUrl + "datasetprofiles/get" + "?query=" + like, { headers: this.headers }); + return this.http.get(this.actionUrl + 'datasetprofiles/get' + '?query=' + like, { headers: this.headers }); } } diff --git a/dmp-frontend/src/app/shared/components/facets/facet-search.component.html b/dmp-frontend/src/app/shared/components/facets/facet-search.component.html index e95bed097..96cee85a3 100644 --- a/dmp-frontend/src/app/shared/components/facets/facet-search.component.html +++ b/dmp-frontend/src/app/shared/components/facets/facet-search.component.html @@ -1,4 +1,4 @@ - + diff --git a/dmp-frontend/src/app/shared/components/facets/facet-search.component.ts b/dmp-frontend/src/app/shared/components/facets/facet-search.component.ts index 7344c0d38..2cad956a2 100644 --- a/dmp-frontend/src/app/shared/components/facets/facet-search.component.ts +++ b/dmp-frontend/src/app/shared/components/facets/facet-search.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit, ViewEncapsulation, Input, ViewChild, Output, EventEmitter } from '@angular/core'; +import { Component, OnInit, ViewEncapsulation, Input, ViewChild, Output, EventEmitter, AfterViewInit } from '@angular/core'; import { ActivatedRoute, NavigationEnd, Router } from '@angular/router'; import { BreadCrumbResolverService } from '../../../services/breadcrumb/breadcrumb-resolver.service'; import { Observable } from 'rxjs/Observable'; @@ -9,7 +9,7 @@ import { ProjectService } from '../../../services/project/project.service'; import { ProjectCriteria } from '../../../models/criteria/project/ProjectCriteria'; import { DataTableRequest } from '../../../models/data-table/DataTableRequest'; import { ProjectListingModel } from '../../../models/projects/ProjectListingModel'; -import { MatSelectionList, MatListOption, MatSelectionListChange } from '@angular/material'; +import { MatSelectionList, MatListOption, MatSelectionListChange, MatAccordion } from '@angular/material'; import { SelectionModel } from '@angular/cdk/collections'; import { DatasetProfileService } from '../../../services/dataset-profile.service'; import { DatasetService } from '../../../services/dataset/dataset.service'; @@ -28,21 +28,18 @@ import { TranslateService } from '@ngx-translate/core'; encapsulation: ViewEncapsulation.None, providers: [ProjectService] }) -export class FacetSearchComponent implements OnInit { - - @Input() - facetCriteria = new FacetSearchCriteriaModel(); - - @Output() - facetCriteriaChange = new EventEmitter(); +export class FacetSearchComponent implements OnInit, AfterViewInit { + @Input() facetCriteria = new FacetSearchCriteriaModel(); + @Output() facetCriteriaChange = new EventEmitter(); ProjectStateType = ProjectStateType; projects: Observable; profiles: Observable; dmpOrganisations: Observable; projectOptions: Observable; - projectStateOptions: Observable; + @ViewChild('facetAccordion') accordion: MatAccordion; + displayProjectStateValue = (option) => option['value']; displayProjectStateLabel = (option) => option['label']; @@ -61,8 +58,7 @@ export class FacetSearchComponent implements OnInit { public languageService: TranslateService, public datasetProfileService: DatasetService, public externalSourcesService: ExternalSourcesService - ) { - } + ) { } ngOnInit() { setTimeout(x => { @@ -76,6 +72,10 @@ export class FacetSearchComponent implements OnInit { this.dmpOrganisations = this.externalSourcesService.searchDMPOrganizations(''); } + ngAfterViewInit(): void { + this.accordion.openAll(); + } + public projectStatusChanged(event) { this.facetCriteria.projectStatus = event.option.value.value; if (!event.option.selected) {