diff --git a/client/src/app/instance/search/components/result/criteria-list.component.html b/client/src/app/instance/search/components/result/criteria-list.component.html new file mode 100644 index 0000000000000000000000000000000000000000..4f47f2d1c2db40bbdcbad31779946fe007528e58 --- /dev/null +++ b/client/src/app/instance/search/components/result/criteria-list.component.html @@ -0,0 +1,23 @@ +<accordion [isAnimated]="true"> + <accordion-group #ag panelClass="abstract-accordion lead" [isOpen]="true" class="mt-2"> + <button class="btn btn-link btn-block clearfix pb-1" accordion-heading> + <div class="pull-left float-left font-weight-bold"> + Search criteria + + <span *ngIf="ag.isOpen"> + <span class="fas fa-chevron-up"></span> + </span> + <span *ngIf="!ag.isOpen"> + <span class="fas fa-chevron-down"></span> + </span> + </div> + </button> + + <!-- Criteria list --> + <ul> + <li *ngFor="let criterion of criteriaList"> + {{ getAttribute(criterion.id).form_label }} {{ printCriterion(criterion) }} + </li> + </ul> + </accordion-group> +</accordion> diff --git a/client/src/app/instance/search/components/result/criteria-list.component.ts b/client/src/app/instance/search/components/result/criteria-list.component.ts new file mode 100644 index 0000000000000000000000000000000000000000..09a4ee969077d573e2e5a1ecf9a49cefe5f704d8 --- /dev/null +++ b/client/src/app/instance/search/components/result/criteria-list.component.ts @@ -0,0 +1,45 @@ +/** + * This file is part of Anis Client. + * + * @copyright Laboratoire d'Astrophysique de Marseille / CNRS + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +import { Component, ChangeDetectionStrategy, Input } from '@angular/core'; + +import { Criterion, getPrettyCriterion } from 'src/app/instance/store/models'; +import { Attribute } from 'src/app/metamodel/models'; + +@Component({ + selector: 'app-criteria-list', + templateUrl: 'criteria-list.component.html', + changeDetection: ChangeDetectionStrategy.OnPush +}) +export class CriteriaListComponent { + @Input() criteriaList: Criterion[]; + @Input() attributeList: Attribute[]; + + /** + * Returns attribute for the given attribute ID. + * + * @param {number} id - The attribute ID. + * + * @return Attribute + */ + getAttribute(id: number): Attribute { + return this.attributeList.find(attribute => attribute.id === id); + } + + /** + * Returns pretty print of the given criterion. + * + * @param {Criterion} criterion - The criterion. + * + * @return string + */ + printCriterion(criterion: Criterion): string { + return getPrettyCriterion(criterion); + } +} diff --git a/client/src/app/instance/search/components/result/index.ts b/client/src/app/instance/search/components/result/index.ts index 550b053fa80c26002e2a762d39c89b3e7f27b735..cddd9634f8dfe897bdb589973d28e8f1e1586a33 100644 --- a/client/src/app/instance/search/components/result/index.ts +++ b/client/src/app/instance/search/components/result/index.ts @@ -4,6 +4,7 @@ import { DatatableActionsComponent } from './datatable-actions.component'; import { UrlDisplayComponent } from './url-display.component'; import { DatatableComponent } from './datatable.component'; import { ConeSearchPlotComponent } from './cone-search-plot.component'; +import { CriteriaListComponent } from './criteria-list.component'; import { rendererComponents } from './renderer'; export const resultComponents = [ @@ -13,5 +14,6 @@ export const resultComponents = [ DatatableActionsComponent, ConeSearchPlotComponent, DownloadResultComponent, + CriteriaListComponent, rendererComponents ]; diff --git a/client/src/app/instance/search/containers/result.component.html b/client/src/app/instance/search/containers/result.component.html index 27a86b3f0cc288b04f711ee83f22f67ca2208b7f..3bf167ec96ca6be076b8b88db8abf1b0d3290771 100644 --- a/client/src/app/instance/search/containers/result.component.html +++ b/client/src/app/instance/search/containers/result.component.html @@ -22,8 +22,15 @@ <div class="jumbotron row mb-4 py-4"> <div class="col"> <div class="lead"> - Dataset <span class="font-weight-bold">{{ (dataset | async).label }}</span> - selected with <span class="font-weight-bold">{{ dataLength | async }}</span> objects found. + <span class="font-weight-bold">{{ dataLength | async }}</span> objects found in the + <span class="font-weight-bold">{{ (dataset | async).label }}</span> dataset + <span *ngIf="(criteriaList | async).length > 0"> + with <span class="font-weight-bold">{{ (criteriaList | async).length }}</span> search criteria. + </span> + <app-criteria-list *ngIf="(criteriaList | async).length > 0" + [criteriaList]="criteriaList | async" + [attributeList]="attributeList | async"> + </app-criteria-list> </div> <div class="lead mt-4"> <app-download-result diff --git a/client/src/app/instance/search/containers/result.component.ts b/client/src/app/instance/search/containers/result.component.ts index 62c78fed672d8e1e0bce2e82cc16a745c8587392..b844c58262d593606dda50b1569c6144b319d695 100644 --- a/client/src/app/instance/search/containers/result.component.ts +++ b/client/src/app/instance/search/containers/result.component.ts @@ -58,6 +58,7 @@ export class ResultComponent extends AbstractSearchComponent { public coneSearchConfigIsLoaded: Observable<boolean>; public archiveIsCreating: Observable<boolean>; public pristineSubscription: Subscription; + public criteraToolTip: string = "Criteria family list"; constructor(protected store: Store<{ }>) { super(store);