Commit 3bf8e458 authored by Matija Obreza's avatar Matija Obreza
Browse files

Taxonomy: Include display of family in Genera, Species and Accession tables

parent 9f896059
......@@ -30,6 +30,11 @@ class TaxonomyGenus {
public static CodeGroup = {
qualifyingCode: 'TAXONOMY_GENUS_QUALIFIER',
}
public static DEREFERENCES = {
_self: { id: [ '_self' ]},
fam: { id: [ 'taxonomyFamily'] },
}
}
export default TaxonomyGenus;
......@@ -60,6 +60,7 @@ class TaxonomySpecies {
public static DEREFERENCES = {
_self: { id: [ '_self' ]},
gen: { id: [ 'taxonomyGenus' ] },
fam: { id: [ 'taxonomyGenus.taxonomyFamily'] },
coo: { id: [ 'verifierCooperator', 'curator1Cooperator', 'curator2Cooperator' ] },
}
}
......
......@@ -3,7 +3,7 @@ import * as QueryString from 'query-string';
import { AxiosInstance, AxiosRequestConfig } from 'axios';
import IPageRequest from '@gringlobal-ce/client/model/page/IPageRequest';
import { TaxonomyFamily, TaxonomyFamilyFilteredPage, TaxonomyFamilyFilter, TaxonomyGenusFilteredPage, TaxonomyGenusFilter, TaxonomySpeciesFilteredPage, TaxonomySpeciesFilter, TaxonomySpecies } from '@gringlobal-ce/client/model/gringlobal';
import { TaxonomyGenus, TaxonomyFamily, TaxonomyFamilyFilteredPage, TaxonomyFamilyFilter, TaxonomyGenusFilteredPage, TaxonomyGenusFilter, TaxonomySpeciesFilteredPage, TaxonomySpeciesFilter, TaxonomySpecies } from '@gringlobal-ce/client/model/gringlobal';
import { dereferenceReferences3 } from '@gringlobal-ce/client/utilities';
const URL_FILTER_SPECIES = '/api/v1/t/species/filter';
......@@ -82,10 +82,7 @@ class TaxonomyService {
method: 'POST',
...content,
}).then((response) => {
dereferenceReferences3(response.data.content, {
fam: { id: [ 'taxonomyFamily' ] },
// coo: { id: [ 'ownedBy', 'modifiedBy', 'createdBy' ] },
});
dereferenceReferences3(response.data.content, TaxonomyGenus.DEREFERENCES);
return response.data;
});
}
......
......@@ -34,6 +34,7 @@ export const AccessionTableDefaultConfig = {
'id',
'accessionNumber',
'taxonomySpecies',
'taxonomyFamily',
'preferredName',
'statusCode',
'mlsStatus',
......@@ -46,10 +47,21 @@ export const AccessionTableDefaultConfig = {
defaultColumnSettings: {
id: { readonly: true, align: TextAlign.right },
taxonomySpecies: { sort: 'taxonomySpecies.name' },
taxonomyFamily: { label: 'client:model.TaxonomyGenus.taxonomyFamily', hidden: true },
},
columnRenderers: {
initialReceivedDate: ({ value, row }: { value: Date, row: Accession }) => <PrettyDate value={ value } format={ row.initialReceivedDateCode } />,
taxonomySpecies: ({ value }: { value: TaxonomySpecies }): JSX.Element => <PrintSpecies taxonomySpecies={ value } />,
taxonomyFamily: ({ row: { taxonomySpecies: { taxonomyGenus: { taxonomyFamily } }}}: { row: Accession }): JSX.Element => {
return taxonomyFamily ? (
<><i>
{ taxonomyFamily.familyName }
{ taxonomyFamily.subfamilyName && ` > ${taxonomyFamily.subfamilyName}` }
{ taxonomyFamily.tribeName && ` > ${taxonomyFamily.tribeName}` }
{ taxonomyFamily.subtribeName && ` > ${taxonomyFamily.subtribeName}` }
</i></>
) : null;
},
accessionNumber: ({ row }: { row: Accession }): JSX.Element => <AccessionLink accession={ row }/>,
doi: Renderers.LTR_RENDERER,
site: ({ value }: { value: Site }): JSX.Element => {
......
......@@ -21,9 +21,10 @@ export const TaxonomyGenusTableDefaultConfig = {
defaultColumns: [
'id',
'qualifyingCode',
'hybridCode',
'name',
'genusAuthority',
'hybridCode',
'taxonomyFamily',
'genusName',
'subgenusName',
'sectionName',
......
......@@ -27,6 +27,7 @@ export const TaxonomySpeciesTableDefaultConfig = {
'id',
'name',
'nameAuthority',
'taxonomyFamily',
'nomenNumber',
'taxonomyGenus',
'speciesName',
......@@ -41,9 +42,20 @@ export const TaxonomySpeciesTableDefaultConfig = {
nomenNumber: { align: TextAlign.right },
nameVerifiedDate: { align: TextAlign.right },
synonymCode: { align: TextAlign.center },
taxonomyFamily: { label: 'client:model.TaxonomyGenus.taxonomyFamily' },
},
columnRenderers: {
taxonomyGenus: ({ value }: { value: TaxonomyGenus }): JSX.Element => value && <><i>{ value.name }</i></>,
taxonomyFamily: ({ row: { taxonomyGenus: { taxonomyFamily } }}: { row: TaxonomySpecies }): JSX.Element => {
return taxonomyFamily ? (
<><i>
{ taxonomyFamily.familyName }
{ taxonomyFamily.subfamilyName && ` > ${taxonomyFamily.subfamilyName}` }
{ taxonomyFamily.tribeName && ` > ${taxonomyFamily.tribeName}` }
{ taxonomyFamily.subtribeName && ` > ${taxonomyFamily.subtribeName}` }
</i></>
) : null;
},
speciesName: Renderers.ITALIC_RENDERER,
subspeciesName: Renderers.ITALIC_RENDERER,
varietyName: Renderers.ITALIC_RENDERER,
......
Supports Markdown
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