|
28 | 28 | }
|
29 | 29 |
|
30 | 30 | // Pre-fill the form from URL parameters.
|
31 |
| - // Supported parameters: source, sensor, start, end, geo_type, geo_id |
| 31 | + // Supported parameters: data_source, signal, start_day, end_day, geo_type, geo_value, as_of |
32 | 32 | const urlParams = new URLSearchParams(window.location.search);
|
33 | 33 |
|
34 | 34 | // Overwrite default source & sensor if these are present in the URL
|
|
52 | 52 | const param = new DateParam(date);
|
53 | 53 |
|
54 | 54 | // Populate date based on URL params or, if absent, the current date
|
55 |
| - if (sensor && !sensor.active) { |
56 |
| - // If the sensor is inactive, set the start and end dates to its historical range rather than current date |
57 |
| - if ( |
58 |
| - urlParams.has('start_day') && |
59 |
| - new Date(urlParams.get('start_day')) >= sensor.meta.minTime && |
60 |
| - new Date(urlParams.get('start_day')) <= sensor.meta.maxTime |
61 |
| - ) { |
62 |
| - startDate = new Date(urlParams.get('start_day')); |
63 |
| - } else { |
64 |
| - startDate = sensor.meta.minTime; |
65 |
| - } |
66 |
| - if ( |
67 |
| - urlParams.has('end_day') && |
68 |
| - new Date(urlParams.get('end_day')) <= sensor.meta.minTime && |
69 |
| - new Date(urlParams.get('end_day')) <= sensor.meta.maxTime |
70 |
| - ) { |
71 |
| - endDate = new Date(urlParams.get('end_day')); |
72 |
| - } else { |
73 |
| - endDate = sensor.meta.maxTime; |
74 |
| - } |
75 |
| - } else { |
76 |
| - startDate = urlParams.has('start_day') ? new Date(urlParams.get('start_day')) : param.sparkLineTimeFrame.min; |
77 |
| - endDate = urlParams.has('end_day') ? new Date(urlParams.get('end_day')) : param.sparkLineTimeFrame.max; |
78 |
| - } |
| 55 | + startDate = urlParams.has('start_day') ? new Date(urlParams.get('start_day')) : param.sparkLineTimeFrame.min; |
| 56 | + endDate = urlParams.has('end_day') ? new Date(urlParams.get('end_day')) : param.sparkLineTimeFrame.max; |
79 | 57 | }
|
80 | 58 | $: initDate($currentDateObject);
|
81 | 59 |
|
|
0 commit comments