@c8y/ng1-modules 1018.0.164 → 1018.0.172

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 _toConsumableArray(t){return _arrayWithoutHoles(t)||_iterableToArray(t)||_unsupportedIterableToArray(t)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(t,a){if(t){if("string"==typeof t)return _arrayLikeToArray(t,a);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?_arrayLikeToArray(t,a):void 0}}function _iterableToArray(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}function _arrayLikeToArray(t,a){(null==a||a>t.length)&&(a=t.length);for(var e=0,n=new Array(a);e<a;e++)n[e]=t[e];return n}!function(){function t(o,t,n,a,e,r,i,d,c,s,l,u,f,m){var g,p;function h(t,a){var e;t&&a&&(o.data.datapoints.length=0,(e=o.data.datapoints).push.apply(e,_toConsumableArray(t)));o.data.graphDataPoints=t;var n=v(_.filter(t,"__active"));o.channel=n?"/measurements/".concat(n):""}function y(t){o.data.graphAlarmsEventsConfigs=t;var a=v(_.filter(t,"__active"));o.alarmsChannel=a?"/alarms/".concat(a):"",o.eventsChannel=a?"/events/".concat(a):""}function v(t){return _(t).map(function(t){return t.__target.id}).uniq().value().join(",")}function A(){var t=a.getContext();t.context&&(g="".concat(t.context,"_").concat(t.id)),function(){if(o.disableLocalStorage)return;var a=_.throttle(function(t,a){t!==a&&function(){if(!o.dontSave&&!o.disableLocalStorage){var t=_.pick(o.data,["dateFrom","dateTo","interval","aggregation","realtime","alarmsEventsConfigs"]);r.setSavedFilters(t,g)}}()},500,{leading:!1,trailing:!0});r.getSavedFilters(g).then(function(t){_.assign(o.data,t),o.$watch("data.realtime",a),o.$watch("data.dateFrom",a),o.$watch("data.dateTo",a),o.$watch("data.interval",a),o.$watch("data.aggregation",a),o.$watch("data.alarmsEventsConfigs",a,!0)})}()}function b(){var t,a=b._hasDashboard,e=a;if(_.isUndefined(a))try{2===(t=n.get("dashboardSvc")).VERSION&&(e=t)}catch(t){e=!1}return b._hasDashboard=e}function T(t){var a=b();a&&a[t]({name:"Data points graph",title:l.getString("Data points"),_width:12,_height:5,config:{datapoints:o.data.graphDataPoints,alarmsEventsConfigs:o.data.graphAlarmsEventsConfigs,dateTo:o.data.dateTo,dateFrom:o.data.dateFrom,aggregation:o.data.aggregation,realtime:o.data.realtime}}).then(S)}function S(){d.success(s("Widget created."))}function D(){T("addWidgetToSelectedDashboardInContext")}function w(){T("addWidgetToSelectedReport")}function F(t){o.chartBox=t}function C(){o.$watch("data.datapoints",function(){r.saveLocal(o.data.datapoints,g)},!0)}o.onRealtimeAlarmFn=function(t){o.onAlarm=t},o.onRealtimeEventFn=function(t){o.onEvent=t},!a.getContext().context&&t.path().match(/datapoint/)&&e.changeTitle({title:s("Data explorer")}),A(),p={text:s(g?"Send as widget to dashboard":"Send as widget to report"),action:g?D:w},b()&&!o.noActions&&i.addAction(p),_.get(o,"data.datapoints.length")||r.listLocal(g).then(function(t){t&&t.length&&h(t,!0)}).then(C),o.noActions||function(){function t(t,a){i.addAction({text:t,action:function(){var t={dateFrom:moment(o.data.dateFrom).format(c.dateFullFormat),dateTo:moment(o.data.dateTo).format(c.dateFullFormat)};f.downloadReportForDatapoints(a,o.data.graphDataPoints,t).catch(function(t){t&&t.message&&d.warning(t.message)})}})}t(s("Download as CSV"),u.format.csv),t(s("Download as Excel"),u.format.xlsx)}(),$(window).resize(function(){o.$broadcast("dashboardResize"),o.$apply()}),o.onBoxChanged=F,o.onUpdateDates=function(t,a){o.data.dateFrom=t;var e=moment().diff(moment(a),"seconds")<10;o.data.realtime&&!e&&(o.data.realtime=!1),o.data.dateTo=a},o.onUpdateDisplayedDates=function(t,a){o.data.displayedDateFrom=t,o.data.displayedDateTo=a},o.savedFilter={config:{},datapoints:[]},o.data=o.data||_.cloneDeep(o.savedFilter),function(){var a=o.data.interval;if(a&&"custom"!==a){var t=_.find(m.intervals,function(t){return t.id===a})||{};t.qty&&(o.data.dateFrom=moment().subtract(t.qty,t.unit).toDate(),o.data.dateTo=moment().toDate())}}(),o.$watch("data.datapoints",function(){return h(o.data.datapoints)},!0),o.$watch("data.alarmsEventsConfigs",y,!0)}t.$inject=["$scope","$location","$injector","c8yUiUtil","c8yTitle","c8yDataPointSvc","c8yActions","c8yAlert","c8yBase","gettext","gettextCatalog","c8yMeasurements","MeasurementsReportSvc","INTERVAL_CONSTANTS"],angular.module("c8y.cockpit.dataPointExplorer").controller("c8yDataPointExplorerCtrl",t)}();
1
+ "use strict";function _toConsumableArray(t){return _arrayWithoutHoles(t)||_iterableToArray(t)||_unsupportedIterableToArray(t)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(t,a){if(t){if("string"==typeof t)return _arrayLikeToArray(t,a);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?_arrayLikeToArray(t,a):void 0}}function _iterableToArray(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}function _arrayWithoutHoles(t){if(Array.isArray(t))return _arrayLikeToArray(t)}function _arrayLikeToArray(t,a){(null==a||a>t.length)&&(a=t.length);for(var e=0,n=new Array(a);e<a;e++)n[e]=t[e];return n}!function(){function t(o,t,n,a,e,r,i,d,c,s,l,u,f,m){var g,p;function h(t,a){var e;t&&a&&(o.data.datapoints.length=0,(e=o.data.datapoints).push.apply(e,_toConsumableArray(t)));o.data.graphDataPoints=t;var n=v(_.filter(t,"__active"));o.channel=n?"/measurements/".concat(n):""}function y(t){o.data.graphAlarmsEventsConfigs=t;var a=v(_.filter(t,"__active"));o.alarmsChannel=a?"/alarms/".concat(a):"",o.eventsChannel=a?"/events/".concat(a):""}function v(t){return _(t).map(function(t){return t.__target.id}).uniq().value().join(",")}function A(){var t=a.getContext();t.context&&(g="".concat(t.context,"_").concat(t.id)),function(){if(o.disableLocalStorage)return;var a=_.throttle(function(t,a){t!==a&&function(){if(!o.dontSave&&!o.disableLocalStorage){var t=_.pick(o.data,["dateFrom","dateTo","interval","aggregation","realtime","alarmsEventsConfigs"]);r.setSavedFilters(t,g)}}()},500,{leading:!1,trailing:!0});r.getSavedFilters(g).then(function(t){_.assign(o.data,t),o.$watch("data.realtime",a),o.$watch("data.dateFrom",a),o.$watch("data.dateTo",a),o.$watch("data.interval",a),o.$watch("data.aggregation",a),o.$watch("data.alarmsEventsConfigs",a,!0)})}()}function b(){var t,a=b._hasDashboard,e=a;if(_.isUndefined(a))try{2===(t=n.get("dashboardSvc")).VERSION&&(e=t)}catch(t){e=!1}return b._hasDashboard=e}function T(t){var a=b();a&&a[t]({name:"Data points graph",title:l.getString("Data points"),_width:12,_height:5,config:{datapoints:o.data.graphDataPoints,alarmsEventsConfigs:o.data.graphAlarmsEventsConfigs,dateTo:o.data.dateTo,dateFrom:o.data.dateFrom,aggregation:o.data.aggregation,realtime:o.data.realtime}}).then(S)}function S(){d.success(s("Widget created."))}function D(){T("addWidgetToSelectedDashboardInContext")}function w(){T("addWidgetToSelectedReport")}function F(t){o.chartBox=t}function C(){o.$watch("data.datapoints",function(){r.saveLocal(o.data.datapoints,g)},!0)}o.onRealtimeAlarmFn=function(t){o.onAlarm=t},o.onRealtimeEventFn=function(t){o.onEvent=t},!a.getContext().context&&t.path().match(/datapoint/)&&e.changeTitle({title:s("Data explorer")}),A(),p={text:s(g?"Send as widget to dashboard":"Send as widget to report"),action:g?D:w},b()&&!o.noActions&&i.addAction(p),_.get(o,"data.datapoints.length")||r.listLocal(g).then(function(t){t&&t.length&&h(t,!0)}).then(C),o.noActions||function(){function t(t,a){i.addAction({text:t,action:function(){var t={dateFrom:moment(o.data.dateFrom).format(c.dateFullFormat),dateTo:moment(o.data.dateTo).format(c.dateFullFormat)};f.downloadReportForDatapoints(a,o.data.graphDataPoints,t).catch(function(t){t&&t.message&&d.warning(t.message)})}})}t(s("Download as CSV"),u.format.csv),t(s("Download as Excel"),u.format.xlsx)}(),$(window).resize(function(){o.$broadcast("dashboardResize"),o.$apply()}),o.onBoxChanged=F,o.onUpdateDates=function(t,a){o.data.dateFrom=t;var e=moment().diff(moment(a),"seconds")<5;o.data.realtime&&!e&&(o.data.realtime=!1),o.data.dateTo=a},o.onUpdateDisplayedDates=function(t,a){o.data.displayedDateFrom=t,o.data.displayedDateTo=a},o.savedFilter={config:{},datapoints:[]},o.data=o.data||_.cloneDeep(o.savedFilter),function(){var a=o.data.interval;if(a&&"custom"!==a){var t=_.find(m.intervals,function(t){return t.id===a})||{};t.qty&&(o.data.dateFrom=moment().subtract(t.qty,t.unit).toDate(),o.data.dateTo=moment().toDate())}}(),o.$watch("data.datapoints",function(){return h(o.data.datapoints)},!0),o.$watch("data.alarmsEventsConfigs",y,!0)}t.$inject=["$scope","$location","$injector","c8yUiUtil","c8yTitle","c8yDataPointSvc","c8yActions","c8yAlert","c8yBase","gettext","gettextCatalog","c8yMeasurements","MeasurementsReportSvc","INTERVAL_CONSTANTS"],angular.module("c8y.cockpit.dataPointExplorer").controller("c8yDataPointExplorerCtrl",t)}();
@@ -1 +1 @@
1
- "use strict";!function(){function n(e,n,t,a){e.onRealtimeAlarmFn=function(n){e.onAlarm=n},e.onRealtimeEventFn=function(n){e.onEvent=n};var i,o=200;function c(n,t){!1!==e.child.config.updateDates&&(e.child.config.dateFrom=n,e.child.config.dateTo=t)}function d(){if(e.child&&e.child.config){var n=e.child.config,t=n.interval,i=n.realtime;t&&(t!==a.custom.id||i)&&(t===a.custom.id&&i?function(){var n=new Date(e.child.config.dateFrom),t=new Date(e.child.config.dateTo)-n,i=moment();e.child.config.dateTo=i.toDate(),e.child.config.dateFrom=i.subtract(t,"milliseconds").toDate()}():function(t){var n=_.find(a.intervals,function(n){return n.id===t})||{};n.qty&&(e.child.config.dateFrom=moment().subtract(n.qty,n.unit).toDate(),e.child.config.dateTo=moment().toDate())}(t))}}function l(){var n=t.height();_.isUndefined(_.get(i,"height"))||(n-=i.height),e.dataPointsGraphHeight=_.max([o,n])}function r(){n(function(){e.$broadcast("dashboardResize")},500)}function f(n,t){e.alarmsEventsTimeline=e.alarmsEventsTimeline||{},e.alarmsEventsTimeline.displayedDateFrom=n,e.alarmsEventsTimeline.displayedDateTo=t}function h(n){return _(n).map(function(n){return n.__target.id}).uniq().value().join(",")}e.onUpdateDates=c,e.onUpdateDisplayedDates=f,e.onBoxChanged=function(n){e.chartBox=n},e.onTimelinesChartSizeChanged=function(n){i=n,l(),r()},e.dataPointsGraphHeight=t.height(),(e.recalculate=d)(),e.$watch("child.config.datapoints",function(n){var t=h(n);e.channel=t?"/measurements/".concat(t):""}),e.$watch("child.config.alarmsEventsConfigs",function(n){var t=h(n);e.alarmsChannel=t?"/alarms/".concat(t):"",e.eventsChannel=t?"/events/".concat(t):""}),e.$watchCollection(["child.config.dateFrom","child.config.dateTo"],function(){f(e.child.config.dateFrom,e.child.config.dateTo)}),e.$watch("child.config.date",function(){e.child.config.widgetInstanceGlobalTimeContext&&c(new Date(e.child.config.date[0]),new Date(e.child.config.date[1]))}),e.$on("dashboardResize",function(n){n.targetScope!==e&&(l(),r())})}n.$inject=["$scope","$timeout","$element","INTERVAL_CONSTANTS"],angular.module("c8y.cockpit.dataPointExplorer").controller("DataPointWidgetCtrl",n)}();
1
+ "use strict";!function(){function i(n,i,t,a){n.onRealtimeAlarmFn=function(i){n.onAlarm=i},n.onRealtimeEventFn=function(i){n.onEvent=i};var e,o=200;function c(i,t){if(!1!==n.child.config.updateDates){n.child.config.dateFrom=i;var e=moment().diff(moment(t),"seconds")<5;n.child.config.widgetInstanceGlobalTimeContext||!n.viewRealtime||e||(n.viewRealtime=!1),n.child.config.dateTo=t}}function l(){if(n.child&&n.child.config){var i=n.child.config,t=i.interval,e=i.realtime;t&&(t!==a.custom.id||e)&&(t===a.custom.id&&e?function(){var i=new Date(n.child.config.dateFrom),t=new Date(n.child.config.dateTo)-i,e=moment();n.child.config.dateTo=e.toDate(),n.child.config.dateFrom=e.subtract(t,"milliseconds").toDate()}():function(t){var i=_.find(a.intervals,function(i){return i.id===t})||{};i.qty&&(n.child.config.dateFrom=moment().subtract(i.qty,i.unit).toDate(),n.child.config.dateTo=moment().toDate())}(t))}}function d(){var i=t.height();_.isUndefined(_.get(e,"height"))||(i-=e.height),n.dataPointsGraphHeight=_.max([o,i])}function f(){i(function(){n.$broadcast("dashboardResize")},500)}function h(i,t){n.alarmsEventsTimeline=n.alarmsEventsTimeline||{},n.alarmsEventsTimeline.displayedDateFrom=i,n.alarmsEventsTimeline.displayedDateTo=t}function m(i){return _(i).map(function(i){return i.__target.id}).uniq().value().join(",")}n.onUpdateDates=c,n.onUpdateDisplayedDates=h,n.onBoxChanged=function(i){n.chartBox=i},n.onTimelinesChartSizeChanged=function(i){e=i,d(),f()},n.dataPointsGraphHeight=t.height(),n.viewRealtime=n.child&&n.child.config&&n.child.config.realtime,n.onRealtimeToggle=function(){n.viewRealtime=!n.viewRealtime},(n.recalculate=l)(),n.$watch("child.config.datapoints",function(i){var t=m(i);n.channel=t?"/measurements/".concat(t):""}),n.$watch("child.config.alarmsEventsConfigs",function(i){var t=m(i);n.alarmsChannel=t?"/alarms/".concat(t):"",n.eventsChannel=t?"/events/".concat(t):""}),n.$watchCollection(["child.config.dateFrom","child.config.dateTo"],function(){h(n.child.config.dateFrom,n.child.config.dateTo)}),n.$watch("child.config.date",function(){n.child.config.widgetInstanceGlobalTimeContext&&c(new Date(n.child.config.date[0]),new Date(n.child.config.date[1]))}),n.$watch("child.config.realtime",function(){n.viewRealtime=n.child&&n.child.config&&n.child.config.realtime}),n.$on("dashboardResize",function(i){i.targetScope!==n&&(d(),f())})}i.$inject=["$scope","$timeout","$element","INTERVAL_CONSTANTS"],angular.module("c8y.cockpit.dataPointExplorer").controller("DataPointWidgetCtrl",i)}();
@@ -39,15 +39,17 @@
39
39
  datapoints-initial-display-limit="child.config.datapointsInitialDisplayLimit"
40
40
  date-from="child.config.dateFrom"
41
41
  date-to="child.config.dateTo"
42
- realtime="child.config.realtime"
42
+ realtime="viewRealtime"
43
43
  aggregation="child.config.aggregation"
44
44
  show-time="child.config.displayDateSelection"
45
45
  on-data="onData"
46
46
  on-update-dates="onUpdateDates($dateFrom, $dateTo)"
47
47
  on-update-displayed-dates="onUpdateDisplayedDates($dateFrom, $dateTo)"
48
+ on-realtime-toggle="onRealtimeToggle()"
48
49
  on-box-changed="onBoxChanged(box)"
49
50
  selectable="child.config.selectable"
50
51
  selected="child.config.selected"
52
+ show-icon-bar="!child.config.widgetInstanceGlobalTimeContext"
51
53
  >
52
54
  </c8y-chart>
53
55
  </div>
@@ -1 +1 @@
1
- "use strict";!function(){function t(i,t,r,n,a,o){var e,u,l=t.deviceId,c={},d=a("Availability percentage is based on the number of critical alarms raised and cleared."),v=a("Operability chart displays how many devices had their average availability on particular level in the last 30 days."),f=r.createEnum([{name:"DAY",value:"day",label:a("Last 24 hours availability")},{name:"WEEK",value:"week",label:a("Last 7 days availability")},{name:"MONTH",value:"month",label:a("Last 30 days availability")}]),m=r.createEnum([{name:"DOWNTIME",value:"downtime",label:a("Downtime"),color:"#d9534f"},{name:"UPTIME",value:"uptime",label:a("Uptime"),color:"#5cb85c"}]);function s(a){var e=function(t){var a=moment(),e=moment().subtract(1,t.value),n=r.dateFullFormat;return{dateFrom:e.format(n),dateTo:a.format(n),id:l}}(a);return(e.id?n.reports.downtimeDuration(e):n.reports.downtimeDurationAggregation(e)).then(function(t){return function(t,a,e){var n=e.downtimeDuration,r=y(a,e)-n;c[t.name]={name:t.name,label:t.label,order:t.ordinal,data:[{key:m.DOWNTIME.value,val:n},{key:m.UPTIME.value,val:r}]}}(a,e,t.data)})}function y(t){var a=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},e=moment(t.dateFrom),n=moment(t.dateTo),r=1;return"number"==typeof a.deviceCount?r=a.deviceCount:Array.isArray(a.availabilityStats)&&(r=a.availabilityStats.length),n.diff(e,"seconds")*(r||1)}function p(t){var a=_.find(t,{key:m.UPTIME.value}).val;return a/(a+_.find(t,{key:m.DOWNTIME.value}).val)*100}_.assign(i,{intervalsData:c,availabilityTooltip:d,operabilityTooltip:v,x:function(){return function(t){return t.key}},y:function(){return function(t){return t.val}},xGraph:function(){return function(t){return t[0]}},yGraph:function(){return function(t){return t[1]}},xTickFormat:function(){return function(t){return"".concat(t,"%")}},color:function(){return function(t){return _.find(m,{value:t.data.key}).color}},colorGraph:function(){return function(){return m.UPTIME.color}},tooltip:function(){return function(t){return o.getString(_.find(m,{value:t}).label)}},tooltipGraph:function(){return function(t,a,e){var n=Math.round(e);return o.getPlural(n,"1 device","{{$count}} devices",{})}},percentage:p,percentageClass:function(t){return 50<p(t)?"text-success":"text-danger"}}),f.values().forEach(s),l||(e=r.dateFullFormat,u={dateFrom:moment().subtract(30,"day").format(e),dateTo:moment().format(e)},n.reports.downtimeDuration(u).then(function(t){return function(t,a){var e=a.availabilityStats,n=y(t),r=e.map(function(t){var a=t.downtimeDuration;return t.percent=100*(n-a)/n,t});i.graphData=[{key:"operability",values:function(e){for(var n=[],t=function(){var a=10*r,t=e.filter(function(t){return function(t,a){return a.percent<=t&&a.percent>t-10}(a,t)}).length;n.push([a,t])},r=0;r<=10;r++)t();return n}(r)}]}(u,t.data)}))}t.$inject=["$scope","$routeParams","c8yBase","c8yAlarms","gettext","gettextCatalog"],angular.module("c8y.parts.availability").controller("availabilityReportCtrl",t)}();
1
+ "use strict";!function(){function t(i,t,r,n,a,o){var e,u,l=t.deviceId,c={},d=a("Availability percentage is based on the number of critical alarms raised and cleared."),v=a("Operability chart displays how many devices had their average availability on particular level in the last 30 days."),f=r.createEnum([{name:"DAY",value:1,label:a("Last 24 hours availability")},{name:"WEEK",value:7,label:a("Last 7 days availability")},{name:"MONTH",value:30,label:a("Last 30 days availability")}]),m=r.createEnum([{name:"DOWNTIME",value:"downtime",label:a("Downtime"),color:"#d9534f"},{name:"UPTIME",value:"uptime",label:a("Uptime"),color:"#5cb85c"}]);function s(a){var e=function(t){var a=moment(),e=moment().subtract(t.value,"days"),n=r.dateFullFormat;return{dateFrom:e.format(n),dateTo:a.format(n),id:l}}(a);return(e.id?n.reports.downtimeDuration(e):n.reports.downtimeDurationAggregation(e)).then(function(t){return function(t,a,e){var n=e.downtimeDuration,r=y(a,e)-n;c[t.name]={name:t.name,label:t.label,order:t.ordinal,data:[{key:m.DOWNTIME.value,val:n},{key:m.UPTIME.value,val:r}]}}(a,e,t.data)})}function y(t){var a=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},e=moment(t.dateFrom),n=moment(t.dateTo),r=1;return"number"==typeof a.deviceCount?r=a.deviceCount:Array.isArray(a.availabilityStats)&&(r=a.availabilityStats.length),n.diff(e,"seconds")*(r||1)}function p(t){var a=_.find(t,{key:m.UPTIME.value}).val;return a/(a+_.find(t,{key:m.DOWNTIME.value}).val)*100}_.assign(i,{intervalsData:c,availabilityTooltip:d,operabilityTooltip:v,x:function(){return function(t){return t.key}},y:function(){return function(t){return t.val}},xGraph:function(){return function(t){return t[0]}},yGraph:function(){return function(t){return t[1]}},xTickFormat:function(){return function(t){return"".concat(t,"%")}},color:function(){return function(t){return _.find(m,{value:t.data.key}).color}},colorGraph:function(){return function(){return m.UPTIME.color}},tooltip:function(){return function(t){return o.getString(_.find(m,{value:t}).label)}},tooltipGraph:function(){return function(t,a,e){var n=Math.round(e);return o.getPlural(n,"1 device","{{$count}} devices",{})}},percentage:p,percentageClass:function(t){return 50<p(t)?"text-success":"text-danger"}}),f.values().forEach(s),l||(e=r.dateFullFormat,u={dateFrom:moment().subtract(30,"day").format(e),dateTo:moment().format(e)},n.reports.downtimeDuration(u).then(function(t){return function(t,a){var e=a.availabilityStats,n=y(t),r=e.map(function(t){var a=t.downtimeDuration;return t.percent=100*(n-a)/n,t});i.graphData=[{key:"operability",values:function(e){for(var n=[],t=function(){var a=10*r,t=e.filter(function(t){return function(t,a){return a.percent<=t&&a.percent>t-10}(a,t)}).length;n.push([a,t])},r=0;r<=10;r++)t();return n}(r)}]}(u,t.data)}))}t.$inject=["$scope","$routeParams","c8yBase","c8yAlarms","gettext","gettextCatalog"],angular.module("c8y.parts.availability").controller("availabilityReportCtrl",t)}();
@@ -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 _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(a,r,e){var o,u=this,m=d3.scale.category10();function i(e){var t=e.currentValue,n=e.previousValue;return!_.isEmpty(t)&&!_.isEmpty(n)&&!_.isEqual(t,n)}function c(e){u.fragmentSeriesPairs=_.groupBy(e,"fragment")}function f(){u.channel="/measurements/".concat(o)}function s(){var e=function(e){var n=0,r=u.fragment,i={__target:{id:o},fragment:r,lineType:"line",renderType:"area"};return _.map(e,function(e,t){return _.assign({series:t,unit:e.unit,label:a.humanizeFragment("".concat(r," => ").concat(t)),color:m(n++),__active:!0},i)})}(function(e){return _.reduce(e,function(e,t){var n=t.series,r=t.unit;return _.assign(e,_defineProperty({},n,{unit:r}))},{})}(_.get(u.fragmentSeriesPairs,u.fragment)));_.set(u,"dataPoints",e)}u.aggregation="MINUTELY",u.interval=e._defaultDuration,_.assign(u,{$onChanges:function(e){var t=e.device,n=e.fragment;u.device&&u.fragment&&((i(t)||i(n))&&(u.fragmentSeriesPairs=void 0),o=a.getId(u.device),u.fragmentSeriesPairs?(f(),s()):r.getSupportedSeries(o,{withUnits:!0}).then(c).then(function(){f(),s()}))},$onInit:function(){u.dateFrom=moment().subtract(1,"hour").toDate(),u.dateTo=new Date},onUpdateDates:function(e,t){u.dateFrom=e;var n=moment().diff(moment(t),"seconds")<10;u.realtime&&!n&&(u.realtime=!1);u.dateTo=t},updateScale:function(e){_.forEach(e.series,function(e){var t=e.dataPoint,n=_.find(u.dataPoints,function(e){return e.fragment===t.fragment&&e.series===t.series});if(n){var r=e.values,i=_.minBy(r,"val.min").val.min,a=_.maxBy(r,"val.max").val.max;i===a&&(i-=1,a+=1),n.min=i,n.max=a}})}})}e.$inject=["c8yBase","c8yDevices","INTERVAL_CONSTANTS"],angular.module("c8y.core.measurements2").component("c8yMeasurementsFragmentChart",{templateUrl:":::PLUGIN_PATH:::/fragmentChart/fragmentChart.html",controllerAs:"vm",controller:e,bindings:{fragment:"<",device:"<",dateFrom:"=",dateTo:"=",realtime:"=?",hideRealtimeButton:"=?"}})}();
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 _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(a,r,e){var o,u=this,m=d3.scale.category10();function i(e){var t=e.currentValue,n=e.previousValue;return!_.isEmpty(t)&&!_.isEmpty(n)&&!_.isEqual(t,n)}function c(e){u.fragmentSeriesPairs=_.groupBy(e,"fragment")}function f(){u.channel="/measurements/".concat(o)}function s(){var e=function(e){var n=0,r=u.fragment,i={__target:{id:o},fragment:r,lineType:"line",renderType:"area"};return _.map(e,function(e,t){return _.assign({series:t,unit:e.unit,label:a.humanizeFragment("".concat(r," => ").concat(t)),color:m(n++),__active:!0},i)})}(function(e){return _.reduce(e,function(e,t){var n=t.series,r=t.unit;return _.assign(e,_defineProperty({},n,{unit:r}))},{})}(_.get(u.fragmentSeriesPairs,u.fragment)));_.set(u,"dataPoints",e)}u.aggregation="MINUTELY",u.interval=e._defaultDuration,_.assign(u,{$onChanges:function(e){var t=e.device,n=e.fragment;u.device&&u.fragment&&((i(t)||i(n))&&(u.fragmentSeriesPairs=void 0),o=a.getId(u.device),u.fragmentSeriesPairs?(f(),s()):r.getSupportedSeries(o,{withUnits:!0}).then(c).then(function(){f(),s()}))},$onInit:function(){u.dateFrom=moment().subtract(1,"hour").toDate(),u.dateTo=new Date},onUpdateDates:function(e,t){u.dateFrom=e;var n=moment().diff(moment(t),"seconds")<5;u.realtime&&!n&&(u.realtime=!1);u.dateTo=t},updateScale:function(e){_.forEach(e.series,function(e){var t=e.dataPoint,n=_.find(u.dataPoints,function(e){return e.fragment===t.fragment&&e.series===t.series});if(n){var r=e.values,i=_.minBy(r,"val.min").val.min,a=_.maxBy(r,"val.max").val.max;i===a&&(i-=1,a+=1),n.min=i,n.max=a}})}})}e.$inject=["c8yBase","c8yDevices","INTERVAL_CONSTANTS"],angular.module("c8y.core.measurements2").component("c8yMeasurementsFragmentChart",{templateUrl:":::PLUGIN_PATH:::/fragmentChart/fragmentChart.html",controllerAs:"vm",controller:e,bindings:{fragment:"<",device:"<",dateFrom:"=",dateTo:"=",realtime:"=?",hideRealtimeButton:"=?"}})}();
@@ -1 +1 @@
1
- "use strict";angular.module("c8y.core.measurements2").directive("c8yChart",["c8yChart",function(o){return{restrict:"E",link:function(t,e,a,r){var n=new o.Chart(e,{showTime:t.showTime()});r.init(n),t.$on("$destroy",function(){n.destroy()})},controller:"c8yChartCtrl",controllerAs:"ctrl",templateUrl:":::PLUGIN_PATH:::/measurements2/chart.html",scope:{dateFrom:"=?",dateTo:"=?",aggregation:"=?",realtime:"=?",datapoints:"=",datapointsInitialDisplayLimit:"<",onData:"=?",onUpdateDates:"&",onUpdateDisplayedDates:"&",onBoxChanged:"&",showTime:"&",selectable:"&",selected:"=?",onDataChange:"&"}}}]);
1
+ "use strict";angular.module("c8y.core.measurements2").directive("c8yChart",["c8yChart",function(r){return{restrict:"E",link:function(e,t,a,o){var n=new r.Chart(t,{showTime:e.showTime()});o.init(n),e.$on("$destroy",function(){n.destroy()})},controller:"c8yChartCtrl",controllerAs:"ctrl",templateUrl:":::PLUGIN_PATH:::/measurements2/chart.html",scope:{dateFrom:"=?",dateTo:"=?",aggregation:"=?",showIconBar:"=?",realtime:"=?",datapoints:"=",datapointsInitialDisplayLimit:"<",onData:"=?",onUpdateDates:"&",onUpdateDisplayedDates:"&",onRealtimeToggle:"&",onBoxChanged:"&",showTime:"&",selectable:"&",selected:"=?",onDataChange:"&"}}}]);
@@ -4,6 +4,7 @@
4
4
  >
5
5
  <!-- icon bar -->
6
6
  <c8y-measurements-icon-bar
7
+ ng-show="showIconBar"
7
8
  class="measurement-icon-bar-wrapper p-static"
8
9
  aggregation="aggregation"
9
10
  realtime="realtime"
@@ -11,10 +12,12 @@
11
12
  show-loading="chart.loading"
12
13
  show-realtime="true"
13
14
  show-truncated="chart.truncated"
15
+ on-realtime-toggle="onRealtimeToggle()"
14
16
  ></c8y-measurements-icon-bar>
15
17
 
16
18
  <!-- datapoints selection -->
17
19
  <c8y-item-selector
20
+ class="m-l-auto"
18
21
  items="seriesAvailable"
19
22
  items-selected="seriesSelected"
20
23
  on-apply="onSeriesSelectionChanged(items)"
@@ -1 +1 @@
1
- "use strict";angular.module("c8y.core.measurements2").directive("c8yMeasurementsIconBar",function(){return{restrict:"E",templateUrl:":::PLUGIN_PATH:::/views/iconBar.html",scope:{realtime:"=",aggregation:"=",showAggregation:"=",showLoading:"=",showRealtime:"=",showTruncated:"="},controller:["$scope","gettext",function(e,t){var n={undefined:t("No aggregation"),MINUTELY:t("Minutely aggregation"),HOURLY:t("Hourly aggregation"),DAILY:t("Daily aggregation")},a={undefined:"line-chart",MINUTELY:"hourglass",HOURLY:"clock-o",DAILY:"calendar-o"};e.getRealtimeIconName=function(){return e.realtime?"check-circle-o":"circle-o"},e.getRealtimeIconText=function(){return e.realtime?t("Realtime active"):t("Realtime inactive")},e.getRealtimeClassName=function(){return e.realtime?"text-success":""},e.getAggregationIconName=function(){return a[e.aggregation]},e.getAggregationIconText=function(){return n[e.aggregation]}}]}});
1
+ "use strict";angular.module("c8y.core.measurements2").directive("c8yMeasurementsIconBar",function(){return{restrict:"E",templateUrl:":::PLUGIN_PATH:::/views/iconBar.html",scope:{realtime:"=",onRealtimeToggle:"&",aggregation:"=",showAggregation:"=",showLoading:"=",showRealtime:"=",showTruncated:"="},controller:["$scope","gettext",function(e,t){var n={undefined:t("No aggregation"),MINUTELY:t("Minutely aggregation"),HOURLY:t("Hourly aggregation"),DAILY:t("Daily aggregation")},a={undefined:"line-chart",MINUTELY:"hourglass",HOURLY:"clock-o",DAILY:"calendar-o"};e.getRealtimeIconName=function(){return e.realtime?"check-circle-o":"circle-o"},e.getRealtimeIconText=function(){return e.realtime?t("Realtime active"):t("Realtime inactive")},e.getRealtimeClassName=function(){return e.realtime?"text-success":""},e.getAggregationIconName=function(){return a[e.aggregation]},e.getAggregationIconText=function(){return n[e.aggregation]}}]}});
@@ -19,6 +19,7 @@
19
19
  tooltip-popup-delay="500"
20
20
  tooltip-append-to-body="true"
21
21
  ng-show="showRealtime"
22
+ ng-click="onRealtimeToggle()"
22
23
  >
23
24
  <!-- TODO: Fix hack
24
25
  change the function getRealtimeIconName to return 'active : inactive ' instead of icon name
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c8y/ng1-modules",
3
- "version": "1018.0.164",
3
+ "version": "1018.0.172",
4
4
  "license": "Apache-2.0",
5
5
  "author": "Cumulocity",
6
6
  "description": "AngularJS modules for Cumulocity IoT applications.",
@@ -1 +1 @@
1
- "use strict";!function(){function e(t,e,n,a,s){var u=this,r=_(a.Types.values()).filter("numeric").map("name").value();function o(){n(function(){e.find(".optionsForm input").first().trigger("focus")})}function i(){var e=u.selectedMessage||{},t=l(e);u.valuesData=[];var n=u.valuesData,s=0,i=a.findMessageForInstruction(u.instruction,u.messages);_.forEach(e.mandatoryValues,function(e){e.mandatory=!0}),_.forEach(t,function(e){s+=1,e.order=s,function(e){return!e.value&&e.type!==a.Types.DATE.name}(e)&&n.push(e)}),function(n){var e=l(u.selectedMessage||{});_.forEach(e,function(e,t){e.inputValue=n?void 0:u.values[t],_.includes(r,e.type)&&!_.isUndefined(e.inputValue)&&(e.inputValue=Number(e.inputValue))})}(!(e&&i===e)),o()}function l(e){var t=_.union(e.mandatoryValues,e.customValues,e.values);return _.reject(t,"value")}function c(e){var t=u.editInstruction;u.messages=e,u.selectedMessage=a.findMessageForInstruction(t,u.messages),"sleep"!==t.type&&i(),o()}_.assign(u,{$onInit:function(){_.assign(u,{icons:s.icons})},$onChanges:function(){u.editInstruction=_.clone(u.instruction);var e=u.editInstruction;e&&((u.messages?t.when(u.messages):a.listAllPublishMessages()).then(c),u.values=e.values||[]);delete u.valuesForm},onSelectedMessage:i,remove:function(){u.simulatorCtrl.remove(u.instruction)},canSave:function(e){var t=e.$valid,n=u.instruction,s=u.selectedMessage,i=_.includes(["message","builtin"],n&&n.type);(!n||i&&!s)&&(t=!1);return t},save:function(){var e=u.instruction,t=u.editInstruction;if(delete e.isNew,"sleep"===e.type)e.seconds=t.seconds;else{var n=u.selectedMessage,s=l(n);e.type=n._template?"message":"builtin",e.values=_.map(s,function(e){var t=_([e.value,e.inputValue]).reject(_.isNil).reject(function(e){return""===e}).head();return _.isUndefined(t)?"":t}),e.messageId=n.msgId,e.templateId=n._template?n._template.__externalId:void 0}u.simulatorCtrl.saveCurrentSimulatorCommands()},cancel:function(){u.instruction.isNew?u.simulatorCtrl.remove(u.instruction):u.simulatorCtrl.selectInstruction()}})}e.$inject=["$q","$element","$timeout","c8ySimulators","c8ySimulatorsUi"],angular.module("c8y.simulators").component("c8ySimulatorInstructionDetail",{templateUrl:":::PLUGIN_PATH:::/detail/instructionDetail.html",require:{simulatorCtrl:"^c8ySimulatorDetail"},bindings:{instruction:"<"},controllerAs:"vm",controller:e})}();
1
+ "use strict";!function(){function e(t,e,n,i,s,a){var u=this,r=_(i.Types.values()).filter("numeric").map("name").value();function o(){n(function(){e.find(".optionsForm input").first().trigger("focus")})}function l(){var e=u.selectedMessage||{},t=c(e);u.valuesData=[];var n=u.valuesData,s=0,a=i.findMessageForInstruction(u.instruction,u.messages);_.forEach(e.mandatoryValues,function(e){e.mandatory=!0}),_.forEach(t,function(e){s+=1,e.order=s,function(e){return!e.value&&e.type!==i.Types.DATE.name}(e)&&n.push(e)}),function(n){var e=c(u.selectedMessage||{});_.forEach(e,function(e,t){e.inputValue=n?void 0:u.values[t],_.includes(r,e.type)&&!_.isUndefined(e.inputValue)&&(e.inputValue=Number(e.inputValue))})}(!(e&&a===e)),o()}function c(e){var t=_.union(e.mandatoryValues,e.customValues,e.values);return _.reject(t,"value")}function m(e){var t=u.editInstruction;u.messages=e,_.forEach(u.messages,function(e){"INVENTORY"===e.api&&("PUT"===e.method?e.byId?d(e.mandatoryValues,a("ID")):(d(e.mandatoryValues,a("External ID")),_.isEmpty(e.externalIdType)&&d(e.mandatoryValues,a("External ID type"))):"POST"===e.method&&(_.isEmpty(e.externalIdType)&&d(e.mandatoryValues,a("External ID type")),d(e.mandatoryValues,a("External ID"))))}),u.selectedMessage=i.findMessageForInstruction(t,u.messages),"sleep"!==t.type&&l(),o()}function d(e,t){_.some(e,function(e){return e.label===t})||e.unshift({label:t,type:"STRING"})}_.assign(u,{$onInit:function(){_.assign(u,{icons:s.icons})},$onChanges:function(){u.editInstruction=_.clone(u.instruction);var e=u.editInstruction;e&&((u.messages?t.when(u.messages):i.listAllPublishMessages()).then(m),u.values=e.values||[]);delete u.valuesForm},onSelectedMessage:l,remove:function(){u.simulatorCtrl.remove(u.instruction)},canSave:function(e){var t=e.$valid,n=u.instruction,s=u.selectedMessage,a=_.includes(["message","builtin"],n&&n.type);(!n||a&&!s)&&(t=!1);return t},save:function(){var e=u.instruction,t=u.editInstruction;if(delete e.isNew,"sleep"===e.type)e.seconds=t.seconds;else{var n=u.selectedMessage,s=c(n);e.type=n._template?"message":"builtin",e.values=_.map(s,function(e){var t=_([e.value,e.inputValue]).reject(_.isNil).reject(function(e){return""===e}).head();return _.isUndefined(t)?"":t}),e.messageId=n.msgId,e.templateId=n._template?n._template.__externalId:void 0}u.simulatorCtrl.saveCurrentSimulatorCommands()},cancel:function(){u.instruction.isNew?u.simulatorCtrl.remove(u.instruction):u.simulatorCtrl.selectInstruction()}})}e.$inject=["$q","$element","$timeout","c8ySimulators","c8ySimulatorsUi","gettext"],angular.module("c8y.simulators").component("c8ySimulatorInstructionDetail",{templateUrl:":::PLUGIN_PATH:::/detail/instructionDetail.html",require:{simulatorCtrl:"^c8ySimulatorDetail"},bindings:{instruction:"<"},controllerAs:"vm",controller:e})}();
@@ -91,7 +91,10 @@
91
91
 
92
92
  <div ng-switch-default>
93
93
  <div class="form-group" ng-repeat="val in vm.valuesData" ng-if="vm.editInstruction.type">
94
- <label ng-bind="(val.path || val.label) | translate | humanize2" style="z-index: 0"></label>
94
+ <label
95
+ style="z-index: 0"
96
+ ng-bind="(val.path | translate | humanize2) || (val.label | translate)"
97
+ ></label>
95
98
  <c8y-smart-rest-value-input
96
99
  name="'field' + val.order"
97
100
  value="val.inputValue"
@@ -251,7 +251,7 @@
251
251
  <div
252
252
  c8y-password-strength
253
253
  user="passwordStrengthUser"
254
- password="tenant.adminPass"
254
+ password="tenantForm.adminPass.$viewValue"
255
255
  ></div>
256
256
  <div ng-if="passwordStrengthEnforced" class="m-t-32">
257
257
  <c8y-password-strength-checklist