ISO-27001-Risk-Management/templates/risks/list_risks.html
Kevin Heyer 9d02badf14 feat: Add risk matrix view and related functionality
- Implemented a new view for the risk matrix, allowing users to visualize risks based on their impact and likelihood.
- Added filters for category, asset, and process in the risk listing view.
- Enhanced risk listing template to include new filters and improved layout.
- Introduced new CSS variables for better color management in the design.
- Updated existing template tags to support new functionalities, including score background class mapping.
- Modified existing risk listing to display residual risk details alongside gross risk.
- Added new risk matrix HTML template with tabbed interface for gross and net risk views.
2025-09-11 10:22:20 +02:00

209 lines
No EOL
9.4 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{% extends "base.html" %}
{% load i18n risk_extras %}
{% block crumbs %}
<li><a href="{% url 'risks:list_risks' %}">{% trans "Risk analysis" %}</a></li>
{% endblock %}
{% block content %}
<section class="section">
<div class="box">
<h2 class="title is-5">{% trans "Filter" %}</h2>
<!-- Filter -->
<form method="get" class="mb-4">
<div class="columns is-multiline">
<div class="column is-2">
<div class="select is-small is-fullwidth">
<select name="risk" onchange="this.form.submit()">
<option value="">{% trans "Risk" %}</option>
{% for r in risks %}
<option value="{{ r.id }}" {% if request.GET.risk == r.id|stringformat:"s" %}selected{% endif %}>
{{ r.title }}
</option>
{% endfor %}
</select>
</div>
</div>
<div class="column is-2">
<div class="select is-small is-fullwidth">
<select name="control" onchange="this.form.submit()">
<option value="">{% trans "Controls" %}</option>
{% for c in controls %}
<option value="{{ c.id }}" {% if request.GET.control == c.id|stringformat:"s" %}selected{% endif %}>
{{ c.title }}
</option>
{% endfor %}
</select>
</div>
</div>
<div class="column is-2">
<div class="select is-small is-fullwidth">
<select name="category" onchange="this.form.submit()">
<option value="">{% trans "Category" %}</option>
{% for cat in categories %}
<option value="{{ cat }}" {% if request.GET.category == cat|stringformat:"s" %}selected{% endif %}>
{{ cat }}
</option>
{% endfor %}
</select>
</div>
</div>
<div class="column is-2">
<div class="select is-small is-fullwidth">
<select name="asset" onchange="this.form.submit()">
<option value="">{% trans "Asset" %}</option>
{% for a in assets %}
<option value="{{ a }}" {% if request.GET.asset == a|stringformat:"s" %}selected{% endif %}>
{{ a }}
</option>
{% endfor %}
</select>
</div>
</div>
<div class="column is-2">
<div class="select is-small is-fullwidth">
<select name="process" onchange="this.form.submit()">
<option value="">{% trans "Process" %}</option>
{% for p in processes %}
<option value="{{ p }}" {% if request.GET.process == p|stringformat:"s" %}selected{% endif %}>
{{ p }}
</option>
{% endfor %}
</select>
</div>
</div>
<div class="column is-2">
<div class="select is-small is-fullwidth">
<select name="owner" onchange="this.form.submit()">
<option value="">{% trans "Owner" %}</option>
{% for u in owners %}
<option value="{{ u.id }}" {% if request.GET.owner == u.id|stringformat:"s" %}selected{% endif %}>
{{ u.get_full_name|default:u.username }}
</option>
{% endfor %}
</select>
</div>
</div>
</div>
</form> <!-- Filter Ende -->
<h2 class="title is-5">{% trans "Risks" %}</h2>
<!-- Risiken -->
<div class="table-container">
<table class="table is-bordered is-striped is-hoverable is-fullwidth">
<thead>
<tr>
{% if request.user.is_staff %}
<th rowspan="2" class="has-text-centered">
<a class="icon has-text-success" href="{% url 'admin:risks_risk_add' %}" title="Risiko hinzufügen">
<i class="fas fa-add"></i>
</a>
</th>
{% endif %}
<th rowspan="2" class="has-text-centered">{% trans "Risk" %}</th>
<th rowspan="2" class="has-text-centered">{% trans "Asset / Process" %}</th>
<th rowspan="2" class="has-text-centered">{% trans "Category" %}</th>
<th rowspan="2" class="has-text-centered">{% trans "Risk Owner" %}</th>
<th colspan="4" class="has-text-centered has-background-light">{% trans "Gross Risk" %}</th>
<th colspan="4" class="has-text-centered has-background-info-light">{% trans "Net Risk" %}</th>
</tr>
<tr>
<th class="has-text-centered has-background-light">{% trans "Likelihood" %}</th>
<th class="has-text-centered has-background-light">{% trans "Impact" %}</th>
<th class="has-text-centered has-background-light">{% trans "Score" %}</th>
<th class="has-text-centered has-background-light">{% trans "Level" %}</th>
<th class="has-text-centered has-background-info-light">{% trans "Likelihood" %}</th>
<th class="has-text-centered has-background-info-light">{% trans "Impact" %}</th>
<th class="has-text-centered has-background-info-light">{% trans "Score" %}</th>
<th class="has-text-centered has-background-info-light">{% trans "Level" %}</th>
</tr>
</thead>
<tbody>
{% for r in risks %}
<tr>
{% if request.user.is_staff %}
<td class="has-text-centered">
<a class="icon has-text-warning" href="{% url 'admin:risks_risk_change' r.id %}" title="Risiko bearbeiten">
<i class="fas fa-edit"></i>
</a>
</td>
{% endif %}
<td onclick="window.location.href='{% url 'risks:show_risk' r.id %}'" style="cursor:pointer;">{{ r.title }}</td>
<td onclick="window.location.href='{% url 'risks:show_risk' r.id %}'" style="cursor:pointer;">
{{ r.asset }}
{% if r.process %}
<br><small>{{ r.process }}</small>
{% endif %}
</td>
<td onclick="window.location.href='{% url 'risks:show_risk' r.id %}'" style="cursor:pointer;">{{ r.category }}</td>
<td onclick="window.location.href='{% url 'risks:show_risk' r.id %}'" style="cursor:pointer;">
{% if r.owner %}
{{ r.owner|user_display }}
{% else %}
{% endif %}
</td>
<!-- Brutto Risiko -->
<td onclick="window.location.href='{% url 'risks:show_risk' r.id %}'" class="has-text-centered {{ r.likelihood|likelihood_class|to_bg }}" style="cursor:pointer;">
<abbr title="{{ r.likelihood|likelihood_id_label }}">{{ r.likelihood }}</abbr>
</td>
<td onclick="window.location.href='{% url 'risks:show_risk' r.id %}'" class="has-text-centered {{ r.impact|impact_class|to_bg }}" style="cursor:pointer;">
<abbr title="{{ r.impact|impact_id_label }}">{{ r.impact }}</abbr>
</td>
<td onclick="window.location.href='{% url 'risks:show_risk' r.id %}'" class="has-text-centered {{ r.score|score_class|to_bg }}" style="cursor:pointer;">
{{ r.score }} / 20
</td>
<td onclick="window.location.href='{% url 'risks:show_risk' r.id %}'" class="has-text-centered {{ r.level|level_class|to_bg }}" style="cursor:pointer;">
{{ r.level }}
</td>
<!-- Netto Risiko -->
{% if r.residual_risk %}
<td onclick="window.location.href='{% url 'risks:show_risk' r.id %}'"
class="has-text-centered {{ r.residual_risk.likelihood|likelihood_class|to_bg }}"
style="cursor:pointer;">
<abbr title="{{ r.residual_risk.likelihood|likelihood_id_label }}">
{{ r.residual_risk.likelihood }}
</abbr>
</td>
<td onclick="window.location.href='{% url 'risks:show_risk' r.id %}'"
class="has-text-centered {{ r.residual_risk.impact|impact_class|to_bg }}"
style="cursor:pointer;">
<abbr title="{{ r.residual_risk.impact|impact_id_label }}">
{{ r.residual_risk.impact }}
</abbr>
</td>
<td onclick="window.location.href='{% url 'risks:show_risk' r.id %}'"
class="has-text-centered {{ r.residual_risk.score|score_class|to_bg }}"
style="cursor:pointer;">
{{ r.residual_risk.score }} / 20
</td>
<td onclick="window.location.href='{% url 'risks:show_risk' r.id %}'"
class="has-text-centered {{ r.residual_risk.level|level_class|to_bg }}"
style="cursor:pointer;">
{{ r.residual_risk.level }}
</td>
{% else %}
<td colspan="4" class="has-text-centered has-text-grey">
{% trans "No residual risk defined" %}
</td>
{% endif %}
</tr>
{% empty %}
<tr>
<td colspan="8" class="has-text-centered has-text-grey">{% trans "No risks present" %}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div> <!-- Ende Risiken -->
</div>
</section>
{% endblock %}