move percentage capacitty to variable

This commit is contained in:
John Mitchell 2017-09-27 16:53:31 -04:00
parent 32920739ef
commit b05925cc0e
No known key found for this signature in database
GPG Key ID: FE6A9B5BD4EB5C94

View File

@ -22,11 +22,14 @@ export default ['templateUrl', 'ComponentsStrings',
scope.$watch('capacity', function() {
if (scope.totalCapacity !== 0) {
var percentageCapacity = Math
.round(scope.capacity / scope.totalCapacity * 10) / 10 * 100;
scope.CapacityStyle = {
'flex-grow': scope.capacity / scope.totalCapacity * 0.01
'flex-grow': percentageCapacity * 0.01
};
scope.consumedCapacity = `${Math.round(scope.capacity / scope.totalCapacity * 10) / 10}%`;
scope.consumedCapacity = `${percentageCapacity}%`;
} else {
scope.CapacityStyle = {
'flex-grow': 1