<div class="row">
<div class="col-lg-6">
<div class="alert alert-info">
- <span i18n>No Imports In Progress</span>
+ <span i18n>No Import Sessions To Display</span>
</div>
</div>
</div>
</div>
- <div class="row" *ngFor="let tracker of trackers">
+ <div class="row mb-4" *ngFor="let tracker of trackers">
<div class="col-lg-12">
<div class="card tight-card">
<div class="card-header">
</div>
</div>
<div class="card-body">
- <div class="list-group">
- <div class="list-group-item border-0 p-2">
+ <div class="row">
+ <div class="col-lg-6">
+ <!-- ensure the progress shows 100% when complete -->
+ <eg-progress-inline
+ [max]="tracker.state() == 'complete' ? tracker.actions_performed() : tracker.total_actions() || null"
+ [value]="tracker.actions_performed()">
+ </eg-progress-inline>
+ </div>
+ <div class="col-lg-6">
<!-- .id (not .id()) check to see if it's fleshed yet -->
<span i18n *ngIf="tracker.queue().id">
<a class="font-weight-bold"
<span class="material-icons text-success">thumb_up</span>
</span>
</div>
- <div class="list-group-item border-0 p-2">
- <!-- ensure the progress shows 100% when complete -->
- <eg-progress-inline
- [max]="tracker.state() == 'complete' ? tracker.actions_performed() : tracker.total_actions() || null"
- [value]="tracker.actions_performed()">
- </eg-progress-inline>
- </div>
</div>
</div>
</div>
trackers: IdlObject[];
refreshInterval = 2000; // ms
sinceDate: string;
+ pollTimeout: any;
constructor(
private idl: IdlService,
}
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() {
// 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;
}
}
);