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

View File

@@ -16,9 +16,17 @@
<x-forms.button type="submit"> <x-forms.button type="submit">
Save Save
</x-forms.button> </x-forms.button>
<x-modal-confirmation isErrorButton buttonTitle="Delete Scheduled Task"> <x-modal-confirmation
You will delete scheduled task <span class="font-bold dark:text-warning">{{ $task->name }}</span>. title="Confirm Scheduled Task Deletion?"
</x-modal-confirmation> 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>
<div class="w-48"> <div class="w-48">
<x-forms.checkbox instantSave id="task.enabled" label="Enabled" /> <x-forms.checkbox instantSave id="task.enabled" label="Enabled" />