diff --git a/providers/edge3/src/airflow/providers/edge3/plugins/www/dist/main.umd.cjs b/providers/edge3/src/airflow/providers/edge3/plugins/www/dist/main.umd.cjs index 33eba547b2c27..703e3856b2208 100644 --- a/providers/edge3/src/airflow/providers/edge3/plugins/www/dist/main.umd.cjs +++ b/providers/edge3/src/airflow/providers/edge3/plugins/www/dist/main.umd.cjs @@ -138,7 +138,7 @@ * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. - */const np="token",pR=()=>{const e=document.cookie.split(";");for(const t of e){const[n,r]=t.split("=");if(n?.trim()==="_token"&&r!==void 0)return localStorage.setItem(np,r),document.cookie="_token=; expires=Sat, 01 Jan 2000 00:00:00 UTC; path=/;",r}},mR=e=>{const t=localStorage.getItem(np)??pR();return t!==void 0&&(e.headers.Authorization=`Bearer ${t}`),e},vR=()=>{const{data:e,error:t}=AI(void 0,{enabled:!0,refetchInterval:tp});return e?.jobs&&e.jobs.length>0?g.jsx(vr,{p:2,children:g.jsxs(tf,{size:"sm",interactive:!0,stickyHeader:!0,striped:!0,children:[g.jsx(nf,{children:g.jsxs(hi,{children:[g.jsx(xe,{children:"Dag ID"}),g.jsx(xe,{children:"Run ID"}),g.jsx(xe,{children:"Task ID"}),g.jsx(xe,{children:"Map Index"}),g.jsx(xe,{children:"Try Number"}),g.jsx(xe,{children:"State"}),g.jsx(xe,{children:"Queue"}),g.jsx(xe,{children:"Queued DTTM"}),g.jsx(xe,{children:"Edge Worker"}),g.jsx(xe,{children:"Last Update"})]})}),g.jsx(rf,{children:e.jobs.map(n=>g.jsxs(hi,{children:[g.jsx(ke,{children:g.jsx(Mr,{href:`../dags/${n.dag_id}`,children:n.dag_id})}),g.jsx(ke,{children:g.jsx(Mr,{href:`../dags/${n.dag_id}/runs/${n.run_id}`,children:n.run_id})}),g.jsx(ke,{children:n.map_index>=0?g.jsx(Mr,{href:`../dags/${n.dag_id}/runs/${n.run_id}/tasks/${n.task_id}/mapped/${n.map_index}?try_number=${n.try_number}`,children:n.task_id}):g.jsx(Mr,{href:`../dags/${n.dag_id}/runs/${n.run_id}/tasks/${n.task_id}?try_number=${n.try_number}`,children:n.task_id})}),g.jsx(ke,{children:n.map_index>=0?n.map_index:"-"}),g.jsx(ke,{children:n.try_number}),g.jsx(ke,{children:g.jsx(fR,{state:n.state,children:n.state})}),g.jsx(ke,{children:n.queue}),g.jsx(ke,{children:n.queued_dttm?g.jsx(Fi,{date:n.queued_dttm,live:!1}):void 0}),g.jsx(ke,{children:g.jsx(Dg,{to:`/plugin/edge_worker#${n.edge_worker}`,children:n.edge_worker})}),g.jsx(ke,{children:n.last_update?g.jsx(Fi,{date:n.last_update,live:!1}):void 0})]},`${n.dag_id}.${n.run_id}.${n.task_id}.${n.map_index}.${n.try_number}`))})]})}):e?g.jsx(Le,{as:"div",pl:4,pt:1,children:"Currently no jobs running. Start a Dag and then all active jobs should show up here. Note that after some (configurable) time, jobs are purged from the list."}):t?g.jsx(Le,{as:"div",pl:4,pt:1,children:g.jsx(Jg,{error:t})}):g.jsx(Le,{as:"div",pl:4,pt:1,children:"Loading..."})},bR=({onQueueUpdate:e,workerName:t})=>{const{onClose:n,onOpen:r,open:o}=Qt(),[i,s]=P.useState(""),a=FI({onError:c=>{e({description:`Unable to add queue to worker ${t}: ${c}`,title:"Add Queue Failed",type:"error"})},onSuccess:()=>{e({description:`Queue "${i}" was added to worker ${t}.`,title:"Queue Added",type:"success"}),n(),s("")}}),l=()=>{if(!i.trim()){e({description:"Please enter a queue name.",title:"Invalid Input",type:"error"});return}a.mutate({queueName:i.trim(),workerName:t})};return g.jsxs(g.Fragment,{children:[g.jsx(Ct,{size:"sm",variant:"ghost",onClick:r,"aria-label":"Add Queue",title:"Add Queue",colorPalette:"success",children:g.jsx(Qg,{})}),g.jsx(dn,{onOpenChange:n,open:o,size:"md",children:g.jsxs(sn,{children:[g.jsx(vn,{}),g.jsx(hn,{children:g.jsxs(fn,{children:[g.jsx(xn,{children:g.jsxs(gn,{children:["Add Queue to ",t]})}),g.jsx(bn,{children:g.jsxs(di,{gap:4,align:"stretch",children:[g.jsx(Le,{children:"Enter the name of the queue to add to this worker:"}),g.jsx(GE,{placeholder:"Queue name",value:i,onChange:c=>s(c.target.value),onKeyDown:c=>{c.key==="Enter"&&l()}})]})}),g.jsxs(yn,{children:[g.jsx(mn,{asChild:!0,children:g.jsx(Pe,{variant:"outline",children:"Cancel"})}),g.jsxs(Pe,{onClick:l,colorPalette:"success",loading:a.isPending,loadingText:"Adding queue...",disabled:!i.trim(),children:[g.jsx(Qg,{}),"Add Queue"]})]}),g.jsx(pn,{asChild:!0,children:g.jsx(un,{size:"sm"})})]})})]})})]})},yR=({onEditComment:e,workerName:t})=>{const{onClose:n,onOpen:r,open:o}=Qt(),[i,s]=P.useState(""),a=LI({onError:c=>{e({description:`Unable to update comments for worker ${t}: ${c}`,title:"Updating Comments failed",type:"error"})},onSuccess:()=>{e({description:`Worker maintenance comments for ${t} were updated.`,title:"Maintenance Comments updated",type:"success"}),n()}}),l=()=>{a.mutate({requestBody:{maintenance_comment:i},workerName:t})};return g.jsxs(g.Fragment,{children:[g.jsx(Ct,{size:"sm",variant:"ghost","aria-label":"Edit Comments",title:"Edit Comments",onClick:r,children:g.jsx(sR,{})}),g.jsx(dn,{onOpenChange:n,open:o,size:"md",children:g.jsxs(sn,{children:[g.jsx(vn,{}),g.jsx(hn,{children:g.jsxs(fn,{children:[g.jsx(xn,{children:g.jsxs(gn,{children:["Edit maintenance comments for worker ",t]})}),g.jsx(bn,{children:g.jsx(of,{placeholder:"Change maintenance comment (required)",value:i,onChange:c=>s(c.target.value),required:!0,maxLength:1024,size:"sm"})}),g.jsxs(yn,{children:[g.jsx(mn,{asChild:!0,children:g.jsx(Pe,{variant:"outline",children:"Cancel"})}),g.jsx(Pe,{onClick:l,disabled:!i.trim(),children:"Update Comments"})]}),g.jsx(pn,{asChild:!0,children:g.jsx(un,{size:"sm"})})]})})]})})]})};function rp(e){return te({attr:{fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.42 15.17 17.25 21A2.652 2.652 0 0 0 21 17.25l-5.877-5.877M11.42 15.17l2.496-3.03c.317-.384.74-.626 1.208-.766M11.42 15.17l-4.655 5.653a2.548 2.548 0 1 1-3.586-3.586l6.837-5.63m5.108-.233c.55-.164 1.163-.188 1.743-.14a4.5 4.5 0 0 0 4.486-6.336l-3.276 3.277a3.004 3.004 0 0 1-2.25-2.25l3.276-3.276a4.5 4.5 0 0 0-6.336 4.486c.091 1.076-.071 2.264-.904 2.95l-.102.085m-1.745 1.437L5.909 7.5H4.5L2.25 3.75l1.5-1.5L7.5 4.5v1.409l4.26 4.26m-1.745 1.437 1.745-1.437m6.615 8.206L15.75 15.75M4.867 19.125h.008v.008h-.008v-.008Z"},child:[]}]})(e)}function xR(e){return te({attr:{fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{strokeLinecap:"round",strokeLinejoin:"round",d:"M21.75 6.75a4.5 4.5 0 0 1-4.884 4.484c-1.076-.091-2.264.071-2.95.904l-7.152 8.684a2.548 2.548 0 1 1-3.586-3.586l8.684-7.152c.833-.686.995-1.874.904-2.95a4.5 4.5 0 0 1 6.336-4.486l-3.276 3.276a3.004 3.004 0 0 0 2.25 2.25l3.276-3.276c.256.565.398 1.192.398 1.852Z"},child:[]},{tag:"path",attr:{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.867 19.125h.008v.008h-.008v-.008Z"},child:[]}]})(e)}const kR=({onEnterMaintenance:e,workerName:t})=>{const{onClose:n,onOpen:r,open:o}=Qt(),[i,s]=P.useState(""),a=_I({onError:c=>{e({description:`Unable to set worker ${t} to maintenance mode: ${c}`,title:"Setting Maintenance Mode failed",type:"error"})},onSuccess:()=>{e({description:`Worker ${t} was requested to be in maintenance mode.`,title:"Maintenance Mode activated",type:"success"})}}),l=()=>{a.mutate({requestBody:{maintenance_comment:i},workerName:t})};return g.jsxs(g.Fragment,{children:[g.jsx(Ct,{size:"sm",variant:"ghost","aria-label":"Enter Maintenance",title:"Enter Maintenance",onClick:r,colorPalette:"warning",children:g.jsx(rp,{})}),g.jsx(dn,{onOpenChange:n,open:o,size:"md",children:g.jsxs(sn,{children:[g.jsx(vn,{}),g.jsx(hn,{children:g.jsxs(fn,{children:[g.jsx(xn,{children:g.jsxs(gn,{children:["Set maintenance for worker ",t]})}),g.jsx(bn,{children:g.jsx(of,{placeholder:"Enter maintenance comment (required)",value:i,onChange:c=>s(c.target.value),required:!0,maxLength:1024,size:"sm"})}),g.jsxs(yn,{children:[g.jsx(mn,{asChild:!0,children:g.jsx(Pe,{variant:"outline",children:"Cancel"})}),g.jsx(Pe,{onClick:l,disabled:!i.trim(),children:"Confirm Maintenance"})]}),g.jsx(pn,{asChild:!0,children:g.jsx(un,{size:"sm"})})]})})]})})]})};function CR(e){return te({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M215.469 332.802l29.863 29.864L352 256 245.332 149.333l-29.863 29.865 55.469 55.469H64v42.666h205.864l-54.395 55.469zM405.334 64H106.666C83.198 64 64 83.198 64 106.666V192h42.666v-85.333h298.668v298.668H106.666V320H64v85.334C64 428.802 83.198 448 106.666 448h298.668C428.802 448 448 428.802 448 405.334V106.666C448 83.198 428.802 64 405.334 64z"},child:[]}]})(e)}const SR=({onExitMaintenance:e,workerName:t})=>{const{onClose:n,onOpen:r,open:o}=Qt(),i=DI({onError:a=>{e({description:`Unable to exit ${t} from maintenance mode: ${a}`,title:"Exit Maintenance Mode failed",type:"error"})},onSuccess:()=>{e({description:`Worker ${t} was requested to exit maintenance mode.`,title:"Maintenance Mode deactivated",type:"success"}),n()}}),s=()=>{i.mutate({workerName:t})};return g.jsxs(g.Fragment,{children:[g.jsx(Ct,{size:"sm",variant:"ghost",onClick:r,"aria-label":"Exit Maintenance",title:"Exit Maintenance",children:g.jsx(CR,{})}),g.jsx(dn,{onOpenChange:n,open:o,size:"md",children:g.jsxs(sn,{children:[g.jsx(vn,{}),g.jsx(hn,{children:g.jsxs(fn,{children:[g.jsx(xn,{children:g.jsxs(gn,{children:["Exit maintenance for worker ",t]})}),g.jsx(bn,{children:g.jsxs(Le,{children:["Are you sure you want to exit maintenance mode for worker ",t,"?"]})}),g.jsxs(yn,{children:[g.jsx(mn,{asChild:!0,children:g.jsx(Pe,{variant:"outline",children:"No"})}),g.jsx(Pe,{onClick:s,children:"Yes"})]}),g.jsx(pn,{asChild:!0,children:g.jsx(un,{size:"sm"})})]})})]})})]})},wR=({onQueueUpdate:e,worker:t})=>{const{onClose:n,onOpen:r,open:o}=Qt(),[i,s]=P.useState(""),a=MI({onError:u=>{e({description:`Unable to remove queue from worker ${t.worker_name}: ${u}`,title:"Remove Queue Failed",type:"error"})},onSuccess:()=>{e({description:`Queue "${i}" was removed from worker ${t.worker_name}.`,title:"Queue Removed",type:"success"}),n(),s("")}}),l=()=>{if(!i){e({description:"Please select a queue to remove.",title:"Invalid Selection",type:"error"});return}a.mutate({queueName:i,workerName:t.worker_name})},c=t.queues||[];return c.length===0?null:g.jsxs(g.Fragment,{children:[g.jsx(Ct,{size:"sm",variant:"ghost",onClick:r,"aria-label":"Remove Queue",title:"Remove Queue",colorPalette:"danger",children:g.jsx(Xg,{})}),g.jsx(dn,{onOpenChange:n,open:o,size:"md",children:g.jsxs(sn,{children:[g.jsx(vn,{}),g.jsx(hn,{children:g.jsxs(fn,{children:[g.jsx(xn,{children:g.jsxs(gn,{children:["Remove Queue from ",t.worker_name]})}),g.jsx(bn,{children:g.jsxs(di,{gap:4,align:"stretch",children:[g.jsx(Le,{children:"Select a queue to remove from this worker:"}),g.jsx(di,{gap:2,align:"stretch",children:g.jsx(HE,{each:c,children:u=>g.jsx(Pe,{variant:i===u?"solid":"outline",colorPalette:i===u?"blue":"gray",onClick:()=>s(u),justifyContent:"flex-start",children:u},u)})})]})}),g.jsxs(yn,{children:[g.jsx(mn,{asChild:!0,children:g.jsx(Pe,{variant:"outline",children:"Cancel"})}),g.jsxs(Pe,{onClick:l,colorPalette:"danger",loading:a.isPending,loadingText:"Removing queue...",disabled:!i,children:[g.jsx(Xg,{}),"Remove Queue"]})]}),g.jsx(pn,{asChild:!0,children:g.jsx(un,{size:"sm"})})]})})]})})]})};function op(e){return te({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M170.5 51.6L151.5 80l145 0-19-28.4c-1.5-2.2-4-3.6-6.7-3.6l-93.7 0c-2.7 0-5.2 1.3-6.7 3.6zm147-26.6L354.2 80 368 80l48 0 8 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-8 0 0 304c0 44.2-35.8 80-80 80l-224 0c-44.2 0-80-35.8-80-80l0-304-8 0c-13.3 0-24-10.7-24-24S10.7 80 24 80l8 0 48 0 13.8 0 36.7-55.1C140.9 9.4 158.4 0 177.1 0l93.7 0c18.7 0 36.2 9.4 46.6 24.9zM80 128l0 304c0 17.7 14.3 32 32 32l224 0c17.7 0 32-14.3 32-32l0-304L80 128zm80 64l0 208c0 8.8-7.2 16-16 16s-16-7.2-16-16l0-208c0-8.8 7.2-16 16-16s16 7.2 16 16zm80 0l0 208c0 8.8-7.2 16-16 16s-16-7.2-16-16l0-208c0-8.8 7.2-16 16-16s16 7.2 16 16zm80 0l0 208c0 8.8-7.2 16-16 16s-16-7.2-16-16l0-208c0-8.8 7.2-16 16-16s16 7.2 16 16z"},child:[]}]})(e)}const ip=({onDelete:e,workerName:t})=>{const{onClose:n,onOpen:r,open:o}=Qt(),i=zI({onError:a=>{e({description:`Unable to delete worker ${t}: ${a}`,title:"Delete Worker Failed",type:"error"})},onSuccess:()=>{e({description:`Worker ${t} has been deleted from the system.`,title:"Worker Deleted",type:"success"}),n()}}),s=()=>{i.mutate({workerName:t})};return g.jsxs(g.Fragment,{children:[g.jsx(Ct,{size:"sm",variant:"ghost",onClick:r,"aria-label":"Delete Worker",title:"Delete Worker",colorPalette:"danger",children:g.jsx(op,{})}),g.jsx(dn,{onOpenChange:n,open:o,size:"md",children:g.jsxs(sn,{children:[g.jsx(vn,{}),g.jsx(hn,{children:g.jsxs(fn,{children:[g.jsx(xn,{children:g.jsxs(gn,{children:["Delete worker ",t]})}),g.jsxs(bn,{children:[g.jsxs(Le,{children:["Are you sure you want to delete worker ",t,"?"]}),g.jsx(Le,{fontSize:"sm",color:"red.500",mt:2,children:"This will permanently remove the worker record from the system. This action cannot be undone."})]}),g.jsxs(yn,{children:[g.jsx(mn,{asChild:!0,children:g.jsx(Pe,{variant:"outline",children:"Cancel"})}),g.jsxs(Pe,{onClick:s,colorPalette:"danger",loading:i.isPending,loadingText:"Deleting...",children:[g.jsx(op,{style:{marginRight:"8px"}}),"Delete Worker"]})]}),g.jsx(pn,{asChild:!0,children:g.jsx(un,{size:"sm"})})]})})]})})]})};function sp(e){return te({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M400 54.1c63 45 104 118.6 104 201.9 0 136.8-110.8 247.7-247.5 248C120 504.3 8.2 393 8 256.4 7.9 173.1 48.9 99.3 111.8 54.2c11.7-8.3 28-4.8 35 7.7L162.6 90c5.9 10.5 3.1 23.8-6.6 31-41.5 30.8-68 79.6-68 134.9-.1 92.3 74.5 168.1 168 168.1 91.6 0 168.6-74.2 168-169.1-.3-51.8-24.7-101.8-68.1-134-9.7-7.2-12.4-20.5-6.5-30.9l15.8-28.1c7-12.4 23.2-16.1 34.8-7.8zM296 264V24c0-13.3-10.7-24-24-24h-32c-13.3 0-24 10.7-24 24v240c0 13.3 10.7 24 24 24h32c13.3 0 24-10.7 24-24z"},child:[]}]})(e)}const ap=({onShutdown:e,workerName:t})=>{const{onClose:n,onOpen:r,open:o}=Qt(),i=VI({onError:a=>{e({description:`Unable to request shutdown for worker ${t}: ${a}`,title:"Shutdown Request Failed",type:"error"})},onSuccess:()=>{e({description:`Worker ${t} was requested to shutdown.`,title:"Shutdown Request Sent",type:"success"}),n()}}),s=()=>{i.mutate({workerName:t})};return g.jsxs(g.Fragment,{children:[g.jsx(Ct,{size:"sm",variant:"ghost",onClick:r,"aria-label":"Shutdown Worker",title:"Shutdown Worker",colorPalette:"danger",children:g.jsx(sp,{})}),g.jsx(dn,{onOpenChange:n,open:o,size:"md",children:g.jsxs(sn,{children:[g.jsx(vn,{}),g.jsx(hn,{children:g.jsxs(fn,{children:[g.jsx(xn,{children:g.jsxs(gn,{children:["Shutdown worker ",t]})}),g.jsxs(bn,{children:[g.jsxs(Le,{children:["Are you sure you want to request shutdown for worker ",t,"?"]}),g.jsx(Le,{fontSize:"sm",color:"red.500",mt:2,children:"This stops the worker on the remote edge. You can't restart it from the UI — you need to start it remotely instead."})]}),g.jsxs(yn,{children:[g.jsx(mn,{asChild:!0,children:g.jsx(Pe,{variant:"outline",children:"Cancel"})}),g.jsxs(Pe,{onClick:s,colorPalette:"danger",loading:i.isPending,loadingText:"Shutting down...",children:[g.jsx(sp,{style:{marginRight:"8px"}}),"Shutdown Worker"]})]}),g.jsx(pn,{asChild:!0,children:g.jsx(un,{size:"sm"})})]})})]})})]})},ER=({onOperations:e,worker:t})=>{const n=t.worker_name,r=t.state,o=i=>{nR.create(i),e()};return r==="idle"||r==="running"?g.jsxs(ui,{justifyContent:"end",gap:2,children:[g.jsx(bR,{onQueueUpdate:o,workerName:n}),g.jsx(wR,{onQueueUpdate:o,worker:t}),g.jsx(kR,{onEnterMaintenance:o,workerName:n}),g.jsx(ap,{onShutdown:o,workerName:n})]}):r==="maintenance pending"||r==="maintenance mode"||r==="maintenance request"||r==="offline maintenance"?g.jsxs(di,{gap:2,align:"stretch",children:[g.jsx(vr,{fontSize:"sm",whiteSpace:"pre-wrap",children:t.maintenance_comments||"No comment"}),g.jsxs(ui,{justifyContent:"end",gap:2,children:[g.jsx(yR,{onEditComment:o,workerName:n}),g.jsx(SR,{onExitMaintenance:o,workerName:n}),r==="offline maintenance"?g.jsx(ip,{onDelete:o,workerName:n}):g.jsx(ap,{onShutdown:o,workerName:n})]})]}):r==="offline"||r==="unknown"?g.jsx(ui,{justifyContent:"end",children:g.jsx(ip,{onDelete:o,workerName:n})}):null};function OR(e){return te({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"m22 3.41-.12-1.26-1.2.4a13.84 13.84 0 0 1-6.41.64 11.87 11.87 0 0 0-6.68.9A7.23 7.23 0 0 0 3.3 9.5a9 9 0 0 0 .39 4.58 16.6 16.6 0 0 1 1.18-2.2 9.85 9.85 0 0 1 4.07-3.43 11.16 11.16 0 0 1 5.06-1A12.08 12.08 0 0 0 9.34 9.2a9.48 9.48 0 0 0-1.86 1.53 11.38 11.38 0 0 0-1.39 1.91 16.39 16.39 0 0 0-1.57 4.54A26.42 26.42 0 0 0 4 22h2a30.69 30.69 0 0 1 .59-4.32 9.25 9.25 0 0 0 4.52 1.11 11 11 0 0 0 4.28-.87C23 14.67 22 3.86 22 3.41z"},child:[]}]})(e)}function PR(e){return te({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"32",d:"M93.72 183.25C49.49 198.05 16 233.1 16 288c0 66 54 112 120 112h184.37m147.45-22.26C485.24 363.3 496 341.61 496 312c0-59.82-53-85.76-96-88-8.89-89.54-71-144-144-144-26.16 0-48.79 6.93-67.6 18.14"},child:[]},{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"32",d:"M448 448 64 64"},child:[]}]})(e)}function IR(e){return te({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M12.0001 18C12.7144 18 13.3704 18.2497 13.8856 18.6665L12.0001 21L10.1145 18.6665C10.6297 18.2497 11.2857 18 12.0001 18ZM2.80766 1.39343L20.4853 19.0711L19.0711 20.4853L13.8913 15.3042C13.2967 15.1069 12.6609 15 12.0001 15C10.5719 15 9.26024 15.499 8.22998 16.3322L6.97363 14.7759C8.24961 13.7442 9.84925 13.0969 11.5964 13.01L9.00025 10.414C7.55273 10.8234 6.22651 11.5217 5.0878 12.4426L3.83099 10.8868C4.89946 10.0226 6.10763 9.32438 7.41633 8.83118L5.13168 6.5451C3.98878 7.08913 2.92058 7.76472 1.94666 8.55228L0.689453 6.99674C1.60358 6.25747 2.59156 5.60589 3.64058 5.05479L1.39345 2.80765L2.80766 1.39343ZM14.5004 10.2854L12.2165 8.00243L12 8C15.0947 8 17.9369 9.08141 20.1693 10.8869L18.9123 12.4426C17.6438 11.4167 16.1427 10.6672 14.5004 10.2854ZM12.0001 3.00003C16.2849 3.00003 20.22 4.49719 23.3109 6.99691L22.0534 8.55228C19.3061 6.33062 15.8085 5.00003 12.0001 5.00003C11.122 5.00003 10.2604 5.07077 9.42075 5.20685L7.72455 3.51088C9.09498 3.17702 10.5268 3.00003 12.0001 3.00003Z"},child:[]}]})(e)}const RR=({state:e,...t})=>{switch(e){case"starting":return g.jsx(ep,{...t});case"running":return g.jsx(Zg,{...t});case"idle":return g.jsx(OR,{...t});case"shutdown request":case"terminating":return g.jsx(oR,{...t});case"offline":return g.jsx(PR,{...t});case"unknown":return g.jsx(IR,{...t});case"maintenance request":case"maintenance pending":case"maintenance exit":return g.jsx(xR,{...t});case"maintenance mode":case"offline maintenance":return g.jsx(rp,{...t});default:return g.jsx(Yg,{...t})}},TR=e=>{switch(e){case"starting":case"maintenance request":case"maintenance exit":return"yellow";case"running":return"green";case"idle":return"teal";case"shutdown request":case"terminating":return"purple";case"offline":case"offline maintenance":return"black";case"unknown":return"red";case"maintenance mode":case"maintenance pending":return"orange";default:return"gray"}},NR=e=>{switch(e){case"starting":return"Edge Worker is in initialization.";case"running":return"Edge Worker is actively running a task.";case"idle":return"Edge Worker is active and waiting for a task.";case"shutdown request":return"Request to shutdown Edge Worker is issued. It will be picked-up on the next heartbeat, tasks will drain and then worker will terminate.";case"terminating":return"Edge Worker is completing work (draining running tasks) and stopping.";case"offline":return"Edge Worker was shut down.";case"unknown":return"No heartbeat signal from worker for some time, Edge Worker probably down or got disconnected.";case"maintenance request":return"Worker was requested to enter maintenance mode. Once worker receives this message it will pause fetching tasks and drain tasks.";case"maintenance pending":return"Edge Worker received the request for maintenance, waiting for tasks to finish. Once tasks are finished will move to 'maintenance mode'.";case"maintenance mode":return"Edge Worker is in maintenance mode. It is online but pauses fetching tasks.";case"maintenance exit":return"Request Worker is requested to exit maintenance mode. Once the worker receives this state it will un-pause and fetch new tasks.";case"offline maintenance":return"Worker was shut down in maintenance mode. It will be in maintenance mode when restarted.";default:return}},AR=O.forwardRef(({children:e,state:t,...n},r)=>g.jsxs(Kh,{borderRadius:"full",colorPalette:TR(t),fontSize:"sm",px:e===void 0?1:2,py:1,ref:r,title:NR(t),variant:"solid",...n,children:[t===void 0?void 0:g.jsx(RR,{state:t}),e]})),_R=()=>{const{data:e,error:t,refetch:n}=NI(void 0,{enabled:!0,refetchInterval:tp});return e?.workers&&e.workers.length>0?g.jsxs(vr,{p:2,children:[g.jsxs(tf,{size:"sm",interactive:!0,stickyHeader:!0,striped:!0,children:[g.jsx(nf,{children:g.jsxs(hi,{children:[g.jsx(xe,{children:"Worker Name"}),g.jsx(xe,{children:"State"}),g.jsx(xe,{children:"Queues"}),g.jsx(xe,{children:"First Online"}),g.jsx(xe,{children:"Last Heartbeat"}),g.jsx(xe,{children:"Active Jobs"}),g.jsx(xe,{children:"System Information"}),g.jsx(xe,{children:"Operations"})]})}),g.jsx(rf,{children:e.workers.map(r=>g.jsxs(hi,{id:r.worker_name,children:[g.jsx(ke,{children:r.worker_name}),g.jsx(ke,{children:g.jsx(AR,{state:r.state,children:r.state})}),g.jsx(ke,{children:r.queues?g.jsx(Zh,{children:r.queues.map(o=>g.jsx(ef,{children:o},o))}):"(all queues)"}),g.jsx(ke,{children:r.first_online?g.jsx(Fi,{date:r.first_online,live:!1}):void 0}),g.jsx(ke,{children:r.last_heartbeat?g.jsx(Fi,{date:r.last_heartbeat,live:!1}):void 0}),g.jsx(ke,{children:r.jobs_active}),g.jsx(ke,{children:r.sysinfo?g.jsx(Zh,{children:Object.entries(r.sysinfo).map(([o,i])=>g.jsxs(ef,{children:[o,": ",i]},o))}):"N/A"}),g.jsx(ke,{children:g.jsx(ER,{worker:r,onOperations:n})})]},r.worker_name))})]}),g.jsx(rR,{})]}):e?g.jsxs(Le,{as:"div",pl:4,pt:1,children:["No known workers. Start one via ",g.jsx($E,{children:"airflow edge worker [...]"}),". See"," ",g.jsxs(Mr,{target:"_blank",variant:"underline",color:"fg.info",href:"https://airflow.apache.org/docs/apache-airflow-providers-edge3/stable/deployment.html",children:["Edge Worker Deployment docs ",g.jsx(QI,{})]})," ","how to deploy a new worker."]}):t?g.jsx(Le,{as:"div",pl:4,pt:1,children:g.jsx(Jg,{error:t})}):g.jsx(Le,{as:"div",pl:4,pt:1,children:"Loading..."})},VR=({tabs:e})=>{const t=P.useRef(null),n=gR(t);return g.jsx(ui,{alignItems:"center",borderBottomWidth:1,mb:2,ref:t,children:e.map(({icon:r,label:o,value:i})=>g.jsx(uI,{end:!0,title:o,to:{pathname:i},children:({isActive:s})=>g.jsx(Yh,{borderBottomColor:"border.info",borderBottomWidth:s?3:0,color:s?"fg":"fg.muted",fontWeight:"bold",height:"40px",mb:"-2px",pb:s?0:"3px",px:4,transition:"all 0.2s ease",children:n>600||!r?o:r})},i))})},FR=()=>{const e=[{label:"Edge Worker",value:"plugin/edge_worker"},{label:"Edge Jobs",value:"plugin/edge_jobs"}];return g.jsx(vr,{p:2,children:g.jsxs(aI,{children:[g.jsx(VR,{tabs:e}),g.jsxs(eI,{children:[g.jsx(Ja,{path:"plugin/edge_worker",element:g.jsx(_R,{})}),g.jsx(Ja,{path:"plugin/edge_jobs",element:g.jsx(vR,{})})]})]})})};/*! + */const np="token",pR=()=>{const e=document.cookie.split(";");for(const t of e){const[n,r]=t.split("=");if(n?.trim()==="_token"&&r!==void 0)return localStorage.setItem(np,r),document.cookie="_token=; expires=Sat, 01 Jan 2000 00:00:00 UTC; path=/;",r}},mR=e=>{const t=localStorage.getItem(np)??pR();return t!==void 0&&(e.headers.Authorization=`Bearer ${t}`),e},vR=()=>{const{data:e,error:t}=AI(void 0,{enabled:!0,refetchInterval:tp});return e?.jobs&&e.jobs.length>0?g.jsx(vr,{p:2,children:g.jsxs(tf,{size:"sm",interactive:!0,stickyHeader:!0,striped:!0,children:[g.jsx(nf,{children:g.jsxs(hi,{children:[g.jsx(xe,{children:"Dag ID"}),g.jsx(xe,{children:"Run ID"}),g.jsx(xe,{children:"Task ID"}),g.jsx(xe,{children:"Map Index"}),g.jsx(xe,{children:"Try Number"}),g.jsx(xe,{children:"State"}),g.jsx(xe,{children:"Queue"}),g.jsx(xe,{children:"Queued DTTM"}),g.jsx(xe,{children:"Edge Worker"}),g.jsx(xe,{children:"Last Update"})]})}),g.jsx(rf,{children:e.jobs.map(n=>g.jsxs(hi,{children:[g.jsx(ke,{children:g.jsx(Mr,{href:`../dags/${n.dag_id}`,children:n.dag_id})}),g.jsx(ke,{children:g.jsx(Mr,{href:`../dags/${n.dag_id}/runs/${n.run_id}`,children:n.run_id})}),g.jsx(ke,{children:n.map_index>=0?g.jsx(Mr,{href:`../dags/${n.dag_id}/runs/${n.run_id}/tasks/${n.task_id}/mapped/${n.map_index}?try_number=${n.try_number}`,children:n.task_id}):g.jsx(Mr,{href:`../dags/${n.dag_id}/runs/${n.run_id}/tasks/${n.task_id}?try_number=${n.try_number}`,children:n.task_id})}),g.jsx(ke,{children:n.map_index>=0?n.map_index:"-"}),g.jsx(ke,{children:n.try_number}),g.jsx(ke,{children:g.jsx(fR,{state:n.state,children:n.state})}),g.jsx(ke,{children:n.queue}),g.jsx(ke,{children:n.queued_dttm?g.jsx(Fi,{date:n.queued_dttm,live:!1}):void 0}),g.jsx(ke,{children:g.jsx(Dg,{to:`/plugin/edge_worker#${n.edge_worker}`,children:n.edge_worker})}),g.jsx(ke,{children:n.last_update?g.jsx(Fi,{date:n.last_update,live:!1}):void 0})]},`${n.dag_id}.${n.run_id}.${n.task_id}.${n.map_index}.${n.try_number}`))})]})}):e?g.jsx(Le,{as:"div",pl:4,pt:1,children:"Currently no jobs running. Start a Dag and then all active jobs should show up here. Note that after some (configurable) time, jobs are purged from the list."}):t?g.jsx(Le,{as:"div",pl:4,pt:1,children:g.jsx(Jg,{error:t})}):g.jsx(Le,{as:"div",pl:4,pt:1,children:"Loading..."})},bR=({onQueueUpdate:e,workerName:t})=>{const{onClose:n,onOpen:r,open:o}=Qt(),[i,s]=P.useState(""),a=FI({onError:c=>{e({description:`Unable to add queue to worker ${t}: ${c}`,title:"Add Queue Failed",type:"error"})},onSuccess:()=>{e({description:`Queue "${i}" was added to worker ${t}.`,title:"Queue Added",type:"success"}),n(),s("")}}),l=()=>{if(!i.trim()){e({description:"Please enter a queue name.",title:"Invalid Input",type:"error"});return}a.mutate({queueName:i.trim(),workerName:t})};return g.jsxs(g.Fragment,{children:[g.jsx(Ct,{size:"sm",variant:"ghost",onClick:r,"aria-label":"Add Queue",title:"Add Queue",colorPalette:"success",children:g.jsx(Qg,{})}),g.jsx(dn,{onOpenChange:n,open:o,size:"md",children:g.jsxs(sn,{children:[g.jsx(vn,{}),g.jsx(hn,{children:g.jsxs(fn,{children:[g.jsx(xn,{children:g.jsxs(gn,{children:["Add Queue to ",t]})}),g.jsx(bn,{children:g.jsxs(di,{gap:4,align:"stretch",children:[g.jsx(Le,{children:"Enter the name of the queue to add to this worker:"}),g.jsx(GE,{placeholder:"Queue name",value:i,onChange:c=>s(c.target.value),onKeyDown:c=>{c.key==="Enter"&&l()}})]})}),g.jsxs(yn,{children:[g.jsx(mn,{asChild:!0,children:g.jsx(Pe,{variant:"outline",children:"Cancel"})}),g.jsxs(Pe,{onClick:l,colorPalette:"success",loading:a.isPending,loadingText:"Adding queue...",disabled:!i.trim(),children:[g.jsx(Qg,{}),"Add Queue"]})]}),g.jsx(pn,{asChild:!0,children:g.jsx(un,{size:"sm"})})]})})]})})]})},yR=({onEditComment:e,workerName:t})=>{const{onClose:n,onOpen:r,open:o}=Qt(),[i,s]=P.useState(""),a=LI({onError:c=>{e({description:`Unable to update comments for worker ${t}: ${c}`,title:"Updating Comments failed",type:"error"})},onSuccess:()=>{e({description:`Worker maintenance comments for ${t} were updated.`,title:"Maintenance Comments updated",type:"success"}),n()}}),l=()=>{a.mutate({requestBody:{maintenance_comment:i},workerName:t})};return g.jsxs(g.Fragment,{children:[g.jsx(Ct,{size:"sm",variant:"ghost","aria-label":"Edit Comments",title:"Edit Comments",onClick:r,colorPalette:"warning",children:g.jsx(sR,{})}),g.jsx(dn,{onOpenChange:n,open:o,size:"md",children:g.jsxs(sn,{children:[g.jsx(vn,{}),g.jsx(hn,{children:g.jsxs(fn,{children:[g.jsx(xn,{children:g.jsxs(gn,{children:["Edit maintenance comments for worker ",t]})}),g.jsx(bn,{children:g.jsx(of,{placeholder:"Change maintenance comment (required)",value:i,onChange:c=>s(c.target.value),required:!0,maxLength:1024,size:"sm"})}),g.jsxs(yn,{children:[g.jsx(mn,{asChild:!0,children:g.jsx(Pe,{variant:"outline",children:"Cancel"})}),g.jsx(Pe,{onClick:l,disabled:!i.trim(),children:"Update Comments"})]}),g.jsx(pn,{asChild:!0,children:g.jsx(un,{size:"sm"})})]})})]})})]})};function rp(e){return te({attr:{fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.42 15.17 17.25 21A2.652 2.652 0 0 0 21 17.25l-5.877-5.877M11.42 15.17l2.496-3.03c.317-.384.74-.626 1.208-.766M11.42 15.17l-4.655 5.653a2.548 2.548 0 1 1-3.586-3.586l6.837-5.63m5.108-.233c.55-.164 1.163-.188 1.743-.14a4.5 4.5 0 0 0 4.486-6.336l-3.276 3.277a3.004 3.004 0 0 1-2.25-2.25l3.276-3.276a4.5 4.5 0 0 0-6.336 4.486c.091 1.076-.071 2.264-.904 2.95l-.102.085m-1.745 1.437L5.909 7.5H4.5L2.25 3.75l1.5-1.5L7.5 4.5v1.409l4.26 4.26m-1.745 1.437 1.745-1.437m6.615 8.206L15.75 15.75M4.867 19.125h.008v.008h-.008v-.008Z"},child:[]}]})(e)}function xR(e){return te({attr:{fill:"none",viewBox:"0 0 24 24",strokeWidth:"1.5",stroke:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{strokeLinecap:"round",strokeLinejoin:"round",d:"M21.75 6.75a4.5 4.5 0 0 1-4.884 4.484c-1.076-.091-2.264.071-2.95.904l-7.152 8.684a2.548 2.548 0 1 1-3.586-3.586l8.684-7.152c.833-.686.995-1.874.904-2.95a4.5 4.5 0 0 1 6.336-4.486l-3.276 3.276a3.004 3.004 0 0 0 2.25 2.25l3.276-3.276c.256.565.398 1.192.398 1.852Z"},child:[]},{tag:"path",attr:{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.867 19.125h.008v.008h-.008v-.008Z"},child:[]}]})(e)}const kR=({onEnterMaintenance:e,workerName:t})=>{const{onClose:n,onOpen:r,open:o}=Qt(),[i,s]=P.useState(""),a=_I({onError:c=>{e({description:`Unable to set worker ${t} to maintenance mode: ${c}`,title:"Setting Maintenance Mode failed",type:"error"})},onSuccess:()=>{e({description:`Worker ${t} was requested to be in maintenance mode.`,title:"Maintenance Mode activated",type:"success"})}}),l=()=>{a.mutate({requestBody:{maintenance_comment:i},workerName:t})};return g.jsxs(g.Fragment,{children:[g.jsx(Ct,{size:"sm",variant:"ghost","aria-label":"Enter Maintenance",title:"Enter Maintenance",onClick:r,colorPalette:"warning",children:g.jsx(rp,{})}),g.jsx(dn,{onOpenChange:n,open:o,size:"md",children:g.jsxs(sn,{children:[g.jsx(vn,{}),g.jsx(hn,{children:g.jsxs(fn,{children:[g.jsx(xn,{children:g.jsxs(gn,{children:["Set maintenance for worker ",t]})}),g.jsx(bn,{children:g.jsx(of,{placeholder:"Enter maintenance comment (required)",value:i,onChange:c=>s(c.target.value),required:!0,maxLength:1024,size:"sm"})}),g.jsxs(yn,{children:[g.jsx(mn,{asChild:!0,children:g.jsx(Pe,{variant:"outline",children:"Cancel"})}),g.jsx(Pe,{onClick:l,disabled:!i.trim(),children:"Confirm Maintenance"})]}),g.jsx(pn,{asChild:!0,children:g.jsx(un,{size:"sm"})})]})})]})})]})};function CR(e){return te({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M215.469 332.802l29.863 29.864L352 256 245.332 149.333l-29.863 29.865 55.469 55.469H64v42.666h205.864l-54.395 55.469zM405.334 64H106.666C83.198 64 64 83.198 64 106.666V192h42.666v-85.333h298.668v298.668H106.666V320H64v85.334C64 428.802 83.198 448 106.666 448h298.668C428.802 448 448 428.802 448 405.334V106.666C448 83.198 428.802 64 405.334 64z"},child:[]}]})(e)}const SR=({onExitMaintenance:e,workerName:t})=>{const{onClose:n,onOpen:r,open:o}=Qt(),i=DI({onError:a=>{e({description:`Unable to exit ${t} from maintenance mode: ${a}`,title:"Exit Maintenance Mode failed",type:"error"})},onSuccess:()=>{e({description:`Worker ${t} was requested to exit maintenance mode.`,title:"Maintenance Mode deactivated",type:"success"}),n()}}),s=()=>{i.mutate({workerName:t})};return g.jsxs(g.Fragment,{children:[g.jsx(Ct,{size:"sm",variant:"ghost",onClick:r,"aria-label":"Exit Maintenance",title:"Exit Maintenance",colorPalette:"warning",children:g.jsx(CR,{})}),g.jsx(dn,{onOpenChange:n,open:o,size:"md",children:g.jsxs(sn,{children:[g.jsx(vn,{}),g.jsx(hn,{children:g.jsxs(fn,{children:[g.jsx(xn,{children:g.jsxs(gn,{children:["Exit maintenance for worker ",t]})}),g.jsx(bn,{children:g.jsxs(Le,{children:["Are you sure you want to exit maintenance mode for worker ",t,"?"]})}),g.jsxs(yn,{children:[g.jsx(mn,{asChild:!0,children:g.jsx(Pe,{variant:"outline",children:"No"})}),g.jsx(Pe,{onClick:s,children:"Yes"})]}),g.jsx(pn,{asChild:!0,children:g.jsx(un,{size:"sm"})})]})})]})})]})},wR=({onQueueUpdate:e,worker:t})=>{const{onClose:n,onOpen:r,open:o}=Qt(),[i,s]=P.useState(""),a=MI({onError:u=>{e({description:`Unable to remove queue from worker ${t.worker_name}: ${u}`,title:"Remove Queue Failed",type:"error"})},onSuccess:()=>{e({description:`Queue "${i}" was removed from worker ${t.worker_name}.`,title:"Queue Removed",type:"success"}),n(),s("")}}),l=()=>{if(!i){e({description:"Please select a queue to remove.",title:"Invalid Selection",type:"error"});return}a.mutate({queueName:i,workerName:t.worker_name})},c=t.queues||[];return c.length===0?null:g.jsxs(g.Fragment,{children:[g.jsx(Ct,{size:"sm",variant:"ghost",onClick:r,"aria-label":"Remove Queue",title:"Remove Queue",colorPalette:"danger",children:g.jsx(Xg,{})}),g.jsx(dn,{onOpenChange:n,open:o,size:"md",children:g.jsxs(sn,{children:[g.jsx(vn,{}),g.jsx(hn,{children:g.jsxs(fn,{children:[g.jsx(xn,{children:g.jsxs(gn,{children:["Remove Queue from ",t.worker_name]})}),g.jsx(bn,{children:g.jsxs(di,{gap:4,align:"stretch",children:[g.jsx(Le,{children:"Select a queue to remove from this worker:"}),g.jsx(di,{gap:2,align:"stretch",children:g.jsx(HE,{each:c,children:u=>g.jsx(Pe,{variant:i===u?"solid":"outline",colorPalette:i===u?"blue":"gray",onClick:()=>s(u),justifyContent:"flex-start",children:u},u)})})]})}),g.jsxs(yn,{children:[g.jsx(mn,{asChild:!0,children:g.jsx(Pe,{variant:"outline",children:"Cancel"})}),g.jsxs(Pe,{onClick:l,colorPalette:"danger",loading:a.isPending,loadingText:"Removing queue...",disabled:!i,children:[g.jsx(Xg,{}),"Remove Queue"]})]}),g.jsx(pn,{asChild:!0,children:g.jsx(un,{size:"sm"})})]})})]})})]})};function op(e){return te({attr:{viewBox:"0 0 448 512"},child:[{tag:"path",attr:{d:"M170.5 51.6L151.5 80l145 0-19-28.4c-1.5-2.2-4-3.6-6.7-3.6l-93.7 0c-2.7 0-5.2 1.3-6.7 3.6zm147-26.6L354.2 80 368 80l48 0 8 0c13.3 0 24 10.7 24 24s-10.7 24-24 24l-8 0 0 304c0 44.2-35.8 80-80 80l-224 0c-44.2 0-80-35.8-80-80l0-304-8 0c-13.3 0-24-10.7-24-24S10.7 80 24 80l8 0 48 0 13.8 0 36.7-55.1C140.9 9.4 158.4 0 177.1 0l93.7 0c18.7 0 36.2 9.4 46.6 24.9zM80 128l0 304c0 17.7 14.3 32 32 32l224 0c17.7 0 32-14.3 32-32l0-304L80 128zm80 64l0 208c0 8.8-7.2 16-16 16s-16-7.2-16-16l0-208c0-8.8 7.2-16 16-16s16 7.2 16 16zm80 0l0 208c0 8.8-7.2 16-16 16s-16-7.2-16-16l0-208c0-8.8 7.2-16 16-16s16 7.2 16 16zm80 0l0 208c0 8.8-7.2 16-16 16s-16-7.2-16-16l0-208c0-8.8 7.2-16 16-16s16 7.2 16 16z"},child:[]}]})(e)}const ip=({onDelete:e,workerName:t})=>{const{onClose:n,onOpen:r,open:o}=Qt(),i=zI({onError:a=>{e({description:`Unable to delete worker ${t}: ${a}`,title:"Delete Worker Failed",type:"error"})},onSuccess:()=>{e({description:`Worker ${t} has been deleted from the system.`,title:"Worker Deleted",type:"success"}),n()}}),s=()=>{i.mutate({workerName:t})};return g.jsxs(g.Fragment,{children:[g.jsx(Ct,{size:"sm",variant:"ghost",onClick:r,"aria-label":"Delete Worker",title:"Delete Worker",colorPalette:"danger",children:g.jsx(op,{})}),g.jsx(dn,{onOpenChange:n,open:o,size:"md",children:g.jsxs(sn,{children:[g.jsx(vn,{}),g.jsx(hn,{children:g.jsxs(fn,{children:[g.jsx(xn,{children:g.jsxs(gn,{children:["Delete worker ",t]})}),g.jsxs(bn,{children:[g.jsxs(Le,{children:["Are you sure you want to delete worker ",t,"?"]}),g.jsx(Le,{fontSize:"sm",color:"red.500",mt:2,children:"This will permanently remove the worker record from the system. This action cannot be undone."})]}),g.jsxs(yn,{children:[g.jsx(mn,{asChild:!0,children:g.jsx(Pe,{variant:"outline",children:"Cancel"})}),g.jsxs(Pe,{onClick:s,colorPalette:"danger",loading:i.isPending,loadingText:"Deleting...",children:[g.jsx(op,{style:{marginRight:"8px"}}),"Delete Worker"]})]}),g.jsx(pn,{asChild:!0,children:g.jsx(un,{size:"sm"})})]})})]})})]})};function sp(e){return te({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M400 54.1c63 45 104 118.6 104 201.9 0 136.8-110.8 247.7-247.5 248C120 504.3 8.2 393 8 256.4 7.9 173.1 48.9 99.3 111.8 54.2c11.7-8.3 28-4.8 35 7.7L162.6 90c5.9 10.5 3.1 23.8-6.6 31-41.5 30.8-68 79.6-68 134.9-.1 92.3 74.5 168.1 168 168.1 91.6 0 168.6-74.2 168-169.1-.3-51.8-24.7-101.8-68.1-134-9.7-7.2-12.4-20.5-6.5-30.9l15.8-28.1c7-12.4 23.2-16.1 34.8-7.8zM296 264V24c0-13.3-10.7-24-24-24h-32c-13.3 0-24 10.7-24 24v240c0 13.3 10.7 24 24 24h32c13.3 0 24-10.7 24-24z"},child:[]}]})(e)}const ap=({onShutdown:e,workerName:t})=>{const{onClose:n,onOpen:r,open:o}=Qt(),i=VI({onError:a=>{e({description:`Unable to request shutdown for worker ${t}: ${a}`,title:"Shutdown Request Failed",type:"error"})},onSuccess:()=>{e({description:`Worker ${t} was requested to shutdown.`,title:"Shutdown Request Sent",type:"success"}),n()}}),s=()=>{i.mutate({workerName:t})};return g.jsxs(g.Fragment,{children:[g.jsx(Ct,{size:"sm",variant:"ghost",onClick:r,"aria-label":"Shutdown Worker",title:"Shutdown Worker",colorPalette:"danger",children:g.jsx(sp,{})}),g.jsx(dn,{onOpenChange:n,open:o,size:"md",children:g.jsxs(sn,{children:[g.jsx(vn,{}),g.jsx(hn,{children:g.jsxs(fn,{children:[g.jsx(xn,{children:g.jsxs(gn,{children:["Shutdown worker ",t]})}),g.jsxs(bn,{children:[g.jsxs(Le,{children:["Are you sure you want to request shutdown for worker ",t,"?"]}),g.jsx(Le,{fontSize:"sm",color:"red.500",mt:2,children:"This stops the worker on the remote edge. You can't restart it from the UI — you need to start it remotely instead."})]}),g.jsxs(yn,{children:[g.jsx(mn,{asChild:!0,children:g.jsx(Pe,{variant:"outline",children:"Cancel"})}),g.jsxs(Pe,{onClick:s,colorPalette:"danger",loading:i.isPending,loadingText:"Shutting down...",children:[g.jsx(sp,{style:{marginRight:"8px"}}),"Shutdown Worker"]})]}),g.jsx(pn,{asChild:!0,children:g.jsx(un,{size:"sm"})})]})})]})})]})},ER=({onOperations:e,worker:t})=>{const n=t.worker_name,r=t.state,o=i=>{nR.create(i),e()};return r==="idle"||r==="running"?g.jsxs(ui,{justifyContent:"end",gap:2,children:[g.jsx(bR,{onQueueUpdate:o,workerName:n}),g.jsx(wR,{onQueueUpdate:o,worker:t}),g.jsx(kR,{onEnterMaintenance:o,workerName:n}),g.jsx(ap,{onShutdown:o,workerName:n})]}):r==="maintenance pending"||r==="maintenance mode"||r==="maintenance request"||r==="offline maintenance"?g.jsxs(di,{gap:2,align:"stretch",children:[g.jsx(vr,{fontSize:"sm",whiteSpace:"pre-wrap",children:t.maintenance_comments||"No comment"}),g.jsxs(ui,{justifyContent:"end",gap:2,children:[g.jsx(yR,{onEditComment:o,workerName:n}),g.jsx(SR,{onExitMaintenance:o,workerName:n}),r==="offline maintenance"?g.jsx(ip,{onDelete:o,workerName:n}):g.jsx(ap,{onShutdown:o,workerName:n})]})]}):r==="offline"||r==="unknown"?g.jsx(ui,{justifyContent:"end",children:g.jsx(ip,{onDelete:o,workerName:n})}):null};function OR(e){return te({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"m22 3.41-.12-1.26-1.2.4a13.84 13.84 0 0 1-6.41.64 11.87 11.87 0 0 0-6.68.9A7.23 7.23 0 0 0 3.3 9.5a9 9 0 0 0 .39 4.58 16.6 16.6 0 0 1 1.18-2.2 9.85 9.85 0 0 1 4.07-3.43 11.16 11.16 0 0 1 5.06-1A12.08 12.08 0 0 0 9.34 9.2a9.48 9.48 0 0 0-1.86 1.53 11.38 11.38 0 0 0-1.39 1.91 16.39 16.39 0 0 0-1.57 4.54A26.42 26.42 0 0 0 4 22h2a30.69 30.69 0 0 1 .59-4.32 9.25 9.25 0 0 0 4.52 1.11 11 11 0 0 0 4.28-.87C23 14.67 22 3.86 22 3.41z"},child:[]}]})(e)}function PR(e){return te({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"32",d:"M93.72 183.25C49.49 198.05 16 233.1 16 288c0 66 54 112 120 112h184.37m147.45-22.26C485.24 363.3 496 341.61 496 312c0-59.82-53-85.76-96-88-8.89-89.54-71-144-144-144-26.16 0-48.79 6.93-67.6 18.14"},child:[]},{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"32",d:"M448 448 64 64"},child:[]}]})(e)}function IR(e){return te({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M12.0001 18C12.7144 18 13.3704 18.2497 13.8856 18.6665L12.0001 21L10.1145 18.6665C10.6297 18.2497 11.2857 18 12.0001 18ZM2.80766 1.39343L20.4853 19.0711L19.0711 20.4853L13.8913 15.3042C13.2967 15.1069 12.6609 15 12.0001 15C10.5719 15 9.26024 15.499 8.22998 16.3322L6.97363 14.7759C8.24961 13.7442 9.84925 13.0969 11.5964 13.01L9.00025 10.414C7.55273 10.8234 6.22651 11.5217 5.0878 12.4426L3.83099 10.8868C4.89946 10.0226 6.10763 9.32438 7.41633 8.83118L5.13168 6.5451C3.98878 7.08913 2.92058 7.76472 1.94666 8.55228L0.689453 6.99674C1.60358 6.25747 2.59156 5.60589 3.64058 5.05479L1.39345 2.80765L2.80766 1.39343ZM14.5004 10.2854L12.2165 8.00243L12 8C15.0947 8 17.9369 9.08141 20.1693 10.8869L18.9123 12.4426C17.6438 11.4167 16.1427 10.6672 14.5004 10.2854ZM12.0001 3.00003C16.2849 3.00003 20.22 4.49719 23.3109 6.99691L22.0534 8.55228C19.3061 6.33062 15.8085 5.00003 12.0001 5.00003C11.122 5.00003 10.2604 5.07077 9.42075 5.20685L7.72455 3.51088C9.09498 3.17702 10.5268 3.00003 12.0001 3.00003Z"},child:[]}]})(e)}const RR=({state:e,...t})=>{switch(e){case"starting":return g.jsx(ep,{...t});case"running":return g.jsx(Zg,{...t});case"idle":return g.jsx(OR,{...t});case"shutdown request":case"terminating":return g.jsx(oR,{...t});case"offline":return g.jsx(PR,{...t});case"unknown":return g.jsx(IR,{...t});case"maintenance request":case"maintenance pending":case"maintenance exit":return g.jsx(xR,{...t});case"maintenance mode":case"offline maintenance":return g.jsx(rp,{...t});default:return g.jsx(Yg,{...t})}},TR=e=>{switch(e){case"starting":case"maintenance request":case"maintenance exit":return"yellow";case"running":return"green";case"idle":return"teal";case"shutdown request":case"terminating":return"purple";case"offline":case"offline maintenance":return"black";case"unknown":return"red";case"maintenance mode":case"maintenance pending":return"orange";default:return"gray"}},NR=e=>{switch(e){case"starting":return"Edge Worker is in initialization.";case"running":return"Edge Worker is actively running a task.";case"idle":return"Edge Worker is active and waiting for a task.";case"shutdown request":return"Request to shutdown Edge Worker is issued. It will be picked-up on the next heartbeat, tasks will drain and then worker will terminate.";case"terminating":return"Edge Worker is completing work (draining running tasks) and stopping.";case"offline":return"Edge Worker was shut down.";case"unknown":return"No heartbeat signal from worker for some time, Edge Worker probably down or got disconnected.";case"maintenance request":return"Worker was requested to enter maintenance mode. Once worker receives this message it will pause fetching tasks and drain tasks.";case"maintenance pending":return"Edge Worker received the request for maintenance, waiting for tasks to finish. Once tasks are finished will move to 'maintenance mode'.";case"maintenance mode":return"Edge Worker is in maintenance mode. It is online but pauses fetching tasks.";case"maintenance exit":return"Request Worker is requested to exit maintenance mode. Once the worker receives this state it will un-pause and fetch new tasks.";case"offline maintenance":return"Worker was shut down in maintenance mode. It will be in maintenance mode when restarted.";default:return}},AR=O.forwardRef(({children:e,state:t,...n},r)=>g.jsxs(Kh,{borderRadius:"full",colorPalette:TR(t),fontSize:"sm",px:e===void 0?1:2,py:1,ref:r,title:NR(t),variant:"solid",...n,children:[t===void 0?void 0:g.jsx(RR,{state:t}),e]})),_R=()=>{const{data:e,error:t,refetch:n}=NI(void 0,{enabled:!0,refetchInterval:tp});return e?.workers&&e.workers.length>0?g.jsxs(vr,{p:2,children:[g.jsxs(tf,{size:"sm",interactive:!0,stickyHeader:!0,striped:!0,children:[g.jsx(nf,{children:g.jsxs(hi,{children:[g.jsx(xe,{children:"Worker Name"}),g.jsx(xe,{children:"State"}),g.jsx(xe,{children:"Queues"}),g.jsx(xe,{children:"First Online"}),g.jsx(xe,{children:"Last Heartbeat"}),g.jsx(xe,{children:"Active Jobs"}),g.jsx(xe,{children:"System Information"}),g.jsx(xe,{children:"Operations"})]})}),g.jsx(rf,{children:e.workers.map(r=>g.jsxs(hi,{id:r.worker_name,children:[g.jsx(ke,{children:r.worker_name}),g.jsx(ke,{children:g.jsx(AR,{state:r.state,children:r.state})}),g.jsx(ke,{children:r.queues?g.jsx(Zh,{children:r.queues.map(o=>g.jsx(ef,{children:o},o))}):"(all queues)"}),g.jsx(ke,{children:r.first_online?g.jsx(Fi,{date:r.first_online,live:!1}):void 0}),g.jsx(ke,{children:r.last_heartbeat?g.jsx(Fi,{date:r.last_heartbeat,live:!1}):void 0}),g.jsx(ke,{children:r.jobs_active}),g.jsx(ke,{children:r.sysinfo?g.jsx(Zh,{children:Object.entries(r.sysinfo).map(([o,i])=>g.jsxs(ef,{children:[o,": ",i]},o))}):"N/A"}),g.jsx(ke,{children:g.jsx(ER,{worker:r,onOperations:n})})]},r.worker_name))})]}),g.jsx(rR,{})]}):e?g.jsxs(Le,{as:"div",pl:4,pt:1,children:["No known workers. Start one via ",g.jsx($E,{children:"airflow edge worker [...]"}),". See"," ",g.jsxs(Mr,{target:"_blank",variant:"underline",color:"fg.info",href:"https://airflow.apache.org/docs/apache-airflow-providers-edge3/stable/deployment.html",children:["Edge Worker Deployment docs ",g.jsx(QI,{})]})," ","how to deploy a new worker."]}):t?g.jsx(Le,{as:"div",pl:4,pt:1,children:g.jsx(Jg,{error:t})}):g.jsx(Le,{as:"div",pl:4,pt:1,children:"Loading..."})},VR=({tabs:e})=>{const t=P.useRef(null),n=gR(t);return g.jsx(ui,{alignItems:"center",borderBottomWidth:1,mb:2,ref:t,children:e.map(({icon:r,label:o,value:i})=>g.jsx(uI,{end:!0,title:o,to:{pathname:i},children:({isActive:s})=>g.jsx(Yh,{borderBottomColor:"border.info",borderBottomWidth:s?3:0,color:s?"fg":"fg.muted",fontWeight:"bold",height:"40px",mb:"-2px",pb:s?0:"3px",px:4,transition:"all 0.2s ease",children:n>600||!r?o:r})},i))})},FR=()=>{const e=[{label:"Edge Worker",value:"plugin/edge_worker"},{label:"Edge Jobs",value:"plugin/edge_jobs"}];return g.jsx(vr,{p:2,children:g.jsxs(aI,{children:[g.jsx(VR,{tabs:e}),g.jsxs(eI,{children:[g.jsx(Ja,{path:"plugin/edge_worker",element:g.jsx(_R,{})}),g.jsx(Ja,{path:"plugin/edge_jobs",element:g.jsx(vR,{})})]})]})})};/*! * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information diff --git a/providers/edge3/src/airflow/providers/edge3/plugins/www/src/components/MaintenanceEditCommentButton.tsx b/providers/edge3/src/airflow/providers/edge3/plugins/www/src/components/MaintenanceEditCommentButton.tsx index 810f830861ec1..cacba3f998b6e 100644 --- a/providers/edge3/src/airflow/providers/edge3/plugins/www/src/components/MaintenanceEditCommentButton.tsx +++ b/providers/edge3/src/airflow/providers/edge3/plugins/www/src/components/MaintenanceEditCommentButton.tsx @@ -57,7 +57,14 @@ export const MaintenanceEditCommentButton = ({ return ( <> - + diff --git a/providers/edge3/src/airflow/providers/edge3/plugins/www/src/components/MaintenanceExitButton.tsx b/providers/edge3/src/airflow/providers/edge3/plugins/www/src/components/MaintenanceExitButton.tsx index d1b34ca4cc5b0..a7f7b7aff282f 100644 --- a/providers/edge3/src/airflow/providers/edge3/plugins/www/src/components/MaintenanceExitButton.tsx +++ b/providers/edge3/src/airflow/providers/edge3/plugins/www/src/components/MaintenanceExitButton.tsx @@ -58,6 +58,7 @@ export const MaintenanceExitButton = ({ onExitMaintenance, workerName }: Mainten onClick={onOpen} aria-label="Exit Maintenance" title="Exit Maintenance" + colorPalette="warning" > diff --git a/providers/edge3/www-hash.txt b/providers/edge3/www-hash.txt index dc576b6d78ba9..fe35ae70bea50 100644 --- a/providers/edge3/www-hash.txt +++ b/providers/edge3/www-hash.txt @@ -1 +1 @@ -7e32af67c70359125a37701239579cacb19e6c0a0a248d1bb60d18cc3c274673 +05e9a75c13c19b0018c43055b669b2db9ef0464c1f5179a20e34add6c59ad53b