@c8y/ng1-modules 1017.286.0 → 1017.289.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?Object(arguments[e]):{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&r.push.apply(r,Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})),r.forEach(function(e){_defineProperty(t,e,n[e])})}return t}function _defineProperty(e,t,n){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"===_typeof(t)?t:String(t)}function _toPrimitive(e,t){if("object"!==_typeof(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0===n)return("string"===t?String:Number)(e);var r=n.call(e,t||"default");if("object"!==_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}!function(){function e(w,E,C,e,t,n,T,D,j,A,M,O,r,$,R,U,B,I,z){return a.$inject=["$scope","$element"],{restrict:"EA",templateUrl:":::PLUGIN_PATH:::/ui/views/map2.html",scope:{multipleDevices:"&",realtime:"&",cssClass:"@",deviceId:"&",config:"&",markerTemplate:"&",controlButtons:"&",noDataFetch:"&",map:"=?",c8yLegend:"&"},link:function(e){e.$on("dashboard-change",function(){e.map&&e.map.leafletMap&&e.map.leafletMap.invalidateSize()})},controller:a};function a(o,e){var n,t={padding:[50,50]},c=[],s=!1,l=U("The map widget displays up to {{count}} devices."),u={mapCustomBaseLayers:j.getPluginService("mapCustomBaseLayers"),ecbPositionSelector:j.getPluginService("ecbPositionSelector"),mapMarkerClusterer:j.getPluginService("mapMarkerClusterer")};o.map=this,e.addClass(o.cssClass);var p=L.map(e.find(".c8y-map-internal").get(0)).fitBounds(L.latLngBounds(L.latLng(14,-130.3),L.latLng(53.9,112.3)));if(o.map.leafletMap=p,L.Browser.mobile){var r=U("Use two fingers to move the map.");p.dragging.disable(),p._container.setAttribute("data-touch-warning-content",B.getString(r)),p._container.addEventListener("touchstart",f),p._container.addEventListener("touchmove",f),p._container.addEventListener("touchend",f),p._container.addEventListener("touchcancel",f),p._container.addEventListener("click",f)}o.map.event=o.$new(!0),o.map.markers=c;var a=L.tileLayer("//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{noWrap:!0});a.addTo(p),u.mapMarkerClusterer&&u.mapMarkerClusterer.applyClustering({mapInternalScope:o}),o.map.tracker=new M.Tracker(o),o.tracker=o.map.tracker,o.tracker.onPaths(function(e,t){n&&p.removeLayer(n);(n=e).addTo(p),t&&v(n.getBounds())}),o.$on("$destroy",function(){o.cleanRealtime&&o.cleanRealtime(),s=!0,L.Browser.mobile&&(p._container.removeEventListener("touchstart",f),p._container.removeEventListener("touchmove",f),p._container.removeEventListener("touchend",f),p._container.removeEventListener("touchcancel",f),p._container.removeEventListener("click",f))});var i=L.Control.extend({options:{position:"topright"},onAdd:function(){var e=L.DomUtil.create("div");return angular.element(e).html('\n <c8y-realtime-switch\n ng-if="!realtime()"\n get-state="state()"\n on-start="startRt()"\n on-stop="stopRt()"\n ></c8y-realtime-switch>\n <c8y-refresh-btn></c8y-refresh-btn>\n '),E(e)(o),e}}),m=L.Control.extend({options:{position:"bottomright"},onAdd:function(){var e=L.DomUtil.create("div");return angular.element(e).html("<div c8y-map-legend></div>"),E(e)(o),e}}),d=L.control.layers({OSM:a});function f(e){for(var t=["leaflet-control-minimap","leaflet-interactive","leaflet-popup-content","leaflet-popup-content-wrapper","leaflet-popup-close-button","leaflet-control-zoom-in","leaflet-control-zoom-out"],n=!1,r=0;r<t.length;r++)L.DomUtil.hasClass(e.target,t[r])&&(n=!0);n?L.DomUtil.hasClass(e.target,"leaflet-interactive")&&"touchmove"===e.type&&1===e.touches.length?(L.DomUtil.addClass(p._container,"touch-warning"),p.dragging.disable()):L.DomUtil.removeClass(p._container,"touch-warning"):"touchmove"===e.type||"touchstart"===e.type?1===e.touches.length?(L.DomUtil.addClass(p._container,"touch-warning"),p.dragging.disable()):(p.dragging.enable(),L.DomUtil.removeClass(p._container,"touch-warning")):L.DomUtil.removeClass(p._container,"touch-warning")}function g(){var e=o.deviceId();return(e?function(n){var e;if(_.isArray(n))e=y(n);else{var r=[];e=T.detail(n).then(j.getResData).then(function(e){r.push(e);var t=w.when([]);return o.multipleDevices()&&(t=w.all([T.childDevices(n),T.childAssets(n)]).then(_.flattenDeep)),t}).then(function(e){r=_.union(r,e);var t=_(r).filter(function(e){return!A.isGroup(e)}).map("id").value();return _.isEmpty(t)?(h(),w.when(new L.featureGroup)):y(t)})}return e}(e):y()).then(function(e){o.tracker.getActiveDeviceIds().length||v(e.getBounds())})}function v(e){e&&e.isValid()&&p.fitBounds(e,t)}function h(){o.devices=[],_.forEach(c,function(e){p.removeLayer(e)}),c.length=0}function y(n){var e,i={};if(o.noDataFetch())return w.reject();if(delete o.filterIds,u.ecbPositionSelector)e=u.ecbPositionSelector.getPositionedDevicesByEvents();else if(n&&n.length){var t=_.uniq(n);e=function t(e){var n=j.PAGESIZE;var r=_.take(e,n);var a=_.drop(e,n);return T.list({ids:r.join(","),pageSize:n}).then(function(e){return a.length&&(e.paging.next=function(){return t(a)}),e})}(o.filterIds=t),S()}else{var r={__or:[{__and:[{__has:"".concat(O.c8y_Position,".lat")},{__has:"".concat(O.c8y_Position,".lng")}]},{__and:[{__has:"".concat(O.v4e_Position,".lat")},{__has:"".concat(O.v4e_Position,".lng")}]}]};e=T.listQuery(r,{pageSize:function(){var e=G("mapWidgetPageSize");return!e||_.isNaN(e)?100:e}()}),S()}return function t(e){var r,a;return e.then(function(e){var t=e.statistics,n=e.paging;return r=n.next,a=t.pageSize,e}).then(function(e){return _(e).filter(function(e){var t=O.getLocationFragment(e);return!(!t||180<Math.abs(t.lng)||90<Math.abs(t.lat))||(console.warn("Device ".concat(e.name," has an invalid position!")),!1)}).reduce(function(e,t){return e[t.id]=t,e},{})}).then(function(e){return i=function(e,t,n){var r=_objectSpread({},e),a=Object.keys(r).length;if(a+Object.keys(t).length<=n)r=_objectSpread({},r,t);else{F()||I.info(B.getString(l,{count:n}));var i=Object.entries(t).filter(function(e,t){return void 0!==e&&t+a<n}).reduce(function(e,t){return e[t[0]]=t[1],e},{});r=_objectSpread({},r,i)}return r}(i,e,a),Object.keys(i).length<a&&r&&!s&&t(r()),Object.keys(i).length>=a&&r&&!F()&&I.info(B.getString(l,{count:a})),i}).then(function(e){h(),o.devices=e,_.forEach(e,function(e){var t=b(e),n=O.getLocationFragment(e),r=L.marker(L.latLng(n.lat,n.lng),{icon:t});r.on("click",function(){r.isPopupOpen()&&r.getPopup()||k(e,r)}),r.id=e.id,c.push(r)});var t=new L.featureGroup(c);return t.addTo(p),t}).then(function(e){return o.map.event.$broadcast("refresh",n),e}).then(function(e){o.tracker.getActiveDeviceIds().length||v(e.getBounds())})}(e)}function b(e){var t=e.c8y_ActiveAlarmsStatus||{},n=_.find(["critical","major","minor","warning"],function(e){return t[e]})||"normal";return L.divIcon({className:"".concat(n,"-marker-icon"),iconSize:[25,41],iconAnchor:[12.5,41]})}function k(e,t){return function(n){var e={fragmentType:"c8y_Position",dateFrom:"1970-01-01",dateTo:moment().add(1,"days").format("YYYY-MM-DD"),pageSize:1,source:n.id};return $.list(e).then(function(e){var t=e.length?e[0].time:void 0;return function(e,t){o.markerTemplate()||(o.markerTemplate=P);var n=C("absoluteDate")(t),r='\n <div\n c8y-map-marker\n i-mo="devices['.concat(e.id,']"\n i-template="markerTemplate()"\n i-tracker="tracker"\n last-updated="\'').concat(n,"'\"\n ></div>\n "),a=angular.element(r);return E(a)(o),a.get(0)}(n,t)})}(e).then(function(e){return function(e,t){var n=e.getPopup(),r=n||L.popup({minWidth:120});e.bindPopup(r,{offset:L.point(0,-20)}),r.setContent(t),n||e.openPopup();return r}(t,e)})}function P(){return"<div ng-include=\"'".concat(z,"'\"></div>")}function S(){var e=o.realtimeChannel,t="/managedobjects/*",n=o.filterIds,r=o.deviceId();if(r&&!n&&(n=[r]),n&&(t="/managedobjects/".concat(n.join(","))),e){if(e===t)return;o.cleanRealtime()}e=t,o.realtimeChannel=e,D.addListener.bind(D,o.$id,e)("UPDATE",function(e,t){var n=O.getLocationFragment(t);if(n){var r=_.find(c,{id:t.id});if(r){r.setLatLng(L.latLng(n.lat,n.lng)),r.setIcon(b(t));var a=r.getPopup();a&&a._isOpen&&k(t,r)}o.devices&&o.devices[t.id]&&(o.devices[t.id]=t),o.map.event.$broadcast("realtime",t)}}),o.cleanRealtime=function(){D.removeSubscriber(o.$id,e)},o.map.state=function(){return D.getStatus(o.$id,e)},o.map.startRt=function(){o.noDataFetch()||(D.start(o.$id,e),o.tracker.state||o.tracker.start())},o.map.stopRt=function(){D.stop(o.$id,e),o.tracker.state&&o.tracker.stop()},_.assign(o,{state:o.map.state,startRt:o.map.startRt,stopRt:o.map.stopRt}),o.realtime()&&(x()||o.startRt())}(function(r,a){var e=R.getBaseLayers(o.map),t=R.getOverlays(o.map),n=w.reject();u.mapCustomBaseLayers&&(n=u.mapCustomBaseLayers.create({google:!0,here:!0,bing:!0,googleSatellite:!0,hereSatellite:!0,bingSatellite:!0}));w.any(_.values(e).concat(n,_.values(t))).then(function(e){_.isEmpty(e)||r.addTo(a)}),_.forEach(e,function(e,t){e.then(function(e){r.addBaseLayer(e,t)})}),n.then(function(e){_.forEach(e,function(e){r.addBaseLayer(e.layer,e.name)})}),R.getUserOverlayPreferences().then(function(n){_.forEach(t,function(e,t){e.then(function(e){r.addOverlay(e,t),n[t]&&a.addLayer(e)})})})})(o.map.layersControl=d,p),p.on("overlayadd",function(e){R.setUserOverlayPreference(e,!0)}),p.on("overlayremove",function(e){R.setUserOverlayPreference(e,!1)}),o.controlButtons()&&p.addControl(new i),o.c8yLegend()&&p.addControl(new m),o.paging={refresh:!0},o.refresh=g,S(),o.$watch("deviceId()",g),o.$watch("noDataFetch()",function(e){e?o.stopRt():x()||o.startRt()})}}function G(e){return _.get(window,"C8Y_APP.".concat(e))}function x(){return!!G("mapWidgetRealtimeDisabled")}function F(){return!!G("mapWidgetHideMaxDeviceOnMapHint")}function t(n,e,r){return{restrict:"EA",scope:{iMo:"&",iTemplate:"&",iTracker:"&",lastUpdated:"="},link:function(t,e){_.assign(t,{mo:t.iMo(),tracker:_.defaults(t.iTracker(),{__gps:!1,__gsm:!1}),onTrackingChange:function(e){t.tracker.__gps||t.tracker.__gsm?t.tracker.activate(e,{gps:t.tracker.__gps,gsm:t.tracker.__gsm}):t.tracker.deactivate(e)}}),t.showTrackingOptions=!1,r.gsmTrackingAvailable(t.mo).then(function(e){t.showTrackingOptions=e}),e.html(t.iTemplate()),n(e.contents())(t)}}}t.$inject=["$compile","c8yApplication","c8yCombain"],e.$inject=["$q","$compile","$filter","$http","$timeout","$injector","c8yInventory","c8yRealtime","c8yBase","c8yGroups","c8yTracker","c8yGeo","c8yApplication","c8yEvents","c8yMapConfig","gettext","gettextCatalog","c8yAlert","MARKER_TEMPLATE"],angular.module("c8y.ui").constant("MARKER_TEMPLATE",":::PLUGIN_PATH:::/ui/views/map2-markerTemplate.html").directive("c8yMapInternal",e).directive("c8yMapMarker",t).directive("c8yMapLegend",function(){return{restrict:"EA",templateUrl:":::PLUGIN_PATH:::/ui/views/map2-legend.html"}})}();
|
|
1
|
+
"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?Object(arguments[e]):{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&r.push.apply(r,Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})),r.forEach(function(e){_defineProperty(t,e,n[e])})}return t}function _defineProperty(e,t,n){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _toPropertyKey(e){var t=_toPrimitive(e,"string");return"symbol"===_typeof(t)?t:String(t)}function _toPrimitive(e,t){if("object"!==_typeof(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0===n)return("string"===t?String:Number)(e);var r=n.call(e,t||"default");if("object"!==_typeof(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}!function(){function e(w,C,E,e,t,n,T,D,j,A,M,O,r,$,R,U,B,I,z){return a.$inject=["$scope","$element"],{restrict:"EA",templateUrl:":::PLUGIN_PATH:::/ui/views/map2.html",scope:{multipleDevices:"&",realtime:"&",cssClass:"@",deviceId:"&",config:"&",markerTemplate:"&",controlButtons:"&",noDataFetch:"&",map:"=?",c8yLegend:"&"},link:function(e){e.$on("dashboard-change",function(){e.map&&e.map.leafletMap&&e.map.leafletMap.invalidateSize()})},controller:a};function a(o,e){var n,t={padding:[50,50]},c=[],s=!1,l=U("The map widget displays up to {{count}} devices."),u={mapCustomBaseLayers:j.getPluginService("mapCustomBaseLayers"),ecbPositionSelector:j.getPluginService("ecbPositionSelector"),mapMarkerClusterer:j.getPluginService("mapMarkerClusterer")};o.map=this,e.addClass(o.cssClass);var p=L.map(e.find(".c8y-map-internal").get(0),{attributionControl:!1}).fitBounds(L.latLngBounds(L.latLng(14,-130.3),L.latLng(53.9,112.3)));if(o.map.leafletMap=p,L.Browser.mobile){var r=U("Use two fingers to move the map.");p.dragging.disable(),p._container.setAttribute("data-touch-warning-content",B.getString(r)),p._container.addEventListener("touchstart",f),p._container.addEventListener("touchmove",f),p._container.addEventListener("touchend",f),p._container.addEventListener("touchcancel",f),p._container.addEventListener("click",f)}o.map.event=o.$new(!0),o.map.markers=c;var a=L.tileLayer("//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{noWrap:!0});a.addTo(p),u.mapMarkerClusterer&&u.mapMarkerClusterer.applyClustering({mapInternalScope:o}),o.map.tracker=new M.Tracker(o),o.tracker=o.map.tracker,o.tracker.onPaths(function(e,t){n&&p.removeLayer(n);(n=e).addTo(p),t&&v(n.getBounds())}),o.$on("$destroy",function(){o.cleanRealtime&&o.cleanRealtime(),s=!0,L.Browser.mobile&&(p._container.removeEventListener("touchstart",f),p._container.removeEventListener("touchmove",f),p._container.removeEventListener("touchend",f),p._container.removeEventListener("touchcancel",f),p._container.removeEventListener("click",f))});var i=L.Control.extend({options:{position:"topright"},onAdd:function(){var e=L.DomUtil.create("div");return angular.element(e).html('\n <c8y-realtime-switch\n ng-if="!realtime()"\n get-state="state()"\n on-start="startRt()"\n on-stop="stopRt()"\n ></c8y-realtime-switch>\n <c8y-refresh-btn></c8y-refresh-btn>\n '),C(e)(o),e}}),m=L.Control.extend({options:{position:"bottomright"},onAdd:function(){var e=L.DomUtil.create("div");return angular.element(e).html("<div c8y-map-legend></div>"),C(e)(o),e}}),d=L.control.layers({OSM:a});function f(e){for(var t=["leaflet-control-minimap","leaflet-interactive","leaflet-popup-content","leaflet-popup-content-wrapper","leaflet-popup-close-button","leaflet-control-zoom-in","leaflet-control-zoom-out"],n=!1,r=0;r<t.length;r++)L.DomUtil.hasClass(e.target,t[r])&&(n=!0);n?L.DomUtil.hasClass(e.target,"leaflet-interactive")&&"touchmove"===e.type&&1===e.touches.length?(L.DomUtil.addClass(p._container,"touch-warning"),p.dragging.disable()):L.DomUtil.removeClass(p._container,"touch-warning"):"touchmove"===e.type||"touchstart"===e.type?1===e.touches.length?(L.DomUtil.addClass(p._container,"touch-warning"),p.dragging.disable()):(p.dragging.enable(),L.DomUtil.removeClass(p._container,"touch-warning")):L.DomUtil.removeClass(p._container,"touch-warning")}function g(){var e=o.deviceId();return(e?function(n){var e;if(_.isArray(n))e=y(n);else{var r=[];e=T.detail(n).then(j.getResData).then(function(e){r.push(e);var t=w.when([]);return o.multipleDevices()&&(t=w.all([T.childDevices(n),T.childAssets(n)]).then(_.flattenDeep)),t}).then(function(e){r=_.union(r,e);var t=_(r).filter(function(e){return!A.isGroup(e)}).map("id").value();return _.isEmpty(t)?(h(),w.when(new L.featureGroup)):y(t)})}return e}(e):y()).then(function(e){o.tracker.getActiveDeviceIds().length||v(e.getBounds())})}function v(e){e&&e.isValid()&&p.fitBounds(e,t)}function h(){o.devices=[],_.forEach(c,function(e){p.removeLayer(e)}),c.length=0}function y(n){var e,i={};if(o.noDataFetch())return w.reject();if(delete o.filterIds,u.ecbPositionSelector)e=u.ecbPositionSelector.getPositionedDevicesByEvents();else if(n&&n.length){var t=_.uniq(n);e=function t(e){var n=j.PAGESIZE;var r=_.take(e,n);var a=_.drop(e,n);return T.list({ids:r.join(","),pageSize:n}).then(function(e){return a.length&&(e.paging.next=function(){return t(a)}),e})}(o.filterIds=t),S()}else{var r={__or:[{__and:[{__has:"".concat(O.c8y_Position,".lat")},{__has:"".concat(O.c8y_Position,".lng")}]},{__and:[{__has:"".concat(O.v4e_Position,".lat")},{__has:"".concat(O.v4e_Position,".lng")}]}]};e=T.listQuery(r,{pageSize:function(){var e=G("mapWidgetPageSize");return!e||_.isNaN(e)?100:e}()}),S()}return function t(e){var r,a;return e.then(function(e){var t=e.statistics,n=e.paging;return r=n.next,a=t.pageSize,e}).then(function(e){return _(e).filter(function(e){var t=O.getLocationFragment(e);return!(!t||180<Math.abs(t.lng)||90<Math.abs(t.lat))||(console.warn("Device ".concat(e.name," has an invalid position!")),!1)}).reduce(function(e,t){return e[t.id]=t,e},{})}).then(function(e){return i=function(e,t,n){var r=_objectSpread({},e),a=Object.keys(r).length;if(a+Object.keys(t).length<=n)r=_objectSpread({},r,t);else{F()||I.info(B.getString(l,{count:n}));var i=Object.entries(t).filter(function(e,t){return void 0!==e&&t+a<n}).reduce(function(e,t){return e[t[0]]=t[1],e},{});r=_objectSpread({},r,i)}return r}(i,e,a),Object.keys(i).length<a&&r&&!s&&t(r()),Object.keys(i).length>=a&&r&&!F()&&I.info(B.getString(l,{count:a})),i}).then(function(e){h(),o.devices=e,_.forEach(e,function(e){var t=b(e),n=O.getLocationFragment(e),r=L.marker(L.latLng(n.lat,n.lng),{icon:t});r.on("click",function(){r.isPopupOpen()&&r.getPopup()||k(e,r)}),r.id=e.id,c.push(r)});var t=new L.featureGroup(c);return t.addTo(p),t}).then(function(e){return o.map.event.$broadcast("refresh",n),e}).then(function(e){o.tracker.getActiveDeviceIds().length||v(e.getBounds())})}(e)}function b(e){var t=e.c8y_ActiveAlarmsStatus||{},n=_.find(["critical","major","minor","warning"],function(e){return t[e]})||"normal";return L.divIcon({className:"".concat(n,"-marker-icon"),iconSize:[25,41],iconAnchor:[12.5,41]})}function k(e,t){return function(n){var e={fragmentType:"c8y_Position",dateFrom:"1970-01-01",dateTo:moment().add(1,"days").format("YYYY-MM-DD"),pageSize:1,source:n.id};return $.list(e).then(function(e){var t=e.length?e[0].time:void 0;return function(e,t){o.markerTemplate()||(o.markerTemplate=P);var n=E("absoluteDate")(t),r='\n <div\n c8y-map-marker\n i-mo="devices['.concat(e.id,']"\n i-template="markerTemplate()"\n i-tracker="tracker"\n last-updated="\'').concat(n,"'\"\n ></div>\n "),a=angular.element(r);return C(a)(o),a.get(0)}(n,t)})}(e).then(function(e){return function(e,t){var n=e.getPopup(),r=n||L.popup({minWidth:120});e.bindPopup(r,{offset:L.point(0,-20)}),r.setContent(t),n||e.openPopup();return r}(t,e)})}function P(){return"<div ng-include=\"'".concat(z,"'\"></div>")}function S(){var e=o.realtimeChannel,t="/managedobjects/*",n=o.filterIds,r=o.deviceId();if(r&&!n&&(n=[r]),n&&(t="/managedobjects/".concat(n.join(","))),e){if(e===t)return;o.cleanRealtime()}e=t,o.realtimeChannel=e,D.addListener.bind(D,o.$id,e)("UPDATE",function(e,t){var n=O.getLocationFragment(t);if(n){var r=_.find(c,{id:t.id});if(r){r.setLatLng(L.latLng(n.lat,n.lng)),r.setIcon(b(t));var a=r.getPopup();a&&a._isOpen&&k(t,r)}o.devices&&o.devices[t.id]&&(o.devices[t.id]=t),o.map.event.$broadcast("realtime",t)}}),o.cleanRealtime=function(){D.removeSubscriber(o.$id,e)},o.map.state=function(){return D.getStatus(o.$id,e)},o.map.startRt=function(){o.noDataFetch()||(D.start(o.$id,e),o.tracker.state||o.tracker.start())},o.map.stopRt=function(){D.stop(o.$id,e),o.tracker.state&&o.tracker.stop()},_.assign(o,{state:o.map.state,startRt:o.map.startRt,stopRt:o.map.stopRt}),o.realtime()&&(x()||o.startRt())}(function(r,a){var e=R.getBaseLayers(o.map),t=R.getOverlays(o.map),n=w.reject();u.mapCustomBaseLayers&&(n=u.mapCustomBaseLayers.create({google:!0,here:!0,bing:!0,googleSatellite:!0,hereSatellite:!0,bingSatellite:!0}));w.any(_.values(e).concat(n,_.values(t))).then(function(e){_.isEmpty(e)||r.addTo(a)}),_.forEach(e,function(e,t){e.then(function(e){r.addBaseLayer(e,t)})}),n.then(function(e){_.forEach(e,function(e){r.addBaseLayer(e.layer,e.name)})}),R.getUserOverlayPreferences().then(function(n){_.forEach(t,function(e,t){e.then(function(e){r.addOverlay(e,t),n[t]&&a.addLayer(e)})})})})(o.map.layersControl=d,p),p.on("overlayadd",function(e){R.setUserOverlayPreference(e,!0)}),p.on("overlayremove",function(e){R.setUserOverlayPreference(e,!1)}),o.controlButtons()&&p.addControl(new i),o.c8yLegend()&&p.addControl(new m),o.paging={refresh:!0},o.refresh=g,S(),o.$watch("deviceId()",g),o.$watch("noDataFetch()",function(e){e?o.stopRt():x()||o.startRt()})}}function G(e){return _.get(window,"C8Y_APP.".concat(e))}function x(){return!!G("mapWidgetRealtimeDisabled")}function F(){return!!G("mapWidgetHideMaxDeviceOnMapHint")}function t(n,e,r){return{restrict:"EA",scope:{iMo:"&",iTemplate:"&",iTracker:"&",lastUpdated:"="},link:function(t,e){_.assign(t,{mo:t.iMo(),tracker:_.defaults(t.iTracker(),{__gps:!1,__gsm:!1}),onTrackingChange:function(e){t.tracker.__gps||t.tracker.__gsm?t.tracker.activate(e,{gps:t.tracker.__gps,gsm:t.tracker.__gsm}):t.tracker.deactivate(e)}}),t.showTrackingOptions=!1,r.gsmTrackingAvailable(t.mo).then(function(e){t.showTrackingOptions=e}),e.html(t.iTemplate()),n(e.contents())(t)}}}t.$inject=["$compile","c8yApplication","c8yCombain"],e.$inject=["$q","$compile","$filter","$http","$timeout","$injector","c8yInventory","c8yRealtime","c8yBase","c8yGroups","c8yTracker","c8yGeo","c8yApplication","c8yEvents","c8yMapConfig","gettext","gettextCatalog","c8yAlert","MARKER_TEMPLATE"],angular.module("c8y.ui").constant("MARKER_TEMPLATE",":::PLUGIN_PATH:::/ui/views/map2-markerTemplate.html").directive("c8yMapInternal",e).directive("c8yMapMarker",t).directive("c8yMapLegend",function(){return{restrict:"EA",templateUrl:":::PLUGIN_PATH:::/ui/views/map2-legend.html"}})}();
|