angular.module("c8y.parts.kpi").controller("kpiListCtrl",["$scope","$location","baseWidgetSvc","assetLink","c8yInventory","c8yBase",function(i,n,t,e,s,o){t=t.createWidget(i);function r(t){var n=i.measurements[t.id],n=n&&n.value,t=t&&t.target,e="--";return e=_.isUndefined(n)||_.isUndefined(t)?e:n-t}t.init=function(){var t=i.child.config;t.datapoints=t.options&&t.options.dataPoints,this.__super.init.call(this)},t.refresh=function(){i.measurements=this.mostRecentKpi.measurements,i.dataPoints=this.mostRecentKpi.dataPoints,i.times=this.mostRecentKpi.times},t.onNotification=t.refresh,i.options=i.child.config.options,i.diff=r,i.diffPercent=function(t){var n="--";return n=_.isUndefined(t.target)?n:r(t)/t.target*100},i.columnVisible=function(t){return!1!==t},i.redirectToAsset=function(t){s.detailCached(t).then(o.getResData).then(function(t){return e.transform(t)}).then(function(t){return n.path(t)})},t.init()}]);