Skip to content

Commit 9ed8c5d

Browse files
authored
Merge branch 'wh1te909:develop' into develop
2 parents 5a541b0 + a2fac5d commit 9ed8c5d

File tree

6 files changed

+68
-10
lines changed

6 files changed

+68
-10
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 3.2.11 on 2022-01-09 21:27
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('autotasks', '0027_auto_20220107_0643'),
10+
]
11+
12+
operations = [
13+
migrations.AlterField(
14+
model_name='automatedtask',
15+
name='actions',
16+
field=models.JSONField(default=list),
17+
),
18+
]
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 3.2.10 on 2022-01-10 01:48
2+
3+
from django.db import migrations, models
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
('autotasks', '0028_alter_automatedtask_actions'),
10+
]
11+
12+
operations = [
13+
migrations.AlterField(
14+
model_name='automatedtask',
15+
name='task_type',
16+
field=models.CharField(choices=[('daily', 'Daily'), ('weekly', 'Weekly'), ('monthly', 'Monthly'), ('monthlydow', 'Monthly Day of Week'), ('checkfailure', 'On Check Failure'), ('manual', 'Manual'), ('runonce', 'Run Once'), ('scheduled', 'Scheduled')], default='manual', max_length=100),
17+
),
18+
]

api/tacticalrmm/autotasks/models.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
("checkfailure", "On Check Failure"),
3333
("manual", "Manual"),
3434
("runonce", "Run Once"),
35+
("scheduled", "Scheduled"), # deprecated
3536
]
3637

3738
SYNC_STATUS_CHOICES = [

api/tacticalrmm/core/management/commands/post_update_tasks.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import base64
22
from django.core.management.base import BaseCommand
3+
import datetime as dt
34

45
from logs.models import PendingAction
56
from scripts.models import Script
@@ -35,8 +36,18 @@ def handle(self, *args, **kwargs):
3536
# script.hash_script_body() # also saves script
3637
script.save(update_fields=["script_body"])
3738

38-
# convert autotask actions to the new format
39+
# convert autotask to the new format
3940
for task in AutomatedTask.objects.all():
41+
edited = False
42+
43+
# convert scheduled task_type
44+
if task.task_type == "scheduled":
45+
task.task_type = "daily"
46+
task.run_time_date = dt.datetime.strptime(task.run_time_minute, "%H:%M")
47+
task.daily_interval = 1
48+
edited = True
49+
50+
# convert actions
4051
if not task.actions:
4152
task.actions = [
4253
{
@@ -47,4 +58,7 @@ def handle(self, *args, **kwargs):
4758
"name": task.script.name,
4859
}
4960
]
61+
edited = True
62+
63+
if edited:
5064
task.save()

docker/containers/tactical-nats/entrypoint.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ config_watcher="$(cat << EOF
2323
while true; do
2424
sleep ${NATS_CONFIG_CHECK_INTERVAL};
2525
if [[ ! -z \${NATS_CHECK} ]]; then
26-
NATS_RELOAD=\$(date -r '/opt/tactical/api/nats-rmm.conf')
26+
NATS_RELOAD=\$(date -r '${NATS_CONFIG}')
2727
if [[ \$NATS_RELOAD == \$NATS_CHECK ]]; then
2828
:
2929
else
3030
nats-server --signal reload;
31-
NATS_CHECK=\$(date -r '/opt/tactical/api/nats-rmm.conf');
31+
NATS_CHECK=\$(date -r '${NATS_CONFIG}');
3232
fi
33-
else NATS_CHECK=\$(date -r '/opt/tactical/api/nats-rmm.conf');
33+
else NATS_CHECK=\$(date -r '${NATS_CONFIG}');
3434
fi
3535
done
3636

web/src/components/tasks/AutomatedTaskForm.vue

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,16 @@
2626
/>
2727
</q-card-section>
2828
<q-card-section>
29-
<q-checkbox dense label="Collector Task" v-model="collector" class="q-pb-sm" />
29+
<q-checkbox
30+
dense
31+
label="Collector Task"
32+
v-model="collector"
33+
class="q-pb-sm"
34+
@update:model-value="
35+
state.custom_field = null;
36+
state.collector_all_output = false;
37+
"
38+
/>
3039
<tactical-dropdown
3140
v-if="collector"
3241
:rules="[val => !!val || '*Required']"
@@ -567,7 +576,7 @@
567576
/>
568577
<q-btn
569578
v-else
570-
label="Add Task"
579+
:label="task ? 'Edit Task' : 'Add Task'"
571580
color="primary"
572581
@click="validateStep($refs.taskDetailForm, $refs.stepper)"
573582
:loading="loading"
@@ -875,10 +884,8 @@ export default {
875884
}
876885
);
877886
878-
watch(collector, (newValue, oldValue) => {
879-
task.value.custom_field = null;
880-
task.value.collector_all_ouput = false;
881-
});
887+
// check the collector box when editing task and custom field is set
888+
if (props.task && props.task.custom_field) collector.value = true;
882889
883890
// stepper logic
884891
const step = ref(1);

0 commit comments

Comments
 (0)