toast now used for JM messages that are successful, its a hack but good enough for now added TODO to do this all properly one day

This commit is contained in:
2023-01-05 20:49:48 +11:00
parent a64b449327
commit 62f476e80f
2 changed files with 32 additions and 22 deletions

View File

@@ -137,22 +137,24 @@
{% if GetJM_Message() != None %}
{% set msg=GetJM_Message() %}
{% if request.endpoint != "fix_dups" and request.endpoint != "rm_dups" and request.endpoint != "stale_jobs" %}
<div class="py-2 mx-1 alert alert-{{msg.alert}}">
{% if msg.alert != "success" and msg.job.name != "checkdups" %}
<form id="_dismiss" action="{{url_for('clear_jm_msg', id=msg.id)}}" method="POST">
<button type="button" class="close btn border-secondary me-3" aria-label="Close" onClick="$('#_dismiss').submit()">
<span aria-hidden="true">&times;</span>
</button>
{% if msg.alert != "success" %}
<div class="py-2 mx-1 alert alert-{{msg.alert}}">
{% if msg.alert != "success" and msg.job.name != "checkdups" %}
<form id="_dismiss" action="{{url_for('clear_jm_msg', id=msg.id)}}" method="POST">
<button type="button" class="close btn border-secondary me-3" aria-label="Close" onClick="$('#_dismiss').submit()">
<span aria-hidden="true">&times;</span>
</button>
{% endif %}
{% if msg.job_id %}
<a href="{{url_for('joblog', id=msg.job_id)}}">Job #{{msg.job_id}}</a>:
{% endif %}
{{msg.message|safe}}
</form>
</div>
{# if a JM is a danger message, allow code to remove the status, it should be 'permanent' until addressed -- e.g. you have duplicates, fix them #}
{% if msg.alert != "danger" %}
{% set dont_print=ClearJM_Message(msg.id) %}
{% endif %}
{% if msg.job_id %}
<a href="{{url_for('joblog', id=msg.job_id)}}">Job #{{msg.job_id}}</a>:
{% endif %}
{{msg.message|safe}}
</form>
</div>
{# if a JM is a danger message, allow code to remove the status, it should be 'permanent' until addressed -- e.g. you have duplicates, fix them #}
{% if msg.alert != "danger" %}
{% set dont_print=ClearJM_Message(msg.id) %}
{% endif %}
{% endif %}
{% endif %}
@@ -172,16 +174,23 @@
</div>
</div>
</div>
{% if GetMessage()|length %}
<script>
$(document).ready(function() {
msg = "{{ GetMessage()|safe }}"
msg=msg.replace('href=', 'class=link-light href=')
st=Object; st.message=msg; st.alert="success"; StatusMsg(st)
{% if GetMessage()|length %}
msg = "{{ GetMessage()|safe }}"
msg=msg.replace('href=', 'class=link-light href=')
st=Object; st.message=msg; st.alert="success"; StatusMsg(st)
{{ ClearStatus() }}
{% endif %}
{% if GetJM_Message() != None and GetJM_Message().alert == "success" %}
msg="{{GetJM_Message().message}}"
msg=msg.replace('href=', 'class=link-light href=')
st=Object; st.message=msg; st.alert="success"; StatusMsg(st)
StatusMsg(st)
{% set dont_print=ClearJM_Message(GetJM_Message().id) %}
{% endif %}
} )
</script>
{{ ClearStatus() }}
{% endif %}
</body>
</html>
{% endif %}