Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor
app/gui/queryresults/queryresultsservice.js
(#317)
* refactor `src/app/gui/queryresults/queryresultsservice.js` - add FIXME comments (eg. please "add function description") - code cleanup (eg. tons of weird ternary conditions, short-circuiting logic and missing brackets!) - full function rewrite `QueryResultsService::updateLayerResultFeatures(layer)` - notable function rewrite `QueryResultsService::_digestFeaturesForLayers (featuresForLayers)` * Fix misspelling and properties position declaration * Add comments * Closes #59 * wrong parameter * add geometry check within `QueryResultsService::showGeometry(geometry)` * extract function `QueryResultsService::_handleFeatureForLayer(featuresForLayer)` * remove undefined action `QueryResultsService.zoomToElement` * clean up some code * convert `QueryResultsService` to ES6 class * update @SInCE tags * update @param tag * 🐛 Fix bugs due refactoring * wrong merge * 🐛 Fix undefined check and change layer.selection.features to empty array instead empty object * code readability - slim down function `updateLayerResultFeatures()` - alias long variable name `this._addFeaturesLayerResultInteraction` - slim down function `downloadFeatures()` - extract function `_handleExternalVectorLayerSelection()` - extract function `_handleProjectLayerSelection()` * 🐛 Ensure that find array method return undefined (not found). Add extenal parameter into _getFeaturesIds * slim down `unRegisterCustomComponent` * 🐛 Fix add feature to a external layer. fix add settimeout to querycontrol * code readability - slim down comments - alias long variable name `this.state.currentactiontools` - alias long variable name `this.state.currentactionfeaturelayer` - alias long variable name ` this.state.layersFeaturesBoxes` - extract function `_clearActions` - alias prototype function `QueryResultsService.init` - alias prototype function `QueryResultsService.reset` * refactor function `QueryControl.setMap()` * refactor `_handleFeatureForLayer` * ♻️ Set right event 'picked' on queryControl * comments * 🐛 Fix setCurrentActionLayerFeatureTool * Check and correct some refactoring code * ✨ Create common downloadApplicationWrapper to run download * ♻️ Move downloadApplicationWrapper from queryresultsservice.js to index.prod.js as GUI method * move application wrapper * extract `_hasLayerObjGeometry` and `_parseLayerObjFeatures` * params destrcuturing: `featuresForLayer` * simplify condition * refactor `setQueryResponse` - remove function `_digestFeaturesForLayers()` - rename function `_handleFeatureForLayer()` into `_responseToLayer()` - extract function `_hasLayerObjGeometry()` - extract function `_hasLayerObjImageField()` - refactor function `_parseLayerObjFormStructure()` * alias `_changeLayerResult` * remove `_orderResponseByProjectLayers` * apply some fixme and todos - remove nested if-else in: `getVectorLayerFeaturesFromQueryRequest()` - incorporate function `_addVectorLayersDataToQueryResponse()` into `*/ setQueryResponse()` setter - simplify destructuring assignment within `_printSingleAtlas()` function - remove function `_addComponent()` * wrong variable reference * wrong variable name * 🐛 Fix case when click to add feature to layer result and no current mapcontrol is active (undefined). Need to be set null to align default value and evaluation. * `console.warn` * wrong comments * 🐛 In case of no features for a specific layer, return undefind, so layer is not add to query results state layers array * simplify conditions * 🐛 Need to refer to instance and not to "class" * 🐛 Handle selection feature action when add new feature to layer result * 🐛 Add custom drawpolygon type for query by drw polygon otherwise it conflict to download action to get all attributes of polygon query (query by polygon) * 🐛 fix download action * boolean logic --------- Co-authored-by: volterra79 <[email protected]>
- Loading branch information