diff --git a/src-ui/src/app/components/common/system-status-dialog/system-status-dialog.component.html b/src-ui/src/app/components/common/system-status-dialog/system-status-dialog.component.html index 5ec800b2e..2e30a5a24 100644 --- a/src-ui/src/app/components/common/system-status-dialog/system-status-dialog.component.html +++ b/src-ui/src/app/components/common/system-status-dialog/system-status-dialog.component.html @@ -168,16 +168,6 @@ } - @if (currentUserIsSuperUser) { - @if (isRunning(PaperlessTaskType.IndexOptimize)) { -
- } @else { - - } - } @if (status.tasks.index_status === 'OK') { diff --git a/src-ui/src/app/components/common/system-status-dialog/system-status-dialog.component.spec.ts b/src-ui/src/app/components/common/system-status-dialog/system-status-dialog.component.spec.ts index 58310be8f..29bad431e 100644 --- a/src-ui/src/app/components/common/system-status-dialog/system-status-dialog.component.spec.ts +++ b/src-ui/src/app/components/common/system-status-dialog/system-status-dialog.component.spec.ts @@ -138,9 +138,9 @@ describe('SystemStatusDialogComponent', () => { }) it('should check if task is running', () => { - component.runTask(PaperlessTaskType.IndexOptimize) - expect(component.isRunning(PaperlessTaskType.IndexOptimize)).toBeTruthy() - expect(component.isRunning(PaperlessTaskType.SanityCheck)).toBeFalsy() + component.runTask(PaperlessTaskType.SanityCheck) + expect(component.isRunning(PaperlessTaskType.SanityCheck)).toBeTruthy() + expect(component.isRunning(PaperlessTaskType.TrainClassifier)).toBeFalsy() }) it('should support running tasks, refresh status and show toasts', () => { @@ -151,22 +151,22 @@ describe('SystemStatusDialogComponent', () => { // fail first runSpy.mockReturnValue(throwError(() => new Error('error'))) - component.runTask(PaperlessTaskType.IndexOptimize) - expect(runSpy).toHaveBeenCalledWith(PaperlessTaskType.IndexOptimize) + component.runTask(PaperlessTaskType.SanityCheck) + expect(runSpy).toHaveBeenCalledWith(PaperlessTaskType.SanityCheck) expect(toastErrorSpy).toHaveBeenCalledWith( - `Failed to start task ${PaperlessTaskType.IndexOptimize}, see the logs for more details`, + `Failed to start task ${PaperlessTaskType.SanityCheck}, see the logs for more details`, expect.any(Error) ) // succeed runSpy.mockReturnValue(of({})) getStatusSpy.mockReturnValue(of(status)) - component.runTask(PaperlessTaskType.IndexOptimize) - expect(runSpy).toHaveBeenCalledWith(PaperlessTaskType.IndexOptimize) + component.runTask(PaperlessTaskType.SanityCheck) + expect(runSpy).toHaveBeenCalledWith(PaperlessTaskType.SanityCheck) expect(getStatusSpy).toHaveBeenCalled() expect(toastSpy).toHaveBeenCalledWith( - `Task ${PaperlessTaskType.IndexOptimize} started` + `Task ${PaperlessTaskType.SanityCheck} started` ) }) diff --git a/src/documents/migrations/0019_task_system_redesign.py b/src/documents/migrations/0019_task_system_redesign.py index 5fcb7b54b..85ba489f1 100644 --- a/src/documents/migrations/0019_task_system_redesign.py +++ b/src/documents/migrations/0019_task_system_redesign.py @@ -59,6 +59,7 @@ class Migration(migrations.Migration): ("consume_file", "Consume File"), ("train_classifier", "Train Classifier"), ("sanity_check", "Sanity Check"), + ("index_optimize", "Index Optimize"), ("mail_fetch", "Mail Fetch"), ("llm_index", "LLM Index"), ("empty_trash", "Empty Trash"), diff --git a/src/documents/models.py b/src/documents/models.py index 62f528f74..da51823ae 100644 --- a/src/documents/models.py +++ b/src/documents/models.py @@ -682,6 +682,7 @@ class PaperlessTask(ModelWithOwner): CONSUME_FILE = "consume_file", _("Consume File") TRAIN_CLASSIFIER = "train_classifier", _("Train Classifier") SANITY_CHECK = "sanity_check", _("Sanity Check") + INDEX_OPTIMIZE = "index_optimize", _("Index Optimize") MAIL_FETCH = "mail_fetch", _("Mail Fetch") LLM_INDEX = "llm_index", _("LLM Index") EMPTY_TRASH = "empty_trash", _("Empty Trash") diff --git a/src/documents/views.py b/src/documents/views.py index 73e5d1c1a..d56ced452 100644 --- a/src/documents/views.py +++ b/src/documents/views.py @@ -216,7 +216,6 @@ from documents.signals import document_updated from documents.tasks import build_share_link_bundle from documents.tasks import consume_file from documents.tasks import empty_trash -from documents.tasks import index_optimize from documents.tasks import llmindex_index from documents.tasks import sanity_check from documents.tasks import train_classifier @@ -3803,7 +3802,6 @@ class TasksViewSet(ReadOnlyModelViewSet[PaperlessTask]): } _RUNNABLE_TASKS = { - PaperlessTask.TaskType.INDEX_OPTIMIZE: (index_optimize, {}), PaperlessTask.TaskType.TRAIN_CLASSIFIER: (train_classifier, {}), PaperlessTask.TaskType.SANITY_CHECK: (sanity_check, {"raise_on_error": False}), PaperlessTask.TaskType.LLM_INDEX: (llmindex_index, {"rebuild": False}),