From 8f08e60e6b42feb1851e6ee83571dd75822af8bd Mon Sep 17 00:00:00 2001 From: Don Date: Mon, 5 Jul 2021 16:15:56 +1000 Subject: [PATCH] blast-result-view : make transient dataset and block ids unique by parent ... to address issue of subsequent results not displaying features/triangles. dnaSequenceSearch.bash : pass datasetId to dev_blastResult, so that multiple results can be simulated in development. blast-results-view.js : viewFeatures() : append parentName to datasetName for transient datasets, to make them distinct by parent. add featuresU : prepend dataset.id to features[*].blockId transient.js : pushBlockArgs() : blockId : prefix datasetId, so that results for different parents are distinct. --- backend/scripts/dnaSequenceSearch.bash | 2 +- .../app/components/panel/upload/blast-results-view.js | 8 ++++++-- frontend/app/services/data/transient.js | 3 ++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/backend/scripts/dnaSequenceSearch.bash b/backend/scripts/dnaSequenceSearch.bash index 9b0a118c8..f897c7cee 100755 --- a/backend/scripts/dnaSequenceSearch.bash +++ b/backend/scripts/dnaSequenceSearch.bash @@ -134,7 +134,7 @@ if [ -d ../../pretzel.A1 ] then # sleep 10 # FJ039903.1, DQ146423.1 - dev_blastResult | \ + dev_blastResult "$datasetId" | \ ( [ "$addDataset" = true ] && convertSearchResults2Json || cat) | \ ( [ -n "$resultRows" ] && head -n $resultRows || cat) status=$? diff --git a/frontend/app/components/panel/upload/blast-results-view.js b/frontend/app/components/panel/upload/blast-results-view.js index 43e6df3de..02daaaab5 100644 --- a/frontend/app/components/panel/upload/blast-results-view.js +++ b/frontend/app/components/panel/upload/blast-results-view.js @@ -414,7 +414,9 @@ export default Component.extend({ } let transient = this.get('transient'), - datasetName = this.get('newDatasetName') || 'blastResults', + parentName = this.get('search.parent'), + /** append parentName to make transient datasets distinct by parent */ + datasetName = this.get('newDatasetName') || ('blastResults_' + parentName), namespace = this.get('namespace'), dataset = transient.pushDatasetArgs( datasetName, @@ -426,6 +428,8 @@ export default Component.extend({ this.get('blockNames'), namespace ); + /** change features[].blockId to match blocks[], which has dataset.id prefixed to make them distinct. */ + let featuresU = features.map((f) => { let {blockId, ...rest} = f; rest.blockId = dataset.id + '-' + blockId; return rest; }); /** When changing between 2 blast-results tabs, this function will be * called for both. * @@ -445,7 +449,7 @@ export default Component.extend({ active, /* when switching tabs got : this.isDestroyed===true, this.viewRow and this.get('viewRow') undefined * but this.search.viewRow OK */ - () => transient.showFeatures(dataset, blocks, features, active, this.get('viewRow') || this.search.viewRow)); + () => transient.showFeatures(dataset, blocks, featuresU, active, this.get('viewRow') || this.search.viewRow)); } }, diff --git a/frontend/app/services/data/transient.js b/frontend/app/services/data/transient.js index 62c40809d..7f7484d3a 100644 --- a/frontend/app/services/data/transient.js +++ b/frontend/app/services/data/transient.js @@ -91,8 +91,9 @@ export default Service.extend({ pushBlockArgs(datasetId, name, namespace) { let + /** may need to pass search ID also; depends on whether distinct blocks should be used for each search result. */ /** prefix _id with datasetId to make it unique enough. May use UUID. */ - data = {_id : /*datasetId + '-' +*/ name, scope : name, name, namespace, datasetId}, + data = {_id : datasetId + '-' + name, scope : name, name, namespace, datasetId}, store = this.get('store'), record = this.pushData(store, 'block', data); return record;