From 5d6e6f9441c8ca692befedc7f20777e3ad46eda0 Mon Sep 17 00:00:00 2001 From: wh1te909 Date: Mon, 29 Mar 2021 11:14:04 +0000 Subject: [PATCH] fix custom fields --- .../migrations/0017_auto_20210329_1050.py | 24 ++++++++++++++++ api/tacticalrmm/core/models.py | 7 +++++ .../modals/coresettings/CustomFieldsForm.vue | 28 ++++++++++++++++--- .../modals/coresettings/CustomFieldsTable.vue | 19 +++++++++++-- 4 files changed, 71 insertions(+), 7 deletions(-) create mode 100644 api/tacticalrmm/core/migrations/0017_auto_20210329_1050.py diff --git a/api/tacticalrmm/core/migrations/0017_auto_20210329_1050.py b/api/tacticalrmm/core/migrations/0017_auto_20210329_1050.py new file mode 100644 index 00000000..47770302 --- /dev/null +++ b/api/tacticalrmm/core/migrations/0017_auto_20210329_1050.py @@ -0,0 +1,24 @@ +# Generated by Django 3.1.7 on 2021-03-29 10:50 + +import django.contrib.postgres.fields +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('core', '0016_auto_20210319_1536'), + ] + + operations = [ + migrations.AddField( + model_name='customfield', + name='checkbox_value', + field=models.BooleanField(default=False), + ), + migrations.AddField( + model_name='customfield', + name='default_values_multiple', + field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(blank=True, max_length=255, null=True), blank=True, default=list, null=True, size=None), + ), + ] diff --git a/api/tacticalrmm/core/models.py b/api/tacticalrmm/core/models.py index 3a6f0a75..40f958b2 100644 --- a/api/tacticalrmm/core/models.py +++ b/api/tacticalrmm/core/models.py @@ -244,6 +244,13 @@ class CustomField(models.Model): name = models.TextField(null=True, blank=True) default_value = models.TextField(null=True, blank=True) required = models.BooleanField(blank=True, default=False) + checkbox_value = models.BooleanField(default=False) + default_values_multiple = ArrayField( + models.CharField(max_length=255, null=True, blank=True), + null=True, + blank=True, + default=list, + ) class Meta: unique_together = (("model", "name"),) diff --git a/web/src/components/modals/coresettings/CustomFieldsForm.vue b/web/src/components/modals/coresettings/CustomFieldsForm.vue index 7640a59d..c516b60f 100644 --- a/web/src/components/modals/coresettings/CustomFieldsForm.vue +++ b/web/src/components/modals/coresettings/CustomFieldsForm.vue @@ -49,6 +49,10 @@ hide-dropdown-icon input-debounce="0" new-value-mode="add" + @input=" + localField.default_value = ''; + localField.default_values_multiple = []; + " /> @@ -87,23 +91,35 @@ - + + + + - + + {{ props.row.checkbox_value }} + + + {{ props.row.default_values_multiple }} + + {{ props.row.default_value }} @@ -65,7 +71,7 @@