Skip to content

Commit

Permalink
feat(plugin): tabular JSON query output
Browse files Browse the repository at this point in the history
Relates #5729
  • Loading branch information
alyec committed Apr 8, 2015
1 parent 6994fdd commit 88deeec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,7 @@
"legendMimeType": "image/jpeg",
"featureInfo": {
"mimeType": "text/plain",
"parser": "windParse"
"parser": "jsonParse"
},
"settings": { "opacity": { "default": 0.4 } }
},
Expand Down Expand Up @@ -760,6 +760,7 @@
"stringParse.js",
"htmlRawParse.js",
"jsonRawParse.js",
"jsonParse.js",
"tempParse.js",
"windParse.js",
"epsgio.js"
Expand Down
4 changes: 2 additions & 2 deletions src/js/plugins/jsonParse.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RAMP.plugins.featureInfoParser.jsonParse = function (data) {

data = { a: 1, b: '2', c: true, d: [1, 2, 3], e: { f: 1, g: 2 }, h: null };

summary = ''.join(Object.keys(data).filter(function (e) { return typeof e !== 'object' && typeof e !== 'undefined'; }).map(function (e) { return '<tr><th>{0}</th><td>{1}</td></tr>'.format(e, data[e]); }));
summary = Object.keys(data).filter(function (e) { return typeof data[e] !== 'object' && typeof data[e] !== 'undefined'; }).map(function (e) { return '<tr><th>{0}</th><td>{1}</td></tr>'.format(e, data[e]); }).join('');

return "<p>{0}</p>".format(data);
return "<table>{0}</table>".format(summary);
};

0 comments on commit 88deeec

Please sign in to comment.