Mercurial > farol
changeset 95:0b64dc3f50eb
Add deletion of Remediations
author | Benoît Allard <benoit.allard@greenbone.net> |
---|---|
date | Thu, 09 Oct 2014 16:26:55 +0200 |
parents | 1ca989387aeb |
children | 3848faa88cd5 |
files | farol/templates/vulnerability/view_remediation.j2 farol/vulnerability.py |
diffstat | 2 files changed, 13 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/farol/templates/vulnerability/view_remediation.j2 Thu Oct 09 16:22:41 2014 +0200 +++ b/farol/templates/vulnerability/view_remediation.j2 Thu Oct 09 16:26:55 2014 +0200 @@ -24,7 +24,7 @@ -#} {% extends "vulnerability/base.j2" %} -{% from "macros.j2" import label_value, panel %} +{% from "macros.j2" import label_value, panel, delete_button %} {% block title %}{{ remediation.getTitle() }}{% endblock %} {% block i_content %} @@ -57,4 +57,5 @@ </ul> {% endcall %} {% endif %} +<div class="pull-right">{{ delete_button(url_for('.del_remediation', ordinal=ordinal, index=index)) }}</div> {% endblock %}
--- a/farol/vulnerability.py Thu Oct 09 16:22:41 2014 +0200 +++ b/farol/vulnerability.py Thu Oct 09 16:26:55 2014 +0200 @@ -477,6 +477,17 @@ remediation.addGroupID(groupid) return redirect(url_for('.view', ordinal=ordinal)) +@vulnerability.route('/<int:ordinal>/remediation/<int:index>/del', methods=['POST']) +@document_required +def del_remediation(ordinal, index): + rems = get_vuln(ordinal)._remediations + if not ( 0 <= index < len(rems)): + flash('Remediation not found', 'danger') + abort(404) + + del rems[index] + return redirect(url_for('.view', ordinal=ordinal)) + @vulnerability.route('/<int:ordinal>/reference/<int:index>/edit', methods=['GET', 'POST']) @document_required