diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d76ee2c..b7abb9a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,4 +6,5 @@ All notable changes to this project will be documented in this file. ### Improvements - A new "Check Details" page. - Updated django-compressor, psycopg2, pytz, requests package versions. -- C# usage example. \ No newline at end of file +- C# usage example. +- Checks have a "Description" field. \ No newline at end of file diff --git a/hc/api/migrations/0041_check_desc.py b/hc/api/migrations/0041_check_desc.py new file mode 100644 index 00000000..5e28682e --- /dev/null +++ b/hc/api/migrations/0041_check_desc.py @@ -0,0 +1,18 @@ +# Generated by Django 2.1 on 2018-08-20 14:43 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0040_auto_20180517_1336'), + ] + + operations = [ + migrations.AddField( + model_name='check', + name='desc', + field=models.TextField(blank=True), + ), + ] diff --git a/hc/api/models.py b/hc/api/models.py index 969c41a4..fcebe56b 100644 --- a/hc/api/models.py +++ b/hc/api/models.py @@ -60,6 +60,7 @@ class Check(models.Model): name = models.CharField(max_length=100, blank=True) tags = models.CharField(max_length=500, blank=True) code = models.UUIDField(default=uuid.uuid4, editable=False, db_index=True) + desc = models.TextField(blank=True) user = models.ForeignKey(User, models.CASCADE, blank=True, null=True) created = models.DateTimeField(auto_now_add=True) kind = models.CharField(max_length=10, default="simple", diff --git a/hc/front/forms.py b/hc/front/forms.py index 95307dc9..2098f12c 100644 --- a/hc/front/forms.py +++ b/hc/front/forms.py @@ -11,6 +11,7 @@ from hc.front.validators import (CronExpressionValidator, TimezoneValidator, class NameTagsForm(forms.Form): name = forms.CharField(max_length=100, required=False) tags = forms.CharField(max_length=500, required=False) + desc = forms.CharField(required=False) def clean_tags(self): result = [] diff --git a/hc/front/views.py b/hc/front/views.py index 54d3b261..719120ee 100644 --- a/hc/front/views.py +++ b/hc/front/views.py @@ -209,6 +209,7 @@ def update_name(request, code): if form.is_valid(): check.name = form.cleaned_data["name"] check.tags = form.cleaned_data["tags"] + check.desc = form.cleaned_data["desc"] check.save() if "/details/" in request.META.get("HTTP_REFERER", ""): diff --git a/static/css/my_checks.css b/static/css/my_checks.css index 79d6d559..969ce0d3 100644 --- a/static/css/my_checks.css +++ b/static/css/my_checks.css @@ -28,11 +28,15 @@ } @media (min-width: 992px) { - #update-timeout-modal .modal-dialog, #ping-details-modal .modal-dialog { + #update-timeout-modal .modal-dialog, #ping-details-modal .modal-dialog { width: 800px; } + #update-name-modal .modal-dialog { + width: 650px; + } } + #update-timeout-form .modal-body { padding-top: 35px; } @@ -182,4 +186,8 @@ text-align: center; margin-top: 10px; font-size: 12px; -} \ No newline at end of file +} + +#update-name-modal .modal-body { + padding: 15px 40px; +} diff --git a/static/js/checks.js b/static/js/checks.js index 719466ec..b49c00af 100644 --- a/static/js/checks.js +++ b/static/js/checks.js @@ -7,6 +7,7 @@ $(function () { $("#update-name-form").attr("action", url); $("#update-name-input").val(this.dataset.name); $("#update-tags-input").val(this.dataset.tags); + $("#update-desc-input").val(this.dataset.desc); $('#update-name-modal').modal("show"); $("#update-name-input").focus(); diff --git a/templates/front/details.html b/templates/front/details.html index a93577e8..8040203c 100644 --- a/templates/front/details.html +++ b/templates/front/details.html @@ -19,6 +19,15 @@