scheduled task deletion

This commit is contained in:
ayntk-ai
2024-08-30 20:33:12 +02:00
parent b807601d19
commit bff6964d4a
2 changed files with 16 additions and 5 deletions

View File

@@ -20,6 +20,8 @@ class Show extends Component
public string $type;
public string $scheduledTaskName;
protected $rules = [
'task.enabled' => 'required|boolean',
'task.name' => 'required|string',
@@ -49,6 +51,7 @@ class Show extends Component
$this->modalId = new Cuid2;
$this->task = ModelsScheduledTask::where('uuid', request()->route('task_uuid'))->first();
$this->scheduledTaskName = $this->task->name;
}
public function instantSave()
@@ -75,9 +78,9 @@ class Show extends Component
$this->task->delete();
if ($this->type == 'application') {
return redirect()->route('project.application.configuration', $this->parameters);
return redirect()->route('project.application.configuration', $this->parameters, $this->scheduledTaskName);
} else {
return redirect()->route('project.service.configuration', $this->parameters);
return redirect()->route('project.service.configuration', $this->parameters, $this->scheduledTaskName);
}
} catch (\Exception $e) {
return handleError($e);

View File

@@ -16,9 +16,17 @@
<x-forms.button type="submit">
Save
</x-forms.button>
<x-modal-confirmation isErrorButton buttonTitle="Delete Scheduled Task">
You will delete scheduled task <span class="font-bold dark:text-warning">{{ $task->name }}</span>.
</x-modal-confirmation>
<x-modal-confirmation
title="Confirm Scheduled Task Deletion?"
isErrorButton
buttonTitle="Delete"
isErrorButton
:actions="['You will delete the selected scheduled task.']"
confirmationLabel="Please confirm the execution of the actions by entering the Scheduled Task Name below"
shortConfirmationLabel="Scheduled Task Name"
confirmText="{{ $scheduledTaskName }}"
submitAction="delete({{ $task->id }})"
/>
</div>
<div class="w-48">
<x-forms.checkbox instantSave id="task.enabled" label="Enabled" />