import{r as l,j as e}from"./vendor-react-wBh_31cN.js";import{E as c}from"./editable-select-Co_-YcCr.js";import{C as b,a as h,b as g,c as v}from"./card-DISTA6Ay.js";import{F as B}from"./form-footer-CprMCGDT.js";import{aq as T,G as A}from"./index-BKr2rJhV.js";import{T as D}from"./tooltip-Da8-EbK8.js";import{L as d}from"./label-Dnebucx5.js";import{b as H,a as I,f as K}from"./index-CzW6Djeq.js";import{p as M,g as q,l as C,s as E,a as F}from"./kubernetes-mdfH7o1Q.js";import{c as L}from"./vendor-router-D1GqFWiT.js";import{s as y}from"./symmetricDifference-B5oxoXBg.js";import{O as J}from"./vendor-icons-BUUmD6ht.js";import"./vendor-radix-BRyWS4bQ.js";import"./vendor-redux-CJZrIb6x.js";import"./vendor-utils-OeoE2qq_.js";import"./vendor-grid-CeFlDWv4.js";import"./props-gQDi595u.js";import"./join-DatdAzSt.js";import"./pathOr-DUeeLFEu.js";import"./concat-AxOj0lUI.js";const x=({text:s})=>e.jsx(D,{content:s,children:e.jsx(J,{className:"ml-1.5 size-3.5 text-quartz-gray"})}),G=({projectPCs:s,basePC:t,projectLabels:r,baseLabels:i})=>{const{id:n}=L(),[a,p]=l.useState(t!==""?[t]:[]),[o,f]=l.useState(i),[m,{isLoading:P}]=K(),j=l.useCallback(()=>{const u=E(a),S=F(o),[k=void 0]=u;m({id:n,baseLabels:S,basePriorityClass:k})},[o,a,n,m]),w=l.useCallback(async()=>{await j()},[j]),N=y([t],a).length>0||y(i,o).length>0;return e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsxs(b,{children:[e.jsx(h,{children:e.jsx(g,{children:"Labels"})}),e.jsx(v,{children:e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex flex-row items-center",children:[e.jsx(d,{children:"Available"}),e.jsx(x,{text:"Labels configured by a Hopsworks Administrator as available to this project. If you require additional Labels, contact a Hopsworks Admin."})]}),e.jsx(c,{disabled:!0,isMulti:!0,value:r,options:[],placeholder:"Labels available in this project",onChange:function(u){}})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex flex-row items-center",children:[e.jsx(d,{children:"Job Default"}),e.jsx(x,{text:"Default Labels will be set as the initial (pre-populated) values for affinity when starting a job, notebook or deployment."})]}),e.jsx(c,{isMulti:!0,value:o,options:r,placeholder:"Base Label for Jobs",onChange:f},`${o.join("")}`)]})]})})]}),e.jsxs(b,{children:[e.jsx(h,{children:e.jsx(g,{children:"Project Priority Classes"})}),e.jsx(v,{children:e.jsxs("div",{className:"flex flex-col gap-5",children:[e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex flex-row items-center",children:[e.jsx(d,{children:"Available"}),e.jsx(x,{text:"Priority Classes configured by a Hopsworks Administrator as available to this project. If you require additional priority classes, contact a Hopsworks Admin."})]}),e.jsx(c,{disabled:!0,isMulti:!0,value:s,options:[],placeholder:"Priority Classes available in this project",onChange:function(u){}})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex flex-row items-center",children:[e.jsx(d,{children:"Job Default"}),e.jsx(x,{text:"Default will be set as the initial (pre-populated) value for Priority Class when starting a job, notebook or deployment."})]}),e.jsx(c,{isMulti:!1,value:a,options:s,placeholder:"Base Priority Class for Jobs",onChange:p,preventAdding:!0},`${a.join("")}`)]})]})})]}),e.jsx(B,{children:e.jsx(A,{"data-test":"save",onClick:w,loading:P,disabled:!N,children:"Save"})})]})},z=()=>{const{id:s}=L(),{data:t,isLoading:r}=H({id:s}),{data:i,isLoading:n}=I({id:s});if(r||n)return e.jsx(T,{});const a=M(["value","allowed"],t),p=q(["value","base"],t),o=C(["value","allowed"],i),f=C(["value","base"],i);return e.jsx("div",{className:"flex w-full flex-col gap-5",children:e.jsx(G,{projectPCs:a,basePC:p,projectLabels:o,baseLabels:f})})},ce=l.memo(z);export{ce as default};
