renamed toast.js to jobs.js and moved Job related calls to jobs.py form files.py AND get job.py to allow job_mgr msgs to go to F/E via a POST of /checkforjobs (picked up in templates/base.html). move files also calls new CheckForJobs() to pick up when move job finishes without needing a page reload

This commit is contained in:
2023-01-06 17:37:15 +11:00
parent e1c0622be6
commit 1ba9bf4312
8 changed files with 180 additions and 95 deletions

View File

@@ -17,7 +17,7 @@
<script src="{{ url_for( 'internal', filename='upstream/bootstrap-5.0.2-dist/js/bootstrap.bundle.min.js')}}"></script>
<script src="{{ url_for( 'internal', filename='upstream/jquery.contextMenu.min.js')}}"></script>
<script src="{{ url_for( 'internal', filename='upstream/jquery.ui.position.min.js')}}"></script>
<script src="{{ url_for( 'internal', filename='js/toast.js')}}"></script>
<script src="{{ url_for( 'internal', filename='js/jobs.js')}}"></script>
<link rel="shortcut icon" href="{{ url_for('internal', filename='favicon.ico') }}">
@@ -106,12 +106,7 @@
</div class="nav-item dropdown">
<div class="d-flex nav-link flex-grow-1 justify-content-center p-0">
<a href="{{url_for('jobs')}}"}}<span class="navbar-text">Active Jobs:
{% set num_active_jobs = GetNumActiveJobs() %}
{% if num_active_jobs > 0 %}
<span id="num_active_jobs" class="badge bg-danger text-white"}}>{{num_active_jobs}}</span>
{% else %}
<span class="badge">0</span>
{% endif %}
<span id="num_active_jobs" class="badge badge-pill bg-danger invisible">0</></span>
</a>
</div class="nav-item">
@@ -136,10 +131,11 @@
{% if GetJM_Message() != None %}
{% set msg=GetJM_Message() %}
<!-- if we are fixing things dont put up alert -->
{% if request.endpoint != "fix_dups" and request.endpoint != "rm_dups" and request.endpoint != "stale_jobs" %}
{% if msg.alert != "success" %}
<div class="py-2 mx-1 alert alert-{{msg.alert}}">
{% if msg.alert != "success" and msg.job.name != "checkdups" %}
{% if 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>
@@ -176,12 +172,16 @@
</div>
<script>
$(document).ready(function() {
<!-- f/e messages are resident in memory of the page being rendered, just process now -->
{% 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() }}
st=Object; st.message=msg; st.alert='{{GetAlert()}}'; StatusMsg(st)
{% endif %}
CheckForJobs()
/*
<!-- this this is totally useless as can only live for this 1 page render anyway -->
{{ ClearStatus() }}
{% if GetJM_Message() != None and GetJM_Message().alert == "success" %}
msg="{{GetJM_Message().message}}"
msg=msg.replace('href=', 'class=link-light href=')
@@ -189,6 +189,7 @@
StatusMsg(st)
{% set dont_print=ClearJM_Message(GetJM_Message().id) %}
{% endif %}
*/
} )
</script>
</body>