Revize 05d4a2a9
Přidáno uživatelem Jakub Hlaváč před více než 3 roky(ů)
src/app/unit/components/unit.component.ts | ||
---|---|---|
64 | 64 |
if (!this.sensorGroups.some(group => group === sensorType)) { |
65 | 65 |
this.sensorGroups.push(sensorType); |
66 | 66 |
setTimeout(() => { |
67 |
//GraphLoader.getAnalyticsGraph(null, null, null, '#vega_container_' + sensor.sensorId.toString().slice(0, 5)); |
|
67 |
// GraphLoader.getAnalyticsGraph(null, null, null, '#vega_container_' + sensor.sensorId.toString().slice(0, 5));
|
|
68 | 68 |
GraphLoader.getGraph(null, null, null, '#vega_container_' + sensor.sensorId.toString().slice(0, 5),null ); |
69 | 69 |
}, 0); |
70 | 70 |
} |
... | ... | |
111 | 111 |
if (response.status === 200) { |
112 | 112 |
return response.body; |
113 | 113 |
} else if (response.status === 204) { |
114 |
//GraphLoader.getAnalyticsGraph(null, null, null, '#vega_container_' + selectSens.toString().slice(0, 5)); |
|
114 |
// GraphLoader.getAnalyticsGraph(null, null, null, '#vega_container_' + selectSens.toString().slice(0, 5));
|
|
115 | 115 |
GraphLoader.getGraph(null, null, null, '#vega_container_' + selectSens.toString().slice(0, 5),null ); |
116 | 116 |
this.toastService.showWarningNoData(); |
117 | 117 |
return response.body; |
... | ... | |
127 | 127 |
if (data[key].data) { |
128 | 128 |
const view = '#vega_container_' + key.slice(0, 5); |
129 | 129 |
if (this.selectedSensors.some(sens => sens.toString() === key)) { |
130 |
//GraphLoader.getAnalyticsGraph(key, data[key].data, data[key].interval, view); |
|
131 |
//GraphLoader.getGraph(this.selectedSensors, this.filteredAnalyticsData(groupId), view, true); |
|
130 |
// GraphLoader.getAnalyticsGraph(key, data[key].data, data[key].interval, view);
|
|
131 |
// GraphLoader.getGraph(this.selectedSensors, this.filteredAnalyticsData(groupId), view, true);
|
|
132 | 132 |
} else { |
133 | 133 |
GraphLoader.getGraph(null, null, null, view, null); |
134 | 134 |
} |
... | ... | |
162 | 162 |
// GraphLoader.getAnalyticsGraph(key, data[key].data, data[key].interval, view); |
163 | 163 |
GraphLoader.getGraph(this.selectedSensors, this.analyticsData, this.filteredSensorsInfos(groupId), view, true); |
164 | 164 |
} else { |
165 |
//GraphLoader.getAnalyticsGraph(null, null, null, view); |
|
165 |
// GraphLoader.getAnalyticsGraph(null, null, null, view);
|
|
166 | 166 |
GraphLoader.getGraph(null, null, null, view, null); |
167 | 167 |
} |
168 | 168 |
} |
... | ... | |
181 | 181 |
const groupId = sensorId.toString().slice(0, 5); |
182 | 182 |
const sensorGroupElement = '#vega_container_' + groupId; |
183 | 183 |
if (!this.selectedSensors.find(sensId => sensId.toString().slice(0, 5) === groupId)) { // if group of sensors is empty show empty graph |
184 |
//GraphLoader.getAnalyticsGraph(null, null, null, sensorGroupElement); |
|
184 |
// GraphLoader.getAnalyticsGraph(null, null, null, sensorGroupElement);
|
|
185 | 185 |
GraphLoader.getGraph(null, null, null, sensorGroupElement, null); |
186 | 186 |
} else { |
187 | 187 |
if (this.useAnalyticsData) { // use analytics data |
188 | 188 |
if (event.checked) { // if checked > add to graph |
189 | 189 |
if (this.analyticsData.some(sens => sens.sensorId === sensorId)) { // if already data for selected sensor in memory |
190 |
//GraphLoader.getAnalyticsGraph(sensorId, this.analyticsData.find(sens => sens.sensorId === sensorId).data, |
|
190 |
// GraphLoader.getAnalyticsGraph(sensorId, this.analyticsData.find(sens => sens.sensorId === sensorId).data,
|
|
191 | 191 |
// this.analyticsData.find((sens => sens.sensorId === sensorId).interval, sensorGroupElement); |
192 | 192 |
GraphLoader.getGraph(this.selectedSensors, this.analyticsData, this.filteredSensorsInfos(groupId), sensorGroupElement, true); |
193 | 193 |
|
... | ... | |
195 | 195 |
this.showGraph(false, sensorId); |
196 | 196 |
} |
197 | 197 |
} else { // remove sensor from graph |
198 |
//GraphLoader.getAnalyticsGraph(sensorId, this.analyticsData.find(sens => sens.sensorId === sensorId).data, |
|
198 |
// GraphLoader.getAnalyticsGraph(sensorId, this.analyticsData.find(sens => sens.sensorId === sensorId).data,
|
|
199 | 199 |
// this.analyticsData.find(sens => sens.sensorId === sensorId).interval, sensorGroupElement); |
200 | 200 |
GraphLoader.getGraph(this.selectedSensors, this.analyticsData, this.filteredSensorsInfos(groupId), sensorGroupElement, true); |
201 | 201 |
|
... | ... | |
203 | 203 |
} else { // use observations data |
204 | 204 |
if (event.checked) { // if checked > add to graph |
205 | 205 |
if (this.observationsData.some(sens => sens.sensorId.toString() === sensorId)) { // if already data for selected sensor in memory |
206 |
GraphLoader.getGraph(this.filteredSelectedSensors(groupId), this.filteredObservationData(groupId), this.filteredSensorsInfos(groupId), sensorGroupElement, false); |
|
207 |
//GraphLoader.getMultilineGraph(this.selectedSensors, this.filteredObservationData(groupId), sensorGroupElement) |
|
206 |
GraphLoader.getGraph(this.filteredSelectedSensors(groupId), this.filteredObservationData(groupId), |
|
207 |
this.filteredSensorsInfos(groupId), sensorGroupElement, false); |
|
208 |
// GraphLoader.getMultilineGraph(this.selectedSensors, this.filteredObservationData(groupId), sensorGroupElement) |
|
208 | 209 |
} else { // get data from server for added sensor and show graph for selected sensors |
209 | 210 |
this.showGraph(false, sensorId); |
210 | 211 |
} |
211 | 212 |
} else { // remove sensor from graph |
212 |
//GraphLoader.getMultilineGraph(this.selectedSensors, this.filteredObservationData(groupId), sensorGroupElement) |
|
213 |
GraphLoader.getGraph(this.filteredSelectedSensors(groupId), this.filteredObservationData(groupId), this.filteredSensorsInfos(groupId), sensorGroupElement, false); |
|
213 |
// GraphLoader.getMultilineGraph(this.selectedSensors, this.filteredObservationData(groupId), sensorGroupElement) |
|
214 |
GraphLoader.getGraph(this.filteredSelectedSensors(groupId), this.filteredObservationData(groupId), |
|
215 |
this.filteredSensorsInfos(groupId), sensorGroupElement, false); |
|
214 | 216 |
|
215 | 217 |
} |
216 | 218 |
} |
... | ... | |
236 | 238 |
|
237 | 239 |
|
238 | 240 |
filteredSelectedSensors(sensorGroupId: string): any { |
239 |
return this.selectedSensors.filter(sen => sen.toString().slice(0, 5) == sensorGroupId ); |
|
241 |
return this.selectedSensors.filter(sen => sen.toString().slice(0, 5) === sensorGroupId );
|
|
240 | 242 |
} |
241 | 243 |
|
242 | 244 |
filteredSensorsInfos(sensorGroupId: string): any { |
243 | 245 |
return this.sensors.filter(sen => this.selectedSensors.includes(sen.sensorId.toString()) && |
244 |
sen.sensorId.toString().slice(0, 5) == sensorGroupId); |
|
246 |
sen.sensorId.toString().slice(0, 5) === sensorGroupId);
|
|
245 | 247 |
} |
246 | 248 |
|
247 | 249 |
private getObservations(range: Date[], changedDate: boolean, changedSensorId: string) { |
... | ... | |
276 | 278 |
const view = '#vega_container_' + selectSens.toString().slice(0, 5); |
277 | 279 |
setTimeout(() => { |
278 | 280 |
console.log(this.selectedSensors); |
279 |
//GraphLoader.getMultilineGraph(this.selectedSensors, this.filteredObservationData(selectSens.toString().slice(0, 5)), view); |
|
280 |
GraphLoader.getGraph(this.filteredSelectedSensors(groupId), this.filteredObservationData(groupId), this.filteredSensorsInfos(groupId), view, false); |
|
281 |
// GraphLoader.getMultilineGraph(this.selectedSensors, this.filteredObservationData(selectSens.toString().slice(0, 5)), view); |
|
282 |
GraphLoader.getGraph(this.filteredSelectedSensors(groupId), this.filteredObservationData(groupId), |
|
283 |
this.filteredSensorsInfos(groupId), view, false); |
|
281 | 284 |
}, 10); |
282 | 285 |
} |
283 | 286 |
}) |
... | ... | |
305 | 308 |
this.observationsData.push({sensorId: changedSensorId, sensor: |
306 | 309 |
this.sensors.find(sens => sens.sensorId.toString() === changedSensorId.toString()), data: observations}); |
307 | 310 |
const view = '#vega_container_' + changedSensorId.toString().slice(0, 5); |
308 |
|
|
309 |
GraphLoader.getGraph(this.filteredSelectedSensors(groupId), this.filteredObservationData(groupId), this.filteredSensorsInfos(groupId), view, false);
|
|
311 |
GraphLoader.getGraph(this.filteredSelectedSensors(groupId), this.filteredObservationData(groupId), |
|
312 |
this.filteredSensorsInfos(groupId), view, false); |
|
310 | 313 |
}, err => this.toastService.showError(err.error.message)); |
311 | 314 |
} |
312 | 315 |
} |
Také k dispozici: Unified diff
Re #XXXX - Podpora