aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack
diff options
context:
space:
mode:
Diffstat (limited to 'ctrack')
-rw-r--r--ctrack/core/views.py5
-rw-r--r--ctrack/organisations/migrations/0008_auto_20200529_1545.py38
-rw-r--r--ctrack/organisations/models.py40
-rw-r--r--ctrack/templates/pages/stakeholder_home.html38
4 files changed, 81 insertions, 40 deletions
diff --git a/ctrack/core/views.py b/ctrack/core/views.py
index b80d212..4584612 100644
--- a/ctrack/core/views.py
+++ b/ctrack/core/views.py
@@ -1,7 +1,7 @@
from django.contrib.auth.decorators import login_required
from django.shortcuts import render
-from ctrack.organisations.models import Organisation
+from ctrack.organisations.models import IncidentReport, Organisation
@login_required
@@ -10,11 +10,12 @@ def home_page(request):
org = Organisation.objects.get(
name=request.user.stakeholder.person.get_organisation_name()
)
+ irs = IncidentReport.objects.filter(organisation=org)
systems = org.applicablesystem_set.all()
return render(
request,
"pages/stakeholder_home.html",
- context={"org": org, "systems": systems},
+ context={"org": org, "systems": systems, "irs": irs},
)
else:
return render(request, "pages/home.html")
diff --git a/ctrack/organisations/migrations/0008_auto_20200529_1545.py b/ctrack/organisations/migrations/0008_auto_20200529_1545.py
new file mode 100644
index 0000000..1c4cec6
--- /dev/null
+++ b/ctrack/organisations/migrations/0008_auto_20200529_1545.py
@@ -0,0 +1,38 @@
+# Generated by Django 2.2.12 on 2020-05-29 15:45
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('organisations', '0007_auto_20200529_1520'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='incidentreport',
+ name='date_time_incident_detected',
+ field=models.DateTimeField(verbose_name='Date/Time incident detected'),
+ ),
+ migrations.AlterField(
+ model_name='incidentreport',
+ name='dft_handle_status',
+ field=models.CharField(choices=[('QUEUED', 'QUEUED'), ('REVIEWING', 'REVIEWING'), ('WAITING', 'WAITING'), ('COMPLETED', 'COMPLETED')], default='QUEUED', max_length=20),
+ ),
+ migrations.AlterField(
+ model_name='incidentreport',
+ name='incident_stage',
+ field=models.CharField(choices=[('Ongoing', 'Ongoing'), ('Ended', 'Ended'), ('Ongoing but managed', 'Ongoing but managed')], max_length=20),
+ ),
+ migrations.AlterField(
+ model_name='incidentreport',
+ name='incident_status',
+ field=models.CharField(choices=[('Detected', 'Detected'), ('Suspected', 'Suspected'), ('Resolved', 'Resolved')], max_length=20),
+ ),
+ migrations.AlterField(
+ model_name='incidentreport',
+ name='incident_type',
+ field=models.CharField(choices=[('Cyber', 'Cyber'), ('Non-Cyber', 'Non-Cyber'), ('Both', 'Both'), ('Power Outage', 'Power Outage')], help_text='This can be appoximate', max_length=20),
+ ),
+ ]
diff --git a/ctrack/organisations/models.py b/ctrack/organisations/models.py
index 270ebd6..8fbe296 100644
--- a/ctrack/organisations/models.py
+++ b/ctrack/organisations/models.py
@@ -185,26 +185,26 @@ class Stakeholder(models.Model):
class IncidentReport(models.Model):
DFT_HANDLE_STATUS = (
- ("queued", "QUEUED"),
- ("reviewing", "REVIEWING"),
- ("waiting", "WAITING"),
- ("completed", "COMPLETE"),
+ ("QUEUED", "QUEUED"),
+ ("REVIEWING", "REVIEWING"),
+ ("WAITING", "WAITING"),
+ ("COMPLETED", "COMPLETED"),
)
INCIDENT_TYPES = (
- ("cyber", "Cyber"),
- ("non-cyber", "Non-Cyber"),
- ("both", "Both"),
- ("power", "Power Outage"),
+ ("Cyber", "Cyber"),
+ ("Non-Cyber", "Non-Cyber"),
+ ("Both", "Both"),
+ ("Power Outage", "Power Outage"),
)
INCIDENT_STATUS = (
- ("detected", "Detected"),
- ("suspected", "Suspected"),
- ("resolved", "Resolved"),
+ ("Detected", "Detected"),
+ ("Suspected", "Suspected"),
+ ("Resolved", "Resolved"),
)
INCIDENT_STAGE = (
- ("ongoing", "Ongoing"),
- ("ended", "Ended"),
- ("managed", "Ongoing but managed"),
+ ("Ongoing", "Ongoing"),
+ ("Ended", "Ended"),
+ ("Ongoing but managed", "Ongoing but managed"),
)
organisation = models.ForeignKey(
Organisation, blank=False, on_delete=models.CASCADE
@@ -222,18 +222,16 @@ class IncidentReport(models.Model):
email = models.EmailField(blank=False)
internal_incident_number = models.CharField(max_length=30, blank=True)
date_time_incident_detected = models.DateTimeField(
- verbose_name="Date/Time incident detected",
- auto_now=False,
- help_text="This can be approximate",
+ verbose_name="Date/Time incident detected", auto_now=False,
)
date_time_incident_reported = models.DateTimeField(
verbose_name="Date/Time incident reported", auto_now=True
)
incident_type = models.CharField(
- choices=INCIDENT_TYPES, help_text="This can be appoximate", max_length=10
+ choices=INCIDENT_TYPES, help_text="This can be appoximate", max_length=20
)
- incident_status = models.CharField(choices=INCIDENT_STATUS, max_length=10)
- incident_stage = models.CharField(choices=INCIDENT_STAGE, max_length=10)
+ incident_status = models.CharField(choices=INCIDENT_STATUS, max_length=20)
+ incident_stage = models.CharField(choices=INCIDENT_STAGE, max_length=20)
summary = models.TextField(
help_text="Please provide a summary of your understanding of the incident, including"
" any impact to services and/or users."
@@ -252,7 +250,7 @@ class IncidentReport(models.Model):
verbose_name="Planned next steps", help_text="What are your planned next steps?"
)
dft_handle_status = models.CharField(
- choices=DFT_HANDLE_STATUS, max_length=20, default="queued"
+ choices=DFT_HANDLE_STATUS, max_length=20, default="QUEUED"
)
def __str__(self):
diff --git a/ctrack/templates/pages/stakeholder_home.html b/ctrack/templates/pages/stakeholder_home.html
index 7070d71..3cbba15 100644
--- a/ctrack/templates/pages/stakeholder_home.html
+++ b/ctrack/templates/pages/stakeholder_home.html
@@ -37,6 +37,8 @@
<div class="row">
<div class="col md-12">
<h2>Incident Reporting</h2>
+
+ {% if irs.count > 0 %}
<table class="table">
<thead>
<tr>
@@ -46,24 +48,26 @@
<th scope="col">Status</th>
</tr>
</thead>
- <tr>
- <td>Power failure at Random Site</td>
- <td>12 May 2020</td>
- <td>There was a problem with some wires inside the black box at the site.
- There was very little we could do until someone switched the circuit breakers off,
- then we had to switch off the server that supplies the TLS link to the estate management
- system. We failed on this one, big time.</td>
- <td><strong><span class="badge badge-warning">UNRESOLVED</span></strong></td>
- </tr>
- <tr>
- <td>Corruption of main database</td>
- <td>8 December 2019</td>
- <td>Weather got to the night-watchperson, who typed in the command to seal
- the compound incorrectly. This led to a deluge of sand into the minky processor
- which eventually wiped all data tables.</td>
- <td><strong><span class="badge badge-success">RESOLVED</span></strong></td>
- </tr>
+ {% for ir in irs %}
+ <tr>
+ <td>{{ ir.incident_type}}</td>
+ <td>{{ ir.date_time_incident_detected }}</td>
+ <td>{{ ir.summary }}</td>
+ {% if ir.dft_handle_status == "QUEUED" %}
+ <td><span class="badge badge-primary">{{ ir.dft_handle_status }}</span></td>
+ {% elif ir.dft_handle_status == "REVIEWING"%}
+ <td><span class="badge badge-info">{{ ir.dft_handle_status }}</span></td>
+ {% elif ir.dft_handle_status == "WAITING"%}
+ <td><span class="badge badge-secondary">{{ ir.dft_handle_status }}</span></td>
+ {% else %}
+ <td><span class="badge badge-success">{{ ir.dft_handle_status }}</span></td>
+ {% endif %}
+ </tr>
+ {% endfor %}
</table>
+ {% else %}
+ <p>No incidents reported</p>
+ {% endif %}
<a class="btn btn-primary" id="id_submit_incident_button" href="{% url "organisations:create_incident_report" org.slug %}">Report a NIS incident</a>
</div>
</div>