gramene-search 2.41.4 → 2.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +37 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -21546,6 +21546,42 @@ const $15504f5eba8e73bd$var$TaxDistTbrowse = (props)=>{
|
|
|
21546
21546
|
}, [
|
|
21547
21547
|
doAcceptGrameneSuggestion
|
|
21548
21548
|
]);
|
|
21549
|
+
// Node-tooltip "Filter on" button: restrict the search to the clicked
|
|
21550
|
+
// taxon (taxonomy__ancestors covers every genome beneath it). Node ids are
|
|
21551
|
+
// the taxDist model ids (NCBI taxon ids, the Solr doc's _id), so look the
|
|
21552
|
+
// model up for its name and rank.
|
|
21553
|
+
const modelById = (0, $gXNCa$react.useMemo)(()=>{
|
|
21554
|
+
const byId = {};
|
|
21555
|
+
const walk = (n)=>{
|
|
21556
|
+
if (!n || !n.model) return;
|
|
21557
|
+
byId[String(n.model.id)] = n.model;
|
|
21558
|
+
(n.children || []).forEach(walk);
|
|
21559
|
+
};
|
|
21560
|
+
walk(grameneTaxDist);
|
|
21561
|
+
return byId;
|
|
21562
|
+
}, [
|
|
21563
|
+
grameneTaxDist
|
|
21564
|
+
]);
|
|
21565
|
+
const nodeActions = (0, $gXNCa$react.useCallback)((treeNode)=>{
|
|
21566
|
+
const node = modelById[treeNode.id];
|
|
21567
|
+
if (!node || !doAcceptGrameneSuggestion) return [];
|
|
21568
|
+
const name = `${node.name} (${node.rank})`;
|
|
21569
|
+
return [
|
|
21570
|
+
{
|
|
21571
|
+
label: 'Add search filter',
|
|
21572
|
+
title: `Filter results to ${name}`,
|
|
21573
|
+
onClick: ()=>doAcceptGrameneSuggestion({
|
|
21574
|
+
category: 'Taxonomy',
|
|
21575
|
+
fq_field: 'taxonomy__ancestors',
|
|
21576
|
+
fq_value: `${node.id}`,
|
|
21577
|
+
name: name
|
|
21578
|
+
})
|
|
21579
|
+
}
|
|
21580
|
+
];
|
|
21581
|
+
}, [
|
|
21582
|
+
modelById,
|
|
21583
|
+
doAcceptGrameneSuggestion
|
|
21584
|
+
]);
|
|
21549
21585
|
const hostData = (0, $gXNCa$react.useMemo)(()=>{
|
|
21550
21586
|
const facet = props.grameneSearch && props.grameneSearch.facet_counts && props.grameneSearch.facet_counts.facet_fields && props.grameneSearch.facet_counts.facet_fields.taxon_id;
|
|
21551
21587
|
return {
|
|
@@ -21692,6 +21728,7 @@ const $15504f5eba8e73bd$var$TaxDistTbrowse = (props)=>{
|
|
|
21692
21728
|
zones: true
|
|
21693
21729
|
},
|
|
21694
21730
|
headerActions: headerActions,
|
|
21731
|
+
nodeActions: nodeActions,
|
|
21695
21732
|
viewState: effectiveViewState,
|
|
21696
21733
|
onViewStateChange: (next)=>setTaxTreeView({
|
|
21697
21734
|
viewState: next
|