Commit 20f316cec002fadb2912a908f7af6bf015f17aab

Authored by Artem Halushko
1 parent 889e5510

fix map type caching

... ... @@ -17,12 +17,12 @@
17 17 import { defaultSettings, hereProviders, MapProviders, providerSets, UnitedMapSettings } from './map-models';
18 18 import LeafletMap from './leaflet-map';
19 19 import {
20   - commonMapSettingsSchema,
21   - mapPolygonSchema,
22   - mapProviderSchema,
23   - markerClusteringSettingsSchema,
24   - markerClusteringSettingsSchemaLeaflet,
25   - routeMapSettingsSchema
  20 + commonMapSettingsSchema,
  21 + mapPolygonSchema,
  22 + mapProviderSchema,
  23 + markerClusteringSettingsSchema,
  24 + markerClusteringSettingsSchemaLeaflet,
  25 + routeMapSettingsSchema
26 26 } from './schemes';
27 27 import { MapWidgetInterface, MapWidgetStaticInterface } from './map-widget.interface';
28 28 import { addCondition, addGroupInfo, addToSchema, initSchema, mergeSchemes } from '@core/schema-utils';
... ... @@ -30,17 +30,18 @@ import { of, Subject } from 'rxjs';
30 30 import { WidgetContext } from '@app/modules/home/models/widget-component.models';
31 31 import { getDefCenterPosition, parseArray, parseData, parseFunction, parseWithTranslation } from './maps-utils';
32 32 import {
33   - Datasource,
34   - DatasourceType,
35   - JsonSettingsSchema,
36   - WidgetActionDescriptor,
37   - widgetType
  33 + Datasource,
  34 + DatasourceType,
  35 + JsonSettingsSchema,
  36 + WidgetActionDescriptor,
  37 + widgetType
38 38 } from '@shared/models/widget.models';
39 39 import { EntityId } from '@shared/models/id/entity-id';
40 40 import { AttributeScope, DataKeyType, LatestTelemetry } from '@shared/models/telemetry/telemetry.models';
41 41 import { AttributeService } from '@core/http/attribute.service';
42 42 import { TranslateService } from '@ngx-translate/core';
43 43 import { UtilsService } from '@core/services/utils.service';
  44 +import _ from 'lodash';
44 45
45 46 // @dynamic
46 47 export class MapWidgetController implements MapWidgetInterface {
... ... @@ -90,9 +91,9 @@ export class MapWidgetController implements MapWidgetInterface {
90 91 }
91 92
92 93 public static getProvidersSchema(mapProvider: MapProviders, ignoreImageMap = false) {
  94 + const providerSchema = _.cloneDeep(mapProviderSchema);
93 95 if (mapProvider)
94   - mapProviderSchema.schema.properties.provider.default = mapProvider;
95   - const providerSchema = mapProviderSchema;
  96 + providerSchema.schema.properties.provider.default = mapProvider;
96 97 if (ignoreImageMap) {
97 98 providerSchema.form[0].items = providerSchema.form[0]?.items.filter(item => item.value !== 'image-map');
98 99 }
... ...