Mercurial > gemma
annotate client/src/components/identify/formatter.js @ 3636:89a39783c20a
Add forecast and measurement quality parameters to sections and stretches
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Tue, 11 Jun 2019 20:32:25 +0200 |
parents | 6d6577a87963 |
children | bb66e144dece |
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"; |
2573
4486ca003b55
client: added objname to identify formatter
Markus Kottlaender <markus@intevation.de>
parents:
2509
diff
changeset
|
4 if (p.key === "objname") p.key = "Name"; |
2509
3dc7c0f60a62
client: identify box: formatted fa_date_info and fa_critical
Markus Kottlaender <markus@intevation.de>
parents:
2458
diff
changeset
|
5 if (p.key === "staging_done" || p.key === "fa_critical") |
3dc7c0f60a62
client: identify box: formatted fa_date_info and fa_critical
Markus Kottlaender <markus@intevation.de>
parents:
2458
diff
changeset
|
6 p.val = p.val ? "yes" : "no"; |
3485
ef4803f87631
Add 'translation' and bottleneck attributes for measurement availability
Tom Gottfried <tom@intevation.de>
parents:
3362
diff
changeset
|
7 if ( |
3635
6d6577a87963
Do not show missing date as Unix epoch
Tom Gottfried <tom@intevation.de>
parents:
3505
diff
changeset
|
8 (p.key === "date_info" || |
6d6577a87963
Do not show missing date as Unix epoch
Tom Gottfried <tom@intevation.de>
parents:
3505
diff
changeset
|
9 p.key === "fa_date_info" || |
6d6577a87963
Do not show missing date as Unix epoch
Tom Gottfried <tom@intevation.de>
parents:
3505
diff
changeset
|
10 p.key === "gm_measuredate") && |
6d6577a87963
Do not show missing date as Unix epoch
Tom Gottfried <tom@intevation.de>
parents:
3505
diff
changeset
|
11 p.val !== null |
3485
ef4803f87631
Add 'translation' and bottleneck attributes for measurement availability
Tom Gottfried <tom@intevation.de>
parents:
3362
diff
changeset
|
12 ) { |
2441
9de710bdb535
client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents:
2439
diff
changeset
|
13 p.val = new Date(p.val).toLocaleString(); |
9de710bdb535
client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents:
2439
diff
changeset
|
14 } |
2743
4063adda3095
client: identified box: moved bbox zoom button to feature headers and removed bbox from the feature's properties list
Markus Kottlaender <markus@intevation.de>
parents:
2573
diff
changeset
|
15 |
4063adda3095
client: identified box: moved bbox zoom button to feature headers and removed bbox from the feature's properties list
Markus Kottlaender <markus@intevation.de>
parents:
2573
diff
changeset
|
16 // remove certain props |
4063adda3095
client: identified box: moved bbox zoom button to feature headers and removed bbox from the feature's properties list
Markus Kottlaender <markus@intevation.de>
parents:
2573
diff
changeset
|
17 let propsToRemove = ["bbox"]; |
4063adda3095
client: identified box: moved bbox zoom button to feature headers and removed bbox from the feature's properties list
Markus Kottlaender <markus@intevation.de>
parents:
2573
diff
changeset
|
18 if (propsToRemove.indexOf(p.key) !== -1) return null; |
4063adda3095
client: identified box: moved bbox zoom button to feature headers and removed bbox from the feature's properties list
Markus Kottlaender <markus@intevation.de>
parents:
2573
diff
changeset
|
19 |
2441
9de710bdb535
client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents:
2439
diff
changeset
|
20 return p; |
9de710bdb535
client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents:
2439
diff
changeset
|
21 }, |
2371
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
22 bottlenecks_geoserver: { |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
23 label: "Bottleneck", |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
24 props: p => { |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
25 if (p.key === "bottleneck_id") p.key = "ID"; |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
26 if (p.key === "responsible_country") p.key = "Responsible Country"; |
2509
3dc7c0f60a62
client: identify box: formatted fa_date_info and fa_critical
Markus Kottlaender <markus@intevation.de>
parents:
2458
diff
changeset
|
27 if (p.key === "fa_date_info") p.key = "Fairway Date"; |
3dc7c0f60a62
client: identify box: formatted fa_date_info and fa_critical
Markus Kottlaender <markus@intevation.de>
parents:
2458
diff
changeset
|
28 if (p.key === "fa_critical") p.key = "Fairway Critical"; |
3359
af6d8020b4a6
client: identify: improved label formatting
Markus Kottlaender <markus@intevation.de>
parents:
3309
diff
changeset
|
29 if (p.key === "gauge_objname") p.key = "Reference Gauge"; |
af6d8020b4a6
client: identify: improved label formatting
Markus Kottlaender <markus@intevation.de>
parents:
3309
diff
changeset
|
30 if (p.key === "source_organization") p.key = "Source Organization"; |
3485
ef4803f87631
Add 'translation' and bottleneck attributes for measurement availability
Tom Gottfried <tom@intevation.de>
parents:
3362
diff
changeset
|
31 if (p.key === "gm_measuredate") p.key = "Gauge Waterlevel Date"; |
3359
af6d8020b4a6
client: identify: improved label formatting
Markus Kottlaender <markus@intevation.de>
parents:
3309
diff
changeset
|
32 if (p.key === "gm_waterlevel") p.key = "Gauge Waterlevel"; |
3485
ef4803f87631
Add 'translation' and bottleneck attributes for measurement availability
Tom Gottfried <tom@intevation.de>
parents:
3362
diff
changeset
|
33 if (p.key === "gm_n_14d") p.key = "G.W. Count in Last 14 Days"; |
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 // remove certain props |
3505
d136ceed5d41
client: identify: remove unwanted attributes from bottlenecks and gauges
Markus Kottlaender <markus@intevation.de>
parents:
3485
diff
changeset
|
36 let propsToRemove = ["nobjnm", "reference_water_levels", "fa_data"]; |
2371
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
37 if (propsToRemove.indexOf(p.key) !== -1) return null; |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
38 |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
39 return p; |
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 fairway_dimensions: { |
2441
9de710bdb535
client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents:
2439
diff
changeset
|
43 label: "Fairway Dimensions" |
2371
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
44 }, |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
45 waterway_area: { |
2441
9de710bdb535
client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents:
2439
diff
changeset
|
46 label: "Waterway Area" |
2371
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
47 }, |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
48 distance_marks_geoserver: { |
2441
9de710bdb535
client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents:
2439
diff
changeset
|
49 label: "Distance Mark" |
2371
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
50 }, |
3081
9107c959bb3b
client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2743
diff
changeset
|
51 distance_marks_ashore_geoserver: { |
9107c959bb3b
client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2743
diff
changeset
|
52 label: "Distance Mark ashore" |
9107c959bb3b
client: Changed distance marks ashore to WMS layer.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2743
diff
changeset
|
53 }, |
2371
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
54 waterway_axis: { |
2441
9de710bdb535
client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents:
2439
diff
changeset
|
55 label: "Waterway Axis" |
2371
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
56 }, |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
57 waterway_profiles: { |
2441
9de710bdb535
client: improved identify box formatter
Markus Kottlaender <markus@intevation.de>
parents:
2439
diff
changeset
|
58 label: "Waterway Profile" |
2439
c3c014435e88
client: identify box: formatted streches
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
59 }, |
c3c014435e88
client: identify box: formatted streches
Markus Kottlaender <markus@intevation.de>
parents:
2405
diff
changeset
|
60 stretches_geoserver: { |
3636
89a39783c20a
Add forecast and measurement quality parameters to sections and stretches
Tom Gottfried <tom@intevation.de>
parents:
3635
diff
changeset
|
61 label: "Stretch", |
89a39783c20a
Add forecast and measurement quality parameters to sections and stretches
Tom Gottfried <tom@intevation.de>
parents:
3635
diff
changeset
|
62 props: p => { |
89a39783c20a
Add forecast and measurement quality parameters to sections and stretches
Tom Gottfried <tom@intevation.de>
parents:
3635
diff
changeset
|
63 if (p.key === "gm_measuredate") p.key = "Min. Gauge Waterlevel Date"; |
89a39783c20a
Add forecast and measurement quality parameters to sections and stretches
Tom Gottfried <tom@intevation.de>
parents:
3635
diff
changeset
|
64 if (p.key === "gm_n_14d") p.key = "Min. G.W. Count in Last 14 Days"; |
89a39783c20a
Add forecast and measurement quality parameters to sections and stretches
Tom Gottfried <tom@intevation.de>
parents:
3635
diff
changeset
|
65 |
89a39783c20a
Add forecast and measurement quality parameters to sections and stretches
Tom Gottfried <tom@intevation.de>
parents:
3635
diff
changeset
|
66 return p; |
89a39783c20a
Add forecast and measurement quality parameters to sections and stretches
Tom Gottfried <tom@intevation.de>
parents:
3635
diff
changeset
|
67 } |
2458
204b0baac93c
client: identified box: added gauges to formatter
Markus Kottlaender <markus@intevation.de>
parents:
2441
diff
changeset
|
68 }, |
3309
80037790032d
client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents:
3081
diff
changeset
|
69 sections_geoserver: { |
3636
89a39783c20a
Add forecast and measurement quality parameters to sections and stretches
Tom Gottfried <tom@intevation.de>
parents:
3635
diff
changeset
|
70 label: "Section", |
89a39783c20a
Add forecast and measurement quality parameters to sections and stretches
Tom Gottfried <tom@intevation.de>
parents:
3635
diff
changeset
|
71 props: p => { |
89a39783c20a
Add forecast and measurement quality parameters to sections and stretches
Tom Gottfried <tom@intevation.de>
parents:
3635
diff
changeset
|
72 if (p.key === "gm_measuredate") p.key = "Min. Gauge Waterlevel Date"; |
89a39783c20a
Add forecast and measurement quality parameters to sections and stretches
Tom Gottfried <tom@intevation.de>
parents:
3635
diff
changeset
|
73 if (p.key === "gm_n_14d") p.key = "Min. G.W. Count in Last 14 Days"; |
89a39783c20a
Add forecast and measurement quality parameters to sections and stretches
Tom Gottfried <tom@intevation.de>
parents:
3635
diff
changeset
|
74 |
89a39783c20a
Add forecast and measurement quality parameters to sections and stretches
Tom Gottfried <tom@intevation.de>
parents:
3635
diff
changeset
|
75 return p; |
89a39783c20a
Add forecast and measurement quality parameters to sections and stretches
Tom Gottfried <tom@intevation.de>
parents:
3635
diff
changeset
|
76 } |
3309
80037790032d
client: fully implemented sections
Markus Kottlaender <markus@intevation.de>
parents:
3081
diff
changeset
|
77 }, |
2458
204b0baac93c
client: identified box: added gauges to formatter
Markus Kottlaender <markus@intevation.de>
parents:
2441
diff
changeset
|
78 gauges_geoserver: { |
3362
bda4034304b1
client: identify: added formatting for latest gauge waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3359
diff
changeset
|
79 label: "Gauge", |
bda4034304b1
client: identify: added formatting for latest gauge waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3359
diff
changeset
|
80 props: p => { |
3485
ef4803f87631
Add 'translation' and bottleneck attributes for measurement availability
Tom Gottfried <tom@intevation.de>
parents:
3362
diff
changeset
|
81 if (p.key === "gm_measuredate") p.key = "Latest Waterlevel Date"; |
3362
bda4034304b1
client: identify: added formatting for latest gauge waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3359
diff
changeset
|
82 if (p.key === "gm_waterlevel") p.key = "Latest Waterlevel"; |
3485
ef4803f87631
Add 'translation' and bottleneck attributes for measurement availability
Tom Gottfried <tom@intevation.de>
parents:
3362
diff
changeset
|
83 if (p.key === "gm_n_14d") p.key = "Measurement Count in Last 14 Days"; |
3362
bda4034304b1
client: identify: added formatting for latest gauge waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3359
diff
changeset
|
84 |
3505
d136ceed5d41
client: identify: remove unwanted attributes from bottlenecks and gauges
Markus Kottlaender <markus@intevation.de>
parents:
3485
diff
changeset
|
85 // remove certain props |
d136ceed5d41
client: identify: remove unwanted attributes from bottlenecks and gauges
Markus Kottlaender <markus@intevation.de>
parents:
3485
diff
changeset
|
86 let propsToRemove = ["nsc_data"]; |
d136ceed5d41
client: identify: remove unwanted attributes from bottlenecks and gauges
Markus Kottlaender <markus@intevation.de>
parents:
3485
diff
changeset
|
87 if (propsToRemove.indexOf(p.key) !== -1) return null; |
d136ceed5d41
client: identify: remove unwanted attributes from bottlenecks and gauges
Markus Kottlaender <markus@intevation.de>
parents:
3485
diff
changeset
|
88 |
3362
bda4034304b1
client: identify: added formatting for latest gauge waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3359
diff
changeset
|
89 return p; |
bda4034304b1
client: identify: added formatting for latest gauge waterlevel
Markus Kottlaender <markus@intevation.de>
parents:
3359
diff
changeset
|
90 } |
2371
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
91 } |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
92 }; |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
93 |
045bac575294
client: fixed broken previous commit
Markus Kottlaender <markus@intevation.de>
parents:
diff
changeset
|
94 export { formatter }; |