Merge branch 'bugfix/task-scheduling' into 'dev'

Add command to default actions

See merge request crafty-controller/crafty-4!586
This commit is contained in:
Iain Powrie 2023-05-23 00:20:23 +00:00
commit dfef879ef4
2 changed files with 8 additions and 4 deletions

View File

@ -3,9 +3,9 @@
### New features ### New features
TBD TBD
### Bug fixes ### Bug fixes
TBD - Fix task scheduling where a command was not sent to the DB ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/586))
### Tweaks ### Tweaks
- Improve the UI on several areas of the Crafty Panel ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/547)) - Improve the UI on several areas of the Crafty Panel ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/547))
### Lang ### Lang
TBD TBD
<br><br> <br><br>

View File

@ -273,6 +273,9 @@
if ($("#difficulty").val() == "reaction"){ if ($("#difficulty").val() == "reaction"){
formDataObject.interval_type = "reaction"; formDataObject.interval_type = "reaction";
} }
if ($("action").val() != "command"){
formDataObject.command = formDataObject.action + "_server";
}
if (formDataObject.cron_string != ""){ if (formDataObject.cron_string != ""){
formDataObject.interval_type = ''; formDataObject.interval_type = '';
} }
@ -280,8 +283,6 @@
// Format the plain form data as JSON // Format the plain form data as JSON
let formDataJsonString = JSON.stringify(formDataObject, replacer); let formDataJsonString = JSON.stringify(formDataObject, replacer);
console.log(formDataJsonString);
let res = await fetch(`/api/v2/servers/${serverId}/tasks/`, { let res = await fetch(`/api/v2/servers/${serverId}/tasks/`, {
method: 'POST', method: 'POST',
headers: { headers: {
@ -317,6 +318,9 @@
if ($("#difficulty").val() == "reaction"){ if ($("#difficulty").val() == "reaction"){
formDataObject.interval_type = "reaction"; formDataObject.interval_type = "reaction";
} }
if ($("#action").val() != "command"){
formDataObject.command = formDataObject.action + "_server";
}
if (formDataObject.cron_string != ""){ if (formDataObject.cron_string != ""){
formDataObject.interval_type = ''; formDataObject.interval_type = '';
} }