# HG changeset patch # User Markus Kottlaender # Date 1551339461 -3600 # Node ID ef928c63388aea3a3ad4358bf8efb89cddbedc94 # Parent fd248ede0251868849bf611effeed5a5541af76c client: handle json values in identify box diff -r fd248ede0251 -r ef928c63388a client/src/components/identify/Identify.vue --- a/client/src/components/identify/Identify.vue Thu Feb 28 07:45:34 2019 +0100 +++ b/client/src/components/identify/Identify.vue Thu Feb 28 08:37:41 2019 +0100 @@ -138,9 +138,21 @@ // create array with {key, val} objects let propsArray = []; Object.keys(feature.getProperties()).forEach(key => { - // avoid cyclic object value - if (key !== feature.getGeometryName()) - propsArray.push({ key, val: feature.getProperties()[key] }); + let val = feature.getProperties()[key]; + + // if val is a valid json string, parse it and spread its values into + // the array + try { + let json = JSON.parse(val); + Object.keys(json).forEach(key => { + propsArray.push({ key, val: json[key] }); + }); + } catch (e) { + // if val is not json then just put the key value pair into the array + // avoid cyclic object value (I didn't further investigate what's the + // problem here but feature.getGeometryName() needs to be skipped) + if (key !== feature.getGeometryName()) propsArray.push({ key, val }); + } }); // change labels and remove unneeded properties diff -r fd248ede0251 -r ef928c63388a client/src/components/identify/formatter.js --- a/client/src/components/identify/formatter.js Thu Feb 28 07:45:34 2019 +0100 +++ b/client/src/components/identify/formatter.js Thu Feb 28 08:37:41 2019 +0100 @@ -10,7 +10,7 @@ } // remove certain props - let propsToRemove = ["nobjnm"]; + let propsToRemove = ["nobjnm", "reference_water_levels"]; if (propsToRemove.indexOf(p.key) !== -1) return null; return p;