From 0b984fecdaf1ea0e10528376f1dae42a2b0f8d2f Mon Sep 17 00:00:00 2001 From: Dave Roberts Date: Thu, 19 Dec 2024 10:31:02 +0000 Subject: [PATCH] Added triage to timeline code --- lib/GADS/Timeline.pm | 5 +++++ src/frontend/components/timeline/lib/component.js | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/GADS/Timeline.pm b/lib/GADS/Timeline.pm index 9c0da8b5e..70ebd500d 100644 --- a/lib/GADS/Timeline.pm +++ b/lib/GADS/Timeline.pm @@ -428,6 +428,11 @@ sub _build_items $self->_set_display_to($oldest) if $oldest > ($self->display_to || AT_BIGBANG); + + if(scalar(@items) > 1000) # XXX Arbitrary limit + { warning __"Too many items to display on the timeline - showing first 1000 results"; + last; + } } if(!@items) diff --git a/src/frontend/components/timeline/lib/component.js b/src/frontend/components/timeline/lib/component.js index 83fe22ead..a81925520 100644 --- a/src/frontend/components/timeline/lib/component.js +++ b/src/frontend/components/timeline/lib/component.js @@ -12,6 +12,7 @@ class TimelineComponent extends Component { this.el = $(this.element) this.initTimeline() + this.tl_request = undefined } initTimeline() { @@ -257,12 +258,13 @@ class TimelineComponent extends Component { if (is_dashboard) { url = url + '&dashboard=1&view=' + $container.data('view') } - $.ajax({ - async: false, + if(self.tl_request) self.tl_request.abort() + self.tl_request = $.ajax({ url: url, dataType: 'json', success: function(data) { items.add(data) + self.tl_request = undefined } }) }