</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/admin/tasks/tasks.component.ts</context>
- <context context-type="linenumber">30</context>
+ <context context-type="linenumber">31</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/admin/trash/trash.component.html</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/admin/tasks/tasks.component.ts</context>
- <context context-type="linenumber">122</context>
+ <context context-type="linenumber">129</context>
</context-group>
</trans-unit>
<trans-unit id="2134950584701094962" datatype="html">
<source>Result</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/admin/tasks/tasks.component.ts</context>
- <context context-type="linenumber">31</context>
+ <context context-type="linenumber">32</context>
</context-group>
</trans-unit>
<trans-unit id="5404910960991552159" datatype="html">
<source>Dismiss selected</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/admin/tasks/tasks.component.ts</context>
- <context context-type="linenumber">75</context>
+ <context context-type="linenumber">76</context>
</context-group>
</trans-unit>
<trans-unit id="8829078752502782653" datatype="html">
<source>Dismiss all</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/admin/tasks/tasks.component.ts</context>
- <context context-type="linenumber">76</context>
+ <context context-type="linenumber">77</context>
</context-group>
</trans-unit>
<trans-unit id="1323591410517879795" datatype="html">
<source>Confirm Dismiss All</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/admin/tasks/tasks.component.ts</context>
- <context context-type="linenumber">119</context>
+ <context context-type="linenumber">126</context>
</context-group>
</trans-unit>
<trans-unit id="4157200209636243740" datatype="html">
<source>Dismiss all <x id="PH" equiv-text="tasks.size"/> tasks?</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/admin/tasks/tasks.component.ts</context>
- <context context-type="linenumber">120</context>
+ <context context-type="linenumber">127</context>
</context-group>
</trans-unit>
<trans-unit id="9011556615675272238" datatype="html">
<source>queued</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/admin/tasks/tasks.component.ts</context>
- <context context-type="linenumber">205</context>
+ <context context-type="linenumber">212</context>
</context-group>
</trans-unit>
<trans-unit id="6415892379431855826" datatype="html">
<source>started</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/admin/tasks/tasks.component.ts</context>
- <context context-type="linenumber">207</context>
+ <context context-type="linenumber">214</context>
</context-group>
</trans-unit>
<trans-unit id="7510279840486540181" datatype="html">
<source>completed</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/admin/tasks/tasks.component.ts</context>
- <context context-type="linenumber">209</context>
+ <context context-type="linenumber">216</context>
</context-group>
</trans-unit>
<trans-unit id="4083337005045748464" datatype="html">
<source>failed</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/admin/tasks/tasks.component.ts</context>
- <context context-type="linenumber">211</context>
+ <context context-type="linenumber">218</context>
</context-group>
</trans-unit>
<trans-unit id="3418677553313974490" datatype="html">
ChangeDetectorRef,
OnDestroy,
} from '@angular/core'
-import { takeUntil } from 'rxjs'
+import { filter, takeUntil, timer } from 'rxjs'
import { LogService } from 'src/app/services/rest/log.service'
import { LoadingComponentWithPermissions } from '../../loading-component/loading.component'
public activeLog: string
- public autoRefreshInterval: any
+ public autoRefreshEnabled: boolean = true
@ViewChild('logContainer') logContainer: ElementRef
this.activeLog = this.logFiles[0]
this.reloadLogs()
}
- this.toggleAutoRefresh()
+ timer(5000, 5000)
+ .pipe(
+ filter(() => this.autoRefreshEnabled),
+ takeUntil(this.unsubscribeNotifier)
+ )
+ .subscribe(() => {
+ this.reloadLogs()
+ })
})
}
ngOnDestroy(): void {
super.ngOnDestroy()
- clearInterval(this.autoRefreshInterval)
}
reloadLogs() {
behavior: 'auto',
})
}
-
- toggleAutoRefresh(): void {
- if (this.autoRefreshInterval) {
- clearInterval(this.autoRefreshInterval)
- this.autoRefreshInterval = null
- } else {
- this.autoRefreshInterval = setInterval(() => {
- this.reloadLogs()
- }, 5000)
- }
- }
}
first,
Subject,
takeUntil,
+ timer,
} from 'rxjs'
import { PaperlessTask } from 'src/app/data/paperless-task'
import { TasksService } from 'src/app/services/tasks.service'
public pageSize: number = 25
public page: number = 1
- public autoRefreshInterval: any
+ public autoRefreshEnabled: boolean = true
private _filterText: string = ''
get filterText() {
ngOnInit() {
this.tasksService.reload()
- this.toggleAutoRefresh()
+ timer(5000, 5000)
+ .pipe(
+ filter(() => this.autoRefreshEnabled),
+ takeUntil(this.unsubscribeNotifier)
+ )
+ .subscribe(() => {
+ this.tasksService.reload()
+ })
this.filterDebounce
.pipe(
ngOnDestroy() {
super.ngOnDestroy()
this.tasksService.cancelPending()
- clearInterval(this.autoRefreshInterval)
}
dismissTask(task: PaperlessTask) {
}
}
- toggleAutoRefresh(): void {
- if (this.autoRefreshInterval) {
- clearInterval(this.autoRefreshInterval)
- this.autoRefreshInterval = null
- } else {
- this.autoRefreshInterval = setInterval(() => {
- this.tasksService.reload()
- }, 5000)
- }
- }
-
public resetFilter() {
this._filterText = ''
}