added persistent and cant_close to PA_JobManager_FE_Message, used them from pa_job_manager to set status messages with persistence/close buttons appropriately for items like fix_dups/stale_jobs. When "fixing" now, the persistent Status message stays, but its now positioned approx. below the navbar on the right and is ok. Started on changing status to a more sensible naming conventions (away from alert to level) - more work to complete this

This commit is contained in:
2023-01-10 17:45:02 +11:00
parent 56c2d586b6
commit 0784861331
8 changed files with 46 additions and 64 deletions

View File

@@ -3,11 +3,14 @@ var next_toast_id=1
function NewToast(data)
{
console.log(data)
// make new div, include data.alert as background colour, and data.message as toast body
d_id='st' + String(next_toast_id)
div='<div id="' + d_id + '"'
if( data.persistent === true )
div+=' data-bs-autohide="false"'
if( data.job_id !== undefined )
div+=' job_id=' + String(data.job_id)
div +=' class="toast hide align-items-center border-0'
if( data.alert == "success" || data.alert == "danger" )
div += ' text-white'
@@ -42,6 +45,7 @@ function NewToast(data)
// can reuse any that are hidden, OR, create a new one by appending as needed (so we can have 2+ toasts on screen)
function StatusMsg(st)
{
console.log('StatusMsg' + st )
el=NewToast(st)
$('#' + el ).toast("show")
// if there is a job_id, then clear the message for it or it will be picked up again on reload
@@ -49,7 +53,11 @@ function StatusMsg(st)
// now, we will do this to get a first pass working
if( st.job_id !== undefined )
{
$.ajax( { type: 'POST', url: '/clearmsgforjob/'+st.job_id, success: function(data) { } } )
console.log( 'set hidden.bs.toast handler for: ' + st.job_id )
$('#' + el).on( 'hidden.bs.toast',
function() {
$.ajax( { type: 'POST', url: '/clearmsgforjob/'+st.job_id, success: function(data) { console.log('cleared job id' )} } )
} )
}
}