Merge pull request #1106 from Terny22/widget-basic-settings

fixed units and decimals settings in some widgets
This commit is contained in:
Igor Kulikov 2018-10-04 14:50:55 +03:00 committed by GitHub
commit 23a596bbd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 13 deletions

File diff suppressed because one or more lines are too long

View File

@ -371,7 +371,9 @@ function EntitiesTableWidgetController($element, $scope, $filter, $mdMedia, $mdP
content = strContent;
}
} else {
content = defaultContent(key, value);
var decimals = (contentInfo.decimals || contentInfo.decimals === 0) ? contentInfo.decimals : vm.widgetConfig.decimals;
var units = contentInfo.units || vm.widgetConfig.units;
content = vm.ctx.utils.formatValue(value, decimals, units, true);
}
return content;
} else {
@ -379,14 +381,6 @@ function EntitiesTableWidgetController($element, $scope, $filter, $mdMedia, $mdP
}
}
function defaultContent(key, value) {
if (angular.isDefined(value)) {
return value;
} else {
return '';
}
}
function defaultStyle(/*key, value*/) {
return {};
}
@ -542,7 +536,9 @@ function EntitiesTableWidgetController($element, $scope, $filter, $mdMedia, $mdP
vm.contentsInfo[dataKey.label] = {
useCellContentFunction: useCellContentFunction,
cellContentFunction: cellContentFunction
cellContentFunction: cellContentFunction,
units: dataKey.units,
decimals: dataKey.decimals
};
var columnWidth = angular.isDefined(keySettings.columnWidth) ? keySettings.columnWidth : '0px';

View File

@ -217,7 +217,9 @@ function TimeseriesTableWidgetController($element, $scope, $filter, $timeout) {
content = strContent;
}
} else {
content = vm.ctx.utils.formatValue(value, contentInfo.decimals, contentInfo.units);
var decimals = (contentInfo.decimals || contentInfo.decimals === 0) ? contentInfo.decimals : vm.widgetConfig.decimals;
var units = contentInfo.units || vm.widgetConfig.units;
content = vm.ctx.utils.formatValue(value, decimals, units, true);
}
return content;
}