Add enabled field to aggregator

This commit is contained in:
Mark Veidemanis 2023-03-07 17:02:09 +00:00
parent 8112119b7e
commit 3699fff272
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
4 changed files with 34 additions and 0 deletions

View File

@ -63,6 +63,7 @@ class AggregatorForm(RestrictedFormMixin, ModelForm):
"secret_id",
"secret_key",
"poll_interval",
"enabled",
)
help_texts = {
"name": "The name of the aggregator connection.",
@ -70,4 +71,5 @@ class AggregatorForm(RestrictedFormMixin, ModelForm):
"secret_id": "The secret ID for the aggregator service.",
"secret_key": "The secret key for the aggregator service.",
"poll_interval": "The interval in seconds to poll the aggregator service.",
"enabled": "Whether or not the aggregator connection is enabled.",
}

View File

@ -0,0 +1,18 @@
# Generated by Django 4.1.7 on 2023-03-07 17:01
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0002_alter_notificationsettings_user_aggregator'),
]
operations = [
migrations.AddField(
model_name='aggregator',
name='enabled',
field=models.BooleanField(default=True),
),
]

View File

@ -43,3 +43,5 @@ class Aggregator(models.Model):
secret_key = models.CharField(max_length=1024, null=True, blank=True)
access_token = models.CharField(max_length=1024, null=True, blank=True)
poll_interval = models.IntegerField(default=10)
enabled = models.BooleanField(default=True)

View File

@ -15,6 +15,7 @@
<th>user</th>
<th>name</th>
<th>service</th>
<th>enabled</th>
<th>actions</th>
</thead>
{% for item in object_list %}
@ -31,6 +32,17 @@
<td>{{ item.user }}</td>
<td>{{ item.name }}</td>
<td>{{ item.get_service_display }}</td>
<td>
{% if item.enabled %}
<span class="icon">
<i class="fa-solid fa-check"></i>
</span>
{% else %}
<span class="icon">
<i class="fa-solid fa-xmark"></i>
</span>
{% endif %}
</td>
<td>
<div class="buttons">
<button