Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

564-565-566-sightings-table-and-search #586

Merged
merged 2 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1268,5 +1268,7 @@
"IN_PROGRESS" : "In progress",
"UNPROCESSED" : "Unprocessed",
"NO_MATCH_DESCRIPTION" : "Can't find any match for the sighting?",
"CONFIRM_NO_MATCH" : "Confirm no match"
"CONFIRM_NO_MATCH" : "Confirm no match",
"NUMBER_OF_INDIVIDUALS" : "Number of individuals",
"NUMBER_OF_ENCOUNTERS" : "Number of animals"
}
33 changes: 27 additions & 6 deletions src/components/dataDisplays/ElasticsearchSightingsDisplay.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export default function ElasticsearchSightingsDisplay({
...rest
}) {
const title = `${dataCount || sightings.length} matching sightings`;
const tableData = sightings.map(sighting => {

const tableData = sightings.map(sighting =>
// const encounters = sighting?.encounters || [];
// const photoCount = encounters.reduce((memo, e) => {
// memo += e.images.length;
Expand All @@ -27,12 +27,12 @@ export default function ElasticsearchSightingsDisplay({
// return individual ? [...memo, individual] : null;
// }, []);

return {
({
...sighting,
// photoCount,
// individuals,
};
});
}),
);

const columns = [
{
Expand All @@ -50,6 +50,24 @@ export default function ElasticsearchSightingsDisplay({
sortable: true,
align: 'left',
},
{
name: 'numberIndividuals',
labelId: 'NUMBER_OF_INDIVIDUALS',
sortable: false,
align: 'left',
},
{
name: 'numberEncounters',
labelId: 'NUMBER_OF_ENCOUNTERS',
sortable: false,
align: 'left',
},
{
name: 'verbatimLocality',
labelId: 'FREEFORM_LOCATION',
sortable: false,
align: 'left',
},
{
name: 'owners',
sortName: 'owners.full_name',
Expand All @@ -58,6 +76,7 @@ export default function ElasticsearchSightingsDisplay({
align: 'left',
options: {
customBodyRender: owners => {
// eslint-disable-line
const ownerName = get(
owners,
[0, 'full_name'],
Expand All @@ -81,7 +100,9 @@ export default function ElasticsearchSightingsDisplay({
labelId: 'ACTIONS',
sortable: false,
options: {
customBodyRender: guid => (
customBodyRender: (
guid, // eslint-disable-line
) => (
<ActionIcon
labelId="VIEW"
variant="view"
Expand Down
9 changes: 9 additions & 0 deletions src/models/sighting/useSightingSearchSchemas.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,15 @@ export default function useSightingSearchSchemas() {
queryTerm: 'numberAnnotations',
},
},
{
id: 'numberIndividuals',
labelId: 'NUMBER_OF_INDIVIDUALS',
FilterComponent: IntegerFilter,
filterComponentProps: {
filterId: 'numberIndividuals',
queryTerm: 'numberIndividuals',
},
},
{
id: 'stage',
labelId: 'SIGHTING_STATE',
Expand Down
Loading