Skip to content

Commit

Permalink
Merge pull request #218 from grycap/devel
Browse files Browse the repository at this point in the history
Minor changes
  • Loading branch information
micafer authored Sep 17, 2021
2 parents 8b9372f + 3cff5ef commit 5fbcd28
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
15 changes: 8 additions & 7 deletions app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ def managevm(op=None, infid=None, vmid=None):
return redirect(url_for('showinfrastructures'))

if response.ok:
flash("Operation '%s' successfully made on VM ID: %s" % (op, vmid), 'info')
flash("Operation '%s' successfully made on VM ID: %s" % (op, vmid), 'success')
else:
flash("Error making %s op on VM %s: \n%s" % (op, vmid, response.text), 'error')

Expand Down Expand Up @@ -833,7 +833,8 @@ def write_creds():
flash(val_msg, 'warning')
if val_res != 1:
cred.write_creds(creds["id"], session["userid"], creds, cred_id in [None, ''])
flash("Credentials successfully written!", 'info')
if val_res == 0:
flash("Credentials successfully written!", 'success')
except db.IntegrityError:
flash("Error writing credentials: Duplicated Credential ID!", 'error')
except Exception as ex:
Expand All @@ -848,7 +849,7 @@ def delete_creds():
cred_id = request.args.get('cred_id', "")
try:
cred.delete_cred(cred_id, session["userid"])
flash("Credentials successfully deleted!", 'info')
flash("Credentials successfully deleted!", 'success')
except Exception as ex:
flash("Error deleting credentials %s!" % ex, 'error')

Expand Down Expand Up @@ -928,7 +929,7 @@ def addresources(infid=None):
if not response.ok:
raise Exception(response.text)
num = len(response.json()["uri-list"])
flash("%d nodes added successfully" % num, 'info')
flash("%d nodes added successfully" % num, 'success')
except Exception as ex:
flash("Error adding nodes: \n%s\n%s" % (ex, response.text), 'error')

Expand All @@ -949,7 +950,7 @@ def manage_inf(infid=None, op=None):
response = im.manage_inf(op, infid, auth_data)
if not response.ok:
raise Exception(response.text)
flash("Operation '%s' successfully made on Infrastructure ID: %s" % (op, infid), 'info')
flash("Operation '%s' successfully made on Infrastructure ID: %s" % (op, infid), 'success')
reload = infid
elif op in ["delete", "delete-recreate"]:
form_data = request.form.to_dict()
Expand All @@ -965,7 +966,7 @@ def manage_inf(infid=None, op=None):
response = im.delete_inf(infid, force, auth_data)
if not response.ok:
raise Exception(response.text)
flash("Infrastructure '%s' successfuly deleted." % infid, "info")
flash("Infrastructure '%s' successfuly deleted." % infid, "success")
try:
infra_data = infra.get_infra(infid)
infra_data["state"]["state"] = "deleting"
Expand All @@ -982,7 +983,7 @@ def manage_inf(infid=None, op=None):
response = im.reconfigure_inf(infid, auth_data)
if not response.ok:
raise Exception(response.text)
flash("Reconfiguration process successfuly started.", "info")
flash("Reconfiguration process successfuly started.", "success")
except Exception as ex:
flash("Error in '%s' operation: %s." % (op, ex), 'error')

Expand Down
1 change: 1 addition & 0 deletions app/templates/flashed_messages.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
{% if messages %}
{% for category, message in messages %}
{% set cat = category %}{% if category == 'error' %}{% set cat = 'danger' %}{% endif %}
{% if category == 'success' %}{% set category = 'info' %}{% endif %}
<div class="alert alert-{{cat}} alert-dismissible">
<button type="button" class="close" data-dismiss="alert">&times;</button>
<strong>{{ category|upper}}</strong> {{ message }}
Expand Down

0 comments on commit 5fbcd28

Please sign in to comment.