saveEntity && minor fixes
This commit is contained in:
parent
77ec391185
commit
d56a3abaca
@ -39,7 +39,6 @@
|
||||
"@ngx-share/core": "^7.1.4",
|
||||
"@ngx-translate/core": "^12.1.2",
|
||||
"@ngx-translate/http-loader": "^4.0.0",
|
||||
"@types/leaflet-markercluster": "^1.0.3",
|
||||
"ace-builds": "^1.4.11",
|
||||
"angular-gridster2": "^9.1.0",
|
||||
"angular2-hotkeys": "^2.2.0",
|
||||
@ -48,7 +47,6 @@
|
||||
"compass-sass-mixins": "^0.12.7",
|
||||
"core-js": "^3.6.5",
|
||||
"date-fns": "^2.12.0",
|
||||
"es6-promise": "^4.2.8",
|
||||
"flot": "git://github.com/thingsboard/flot.git#0.9-work",
|
||||
"flot.curvedlines": "git://github.com/MichaelZinsmaier/CurvedLines.git#master",
|
||||
"font-awesome": "^4.7.0",
|
||||
@ -75,7 +73,6 @@
|
||||
"ngx-hm-carousel": "^2.0.0-rc.1",
|
||||
"ngx-translate-messageformat-compiler": "^4.6.0",
|
||||
"objectpath": "^2.0.0",
|
||||
"promise-polyfill": "8.1.3",
|
||||
"prop-types": "^15.7.2",
|
||||
"raphael": "^2.3.0",
|
||||
"rc-select": "^10.2.4",
|
||||
@ -111,8 +108,8 @@
|
||||
"@types/jstree": "^3.3.39",
|
||||
"@types/jszip": "^3.1.7",
|
||||
"@types/leaflet": "^1.5.12",
|
||||
"@types/leaflet.markercluster": "^1.4.2",
|
||||
"@types/leaflet-polylinedecorator": "^1.6.0",
|
||||
"@types/leaflet-markercluster": "^1.0.3",
|
||||
"@types/lodash": "^4.14.150",
|
||||
"@types/raphael": "^2.3.0",
|
||||
"@types/react": "^16.9.34",
|
||||
|
||||
@ -23,7 +23,7 @@ export type MapSettings = {
|
||||
polygonKeyName: any;
|
||||
draggableMarker: boolean;
|
||||
initCallback?: () => any;
|
||||
posFunction: (rigXPos, origYPos) => { x, y };
|
||||
posFunction: (origXPos, origYPos) => { x, y };
|
||||
defaultZoomLevel?: number;
|
||||
disableScrollZooming?: boolean;
|
||||
minZoomLevel?: number;
|
||||
|
||||
@ -166,16 +166,30 @@ export class MapWidgetController implements MapWidgetInterface {
|
||||
entityType: e.$datasource.entityType,
|
||||
id: e.$datasource.entityId
|
||||
};
|
||||
const keys = e.$datasource.dataKeys.map(key => {
|
||||
return {
|
||||
const attributes = [];
|
||||
const timeseries = [];
|
||||
e.$datasource.dataKeys.forEach(key => {
|
||||
const value = {
|
||||
key: key.name,
|
||||
value: e[key.name]
|
||||
};
|
||||
if(key.type === DataKeyType.attribute){
|
||||
attributes.push(value)
|
||||
}
|
||||
if(key.type === DataKeyType.timeseries){
|
||||
timeseries.push(value)
|
||||
}
|
||||
})
|
||||
return attributeService.saveEntityAttributes(
|
||||
attributeService.saveEntityTimeseries(
|
||||
entityId,
|
||||
AttributeScope.SHARED_SCOPE,
|
||||
keys
|
||||
timeseries
|
||||
).subscribe(() => {
|
||||
});
|
||||
attributeService.saveEntityAttributes(
|
||||
entityId,
|
||||
AttributeScope.SERVER_SCOPE,
|
||||
attributes
|
||||
).subscribe(() => {
|
||||
});
|
||||
}
|
||||
@ -260,7 +274,7 @@ export class MapWidgetController implements MapWidgetInterface {
|
||||
type: widgetType.latest,
|
||||
callbacks: {
|
||||
onDataUpdated: (subscription) => {
|
||||
result.next(subscription.data[0].data[0]);
|
||||
result.next(subscription?.data[0]?.data[0]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -19,7 +19,7 @@ import LeafletMap from '../leaflet-map';
|
||||
import { UnitedMapSettings } from '../map-models';
|
||||
import { aspectCache, parseFunction } from '@app/core/utils';
|
||||
import { Observable } from 'rxjs';
|
||||
import { map, filter } from 'rxjs/operators';
|
||||
import { map, filter, switchMap } from 'rxjs/operators';
|
||||
|
||||
const maxZoom = 4;// ?
|
||||
|
||||
@ -33,7 +33,7 @@ export class ImageMap extends LeafletMap {
|
||||
|
||||
constructor($container: HTMLElement, options: UnitedMapSettings) {
|
||||
super($container, options);
|
||||
options.posFunction = parseFunction(options.posFunction, ['origXPos', 'origYPos']) as ((rigXPos, origYPos) => { x, y });
|
||||
options.posFunction = parseFunction(options.posFunction, ['origXPos', 'origYPos']) as ((origXPos, origYPos) => { x, y });
|
||||
this.imageUrl = options.mapUrl;
|
||||
aspectCache(this.imageUrl).subscribe(aspect => {
|
||||
this.aspect = aspect;
|
||||
@ -44,14 +44,13 @@ export class ImageMap extends LeafletMap {
|
||||
}
|
||||
|
||||
setImageAlias(alias: Observable<any>) {
|
||||
alias.pipe(filter(result => result),
|
||||
filter(result => result), map(el => el[1])).subscribe(res => {
|
||||
alias.pipe(filter(result => result), map(el => el[1]), switchMap(res => {
|
||||
this.imageUrl = res;
|
||||
aspectCache(res).subscribe(aspect => {
|
||||
return aspectCache(res);
|
||||
})).subscribe(aspect => {
|
||||
this.aspect = aspect;
|
||||
this.onResize(true);
|
||||
})
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
updateBounds(updateImage?, lastCenterPos?) {
|
||||
|
||||
@ -52,7 +52,7 @@
|
||||
margin: 2px;
|
||||
line-height: 24px;
|
||||
|
||||
ng-mat-icon {
|
||||
mat-icon {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
|
||||
|
||||
@ -75,7 +75,6 @@
|
||||
import './zone-flags';
|
||||
import 'zone.js/dist/zone'; // Included with Angular CLI.
|
||||
import 'core-js/es/array';
|
||||
import { polyfill } from 'es6-promise'; polyfill();
|
||||
import moment from 'moment';
|
||||
|
||||
/***************************************************************************************************
|
||||
|
||||
@ -2,9 +2,6 @@
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "../out-tsc/app",
|
||||
"typeRoots": [
|
||||
"node_modules/@types"
|
||||
],
|
||||
"types": ["node", "jquery", "flot", "tooltipster", "tinycolor2", "js-beautify",
|
||||
"react", "react-dom", "jstree", "raphael", "canvas-gauges", "leaflet", "leaflet-markercluster"]
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user