diff --git a/src/app/tasks/supertasks/applyhashlist.component.html b/src/app/tasks/supertasks/applyhashlist.component.html
index 55b5c1e54..49b6915be 100644
--- a/src/app/tasks/supertasks/applyhashlist.component.html
+++ b/src/app/tasks/supertasks/applyhashlist.component.html
@@ -38,6 +38,11 @@
>
+
diff --git a/src/app/tasks/supertasks/applyhashlist.component.ts b/src/app/tasks/supertasks/applyhashlist.component.ts
index 1ab06cd6f..516dae6fa 100644
--- a/src/app/tasks/supertasks/applyhashlist.component.ts
+++ b/src/app/tasks/supertasks/applyhashlist.component.ts
@@ -30,6 +30,17 @@ export interface ApplyHashlistForm {
hashlistId: FormControl;
crackerBinaryId: FormControl;
crackerBinaryTypeId: FormControl;
+ skipCompleted: FormControl;
+}
+
+interface SkippedPretask {
+ pretaskId: number;
+ matchingTaskId: number;
+}
+
+interface CreateSupertaskMeta {
+ taskWrapperId: number | null;
+ skippedPretasks?: SkippedPretask[];
}
/**
@@ -119,7 +130,8 @@ export class ApplyHashlistComponent implements OnInit, OnDestroy {
supertaskTemplateId: new FormControl(null),
hashlistId: new FormControl(null),
crackerBinaryId: new FormControl(null),
- crackerBinaryTypeId: new FormControl(null)
+ crackerBinaryTypeId: new FormControl(null),
+ skipCompleted: new FormControl(false, { nonNullable: true })
});
}
@@ -135,7 +147,8 @@ export class ApplyHashlistComponent implements OnInit, OnDestroy {
supertaskTemplateId: new FormControl(this.editedIndex),
hashlistId: new FormControl(null),
crackerBinaryId: new FormControl(1),
- crackerBinaryTypeId: new FormControl(null)
+ crackerBinaryTypeId: new FormControl(null),
+ skipCompleted: new FormControl(false, { nonNullable: true })
});
//subscribe to changes to handle select cracker binary
@@ -252,13 +265,30 @@ export class ApplyHashlistComponent implements OnInit, OnDestroy {
const adaptedFormValue = {
supertaskTemplateId: formValue.supertaskTemplateId,
hashlistId: formValue.hashlistId,
- crackerVersionId: formValue.crackerBinaryTypeId
+ crackerVersionId: formValue.crackerBinaryTypeId,
+ skipCompleted: formValue.skipCompleted
};
- const onSubmitSubscription$ = this.gs.chelper(SERV.HELPER, 'createSupertask', adaptedFormValue).subscribe(() => {
- this.alert.showSuccessMessage('New SuperTask created');
- this.router.navigate(['tasks/show-tasks']);
- this.isCreatingLoading = false;
- });
+ const onSubmitSubscription$ = this.gs
+ .chelper>(SERV.HELPER, 'createSupertask', adaptedFormValue)
+ .subscribe({
+ next: (response) => {
+ const skipped = response?.meta?.skippedPretasks ?? [];
+ const allSkipped = response?.meta?.taskWrapperId == null;
+ if (skipped.length) {
+ this.alert.showInfoMessage(`Skipped ${skipped.length} pretask(s) already completed for this hashlist.`);
+ }
+ this.alert.showSuccessMessage(
+ allSkipped ? 'All pretasks already completed - no new SuperTask created.' : 'New SuperTask created'
+ );
+ this.router.navigate(['tasks/show-tasks']);
+ },
+ error: () => {
+ this.isCreatingLoading = false;
+ },
+ complete: () => {
+ this.isCreatingLoading = false;
+ }
+ });
this.unsubscribeService.add(onSubmitSubscription$);
} else {
this.form.markAllAsTouched();