diff options
author | Michael Elkins <melkins@tislabs.com> | 2013-04-15 18:23:04 +0000 |
---|---|---|
committer | Michael Elkins <melkins@tislabs.com> | 2013-04-15 18:23:04 +0000 |
commit | f6eb2fd46232e5b8f681b39e9c5f56e9a67ec979 (patch) | |
tree | 2e7116e81fcd0ec1e26ed307b387c05c8b7d7aa6 /rpkid/rpki/gui | |
parent | d2c326f509fcd5b6fc0d661d8850dff1ee270f3c (diff) |
add warning to CSV import form for ROAs, ASes and Prefixes that all existing objects will be replaced with the contents of the CSV file.
see #509
svn path=/trunk/; revision=5295
Diffstat (limited to 'rpkid/rpki/gui')
-rw-r--r-- | rpkid/rpki/gui/app/templates/app/app_form.html | 3 | ||||
-rw-r--r-- | rpkid/rpki/gui/app/templates/app/import_resource_form.html | 9 | ||||
-rw-r--r-- | rpkid/rpki/gui/app/views.py | 8 |
3 files changed, 17 insertions, 3 deletions
diff --git a/rpkid/rpki/gui/app/templates/app/app_form.html b/rpkid/rpki/gui/app/templates/app/app_form.html index 71aaf086..b6ab60a2 100644 --- a/rpkid/rpki/gui/app/templates/app/app_form.html +++ b/rpkid/rpki/gui/app/templates/app/app_form.html @@ -5,6 +5,9 @@ <h1>{{ form_title }}</h1> </div> +{# allow this template to be subclassed to fill in extra information, such as warnings #} +{% block form_info %}{% endblock form_info %} + <form method="POST" action="" enctype="multipart/form-data" class="form-horizontal"> {% csrf_token %} {% include "app/bootstrap_form.html" %} diff --git a/rpkid/rpki/gui/app/templates/app/import_resource_form.html b/rpkid/rpki/gui/app/templates/app/import_resource_form.html new file mode 100644 index 00000000..e446d344 --- /dev/null +++ b/rpkid/rpki/gui/app/templates/app/import_resource_form.html @@ -0,0 +1,9 @@ +{% extends "app/app_form.html" %} + +{% block form_info %} +<div class="alert alert-block alert-warning"> + <b>Warning!</b> All existing resources of this type currently in the + database <b>will be deleted</b> and replaced with the contents of the CSV + file you are uploading. +</div> +{% endblock form_info %} diff --git a/rpkid/rpki/gui/app/views.py b/rpkid/rpki/gui/app/views.py index 088df8a3..60a40e0a 100644 --- a/rpkid/rpki/gui/app/views.py +++ b/rpkid/rpki/gui/app/views.py @@ -317,10 +317,11 @@ def import_asns(request): z.load_asns(f.name) z.run_rpkid_now() os.unlink(f.name) + messages.success(request, 'Successfully imported AS delgations from CSV file.') return redirect(dashboard) else: form = forms.ImportCSVForm() - return render(request, 'app/app_form.html', { + return render(request, 'app/import_resource_form.html', { 'form_title': 'Import CSV containing ASN delegations', 'form': form, 'cancel_url': reverse(dashboard) @@ -351,10 +352,11 @@ def import_prefixes(request): z.load_prefixes(f.name) z.run_rpkid_now() os.unlink(f.name) + messages.success(request, 'Successfully imported prefix delegations from CSV file.') return redirect(dashboard) else: form = forms.ImportCSVForm() - return render(request, 'app/app_form.html', { + return render(request, 'app/import_resource_form.html', { 'form_title': 'Import CSV containing Prefix delegations', 'form': form, 'cancel_url': reverse(dashboard) @@ -834,7 +836,7 @@ def roa_import(request): return redirect(dashboard) else: form = forms.ImportCSVForm() - return render(request, 'app/app_form.html', { + return render(request, 'app/import_resource_form.html', { 'form_title': 'Import ROAs from CSV', 'form': form, 'cancel_url': reverse(dashboard) |