@c8y/ng1-modules 1017.0.525 → 1017.0.526
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(){function i(
|
|
1
|
+
"use strict";!function(){function i(e,i,n,a,o){e.onRealtimeAlarmFn=function(i){e.onAlarm=i},e.onRealtimeEventFn=function(i){e.onEvent=i};var t,c=200;function l(){if(e.child&&e.child.config){var i=e.child.config,n=i.interval,t=i.realtime;n&&(n!==a.custom.id||t)&&(n===a.custom.id&&t?function(){var i=new Date(e.child.config.dateFrom),n=new Date(e.child.config.dateTo)-i,t=moment();e.child.config.dateTo=t.toDate(),e.child.config.dateFrom=t.subtract(n,"milliseconds").toDate()}():function(n){var i=_.find(a.intervals,function(i){return i.id===n})||{};i.qty&&(e.child.config.dateFrom=moment().subtract(i.qty,i.unit).toDate(),e.child.config.dateTo=moment().toDate())}(n))}}function d(){var i=n.height();_.isUndefined(_.get(t,"height"))||(i-=t.height),e.dataPointsGraphHeight=_.max([c,i])}function r(){i(function(){e.$broadcast("dashboardResize")},500)}function f(i,n){e.alarmsEventsTimeline=e.alarmsEventsTimeline||{},e.alarmsEventsTimeline.displayedDateFrom=i,e.alarmsEventsTimeline.displayedDateTo=n}function h(i){return _(i).map(function(i){return i.__target.id}).uniq().value().join(",")}e.onUpdateDates=function(i,n,t){if(!1===e.child.config.updateDates)return;e.child.config.dateFrom=i,e.viewRealtime&&t===o.onDragEnd&&(e.viewRealtime=!1);e.child.config.dateTo=n},e.onUpdateDisplayedDates=f,e.onBoxChanged=function(i){e.chartBox=i},e.onTimelinesChartSizeChanged=function(i){t=i,d(),r()},e.dataPointsGraphHeight=n.height(),e.viewRealtime=e.child&&e.child.config&&e.child.config.realtime,e.onRealtimeToggle=function(){e.viewRealtime=!e.viewRealtime},(e.recalculate=l)(),e.$watch("child.config.datapoints",function(i){var n=h(i);e.channel=n?"/measurements/".concat(n):""}),e.$watch("child.config.alarmsEventsConfigs",function(i){var n=h(i);e.alarmsChannel=n?"/alarms/".concat(n):"",e.eventsChannel=n?"/events/".concat(n):""}),e.$watchCollection(["child.config.dateFrom","child.config.dateTo"],function(){f(e.child.config.dateFrom,e.child.config.dateTo)}),e.$watch("child.config.realtime",function(){e.viewRealtime=e.child&&e.child.config&&e.child.config.realtime}),e.$on("dashboardResize",function(i){i.targetScope!==e&&(d(),r())})}i.$inject=["$scope","$timeout","$element","INTERVAL_CONSTANTS","X_AXIS_CONSTANTS"],angular.module("c8y.cockpit.dataPointExplorer").controller("DataPointWidgetCtrl",i)}();
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
aggregation="child.config.aggregation"
|
|
44
44
|
show-time="child.config.displayDateSelection"
|
|
45
45
|
on-data="onData"
|
|
46
|
-
on-update-dates="onUpdateDates($dateFrom, $dateTo)"
|
|
46
|
+
on-update-dates="onUpdateDates($dateFrom, $dateTo, $updateTrigger)"
|
|
47
47
|
on-update-displayed-dates="onUpdateDisplayedDates($dateFrom, $dateTo)"
|
|
48
48
|
on-realtime-toggle="onRealtimeToggle()"
|
|
49
49
|
on-box-changed="onBoxChanged(box)"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";!function(){function t(e,c,t){var r=t.getD3Locales().timeFormat.multi([[".%L",function(t){return t.getMilliseconds()}],[":%S",function(t){return t.getSeconds()}],["%H:%M",function(t){return t.getMinutes()}],["%H:%M",function(t){return t.getHours()}],["%a %d",function(t){return t.getDay()&&1!==t.getDate()}],["%b %d",function(t){return 1!==t.getDate()}],["%B",function(t){return t.getMonth()}],["%Y",function(){return!0}]]);function
|
|
1
|
+
"use strict";!function(){function t(e,c,t,n){var r=t.getD3Locales().timeFormat.multi([[".%L",function(t){return t.getMilliseconds()}],[":%S",function(t){return t.getSeconds()}],["%H:%M",function(t){return t.getMinutes()}],["%H:%M",function(t){return t.getHours()}],["%a %d",function(t){return t.getDay()&&1!==t.getDate()}],["%b %d",function(t){return 1!==t.getDate()}],["%B",function(t){return t.getMonth()}],["%Y",function(){return!0}]]);function a(t){(this.chart=t).addItem(this)}return a.prototype={scale:function(){var t=this,e=t.chart.box();return d3.time.scale().domain([t._from,t._to]).range([e.rangeMin,e.rangeMax])},axis:function(){return d3.svg.axis().scale(this.scale()).orient("bottom").ticks(6).tickFormat(r)},canRender:function(){return!(!this._from||!this._to)},updateDates:function(t,e,n){var r=this,a=moment(t).milliseconds(0),o=moment(e).milliseconds(0);a.isSame(r._from)&&o.isSame(r._to)||(r._from=a.toDate(),r._to=o.toDate(),n&&r.onUpdateDates&&r.onUpdateDates(r._from,r._to),r._xDragStart||r.chart.render())},getDebouncePreference:function(){var t=this,e=moment(t._to).diff(moment(t._from),"seconds");return t.debounceTime!==e?{debounceTime:(t.debounceTime=e)||200,reset:!0}:{debounceTime:e||200,reset:!1}},render:function(){var t=this,e=t.axis(),n=t.el,r=t.chart.box(),a=t.chart.margins,o=r.height-a.b;if(!n){var s=t.chart.svg;t.el=s.append("g").attr({class:"xaxis axis",transform:c.translate(a.l,o)}).style({"pointer-events":"all",cursor:"ew-resize"}),(n=t.el).boxHover=n.append("rect").attr({class:"recthover",height:19,fill:"rgba(255,255,255,0.01)",transform:c.translate(a.l,0)}),t.drag=d3.behavior.drag();var i=t.drag;n.call(i),n.boxHover.call(i),t.addEvents()}n.boxHover.attr("width",function(){return t.chart.box().axisXwidth}),t.canRender()&&n.call(e).attr({transform:c.translate(a.l,o)})},onMouseDown:function(){var e=this;return function(){d3.event.sourceEvent.stopPropagation(),e._scale=e.scale();var t=e._scale;e._xDragStart=t.invert(d3.mouse(e.el.node())[0]),e.__from=e._from,e.__to=e._to,e.el.select("path").style("stroke","#CCC")}},onDragEnd:function(){var t=this;return function(){d3.event.sourceEvent.stopPropagation(),_.isUndefined(t._xDragStart)||(t.chart.render(),t.el.select("path").style("stroke",""),t.onUpdateDates&&(t.onUpdateDates(t._from,t._to,n.onDragEnd),e.$apply())),delete t._xDragStart}},updateScaleOnDrag:function(t){var e=this,n=e._scale,r=moment(n.invert(t)).diff(e._xDragStart);e.updateDates(moment(e.__from).subtract(r,"ms"),moment(e.__to).subtract(r,"ms")),e.render()},onDrag:function(){var e=this;return function(){d3.event.sourceEvent.stopPropagation();var t=e.el.node();_.isUndefined(e._xDragStart)||e.updateScaleOnDrag(d3.mouse(t)[0])}},addEvents:function(){this.drag.on("dragstart",this.onMouseDown()).on("drag",this.onDrag()).on("dragend",this.onDragEnd())}},a}t.$inject=["$rootScope","c8yChartCommon","c8yLocales","X_AXIS_CONSTANTS"],angular.module("c8y.core.measurements2").factory("c8yAxisX",t).constant("X_AXIS_CONSTANTS",{onDragEnd:"onDragEnd"})}();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";!function(){function t(o,t,a,n,e){var i,l,s,c,
|
|
1
|
+
"use strict";!function(){function t(o,t,a,n,e){var i,l,s,r,c,u,d=_.debounce(p,300,{leading:!1,trailing:!0}),m=12e4,f=!1,D=e("Realtime is active. Deactivate it to edit date and time.");function p(){l&&s.dateFrom&&s.dateTo&&(f=!0,l.loadData(s.dateFrom,s.dateTo,o.aggregation).then(h).finally(function(){f=!1,o.onDataChange({chart:l})}))}function g(t){l.realtimeMeasurement(t)&&($(),h(),o.selectable()&&(v(i),o.selected&&l.setSelectPoint(o.selected)))}function h(){i=moment()}function $(){!f&&moment().diff(i)>m&&p()}function v(t,e){var a=e||{},n=moment(t),o=moment.duration(moment(s.dateTo).diff(s.dateFrom)),i=moment(n).subtract(o);s.dateFrom=i.toDate(),s.dateTo=n.toDate();var r=s,c=r.dateFrom,d=r.dateTo;a.notrigger&&(u=!0),l.axisX.updateDates(c,d,!1),a.loadData&&p()}var T={dateFrom:!1,dateTo:!1,aggregation:!1,datapoints:!1};function w(t){t&&(T[t]=!0),_.every(T,function(t){return!0===t})&&d()}function F(){$(),moment(l.axisX._to).isBefore(moment())&&!l.allowSelectFocusTime&&v(moment(),{notrigger:1})}function S(){return _.map(o.datapoints,function(t,e){return{id:e,name:t.label,datapoint:t,datapointActive:t.__active}})}function b(t){o.seriesSelected=t;var e=_.map(o.seriesSelected,"datapoint");l.updateSeries(e,!0)}t.$on("c8yRealtime::connected",function(){p()}),this.init=function(t){l=t,o.chart=l,s={},o.internalDates=s,c=n(F),l.axisX.onUpdateDates=function(t,e,a){r=a,s.dateFrom=t,s.dateTo=e},o.$watch("dateFrom",function(t){moment(o.internalDates.dateFrom).isSame(t)||(o.internalDates.dateFrom=new Date(t),l.axisX.updateDates(t,o.dateTo,!1),w("dateFrom"))}),o.$watch("dateTo",function(t){moment(o.internalDates.dateTo).isSame(t)||(o.internalDates.dateTo=new Date(t),l.axisX.updateDates(o.dateFrom,t,!1),w("dateTo"))}),o.$watch("internalDates",function(t,e){var a=t.dateFrom&&moment(t.dateFrom).toDate(),n=t.dateTo&&moment(t.dateTo).toDate();o.datesValid=a&&n&&a<=n,o.datesValid&&(o.onUpdateDisplayedDates&&o.onUpdateDisplayedDates({$dateFrom:a,$dateTo:n}),u?u=!1:t!==e&&o.onUpdateDates&&(o.onUpdateDates({$dateFrom:a,$dateTo:n,$updateTrigger:r}),r=null,l.axisX.updateDates(a,n,!1),o.realtime?new Date(e.dateTo).valueOf()-new Date(e.dateFrom).valueOf()!=n.valueOf()-a.valueOf()&&d():d()))},!0),o.$watch("aggregation",function(){return w("aggregation")}),o.$watch("datapoints",function(){o.seriesAvailable=S(),o.seriesSelected?b(_.filter(o.seriesAvailable,"datapointActive")):b(function(){var t=_.filter(S(),"datapointActive"),e=o.datapointsInitialDisplayLimit;return _.isUndefined(e)?t:_.take(t,e)}())},!0),o.$watchCollection("datapoints",function(){return w("datapoints")}),o.$watch("realtime",function(t){t&&!o.selectable()?(v(moment(),{notrigger:1,loadData:1}),c.start()):c.cancel()}),o.$watch("selected",function(t){t?l.setSelectPoint(t):l.clearSelectPoint()}),l.onSelectPoint=function(t){a(function(){o.selected=t})},o.$watch(function(){return o.selectable()},function(t){(l.allowSelectFocusTime=t)&&c.cancel()}),o.$watch("chart.chartBox",function(t,e){_.isEqual(t,e)||o.onBoxChanged({box:t})});var e=_.throttle(l.render.bind(l),500);o.$on("dashboardResize",function(){return e()}),o.$watch("showTime()",function(t){t?l.showDateSelection():l.hideDateSelection()}),o.onData=g,o.$on("$destroy",function(){return c.cancel()}),o.onSeriesSelectionChanged=b},o.data={},o.realtimeActiveInfo=D}t.$inject=["$scope","$rootScope","$timeout","RTAutoMove","gettext"],angular.module("c8y.core.measurements2").controller("c8yChartCtrl",t)}();
|