-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
blast results : display table rows as feature triangles
... works; MVP for discussing the features. axis-ticks-selected.js : add featureIsTransient(f), and use in featuresOfBlockLookup() : show the features of un-viewed blocks, when block is reference. blast-results.js : change tableModal true -> false (i.e. initially table is in left panel, not in modal dialog). add viewFeaturesFlag, dataFeatures() (factored from validateData()), blockNames(), viewFeaturesEffect(). paths-progressive.js : pushFeature() : default for param flowsService, return record found by peekRecord(). selected.js : toggle() : add param add : if true then add, if false then remove, if undefined then toggle (as before). add transient.js : with pushFeature(), pushData() (based on pathsPro : pushFeature), datasetForSearch(), pushDatasetArgs(), pushBlockArgs(), blocksForSearch(), showFeatures(). blast-results.hbs : use viewFeaturesEffect, add checkbox viewFeaturesFlag.
- Loading branch information
1 parent
cdcdcf4
commit 27e3a5d
Showing
6 changed files
with
253 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
import { computed } from '@ember/object'; | ||
import Service, { inject as service } from '@ember/service'; | ||
|
||
import { _internalModel_data } from '../../utils/ember-devel'; | ||
|
||
|
||
const dLog = console.debug; | ||
|
||
const trace = 1; | ||
|
||
/** | ||
* Transient data objects (Features / Blocks / Datasets) which are | ||
* created in frontend and not persisted to server & database. May be | ||
* added to store. | ||
* | ||
* Purpose : provide display of Features in similar ways to database | ||
* features, e.g. clickedFeatures as triangles. | ||
*/ | ||
|
||
/** | ||
* Related : services/data/selected.js | ||
* | ||
* for #239 : FASTA / DNA sequence search API, display results in frontend | ||
* comment / section : multiple output tabs : | ||
* - after viewing the added dataset : also put them into the feature search so they are highlighted | ||
* - display table rows as Feature triangles | ||
*/ | ||
export default Service.extend({ | ||
// push to local store for now; could use primaryServer.store. | ||
store: service(), | ||
pathsPro : service('data/paths-progressive'), | ||
selected : service('data/selected'), | ||
|
||
/*--------------------------------------------------------------------------*/ | ||
|
||
pushFeature(f) { | ||
// pathsPro.pushFeature() will use default flowsService. | ||
return this.get('pathsPro').pushFeature(this.get('store'), f, /*flowsService*/undefined); | ||
}, | ||
|
||
/*--------------------------------------------------------------------------*/ | ||
|
||
pushData(store, modelName, d) { | ||
let c; | ||
let r = store.peekRecord(modelName, d._id); | ||
if (r) { | ||
// this can be a @param verifyFn : if (verifyFn) { verifyFn(d, r); } | ||
if (modelName === 'dataset') { | ||
// if ((r.parent !== d.parent) || (r.namespace !== d.namespace)) | ||
dLog('peekRecord', modelName, d._id, d, r.get(_internalModel_data), r); | ||
dLog(r.parent, d.parent, r.namespace, d.namespace); | ||
} | ||
} | ||
else | ||
{ | ||
d.id = d._id; | ||
|
||
// .name is primaryKey of dataset | ||
let n = store.normalize(modelName, d); | ||
c = store.push(n); | ||
|
||
// if (trace > 2) | ||
dLog(c.get('id'), c.get(_internalModel_data)); | ||
} | ||
return c; | ||
}, | ||
|
||
/** | ||
* @param _id datasetName | ||
*/ | ||
datasetForSearch(_id, parent, namespace) { | ||
let | ||
d = | ||
{ | ||
name : _id, | ||
_id, namespace, parent, | ||
tags : [ 'transient' ], | ||
meta : { paths : false } | ||
}; | ||
return d; | ||
}, | ||
|
||
pushDatasetArgs(_id, parent, namespace) { | ||
let | ||
data = this.datasetForSearch(_id, parent, namespace), | ||
store = this.get('store'), | ||
record = this.pushData(store, 'dataset', data); | ||
return record; | ||
}, | ||
|
||
pushBlockArgs(datasetId, name, namespace) { | ||
let | ||
/** prefix _id with datasetId to make it unique enough. May use UUID. */ | ||
data = {_id : /*datasetId + '-' +*/ name, scope : name, name, namespace, datasetId}, | ||
store = this.get('store'), | ||
record = this.pushData(store, 'block', data); | ||
return record; | ||
}, | ||
blocksForSearch(datasetId, blockNames, namespace) { | ||
let blocks = blockNames.map((name) => this.pushBlockArgs(datasetId, name, namespace)); | ||
return blocks; | ||
}, | ||
|
||
showFeatures(dataset, blocks, features, viewFeaturesFlag) { | ||
let | ||
selected = this.get('selected'), | ||
// may pass dataset, blocks to pushFeature() | ||
stored = features.map((f) => this.pushFeature(f)); | ||
stored.forEach((feature) => selected.toggle('features', feature, viewFeaturesFlag)); | ||
} | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters