diff options
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/wqflask/metadata_edits.py | 9 | ||||
-rw-r--r-- | wqflask/wqflask/templates/edit_probeset.html | 31 |
2 files changed, 40 insertions, 0 deletions
diff --git a/wqflask/wqflask/metadata_edits.py b/wqflask/wqflask/metadata_edits.py index 0840d4dd..383316e4 100644 --- a/wqflask/wqflask/metadata_edits.py +++ b/wqflask/wqflask/metadata_edits.py @@ -447,6 +447,15 @@ def update_probeset(name: str): json_data=json.dumps(diff_data), ), ) + edited_values = {k: v for (k, v) in diff_data['Probeset'].items() if k not in {"id_", "timestamp", "author"}} + changes = [] + for k in edited_values.keys(): + changes.append(f"<b><span data-message-id='{k}'></span></b>") + message = f"You successfully updated the following entries \ + at {diff_data['timestamp']}: {', '.join(changes)}" + flash(f"You successfully edited: {message}", "success") + else: + flash("No edits were made!", "warning") return redirect( f"/datasets/traits/{name}" f"?resource-id={request.args.get('resource-id')}" diff --git a/wqflask/wqflask/templates/edit_probeset.html b/wqflask/wqflask/templates/edit_probeset.html index 60973da2..c5ef992e 100644 --- a/wqflask/wqflask/templates/edit_probeset.html +++ b/wqflask/wqflask/templates/edit_probeset.html @@ -3,6 +3,31 @@ {% block content %} <!-- Start of body --> <div class="container"> + {% with messages = get_flashed_messages(category_filter=["warning"]) %} + {% if messages %} + {% for message in messages %} + <div class="alert alert-warning alert-dismissible" role="alert"> + <button class="close" type="button" data-dismiss="alert" aria-label="Close"> + <span aria-hidden="true">×</span> + </button> + {{ message }} + </div> + {% endfor %} + {% endif %} + {% endwith %} + + {% with messages = get_flashed_messages(category_filter=["success"]) %} + {% if messages %} + {% for message in messages %} + <div class="alert alert-success alert-dismissible" role="alert"> + <button class="close" type="button" data-dismiss="alert" aria-label="Close"> + <span aria-hidden="true">×</span> + </button> + {{ message|safe }} + </div> + {% endfor %} + {% endif %} + {% endwith %} <div class="page-header text-left"> <h1>Probeset Editing Form: {{ probeset.name }}</h1> <small><a href="{{url_for('metadata_edit.show_history', name=name)}}" target="_blank">[View History]</a></small> @@ -188,6 +213,12 @@ {% block js %} <script> gn_server_url = "{{ gn_server_url }}"; + spans = document.querySelectorAll("[data-message-id]") + spans.forEach((span) => { + span.innerHTML = $("[for='" + span.getAttribute("data-message-id") + "']").text(); + }); + $("[data-message-id]").lead + function MarkAsChanged(){ $(this).addClass("changed"); } |