Commit c78a0b80 authored by Jérémy Destin's avatar Jérémy Destin
Browse files

fix: Change the column that are display in the germplasm result table. Change...

fix: Change the column that are display in the germplasm result table. Change the margin of the border to have better display, and fix the tests link to the modifications GNP-4309
parent aa2102a9
......@@ -1470,7 +1470,6 @@
"resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz",
"integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==",
"dev": true,
"optional": true,
"requires": {
"delegates": "^1.0.0",
"readable-stream": "^2.0.6"
......@@ -2682,8 +2681,7 @@
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz",
"integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=",
"dev": true,
"optional": true
"dev": true
},
"constants-browserify": {
"version": "1.0.0",
......@@ -3085,8 +3083,7 @@
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz",
"integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=",
"dev": true,
"optional": true
"dev": true
},
"depd": {
"version": "1.1.2",
......@@ -4058,8 +4055,7 @@
"ansi-regex": {
"version": "2.1.1",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"aproba": {
"version": "1.2.0",
......@@ -4080,14 +4076,12 @@
"balanced-match": {
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
......@@ -4102,20 +4096,17 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"core-util-is": {
"version": "1.0.2",
......@@ -4232,8 +4223,7 @@
"inherits": {
"version": "2.0.3",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"ini": {
"version": "1.3.5",
......@@ -4245,7 +4235,6 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
......@@ -4260,7 +4249,6 @@
"version": "3.0.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
......@@ -4268,14 +4256,12 @@
"minimist": {
"version": "0.0.8",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"minipass": {
"version": "2.3.5",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
......@@ -4294,7 +4280,6 @@
"version": "0.5.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
......@@ -4375,8 +4360,7 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"object-assign": {
"version": "4.1.1",
......@@ -4388,7 +4372,6 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"wrappy": "1"
}
......@@ -4474,8 +4457,7 @@
"safe-buffer": {
"version": "5.1.2",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"safer-buffer": {
"version": "2.1.2",
......@@ -4511,7 +4493,6 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
......@@ -4531,7 +4512,6 @@
"version": "3.0.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
......@@ -4575,14 +4555,12 @@
"wrappy": {
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true
"dev": true
},
"yallist": {
"version": "3.0.3",
"bundled": true,
"dev": true,
"optional": true
"dev": true
}
}
},
......@@ -4591,7 +4569,6 @@
"resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.12.tgz",
"integrity": "sha512-WvJ193OHa0GHPEL+AycEJgxvBEwyfRkN1vhjca23OaPVMCaLCXTd5qAu82AjTcgP1UJmytkOKb63Ypde7raDIg==",
"dev": true,
"optional": true,
"requires": {
"graceful-fs": "^4.1.2",
"inherits": "~2.0.0",
......@@ -4604,7 +4581,6 @@
"resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz",
"integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=",
"dev": true,
"optional": true,
"requires": {
"aproba": "^1.0.3",
"console-control-strings": "^1.0.0",
......@@ -4642,8 +4618,7 @@
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz",
"integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=",
"dev": true,
"optional": true
"dev": true
},
"get-stream": {
"version": "3.0.0",
......@@ -4832,8 +4807,7 @@
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz",
"integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=",
"dev": true,
"optional": true
"dev": true
},
"has-value": {
"version": "1.0.0",
......@@ -5568,8 +5542,7 @@
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz",
"integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=",
"dev": true,
"optional": true
"dev": true
},
"is-windows": {
"version": "1.0.2",
......@@ -6227,7 +6200,6 @@
"resolved": "http://registry.npmjs.org/load-json-file/-/load-json-file-1.1.0.tgz",
"integrity": "sha1-lWkFcI1YtLq0wiYbBPWfMcmTdMA=",
"dev": true,
"optional": true,
"requires": {
"graceful-fs": "^4.1.2",
"parse-json": "^2.2.0",
......@@ -6240,8 +6212,7 @@
"version": "2.3.0",
"resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
"dev": true,
"optional": true
"dev": true
}
}
},
......@@ -6516,8 +6487,7 @@
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz",
"integrity": "sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=",
"dev": true,
"optional": true
"dev": true
},
"map-visit": {
"version": "1.0.0",
......@@ -7182,7 +7152,6 @@
"resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz",
"integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==",
"dev": true,
"optional": true,
"requires": {
"are-we-there-yet": "~1.1.2",
"console-control-strings": "~1.1.0",
......@@ -8197,7 +8166,6 @@
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-1.1.0.tgz",
"integrity": "sha1-9f+qXs0pyzHAR0vKfXVra7KePyg=",
"dev": true,
"optional": true,
"requires": {
"load-json-file": "^1.0.0",
"normalize-package-data": "^2.3.2",
......@@ -8209,7 +8177,6 @@
"resolved": "https://registry.npmjs.org/path-type/-/path-type-1.1.0.tgz",
"integrity": "sha1-WcRPfuSR2nBNpBXaWkBwuk+P5EE=",
"dev": true,
"optional": true,
"requires": {
"graceful-fs": "^4.1.2",
"pify": "^2.0.0",
......@@ -8220,8 +8187,7 @@
"version": "2.3.0",
"resolved": "http://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
"integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=",
"dev": true,
"optional": true
"dev": true
}
}
},
......@@ -8230,7 +8196,6 @@
"resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-1.0.1.tgz",
"integrity": "sha1-nWPBMnbAZZGNV/ACpX9AobZD+wI=",
"dev": true,
"optional": true,
"requires": {
"find-up": "^1.0.0",
"read-pkg": "^1.0.0"
......@@ -8241,7 +8206,6 @@
"resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz",
"integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=",
"dev": true,
"optional": true,
"requires": {
"path-exists": "^2.0.0",
"pinkie-promise": "^2.0.0"
......@@ -8252,7 +8216,6 @@
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz",
"integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=",
"dev": true,
"optional": true,
"requires": {
"pinkie-promise": "^2.0.0"
}
......@@ -9533,7 +9496,6 @@
"resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz",
"integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=",
"dev": true,
"optional": true,
"requires": {
"is-utf8": "^0.2.0"
}
......@@ -10977,7 +10939,6 @@
"resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz",
"integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==",
"dev": true,
"optional": true,
"requires": {
"string-width": "^1.0.2 || 2"
}
......
<faidare-navbar></faidare-navbar>
<div class="container" style="margin-top: 100px">
<div style="margin-top: 100px ; margin-right: 100px ; margin-left: 100px">
<faidare-error></faidare-error>
<router-outlet></router-outlet>
</div>
......
......@@ -23,7 +23,7 @@
</div>
<div class="card mb-1">
<div class="card-body">
<h3 class="card-title">{{ facet.field | titlecase }}</h3>
<h3 class="card-title">{{ facet.field }}</h3>
<input #typeahead class="form-control" [formControl]="criterion"
[ngbTypeahead]="search"
(selectItem)="selectKey($event)" [resultTemplate]="resultTemplate"
......
import { LargeFacetsComponent } from './large-facets.component';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import {
DataDiscoveryCriteria, DataDiscoveryCriteriaUtils,
DataDiscoveryCriteria,
DataDiscoveryCriteriaUtils,
DataDiscoveryFacet
} from '../../models/data-discovery.model';
import { NgbTypeaheadModule } from '@ng-bootstrap/ng-bootstrap';
......@@ -108,7 +109,7 @@ describe('LargeFacetsComponent', () => {
component.facet = largeFacet;
tester.detectChanges();
expect(tester.facetTitle.textContent).toEqual('Large Facet');
expect(tester.facetTitle.textContent).toEqual('large Facet');
expect(tester.facetInput).toBeTruthy();
});
......
<div class="card mb-1" *ngIf="facet.terms.length && facet.terms.length <= 8">
<div class="card-body">
<h3 class="card-title">{{ facet.field | titlecase }}</h3>
<h3 class="card-title">{{ facet.field }}</h3>
<form [formGroup]="checkBoxes" class="card-text">
<div class="form-check" *ngFor="let term of facet.terms">
......
......@@ -82,7 +82,7 @@ describe('SmallFacetsComponent', () => {
component.displayGermplasmResult$ = new BehaviorSubject<boolean>(false);
tester.detectChanges();
expect(tester.title).toContainText('Sources');
expect(tester.title).toContainText('sources');
expect(tester.terms[0]).toContainText('SOURCE 1 (10)');
expect(tester.terms[0].attr('for')).toBe('source 1');
......
......@@ -61,8 +61,9 @@
<tr>
<td>{{ accession.germplasmName }}</td>
<td>{{ accession.accessionNumber }}</td>
<td>{{ accession.commonCropName }}</td>
<td>{{ accession.genusSpecies }}</td>
<td>{{ accession.instituteName }}</td>
<td>{{ accession.biologicalStatusOfAccessionCode }}</td>
</tr>
</ng-container>
</tbody>
......
......@@ -4,7 +4,7 @@ import { GermplasmResultPageComponent } from './germplasm-result-page.component'
import { RouterTestingModule } from '@angular/router/testing';
import { LoadingSpinnerComponent } from '../loading-spinner/loading-spinner.component';
import { GnpisService } from '../gnpis.service';
import { BrapiGermplasm, GermplasmResults } from '../models/brapi.model';
import { GermplasmResults } from '../models/brapi.model';
import { CardSectionComponent } from '../card-section/card-section.component';
import { NO_ERRORS_SCHEMA } from '@angular/core';
import {
......@@ -14,7 +14,7 @@ import {
DEFAULT_PAGE_SIZE,
MAX_RESULTS
} from '../models/data-discovery.model';
import { GermplasmSearchCriteria } from '../models/gnpis.model';
import { Germplasm, GermplasmSearchCriteria } from '../models/gnpis.model';
import { BehaviorSubject, of } from 'rxjs';
......@@ -86,7 +86,7 @@ describe('GermplasmResultPageComponent', () => {
}
];
const germplasmSearchResult: GermplasmResults<BrapiGermplasm> = {
const germplasmSearchResult: GermplasmResults<Germplasm> = {
metadata: {
pagination: pagination
},
......@@ -114,7 +114,31 @@ describe('GermplasmResultPageComponent', () => {
subtaxa: 'subsp',
subtaxaAuthority: '',
donors: null,
acquisitionDate: 'yesterday'
acquisitionDate: 'yesterday',
genusSpecies: null,
genusSpeciesSubtaxa: null,
taxonSynonyms: null,
taxonCommonNames: null,
taxonComment: null,
geneticNature: null,
comment: null,
photo: null,
holdingInstitute: null,
holdingGenbank: null,
presenceStatus: null,
children: null,
originSite: null,
collectingSite: null,
evaluationSites: null,
collector: null,
breeder: null,
distributors: null,
panel: null,
collection: null,
population: null,
'schema:includedInDataCatalog': null
}, {
germplasmDbId: 'g2',
defaultDisplayName: 'germplam2',
......@@ -137,11 +161,41 @@ describe('GermplasmResultPageComponent', () => {
subtaxa: 'subsp',
subtaxaAuthority: '',
donors: null,
acquisitionDate: 'today'
acquisitionDate: 'today',
genusSpecies: null,
genusSpeciesSubtaxa: null,
taxonSynonyms: null,
taxonCommonNames: null,
taxonComment: null,
geneticNature: null,
comment: null,
photo: null,
holdingInstitute: null,
holdingGenbank: null,
presenceStatus: null,
children: null,
originSite: null,
collectingSite: null,
evaluationSites: null,
collector: null,
breeder: null,
distributors: null,
panel: null,
collection: null,
population: null,
'schema:includedInDataCatalog': null
}],
}
};
const criteria: GermplasmSearchCriteria = {
accessionNumbers: ['G_20'],
germplasmDbIds: null,
......@@ -164,6 +218,7 @@ describe('GermplasmResultPageComponent', () => {
geneticNature: null,
holdingInstitute: null,
sources: null,
types: null,
facetFields: null,
sortBy: 'germplasmName',
......
import { Component, Input, OnInit } from '@angular/core';
import { BrapiGermplasm } from '../models/brapi.model';
import { GnpisService } from '../gnpis.service';
import { GermplasmSearchCriteria } from '../models/gnpis.model';
import { Germplasm, GermplasmSearchCriteria } from '../models/gnpis.model';
import { saveAs } from 'file-saver';
import { ActivatedRoute, Router } from '@angular/router';
import { ActivatedRoute } from '@angular/router';
import {
DataDiscoveryCriteria,
DataDiscoveryCriteriaUtils,
......@@ -24,21 +23,22 @@ import { BehaviorSubject } from 'rxjs';
export class GermplasmResultPageComponent implements OnInit {
germplasm: BrapiGermplasm[];
germplasm: Germplasm[];
localCriteria: GermplasmSearchCriteria = DataDiscoveryCriteriaUtils.emptyGermplasmSearchCriteria();
@Input() criteriaFromForm$: BehaviorSubject<DataDiscoveryCriteria>;
@Input() germplasmSearchCriteria$: BehaviorSubject<GermplasmSearchCriteria>;
@Input() germplasmFacets$: BehaviorSubject<DataDiscoveryFacet[]>;
headers: string[] = ['germplasmName', 'accessionNumber', 'commonCropName', 'instituteName'];
headers: string[] = ['germplasmName', 'accessionNumber', 'genusSpecies', 'instituteName', 'biologicalStatusOfAccessionCode'];
elementPerPage: number[] = [15, 20, 25];
loading: boolean;
fieldSortState: object = {
germplasmName: null,
accessionNumber: null,
commonCropName: null,
instituteName: null
genusSpecies: null,
instituteName: null,
biologicalStatusOfAccessionCode: null
};
pagination = {
......@@ -102,7 +102,8 @@ export class GermplasmResultPageComponent implements OnInit {
accessionNumbers: asArray(criteria.accessions),
synonyms: asArray(criteria.accessions),
sources: asArray(criteria.sources)
// Do not use the source as a criterion because of the ES should request.
// sources: asArray(criteria.sources)
};
this.germplasmSearchCriteria$.next(this.localCriteria);
......@@ -182,7 +183,8 @@ export class GermplasmResultPageComponent implements OnInit {
this.germplasmSearchCriteria$.next(this.localCriteria);
}
formatFacets(facets: DataDiscoveryFacet[]): DataDiscoveryFacet[] {
// Format facets by renaming and merging some facets in one facet.
/*formatFacets(facets: DataDiscoveryFacet[]): DataDiscoveryFacet[] {
const bioStatusAndGeneticNature = [];
let newFacets: DataDiscoveryFacet[] = [];
for (const facet of facets) {
......@@ -206,5 +208,5 @@ export class GermplasmResultPageComponent implements OnInit {
...newFacets
];
return newFacets;
}
}*/
}
......@@ -152,6 +152,7 @@ describe('GnpisService', () => {
geneticNature: null,
holdingInstitute: null,
sources: null,
types: 'Germplasm',
facetFields: null,
sortBy: null,
......
......@@ -8,7 +8,6 @@ import {
DataDiscoverySource
} from './models/data-discovery.model';
import {
BrapiGermplasm,
BrapiResults,
GermplasmCriteria,
GermplasmResults
......@@ -109,7 +108,7 @@ export class GnpisService {
);
}
germplasmSearch(criteria: GermplasmCriteria): Observable<GermplasmResults<BrapiGermplasm>> {
germplasmSearch(criteria: GermplasmCriteria): Observable<GermplasmResults<Germplasm>> {
return zip(
// Get source by URI
......
......@@ -65,6 +65,7 @@ export class DataDiscoveryCriteriaUtils {
biologicalStatus: null,
geneticNature: null,
sources: null,
types: null,
facetFields: ['holdingInstitute',
'biologicalStatus', 'geneticNature', 'country'],
......
......@@ -23,6 +23,7 @@ export interface GermplasmSearchCriteria {
geneticNature: string[];
holdingInstitute: string[];
sources: string[];
types: string;