forked from GithubBackups/healthchecks
Checks have a "Description" field. Fixes #182
This commit is contained in:
parent
0a50962f2b
commit
7046e2410c
@ -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.
|
||||
- C# usage example.
|
||||
- Checks have a "Description" field.
|
18
hc/api/migrations/0041_check_desc.py
Normal file
18
hc/api/migrations/0041_check_desc.py
Normal file
@ -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),
|
||||
),
|
||||
]
|
@ -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",
|
||||
|
@ -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 = []
|
||||
|
@ -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", ""):
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
#update-name-modal .modal-body {
|
||||
padding: 15px 40px;
|
||||
}
|
||||
|
@ -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();
|
||||
|
||||
|
@ -19,6 +19,15 @@
|
||||
|
||||
|
||||
<div class="col-sm-5">
|
||||
|
||||
{% if check.desc %}
|
||||
<div class="details-block">
|
||||
<h2>Description</h2>
|
||||
{{ check.desc|linebreaks|urlize }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
<div class="details-block">
|
||||
<h2>How To Ping</h2>
|
||||
<div>
|
||||
|
@ -52,8 +52,9 @@
|
||||
</td>
|
||||
<td>
|
||||
<div data-name="{{ check.name }}"
|
||||
data-tags="{{ check.tags }}"
|
||||
class="my-checks-name {% if not check.name %}unnamed{% endif %}">
|
||||
data-tags="{{ check.tags }}"
|
||||
data-desc="{{ check.desc }}"
|
||||
class="my-checks-name {% if not check.name %}unnamed{% endif %}">
|
||||
<div>{{ check.name|default:"unnamed"|break_underscore }}</div>
|
||||
{% for tag in check.tags_list %}
|
||||
<span class="label label-tag">{{ tag }}</span>
|
||||
|
@ -16,7 +16,7 @@
|
||||
<label for="update-name-input" class="col-sm-2 control-label">
|
||||
Name
|
||||
</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="col-sm-10">
|
||||
<input
|
||||
id="update-name-input"
|
||||
name="name"
|
||||
@ -36,7 +36,7 @@
|
||||
<label for="update-tags-input" class="col-sm-2 control-label">
|
||||
Tags
|
||||
</label>
|
||||
<div class="col-sm-9">
|
||||
<div class="col-sm-10">
|
||||
<input
|
||||
id="update-tags-input"
|
||||
name="tags"
|
||||
@ -51,6 +51,19 @@
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="update-desc-input" class="col-sm-2 control-label">
|
||||
Description
|
||||
</label>
|
||||
<div class="col-sm-10">
|
||||
<textarea
|
||||
id="update-desc-input"
|
||||
class="form-control"
|
||||
rows="5"
|
||||
name="desc">{{ check.desc }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
||||
|
Loading…
x
Reference in New Issue
Block a user