From a86303a2b43537843ff8217aaeb804a181d912f7 Mon Sep 17 00:00:00 2001 From: Till Breuer Date: Tue, 29 Apr 2014 12:41:51 +0200 Subject: [PATCH 1/2] Avoid chart duplication on timeline updates on modal.close Fixes #7247 --- .../timeline-table-container-directive.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/angular/directives/timelines/timeline-table-container-directive.js b/app/assets/javascripts/angular/directives/timelines/timeline-table-container-directive.js index fdfe8a738f..e6472cdff1 100644 --- a/app/assets/javascripts/angular/directives/timelines/timeline-table-container-directive.js +++ b/app/assets/javascripts/angular/directives/timelines/timeline-table-container-directive.js @@ -123,11 +123,19 @@ angular.module('openproject.timelines.directives') } function renderTimeline() { - fetchData() + return fetchData() .then(buildWorkPackageTable) .then(drawChart); } + function reloadTimeline() { + return fetchData() + .then(buildWorkPackageTable) + .then(function() { + scope.timeline.rebuildAll(); + }); + } + function registerModalHelper() { scope.timeline.modalHelper = modalHelperInstance; @@ -141,7 +149,10 @@ angular.module('openproject.timelines.directives') ); jQuery(scope.timeline.modalHelper).on('closed', function() { - renderTimeline(); // TODO remove and do updates via scope + reloadTimeline().then(function() { + window.clearTimeout(scope.timeline.safetyHook); + }); + // TODO remove and do updates via scope }); } From bf2adbfd4d1b8333d6f56f512445c51c42b881f8 Mon Sep 17 00:00:00 2001 From: Till Breuer Date: Tue, 29 Apr 2014 13:13:23 +0200 Subject: [PATCH 2/2] Restore outline level when reloading timeline on modal.close --- .../directives/timelines/timeline-table-container-directive.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/assets/javascripts/angular/directives/timelines/timeline-table-container-directive.js b/app/assets/javascripts/angular/directives/timelines/timeline-table-container-directive.js index e6472cdff1..5ff40bf8f9 100644 --- a/app/assets/javascripts/angular/directives/timelines/timeline-table-container-directive.js +++ b/app/assets/javascripts/angular/directives/timelines/timeline-table-container-directive.js @@ -132,7 +132,7 @@ angular.module('openproject.timelines.directives') return fetchData() .then(buildWorkPackageTable) .then(function() { - scope.timeline.rebuildAll(); + scope.timeline.expandToOutlineLevel(scope.currentOutlineLevel); // also triggers rebuildAll() }); }