import{u as D,r as b,j as e,L as H,dz as T,B as j,fl as x,fm as y,fn as E,fo as K,aK as w,bG as L,at as C,bm as P,au as A,C as F,aS as v,bH as k}from"./index-C1DmWO_C.js";import{a as I,u as M}from"./index-Dub34MAX.js";const m=({name:o,init:s,title:l,tooltip:t,base:a,options:c,isFetching:n,toStringF:i,toObjF:u})=>{const{control:d,setValue:r,getValues:h}=w();return b.useEffect(()=>{setTimeout(()=>{s&&r(o.join("."),a)},0)},[a,s,o,r]),e.jsxs(j,{gap:"10px",flexDirection:"column",flex:"1",width:"100%",children:[e.jsxs(j,{flexDirecton:"row",children:[e.jsx(L,{children:l}),e.jsx(C,{position:P.right,mainText:t,children:e.jsx(A,{ml:"5px",size:"xs",icon:F.info_block})})]}),e.jsx(v,{render:({field:{value:f,onChange:p}})=>e.jsx(k,{isMulti:!0,value:i(f??[]),options:i(c),placeholder:"",onChange:g=>p(u(g)),preventAdding:!0,isLoading:n},`${i(f??[]).join("")}`),name:o.join("."),control:d})]})},S=({name:o,init:s,title:l,tooltip:t,base:a,options:c,isFetching:n,toStringF:i,toObjF:u})=>{const{control:d,setValue:r,getValues:h}=w();return b.useEffect(()=>{setTimeout(()=>{s&&r(o.join("."),a)},0)},[a,s,o,r]),e.jsxs(j,{gap:"10px",flexDirection:"column",flex:"1",width:"100%",children:[e.jsxs(j,{flexDirecton:"row",children:[e.jsx(L,{children:l}),e.jsx(C,{position:P.right,mainText:t,children:e.jsx(A,{ml:"5px",size:"xs",icon:F.info_block})})]}),e.jsx(v,{render:({field:{value:f,onChange:p}})=>e.jsx(k,{isMulti:!1,value:i([f]),options:i(c),placeholder:"",onChange:g=>p(u(g)[0]),preventAdding:!0,isLoading:n},`${f}`),name:o.join("."),control:d})]})},V=({prefix:o,init:s})=>{const{id:l}=D(),{data:t,isLoading:a,isFetching:c}=I({id:l}),{data:n,isLoading:i,isFetching:u}=M({id:l}),d=b.useMemo(()=>[...o,"schedulingConfig","kubeNodeSelectorLabels"],[o]),r=b.useMemo(()=>[...o,"schedulingConfig","kubeNodeAntiAffinityLabels"],[o]),h=b.useMemo(()=>[...o,"schedulingConfig","kubePriorityClass"],[o]);return a||i?e.jsx(H,{}):!t||!n?null:e.jsx(T,{title:"Scheduler",children:e.jsxs(j,{width:"100%",gap:"20px",flexDirection:"column",children:[e.jsx(m,{name:d,init:s,title:"Node affinity",tooltip:"Job will run on a node with any of the following labels.  Available Labels are configured by a Hopsworks Admin. If you require the use of a particular Label, not currently available in your project, contact a Hopsworks Admin.",base:t.value.base,options:t.value.allowed,toStringF:x,toObjF:y,isFetching:c}),e.jsx(m,{name:r,init:s,title:"Node anti affinity",tooltip:"Job will run on a node that does not have any of the following labels.  Available Labels are configured by a Hopsworks Admin. If you require the use of a particular Label, not currently available in your project, contact a Hopsworks Admin.",base:[],options:t.value.allowed,toStringF:x,toObjF:y,isFetching:c}),e.jsx(S,{name:h,init:s,title:"Priority class",tooltip:"Job will run with this priority class.  Available Priority Classes are configured by a Hopsworks Admin. If you require the use of a particular Priority Classes, not currently availablein your project, contact a Hopsworks Admin.",base:n.value.base,options:n.value.allowed,toStringF:E,toObjF:K,isFetching:u})]})})};export{V as K};
