Mercurial > gemma
diff client/src/components/identify/Identify.vue @ 2441:9de710bdb535
client: improved identify box formatter
author | Markus Kottlaender <markus@intevation.de> |
---|---|
date | Fri, 01 Mar 2019 10:53:52 +0100 |
parents | b6deb03ef13f |
children | bb5286acfee2 |
line wrap: on
line diff
--- a/client/src/components/identify/Identify.vue Fri Mar 01 10:52:32 2019 +0100 +++ b/client/src/components/identify/Identify.vue Fri Mar 01 10:53:52 2019 +0100 @@ -135,6 +135,8 @@ return this.featureId(feature); }, featureProps(feature) { + let featureId = this.featureId(feature); + // create array with {key, val} objects let propsArray = []; Object.keys(feature.getProperties()).forEach(key => { @@ -156,11 +158,17 @@ }); // change labels and remove unneeded properties - if (formatter.hasOwnProperty(this.featureId(feature))) { - propsArray = propsArray - .map(formatter[this.featureId(feature)].props) - .filter(p => p); // remove empty entries + // for all features + propsArray = propsArray.map(formatter.all); + // feature specific + if ( + formatter.hasOwnProperty(featureId) && + formatter[featureId].hasOwnProperty("props") + ) { + propsArray = propsArray.map(formatter[featureId].props); } + // remove empty entries + propsArray = propsArray.filter(p => p); // remove underscores in labels that where not previously changed already propsArray = propsArray.map(prop => {