1import{b as h,o as O,d as P,g as p,H as w,r as a,j as e,e as T,f as E}from"./index-B_Eg0Obd.js";import{D as S}from"./index-BxD-1ne9.js";import{V as I}from"./index-BpUg3BDL.js";import{D as y}from"./index-WeZV9KEP.js";import{T as f}from"./index-CmMJ6yG9.js";import{B as N}from"./index-CFDkn0qQ.js";import{P as _}from"./index-COJ_sq5X.js";import{i as A}from"./inputSimpleOnChangeCallback-DI8I8MYB.js";import{u as b}from"./useMutation-D-kUIAcD.js";import"./useDebouncedProp-YczcRoxw.js";import"./index-CMfwiofY.js";import"./index-Cq4jRDn0.js";import"./index-xzAoeUW2.js";import"./index-Mg7wSTSL.js";import"./zindexes-C5BKpkFg.js";import"./useOnClickOutsideElementEffect-C1mY0zcR.js";import"./index-B3nYGjha.js";import"./lottie-loading-apphive-CnjcHCwh.js";import"./LottieBaseWeb-C5bQzb-x.js";import"./lottie-a22hL3wM.js";import"./index-DPG4c3BO.js";import"./index-Chpp-lIU.js";import"./useIsomorphicLayoutEffect-Dxrgoub2.js";const R=p`query clientProjects($id: String!) { 2 clientProject(id: $id) { 3 id name 4 } 5}`,W=p`query clientProjects($id: String!) { 6 clientApp(id: $id) { 7 id name 8 } 9}`,H=p`mutation setOwnerToApp( 10 $ownerId: String! $id: String! 11) { 12 clientAppAssignOwner(ownerId: $ownerId id: $id) { 13 id name 14 } 15}`,L=p`mutation setOwnerToProject( 16 $ownerId: String! $id: String! 17) { 18 clientProjectAssignOwner(ownerId: $ownerId id: $id) { 19 id name 20 } 21}`,k=({id:r})=>{const{data:o}=h(R,{variables:{id:r}}),{data:i}=h(W,{variables:{id:r}}),[c,{loading:t}]=b(H,{onError:O,onCompleted:()=>{P.success("Owner id was assigned")}}),[l,{loading:d}]=b(L,{onError:O,onCompleted:()=>{P.success("Owner id was assigned")}});return{app:i==null?void 0:i.clientApp,project:o==null?void 0:o.clientProject,loading:t||d,setAppOwner:c,setProjectOwner:l}},q=w.div` 22 display: flex; 23 flex-direction: column; 24 padding: 20px; 25`,$=w.div` 26 width: 50%; 27 margin-top: 10px; 28`,B=w.div` 29 margin-top: 10px; 30 width: 150px; 31`,V=[{displayName:"Project",id:"Project"},{displayName:"App",id:"App"}],le=()=>{const[r,o]=a.useState("Project"),[i,c]=a.useState(""),[t,l]=a.useState(""),{app:d,project:j,loading:v,setAppOwner:g,setProjectOwner:x}=k({id:i}),s=a.useMemo(()=>{if(r==="App")return d;if(r==="Project")return j},[r,d,j]),n=s==null?void 0:s.id,C=a.useCallback(async()=>{n&&(r==="App"?g({variables:{id:n,ownerId:t}}):r==="Project"&&x({variables:{id:n,ownerId:t}}))},[g,x,t,n,r]);return e.jsxs(q,{children:[e.jsx(T,{children:"Project Ownership"}),e.jsx(I,{}),e.jsx(y,{width:"250px",isSlim:!0,idProp:"id",nameProp:"displayName",items:V,selectedItemId:r,onItemSelectedChange:o,label:"Assign owner to"}),e.jsx($,{children:e.jsx(S,{value:i,onChange:c,render:(m,u)=>e.jsx(f,{label:`${r} id`,isSlim:!0,value:m,htmlName:"id",disabled:!r,onChange:A(u)})})}),e.jsx(I,{}),!s&&e.jsx(E,{children:`There are no ${r||"item"}s to show.`}),e.jsx(S,{value:t,onChange:l,render:(m,u)=>e.jsx($,{children:e.jsx(f,{label:"Owner id",isSlim:!0,value:m,htmlName:"ownerId",disabled:!n,onChange:A(u)})})}),t&&e.jsx(_,{userId:t}),e.jsx(B,{children:e.jsx(N,{onClick:C,sizeVariant:"small",disabled:!t||!n||!s,isLoading:v,children:"Add owner"})})]})};export{le as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.