diff --git a/pigway_frame_flow/web/app.js b/pigway_frame_flow/web/app.js index 4f53393..fc96908 100644 --- a/pigway_frame_flow/web/app.js +++ b/pigway_frame_flow/web/app.js @@ -175,7 +175,7 @@ async function jobEditor(job){ views.automation=async epoch=>{ const jobs=await api('/api/v1/jobs'); if(epoch!==state.epoch)return; - $('#main').innerHTML=notice()+`

${state.lang==='zh'?'上海时间':'Shanghai time'} · ${t('automation')}

${buttons('new-job','newJob',true)}
${jobs.length?`
${['name','schedule','status','nextRun','lastRun','result','action'].map(key=>``).join('')}${jobs.map((job,index)=>``).join('')}
${t(key)}
${esc(job.name)}
${esc(deviceDisplayName(state.devices.find(d=>d.id===job.device_id)||{id:job.device_id,name:job.device_id}))}
${esc(scheduleSummary(job.schedule))}${t(job.enabled?'enabled':'disabled')}${fmt(job.next_run)}${fmt(job.last_run)}${esc(job.last_result)}
`:`
${t('noTasks')}
`}
`; + $('#main').innerHTML=notice()+`

${state.lang==='zh'?'上海时间':'Shanghai time'} · ${t('automation')}

${buttons('new-job','newJob',true)}
${jobs.length?`
${['name','schedule','status','nextRun','lastRun','result','action'].map(key=>``).join('')}${jobs.map((job,index)=>``).join('')}
${t(key)}
${esc(job.name)}
${esc(deviceDisplayName(state.devices.find(d=>d.id===job.device_id)||{id:job.device_id,name:job.device_id}))}
${esc(scheduleSummary(job.schedule))}${t(job.enabled?'enabled':'disabled')}${fmt(job.next_run)}${fmt(job.last_run)}${esc(job.last_result)}
`:`
${t('noTasks')}
`}
`; bind('new-job',()=>jobEditor()); document.querySelectorAll('[data-job-edit]').forEach(button=>button.onclick=()=>jobEditor(jobs[button.dataset.jobEdit])); document.querySelectorAll('[data-job-toggle]').forEach(button=>button.onclick=busy(async()=>{const job=jobs[button.dataset.jobToggle];await api('/api/v1/jobs/'+job.id,{method:'PUT',body:jobPayload(job,{enabled:!job.enabled})});await navigate();})); diff --git a/pigway_frame_flow/web/style.css b/pigway_frame_flow/web/style.css index e850724..3b0df2c 100644 --- a/pigway_frame_flow/web/style.css +++ b/pigway_frame_flow/web/style.css @@ -178,3 +178,7 @@ body.login-mode header,body.login-mode footer{flex-shrink:0} @media(max-width:1050px){.gallery-filters{grid-template-columns:repeat(2,minmax(0,1fr))}} @media(max-width:720px){.gallery-filters{grid-template-columns:minmax(0,1fr)}} .gallery-filters input,.gallery-filters select{height:46px} + +.automation-status{color:var(--accent)} +.automation-table td{vertical-align:middle} +.automation-table .row-actions{align-items:center}