...
|
...
|
@@ -38,7 +38,7 @@ import { WidgetContext } from '@app/modules/home/models/widget-component.models' |
38
|
38
|
import { getDefCenterPosition } from './maps-utils';
|
39
|
39
|
import { JsonSettingsSchema, WidgetActionDescriptor, DatasourceType, widgetType } from '@shared/models/widget.models';
|
40
|
40
|
import { EntityId } from '@shared/models/id/entity-id';
|
41
|
|
-import { AttributeScope, DataKeyType } from '@shared/models/telemetry/telemetry.models';
|
|
41
|
+import { AttributeScope, DataKeyType, LatestTelemetry } from '@shared/models/telemetry/telemetry.models';
|
42
|
42
|
import { AttributeService } from '@core/http/attribute.service';
|
43
|
43
|
import { Type } from '@angular/core';
|
44
|
44
|
import { TranslateService } from '@ngx-translate/core';
|
...
|
...
|
@@ -168,30 +168,35 @@ export class MapWidgetController implements MapWidgetInterface { |
168
|
168
|
};
|
169
|
169
|
const attributes = [];
|
170
|
170
|
const timeseries = [];
|
|
171
|
+ const latLngProperties = [this.settings.latKeyName, this.settings.lngKeyName, this.settings.xPosKeyName, this.settings.yPosKeyName];
|
171
|
172
|
e.$datasource.dataKeys.forEach(key => {
|
172
|
|
- const value = {
|
173
|
|
- key: key.name,
|
174
|
|
- value: e[key.name]
|
175
|
|
- };
|
176
|
|
- if(key.type === DataKeyType.attribute){
|
177
|
|
- attributes.push(value)
|
178
|
|
- }
|
179
|
|
- if(key.type === DataKeyType.timeseries){
|
180
|
|
- timeseries.push(value)
|
|
173
|
+ if (latLngProperties.includes(key)) {
|
|
174
|
+ const value = {
|
|
175
|
+ key: key.name,
|
|
176
|
+ value: e[key.name]
|
|
177
|
+ };
|
|
178
|
+ if (key.type === DataKeyType.attribute) {
|
|
179
|
+ attributes.push(value)
|
|
180
|
+ }
|
|
181
|
+ if (key.type === DataKeyType.timeseries) {
|
|
182
|
+ timeseries.push(value)
|
|
183
|
+ }
|
181
|
184
|
}
|
182
|
|
- })
|
183
|
|
- attributeService.saveEntityTimeseries(
|
184
|
|
- entityId,
|
185
|
|
- AttributeScope.SHARED_SCOPE,
|
186
|
|
- timeseries
|
187
|
|
- ).subscribe(() => {
|
188
|
|
- });
|
189
|
|
- attributeService.saveEntityAttributes(
|
190
|
|
- entityId,
|
191
|
|
- AttributeScope.SERVER_SCOPE,
|
192
|
|
- attributes
|
193
|
|
- ).subscribe(() => {
|
194
|
185
|
});
|
|
186
|
+ if (attributes.length) {
|
|
187
|
+ attributeService.saveEntityTimeseries(
|
|
188
|
+ entityId,
|
|
189
|
+ LatestTelemetry.LATEST_TELEMETRY,
|
|
190
|
+ timeseries
|
|
191
|
+ ).subscribe(() => { });
|
|
192
|
+ }
|
|
193
|
+ if (timeseries.length) {
|
|
194
|
+ attributeService.saveEntityAttributes(
|
|
195
|
+ entityId,
|
|
196
|
+ AttributeScope.SERVER_SCOPE,
|
|
197
|
+ attributes
|
|
198
|
+ ).subscribe(() => { });
|
|
199
|
+ }
|
195
|
200
|
}
|
196
|
201
|
|
197
|
202
|
initSettings(settings: UnitedMapSettings): UnitedMapSettings {
|
...
|
...
|
|