diff --git a/beat/web/reports/static/reports/app/directives/edit/plotItem.js b/beat/web/reports/static/reports/app/directives/edit/plotItem.js index 8c85a60448cba6d3b7b40ea82d182e89c50fa939..79c6df93dccf9f632b03225b51d6e8546dc59962 100644 --- a/beat/web/reports/static/reports/app/directives/edit/plotItem.js +++ b/beat/web/reports/static/reports/app/directives/edit/plotItem.js @@ -47,6 +47,25 @@ angular.module('reportApp') PlotService.addPlot(scope.group, scope.id, scope.renderDivId); }); + let plotTimer; + + const updatePlot = () => { + clearTimeout(plotTimer); + + const queueUpdate = () => { + let el = document.querySelector(`#${scope.renderDivId}`); + // if the container is rendered and it already has had a render, + // redo the render + if(el && el.childNodes.length > 0){ + el.innerHTML = ''; + PlotService.addPlot(scope.group, scope.id, scope.renderDivId); + } + }; + + plotTimer = setTimeout(queueUpdate, 1000); + }; + + // if the group has exps added/removed, rerender the plot scope.$watch( // angular doesnt watch arrays properly (i.e. watching scope.group._experimentNames), @@ -55,15 +74,13 @@ angular.module('reportApp') // because it compares shallowly and getters commonly return a new obj each time. // so, watch the getters length instead () => scope.group.experiments.length, - (newExps, oldExps) => { - let el = document.querySelector(`#${scope.renderDivId}`); - // if the container is rendered and it already has had a render, - // redo the render - if(el && el.childNodes.length > 0){ - el.innerHTML = ''; - PlotService.addPlot(scope.group, scope.id, scope.renderDivId); - } - } + updatePlot + ); + + // if the group has aliases changed, rerender the plot + scope.$watch( + () => JSON.stringify(scope.group._aliases), + updatePlot ); scope.exportSrcFunc = () => () => { diff --git a/beat/web/reports/static/reports/app/directives/tableItem.js b/beat/web/reports/static/reports/app/directives/tableItem.js index 9162d1b980b59d6f2b2025b628bb7f4fa028ba10..b1db73311d8789dc30892a4d10cf125d56bf0fa7 100644 --- a/beat/web/reports/static/reports/app/directives/tableItem.js +++ b/beat/web/reports/static/reports/app/directives/tableItem.js @@ -72,12 +72,20 @@ angular.module('reportApp') }; // gets the field val for the given exp scope.getFieldVal = (expName, field) => { - const alias = scope.group.aliases[expName].length > 0 ? scope.group.aliases[expName] : expName; + const alias = scope.group.aliases[expName].length > 0 ? + scope.group.aliases[expName] : expName; - let fVal = scope.tableables[alias] ? - scope.tableables[alias][field] : undefined; + const name = scope.tableables[alias] ? + alias : expName; + + let fVal = scope.tableables[name] ? scope.tableables[name][field] : undefined; let val; + console.log(expName); + console.log(alias); + console.log(scope.tableables); + console.log(fVal); + if(field === scope.fields[0]){ val = alias; } else if(!fVal){