From 011859d50e697b2125e6648a3c2844ccfa9915b7 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 26 Sep 2018 12:00:31 -0400 Subject: [PATCH] LP#1779158 Recent imports UI Signed-off-by: Bill Erickson --- .../cat/vandelay/recent-imports.component.html | 22 +++++++++--------- .../staff/cat/vandelay/recent-imports.component.ts | 26 +++++++++++++++++----- 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/cat/vandelay/recent-imports.component.html b/Open-ILS/src/eg2/src/app/staff/cat/vandelay/recent-imports.component.html index a7a5438689..d7427f1082 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/vandelay/recent-imports.component.html +++ b/Open-ILS/src/eg2/src/app/staff/cat/vandelay/recent-imports.component.html @@ -16,13 +16,13 @@
- No Imports In Progress + No Import Sessions To Display
-
+
@@ -34,8 +34,15 @@
- diff --git a/Open-ILS/src/eg2/src/app/staff/cat/vandelay/recent-imports.component.ts b/Open-ILS/src/eg2/src/app/staff/cat/vandelay/recent-imports.component.ts index 55b054b1cb..ea24774202 100644 --- a/Open-ILS/src/eg2/src/app/staff/cat/vandelay/recent-imports.component.ts +++ b/Open-ILS/src/eg2/src/app/staff/cat/vandelay/recent-imports.component.ts @@ -13,6 +13,7 @@ export class RecentImportsComponent implements OnInit { trackers: IdlObject[]; refreshInterval = 2000; // ms sinceDate: string; + pollTimeout: any; constructor( private idl: IdlService, @@ -24,15 +25,26 @@ export class RecentImportsComponent implements OnInit { } ngOnInit() { + // Default to showing all trackers created today. + const d = new Date(); + d.setHours(0); + d.setMinutes(0); + d.setSeconds(0); + this.sinceDate = d.toISOString(); + this.pollTrackers(); - let now = new Date(); - now.setDate(now.getDate() - 1); - this.sinceDate = now.toISOString(); } dateFilterChange(iso: string) { - this.sinceDate = iso; - // TODO: kill pending setTimeout and start a new poll loop. + if (iso) { + this.sinceDate = iso; + if (this.pollTimeout) { + clearTimeout(this.pollTimeout); + this.pollTimeout = null; + } + this.trackers = []; + this.pollTrackers(); + } } pollTrackers() { @@ -105,8 +117,10 @@ export class RecentImportsComponent implements OnInit { // Continue updating the display with updated tracker // data as long as we have any active trackers. if (active.length > 0) { - setTimeout( + this.pollTimeout = setTimeout( () => this.pollTrackers(), this.refreshInterval); + } else { + this.pollTimeout = null; } } ); -- 2.11.0