Mercurial > gemma
annotate client/src/components/identify/formatter.js @ 2486:bca9a7a89f28 octree-diff
Merged default into octree-diff branch.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 01 Mar 2019 18:28:50 +0100 |
parents | 9de710bdb535 |
children | 204b0baac93c |
rev | line source |
---|---|
2371
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
1 const formatter = { |
2441
9de710bdb535
client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents:
2439
diff
changeset
|
2 all(p) { |
9de710bdb535
client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents:
2439
diff
changeset
|
3 if (p.key === "objnam") p.key = "Name"; |
9de710bdb535
client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents:
2439
diff
changeset
|
4 if (p.key === "staging_done") p.val = p.val ? "yes" : "no"; |
9de710bdb535
client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents:
2439
diff
changeset
|
5 if (p.key === "date_info") { |
9de710bdb535
client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents:
2439
diff
changeset
|
6 p.val = new Date(p.val).toLocaleString(); |
9de710bdb535
client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents:
2439
diff
changeset
|
7 } |
9de710bdb535
client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents:
2439
diff
changeset
|
8 return p; |
9de710bdb535
client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents:
2439
diff
changeset
|
9 }, |
2371
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
10 bottlenecks_geoserver: { |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
11 label: "Bottleneck", |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
12 props: p => { |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
13 if (p.key === "bottleneck_id") p.key = "ID"; |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
14 if (p.key === "responsible_country") p.key = "Responsible Country"; |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
15 |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
16 // remove certain props |
2405
ef928c63388a
client: handle json values in identify box
Markus Kottlaender <markus@intevation.de>
parents:
2371
diff
changeset
|
17 let propsToRemove = ["nobjnm", "reference_water_levels"]; |
2371
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
18 if (propsToRemove.indexOf(p.key) !== -1) return null; |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
19 |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
20 return p; |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
21 } |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
22 }, |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
23 fairway_dimensions: { |
2441
9de710bdb535
client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents:
2439
diff
changeset
|
24 label: "Fairway Dimensions" |
2371
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
25 }, |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
26 waterway_area: { |
2441
9de710bdb535
client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents:
2439
diff
changeset
|
27 label: "Waterway Area" |
2371
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
28 }, |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
29 distance_marks_geoserver: { |
2441
9de710bdb535
client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents:
2439
diff
changeset
|
30 label: "Distance Mark" |
2371
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
31 }, |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
32 waterway_axis: { |
2441
9de710bdb535
client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents:
2439
diff
changeset
|
33 label: "Waterway Axis" |
2371
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
34 }, |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
35 waterway_profiles: { |
2441
9de710bdb535
client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents:
2439
diff
changeset
|
36 label: "Waterway Profile" |
2439
c3c014435e88
client: identify box: formatted streches
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
37 }, |
c3c014435e88
client: identify box: formatted streches
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
38 stretches_geoserver: { |
2441
9de710bdb535
client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents:
2439
diff
changeset
|
39 label: "Stretch" |
2371
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
40 } |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
41 }; |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
42 |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
43 export { formatter }; |