diff --git a/atdb/rollback.bat b/atdb/rollback.bat new file mode 100644 index 0000000000000000000000000000000000000000..dc8c5fa1f66a7a497acde7201e0f895bb36fccf0 --- /dev/null +++ b/atdb/rollback.bat @@ -0,0 +1 @@ +python manage.py migrate taskdatabase 0010 --settings=atdb.settings.dev \ No newline at end of file diff --git a/atdb/taskdatabase/models.py b/atdb/taskdatabase/models.py index e97856d8bb96b319e00b3c4b013199c6c8849912..4aa07ef4720b749b5f81cc72d3681786e8eb0969 100644 --- a/atdb/taskdatabase/models.py +++ b/atdb/taskdatabase/models.py @@ -145,3 +145,18 @@ class Monitor(models.Model): # the representation of the value in the REST API def __str__(self): return str(self.name)+' - '+str(self.timestamp) + ' - ' + self.status + + +class LatestMonitor(models.Model): + name = models.CharField(max_length=50, default="unknown") + type = models.CharField(max_length=20, default="ldv-service", null=True, blank=True) + timestamp = models.DateTimeField(default=datetime.utcnow, blank=True) + hostname = models.CharField(max_length=50, default="unknown") + process_id = models.IntegerField(null=True, blank=True) + description = models.CharField(max_length=255, blank=True, null=True) + status = models.CharField(max_length=50, default="ok", null=True) + metadata = models.JSONField(null=True, blank=True) + + # the representation of the value in the REST API + def __str__(self): + return str(self.name)+' - '+str(self.timestamp) + ' - ' + self.status \ No newline at end of file diff --git a/atdb/taskdatabase/services/algorithms.py b/atdb/taskdatabase/services/algorithms.py index a16903097fb4794f26f66686d03faf0326fb0e2b..f2784480371344954a1915765a2f37fd2aa8cd5c 100644 --- a/atdb/taskdatabase/services/algorithms.py +++ b/atdb/taskdatabase/services/algorithms.py @@ -209,10 +209,13 @@ def convert_monitor_to_html(monitor_data): key = record.name value = record.status filter = record.description - line = '<tr class="' + record.status + '" >' + line = '<tr>' + if "error" in record.status: + line = '<tr class="' + record.status + '" >' + line += "<td><b>" + str(record.name) + "</b></td>" line += "<td>" + str(record.hostname) + "</td>" - line += "<td>" + str(record.status) + "</td>" + line += '<td class="' + record.status + '" >' + str(record.status) + "</td>" line += "<td>" + str(record.timestamp) + "</td>" line += "<td>" + str(record.process_id) + "</td>" line += "<td>" + str(record.description) + "</td>" diff --git a/atdb/taskdatabase/static/taskdatabase/style.css b/atdb/taskdatabase/static/taskdatabase/style.css index 3b9a2cdd8e3d0050a07888175f669b9b195415c1..2bbe0efedf3e0b8d546fe28876bfd66fcbdac739 100644 --- a/atdb/taskdatabase/static/taskdatabase/style.css +++ b/atdb/taskdatabase/static/taskdatabase/style.css @@ -39,7 +39,7 @@ TD { font-weight: bold; } -.processed { +.processed,.ok { color: green; font-weight: bold; } diff --git a/atdb/taskdatabase/templates/taskdatabase/index.html b/atdb/taskdatabase/templates/taskdatabase/index.html index 60a3fc269d5c27ed015917d77834a487e53f12cf..9933d22e4c21ce310f3accb479aee5d2926829c7 100644 --- a/atdb/taskdatabase/templates/taskdatabase/index.html +++ b/atdb/taskdatabase/templates/taskdatabase/index.html @@ -80,7 +80,7 @@ {% include 'taskdatabase/pagination.html' %} </div> </div> - <p class="footer"> Version 1.0.0 (28 jan 2021 - 14:00) + <p class="footer"> Version 1.0.0 (31 jan 2021 - 10:00) </div> diff --git a/atdb/taskdatabase/views.py b/atdb/taskdatabase/views.py index af5af31dbdb4841bf36e914641fdc8e47fbad285..a1afc58587bd644268951d97438acee3f33e28c8 100644 --- a/atdb/taskdatabase/views.py +++ b/atdb/taskdatabase/views.py @@ -326,9 +326,9 @@ def WorkflowDetails(request, id): def ShowMonitoring(request): # get the latest value of each unique combination of service name and hostname. - monitor_data = Monitor.objects.all() + distinct_services_per_host = Monitor.objects.all().order_by('name', 'hostname', '-timestamp').distinct('name', 'hostname') - monitor_results = algorithms.convert_monitor_to_html(monitor_data) + monitor_results = algorithms.convert_monitor_to_html(distinct_services_per_host) return render(request, "taskdatabase/monitoring.html", {'monitor_results': monitor_results})