Showing
7 changed files
with
31 additions
and
25 deletions
... | ... | @@ -39,7 +39,6 @@ |
39 | 39 | "@ngx-share/core": "^7.1.4", |
40 | 40 | "@ngx-translate/core": "^12.1.2", |
41 | 41 | "@ngx-translate/http-loader": "^4.0.0", |
42 | - "@types/leaflet-markercluster": "^1.0.3", | |
43 | 42 | "ace-builds": "^1.4.11", |
44 | 43 | "angular-gridster2": "^9.1.0", |
45 | 44 | "angular2-hotkeys": "^2.2.0", |
... | ... | @@ -48,7 +47,6 @@ |
48 | 47 | "compass-sass-mixins": "^0.12.7", |
49 | 48 | "core-js": "^3.6.5", |
50 | 49 | "date-fns": "^2.12.0", |
51 | - "es6-promise": "^4.2.8", | |
52 | 50 | "flot": "git://github.com/thingsboard/flot.git#0.9-work", |
53 | 51 | "flot.curvedlines": "git://github.com/MichaelZinsmaier/CurvedLines.git#master", |
54 | 52 | "font-awesome": "^4.7.0", |
... | ... | @@ -75,7 +73,6 @@ |
75 | 73 | "ngx-hm-carousel": "^2.0.0-rc.1", |
76 | 74 | "ngx-translate-messageformat-compiler": "^4.6.0", |
77 | 75 | "objectpath": "^2.0.0", |
78 | - "promise-polyfill": "8.1.3", | |
79 | 76 | "prop-types": "^15.7.2", |
80 | 77 | "raphael": "^2.3.0", |
81 | 78 | "rc-select": "^10.2.4", |
... | ... | @@ -111,8 +108,8 @@ |
111 | 108 | "@types/jstree": "^3.3.39", |
112 | 109 | "@types/jszip": "^3.1.7", |
113 | 110 | "@types/leaflet": "^1.5.12", |
114 | - "@types/leaflet.markercluster": "^1.4.2", | |
115 | 111 | "@types/leaflet-polylinedecorator": "^1.6.0", |
112 | + "@types/leaflet-markercluster": "^1.0.3", | |
116 | 113 | "@types/lodash": "^4.14.150", |
117 | 114 | "@types/raphael": "^2.3.0", |
118 | 115 | "@types/react": "^16.9.34", | ... | ... |
... | ... | @@ -23,7 +23,7 @@ export type MapSettings = { |
23 | 23 | polygonKeyName: any; |
24 | 24 | draggableMarker: boolean; |
25 | 25 | initCallback?: () => any; |
26 | - posFunction: (rigXPos, origYPos) => { x, y }; | |
26 | + posFunction: (origXPos, origYPos) => { x, y }; | |
27 | 27 | defaultZoomLevel?: number; |
28 | 28 | disableScrollZooming?: boolean; |
29 | 29 | minZoomLevel?: number; | ... | ... |
... | ... | @@ -166,16 +166,30 @@ export class MapWidgetController implements MapWidgetInterface { |
166 | 166 | entityType: e.$datasource.entityType, |
167 | 167 | id: e.$datasource.entityId |
168 | 168 | }; |
169 | - const keys = e.$datasource.dataKeys.map(key => { | |
170 | - return { | |
169 | + const attributes = []; | |
170 | + const timeseries = []; | |
171 | + e.$datasource.dataKeys.forEach(key => { | |
172 | + const value = { | |
171 | 173 | key: key.name, |
172 | 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 | 181 | } |
174 | 182 | }) |
175 | - return attributeService.saveEntityAttributes( | |
183 | + attributeService.saveEntityTimeseries( | |
176 | 184 | entityId, |
177 | 185 | AttributeScope.SHARED_SCOPE, |
178 | - keys | |
186 | + timeseries | |
187 | + ).subscribe(() => { | |
188 | + }); | |
189 | + attributeService.saveEntityAttributes( | |
190 | + entityId, | |
191 | + AttributeScope.SERVER_SCOPE, | |
192 | + attributes | |
179 | 193 | ).subscribe(() => { |
180 | 194 | }); |
181 | 195 | } |
... | ... | @@ -260,7 +274,7 @@ export class MapWidgetController implements MapWidgetInterface { |
260 | 274 | type: widgetType.latest, |
261 | 275 | callbacks: { |
262 | 276 | onDataUpdated: (subscription) => { |
263 | - result.next(subscription.data[0].data[0]); | |
277 | + result.next(subscription?.data[0]?.data[0]); | |
264 | 278 | } |
265 | 279 | } |
266 | 280 | }; | ... | ... |
... | ... | @@ -19,7 +19,7 @@ import LeafletMap from '../leaflet-map'; |
19 | 19 | import { UnitedMapSettings } from '../map-models'; |
20 | 20 | import { aspectCache, parseFunction } from '@app/core/utils'; |
21 | 21 | import { Observable } from 'rxjs'; |
22 | -import { map, filter } from 'rxjs/operators'; | |
22 | +import { map, filter, switchMap } from 'rxjs/operators'; | |
23 | 23 | |
24 | 24 | const maxZoom = 4;// ? |
25 | 25 | |
... | ... | @@ -33,7 +33,7 @@ export class ImageMap extends LeafletMap { |
33 | 33 | |
34 | 34 | constructor($container: HTMLElement, options: UnitedMapSettings) { |
35 | 35 | super($container, options); |
36 | - options.posFunction = parseFunction(options.posFunction, ['origXPos', 'origYPos']) as ((rigXPos, origYPos) => { x, y }); | |
36 | + options.posFunction = parseFunction(options.posFunction, ['origXPos', 'origYPos']) as ((origXPos, origYPos) => { x, y }); | |
37 | 37 | this.imageUrl = options.mapUrl; |
38 | 38 | aspectCache(this.imageUrl).subscribe(aspect => { |
39 | 39 | this.aspect = aspect; |
... | ... | @@ -44,14 +44,13 @@ export class ImageMap extends LeafletMap { |
44 | 44 | } |
45 | 45 | |
46 | 46 | setImageAlias(alias: Observable<any>) { |
47 | - alias.pipe(filter(result => result), | |
48 | - filter(result => result), map(el => el[1])).subscribe(res => { | |
49 | - this.imageUrl = res; | |
50 | - aspectCache(res).subscribe(aspect => { | |
51 | - this.aspect = aspect; | |
52 | - this.onResize(true); | |
53 | - }) | |
54 | - }) | |
47 | + alias.pipe(filter(result => result), map(el => el[1]), switchMap(res => { | |
48 | + this.imageUrl = res; | |
49 | + return aspectCache(res); | |
50 | + })).subscribe(aspect => { | |
51 | + this.aspect = aspect; | |
52 | + this.onResize(true); | |
53 | + }); | |
55 | 54 | } |
56 | 55 | |
57 | 56 | updateBounds(updateImage?, lastCenterPos?) { | ... | ... |
... | ... | @@ -75,7 +75,6 @@ |
75 | 75 | import './zone-flags'; |
76 | 76 | import 'zone.js/dist/zone'; // Included with Angular CLI. |
77 | 77 | import 'core-js/es/array'; |
78 | -import { polyfill } from 'es6-promise'; polyfill(); | |
79 | 78 | import moment from 'moment'; |
80 | 79 | |
81 | 80 | /*************************************************************************************************** | ... | ... |
... | ... | @@ -2,9 +2,6 @@ |
2 | 2 | "extends": "../tsconfig.json", |
3 | 3 | "compilerOptions": { |
4 | 4 | "outDir": "../out-tsc/app", |
5 | - "typeRoots": [ | |
6 | - "node_modules/@types" | |
7 | - ], | |
8 | 5 | "types": ["node", "jquery", "flot", "tooltipster", "tinycolor2", "js-beautify", |
9 | 6 | "react", "react-dom", "jstree", "raphael", "canvas-gauges", "leaflet", "leaflet-markercluster"] |
10 | 7 | }, | ... | ... |