mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-28 18:24:38 -05:00
acknowledge_tasks endpoint & basic UI
Update tasks.service.ts
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
<use xlink:href="assets/bootstrap-icons.svg#x"/>
|
||||
</svg> <ng-container i18n>Clear selection</ng-container>
|
||||
</button>
|
||||
<button class="btn btn-sm btn-outline-primary me-4" (click)="dismissMany()" [disabled]="tasksService.total == 0">
|
||||
<button class="btn btn-sm btn-outline-primary me-4" (click)="dismissTasks()" [disabled]="tasksService.total == 0">
|
||||
<svg class="sidebaricon" fill="currentColor">
|
||||
<use xlink:href="assets/bootstrap-icons.svg#check2-all"/>
|
||||
</svg> <ng-container i18n>{{dismissButtonText}}</ng-container>
|
||||
|
@@ -30,11 +30,13 @@ export class TasksComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
dismissTask(task: PaperlessTask) {
|
||||
throw new Error('Not implemented' + task)
|
||||
this.dismissTasks(task)
|
||||
}
|
||||
|
||||
dismissMany() {
|
||||
throw new Error('Not implemented')
|
||||
dismissTasks(task: PaperlessTask = undefined) {
|
||||
this.tasksService.dismissTasks(
|
||||
task ? new Set([task.id]) : this.selectedTasks
|
||||
)
|
||||
}
|
||||
|
||||
toggleSelected(task: PaperlessTask) {
|
||||
|
@@ -1,6 +1,5 @@
|
||||
import { HttpClient } from '@angular/common/http'
|
||||
import { Injectable } from '@angular/core'
|
||||
import { Observable } from 'rxjs'
|
||||
import { first, map } from 'rxjs/operators'
|
||||
import { PaperlessTask } from 'src/app/data/paperless-task'
|
||||
import { environment } from 'src/environments/environment'
|
||||
@@ -43,7 +42,7 @@ export class TasksService {
|
||||
this.loading = true
|
||||
|
||||
this.http
|
||||
.get<TasksAPIResponse>(`${this.baseUrl}consumption_tasks/`)
|
||||
.get<TasksAPIResponse>(`${this.baseUrl}tasks/`)
|
||||
.pipe(first())
|
||||
.subscribe((r) => {
|
||||
this.total = r.total
|
||||
@@ -55,35 +54,14 @@ export class TasksService {
|
||||
})
|
||||
}
|
||||
|
||||
// private savedViews: PaperlessSavedView[] = []
|
||||
|
||||
// get allViews() {
|
||||
// return this.savedViews
|
||||
// }
|
||||
|
||||
// get sidebarViews() {
|
||||
// return this.savedViews.filter((v) => v.show_in_sidebar)
|
||||
// }
|
||||
|
||||
// get dashboardViews() {
|
||||
// return this.savedViews.filter((v) => v.show_on_dashboard)
|
||||
// }
|
||||
|
||||
// create(o: PaperlessSavedView) {
|
||||
// return super.create(o).pipe(tap(() => this.reload()))
|
||||
// }
|
||||
|
||||
// update(o: PaperlessSavedView) {
|
||||
// return super.update(o).pipe(tap(() => this.reload()))
|
||||
// }
|
||||
|
||||
// patchMany(objects: PaperlessSavedView[]): Observable<PaperlessSavedView[]> {
|
||||
// return combineLatest(objects.map((o) => super.patch(o))).pipe(
|
||||
// tap(() => this.reload())
|
||||
// )
|
||||
// }
|
||||
|
||||
// delete(o: PaperlessSavedView) {
|
||||
// return super.delete(o).pipe(tap(() => this.reload()))
|
||||
// }
|
||||
public dismissTasks(task_ids: Set<number>) {
|
||||
this.http
|
||||
.post(`${this.baseUrl}acknowledge_tasks/`, {
|
||||
tasks: [...task_ids],
|
||||
})
|
||||
.pipe(first())
|
||||
.subscribe((r) => {
|
||||
this.reload()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user