diff --git a/beat/web/reports/static/reports/app/directives/groupAddItemsMenu.js b/beat/web/reports/static/reports/app/directives/groupAddItemsMenu.js index 6909978c75a79f0d4b8dbdff29cb5cfee4917363..5c2fc9b6357058db8cb38fdb62073890fa3266a8 100644 --- a/beat/web/reports/static/reports/app/directives/groupAddItemsMenu.js +++ b/beat/web/reports/static/reports/app/directives/groupAddItemsMenu.js @@ -50,7 +50,10 @@ angular.module('reportApp') scope.addNewTable = function() { return () => { let id = getNextItemId('table'); - scope.group.addReportItem(id, Array.from(scope.newTable.data)); + scope.group.addReportItem(id, { + fields: Array.from(scope.newTable.data), + precision: 10 + }); scope.newTable.data.length = 0; }; }; diff --git a/beat/web/reports/static/reports/app/directives/groupItemContainer.js b/beat/web/reports/static/reports/app/directives/groupItemContainer.js index 85af840e69b6ae81747bbdb7d57364cd6975f5a2..62cd16e4abe3be1da81ce2e843a1b2b8168dd472 100644 --- a/beat/web/reports/static/reports/app/directives/groupItemContainer.js +++ b/beat/web/reports/static/reports/app/directives/groupItemContainer.js @@ -49,7 +49,7 @@ angular.module('reportApp') id='item.id' show-serialized='showSerialized' serialize-func-obj='serializeFuncObj' - fields='item.content' + content='item.content' > </div> <div diff --git a/beat/web/reports/static/reports/app/directives/groupTableItem.js b/beat/web/reports/static/reports/app/directives/groupTableItem.js index d1eb1d73498e97c534f33535aa09964f236911f6..16215ecf4f17340686e0edd4a601f7747f238a14 100644 --- a/beat/web/reports/static/reports/app/directives/groupTableItem.js +++ b/beat/web/reports/static/reports/app/directives/groupTableItem.js @@ -31,17 +31,21 @@ angular.module('reportApp') scope: { group: '=', id: '=', - fields: '=', + content: '=', showSerialized: '=', serializeFuncObj: '=' }, link: function(scope){ + scope.fields = scope.content.fields; // add 'expName' to the beginning of the fields to show in the table // if it isnt already there if(scope.fields.length === 0 || scope.fields[0] !== 'Experiment'){ scope.fields.unshift('Experiment'); } + // 1 - 10 + scope.floatingPointRange = [...(new Array(10)).keys()].map(i => i + 1); + console.log(scope.fields); scope.tableables = ExperimentsService.tableables || {}; scope.getFieldType = (field) => { @@ -76,7 +80,12 @@ angular.module('reportApp') } else if(!fVal){ val = '-'; } else if(fVal.value){ - val = fVal.value; + let tmp = fVal.value; + if(Number.isInteger(tmp)){ + val = tmp; + } else { + val = tmp.toFixed(parseInt(scope.content.precision)); + } } else if (fVal){ val = fVal; } @@ -163,6 +172,15 @@ angular.module('reportApp') button-text="Save Column Choices" > </div> + <div class='btn-group' role='group'> + <button class='btn btn-default' id="{{domId}}-precision" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> + Precision: {{ content.precision }} + <span class="caret"></span> + </button> + <ul class="dropdown-menu" aria-labelledby="{{domId}}-precision"> + <li ng-click='content.precision = i' ng-repeat='i in floatingPointRange'><a>{{ i }}</a></li> + </ul> + </div> <button class='btn btn-default' ng-click='showSerialized.val = !showSerialized.val'> Toggle Serialize View </button> @@ -199,7 +217,7 @@ angular.module('reportApp') <tbody> <tr ng-repeat="exp in group.experiments | orderBy:sortFunc:sortField.isReversed"> <td ng-repeat='field in fields'> - {{ tableables[exp] ? getFieldVal(exp, field) : '' }} + {{ getFieldVal(exp, field) }} </td> </tr> </tbody>