Skip to content

Commit

Permalink
feature search : change use of d3 nest to group for display of featur…
Browse files Browse the repository at this point in the history
…es blocks

goto-feature-list.js : blocksUnique() : change d3.nest() to d3.group().
entry-block-add.js : action loadBlock() : change sendAction to direct call
  • Loading branch information
Don-Isdale committed Mar 25, 2024
1 parent d2192e4 commit deca791
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions frontend/app/components/goto-feature-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,15 @@ export default Component.extend({
this.set('selected.features', features);
this.get('selected').featureSearchResult(features);

let blockIds = new Set(),
let
blockIds = new Set(),
blockCounts = {},

n = d3.nest()
.key(function(f) { return f.get('blockId.id'); /* was f.blockId */ })
.entries(features),
keyFn = function(f) { return f.get('blockId.id'); /* was f.blockId */ },
ne = d3.group(features, keyFn)
.entries(),
n = Array.from(ne)
.map(([key, values]) => ({key, values})),
n1=n.sort(function (a,b) { return b.values.length - a.values.length; }),
// n1.map(function (d) { return d.key; }),
/** augment d.key : add references to the (block) record. */
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/components/record/entry-block-add.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export default EntryBase.extend({
/*--------------------------------------------------------------------------*/
actions : {
loadBlock(block) {
this.sendAction('loadBlock', block);
this.loadBlock(block.content);
}
}, // actions
/*--------------------------------------------------------------------------*/
Expand Down

0 comments on commit deca791

Please sign in to comment.