mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Task results popover
fix merge
This commit is contained in:
		| @@ -27,29 +27,40 @@ | |||||||
|   <table class="table table-striped align-middle border shadow-sm"> |   <table class="table table-striped align-middle border shadow-sm"> | ||||||
|     <thead> |     <thead> | ||||||
|       <tr> |       <tr> | ||||||
|         <th> |         <th scope="col"> | ||||||
|           <div class="form-check"> |           <div class="form-check"> | ||||||
|             <input type="checkbox" class="form-check-input" id="all-tasks" [disabled]="currentTasks.length == 0" (click)="toggleAll($event); $event.stopPropagation();"> |             <input type="checkbox" class="form-check-input" id="all-tasks" [disabled]="currentTasks.length == 0" (click)="toggleAll($event); $event.stopPropagation();"> | ||||||
|             <label class="form-check-label" for="all-tasks"></label> |             <label class="form-check-label" for="all-tasks"></label> | ||||||
|           </div> |           </div> | ||||||
|         </th> |         </th> | ||||||
|         <th scope="col" i18n>Name</th> |         <th scope="col" width="25%" i18n>Name</th> | ||||||
|         <th scope="col" i18n>Created</th> |         <th scope="col" width="20%" i18n>Created</th> | ||||||
|         <th scope="col" i18n>Actions</th> |         <th scope="col" width="45%" i18n>Results</th> | ||||||
|  |         <th scope="col" width="10%" i18n>Actions</th> | ||||||
|       </tr> |       </tr> | ||||||
|     </thead> |     </thead> | ||||||
|     <tbody> |     <tbody> | ||||||
|       <tr *ngFor="let task of tasks"> |       <tr *ngFor="let task of tasks"> | ||||||
|         <td> |         <th> | ||||||
|           <div class="form-check"> |           <div class="form-check"> | ||||||
|             <input type="checkbox" class="form-check-input" id="task{{task.id}}" [checked]="selectedTasks.has(task.id)" (click)="toggleSelected(task, $event); $event.stopPropagation();"> |             <input type="checkbox" class="form-check-input" id="task{{task.id}}" [checked]="selectedTasks.has(task.id)" (click)="toggleSelected(task, $event); $event.stopPropagation();"> | ||||||
|             <label class="form-check-label" for="task{{task.id}}"></label> |             <label class="form-check-label" for="task{{task.id}}"></label> | ||||||
|           </div> |           </div> | ||||||
|  |         </th> | ||||||
|  |         <td>{{ task.name }}</td> | ||||||
|  |         <td>{{ task.created | customDate:'short' }}</td> | ||||||
|  |         <td> | ||||||
|  |           <div class="text-primary" *ngIf="task.result.length > 50" [ngbPopover]="resultPopover" popoverClass="shadow font-monospace small" triggers="mouseenter:mouseleave:click"> | ||||||
|  |             <svg fill="currentColor" class="me-2" width="1.2em" height="1.2em" style="vertical-align: text-top;" viewBox="0 0 16 16"> | ||||||
|  |               <use xlink:href="assets/bootstrap-icons.svg#info-circle" /> | ||||||
|  |             </svg> | ||||||
|  |             <span class="small d-none d-md-inline-block font-monospace text-muted">{{ task.result | slice:0:50 }}…</span> | ||||||
|  |           </div> | ||||||
|  |           <span *ngIf="task.result.length <= 50" class="small d-none d-md-inline-block font-monospace">{{ task.result | slice:0:50 }}</span> | ||||||
|  |           <ng-template #resultPopover><div class="small">{{ task.result }}</div></ng-template> | ||||||
|         </td> |         </td> | ||||||
|         <td scope="row">{{ task.name }}</td> |  | ||||||
|         <td scope="row">{{ task.created | customDate:'medium' }}</td> |  | ||||||
|         <td scope="row"> |         <td scope="row"> | ||||||
|           <button class="btn btn-sm btn-outline-secondary" (click)="dismissTask(task)"> |           <button class="btn btn-sm btn-outline-secondary" (click)="acknowledgeTask(task)"> | ||||||
|             <svg class="sidebaricon" fill="currentColor"> |             <svg class="sidebaricon" fill="currentColor"> | ||||||
|               <use xlink:href="assets/bootstrap-icons.svg#check"/> |               <use xlink:href="assets/bootstrap-icons.svg#check"/> | ||||||
|             </svg> <ng-container i18n>Dismiss</ng-container> |             </svg> <ng-container i18n>Dismiss</ng-container> | ||||||
|   | |||||||
| @@ -0,0 +1,3 @@ | |||||||
|  | ::ng-deep .popover { | ||||||
|  |     max-width: 50%; | ||||||
|  | } | ||||||
| @@ -24,4 +24,6 @@ export interface PaperlessTask extends ObjectWithId { | |||||||
|   name: string |   name: string | ||||||
|  |  | ||||||
|   created: Date |   created: Date | ||||||
|  |  | ||||||
|  |   result: string | ||||||
| } | } | ||||||
|   | |||||||
| @@ -610,6 +610,14 @@ class TasksViewSerializer(serializers.ModelSerializer): | |||||||
|         # just file tasks, for now |         # just file tasks, for now | ||||||
|         return "file" |         return "file" | ||||||
|  |  | ||||||
|  |     result = serializers.SerializerMethodField() | ||||||
|  |  | ||||||
|  |     def get_result(self, obj): | ||||||
|  |         result = "" | ||||||
|  |         if hasattr(obj, "attempted_task"): | ||||||
|  |             result = obj.attempted_task.result | ||||||
|  |         return result | ||||||
|  |  | ||||||
|     status = serializers.SerializerMethodField() |     status = serializers.SerializerMethodField() | ||||||
|  |  | ||||||
|     def get_status(self, obj): |     def get_status(self, obj): | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Michael Shamoon
					Michael Shamoon