entity save fix #2
This commit is contained in:
parent
c627e79947
commit
9479b4194f
@ -38,7 +38,7 @@ import { WidgetContext } from '@app/modules/home/models/widget-component.models'
|
|||||||
import { getDefCenterPosition } from './maps-utils';
|
import { getDefCenterPosition } from './maps-utils';
|
||||||
import { JsonSettingsSchema, WidgetActionDescriptor, DatasourceType, widgetType } from '@shared/models/widget.models';
|
import { JsonSettingsSchema, WidgetActionDescriptor, DatasourceType, widgetType } from '@shared/models/widget.models';
|
||||||
import { EntityId } from '@shared/models/id/entity-id';
|
import { EntityId } from '@shared/models/id/entity-id';
|
||||||
import { AttributeScope, DataKeyType } from '@shared/models/telemetry/telemetry.models';
|
import { AttributeScope, DataKeyType, LatestTelemetry } from '@shared/models/telemetry/telemetry.models';
|
||||||
import { AttributeService } from '@core/http/attribute.service';
|
import { AttributeService } from '@core/http/attribute.service';
|
||||||
import { Type } from '@angular/core';
|
import { Type } from '@angular/core';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
@ -168,7 +168,9 @@ export class MapWidgetController implements MapWidgetInterface {
|
|||||||
};
|
};
|
||||||
const attributes = [];
|
const attributes = [];
|
||||||
const timeseries = [];
|
const timeseries = [];
|
||||||
|
const latLngProperties = [this.settings.latKeyName, this.settings.lngKeyName, this.settings.xPosKeyName, this.settings.yPosKeyName];
|
||||||
e.$datasource.dataKeys.forEach(key => {
|
e.$datasource.dataKeys.forEach(key => {
|
||||||
|
if (latLngProperties.includes(key)) {
|
||||||
const value = {
|
const value = {
|
||||||
key: key.name,
|
key: key.name,
|
||||||
value: e[key.name]
|
value: e[key.name]
|
||||||
@ -179,19 +181,22 @@ export class MapWidgetController implements MapWidgetInterface {
|
|||||||
if (key.type === DataKeyType.timeseries) {
|
if (key.type === DataKeyType.timeseries) {
|
||||||
timeseries.push(value)
|
timeseries.push(value)
|
||||||
}
|
}
|
||||||
})
|
}
|
||||||
|
});
|
||||||
|
if (attributes.length) {
|
||||||
attributeService.saveEntityTimeseries(
|
attributeService.saveEntityTimeseries(
|
||||||
entityId,
|
entityId,
|
||||||
AttributeScope.SHARED_SCOPE,
|
LatestTelemetry.LATEST_TELEMETRY,
|
||||||
timeseries
|
timeseries
|
||||||
).subscribe(() => {
|
).subscribe(() => { });
|
||||||
});
|
}
|
||||||
|
if (timeseries.length) {
|
||||||
attributeService.saveEntityAttributes(
|
attributeService.saveEntityAttributes(
|
||||||
entityId,
|
entityId,
|
||||||
AttributeScope.SERVER_SCOPE,
|
AttributeScope.SERVER_SCOPE,
|
||||||
attributes
|
attributes
|
||||||
).subscribe(() => {
|
).subscribe(() => { });
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
initSettings(settings: UnitedMapSettings): UnitedMapSettings {
|
initSettings(settings: UnitedMapSettings): UnitedMapSettings {
|
||||||
|
|||||||
@ -150,7 +150,6 @@ export class Marker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
createDefaultMarkerIcon(color, onMarkerIconReady) {
|
createDefaultMarkerIcon(color, onMarkerIconReady) {
|
||||||
const pinColor = color.substr(1);
|
|
||||||
const icon = L.icon({
|
const icon = L.icon({
|
||||||
iconUrl: 'https://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=%E2%80%A2|' + color,
|
iconUrl: 'https://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=%E2%80%A2|' + color,
|
||||||
iconSize: [21, 34],
|
iconSize: [21, 34],
|
||||||
|
|||||||
@ -90,26 +90,26 @@
|
|||||||
mat-slider {
|
mat-slider {
|
||||||
min-width: 80px;
|
min-width: 80px;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
button.mat-button.mat-icon-button {
|
.mat-icon-button {
|
||||||
width: 44px;
|
width: 44px;
|
||||||
min-width: 44px;
|
min-width: 44px;
|
||||||
height: 44px;
|
height: 48px;
|
||||||
min-height: 44px;
|
min-height: 48px;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
line-height: 28px;
|
line-height: 28px;
|
||||||
|
|
||||||
mat-icon {
|
mat-icon {
|
||||||
width: 28px;
|
width: 24px;
|
||||||
height: 28px;
|
height: 24px;
|
||||||
font-size: 28px;
|
font-size: 24px;
|
||||||
|
|
||||||
svg {
|
svg {
|
||||||
width: inherit;
|
width: inherit;
|
||||||
height: inherit;
|
height: inherit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
mat-select {
|
mat-select {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user