PageSourceSearch

https://app.deepwind.ai/assets/js/sprint-planning/sprint-planning-inline-edit-modal-CZz3mmFS-1791218975454.js

js deepwind.ai collected 2026-10-09 04:44:22 UTC 5,652 bytes, 1 lines download raw bytes

1import{bk as P,bl as x,r as c,aP as o,b3 as b}from"../vendors/vendor-YUfIzhZH-1791218974056.js";import{u as S,i as j,v as T,D as E,a as C,b as R,c as F,d as N,J as O,P as D,S as V,O as w,R as M,A as Q,C as W,e as A,B as m}from"./sprint-planning-core-D8DFNeL2-1791218975454.js";function K(e){const r=[];return(!e.overrideReason||e.overrideReason.length<10)&&r.push("Reason must be at least 10 characters"),e.overrideReason&&e.overrideReason.length>200&&r.push("Reason must be at most 200 characters"),e.storyPoints!==void 0&&((e.storyPoints<0||e.storyPoints>100)&&r.push("Story points must be between 0 and 100"),Number.isInteger(e.storyPoints)||r.push("Story points must be a whole number")),e.priority&&!["critical","high","medium","low"].includes(e.priority)&&r.push("Invalid priority value"),e.resourceType&&!["frontend","backend","fullstack"].includes(e.resourceType)&&r.push("Invalid resource type"),{valid:r.length===0,errors:r}}function H(e,r={},u){const{toast:y}=S(),l=P(),i=x({mutationFn:async s=>{const n=K(s);if(!n.valid)throw new Error(n.errors.join(", "));const t=await fetch(`/api/v1/work-items/${e.id}/overrides`,{method:"PATCH",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({workspaceId:u||e.workspaceId,pm33Overrides:{priority:s.priority,storyPoints:s.storyPoints,resourceType:s.resourceType,overrideReason:s.overrideReason}})});if(!t.ok){const p=await t.json().catch(()=>({}));throw new Error(p.message||`HTTP ${t.status}: Failed to save override`)}const a=await t.json();if(!a.success)throw new Error(a.message||"Failed to save override");return a.item},onMutate:async s=>{await l.cancelQueries({queryKey:["work-items"]});const n=e,t={...e,priority:s.priority||e.priority,storyPoints:s.storyPoints!==void 0?s.storyPoints:e.storyPoints,...s.resourceType&&{resourceType:s.resourceType}};return l.setQueryData(["work-items",e.id],t),{previousWorkItem:n}},onError:(s,n,t)=>{t?.previousWorkItem&&l.setQueryData(["work-items",e.id],t.previousWorkItem);const a=s instanceof Error?s.message:"Failed to save override";y({title:"Error Saving Override",description:a,variant:"destructive"}),r.onError?.(s instanceof Error?s:new Error(a))},onSuccess:s=>{l.setQueryData(["work-items",e.id],s),j(l),y({title:"Override Saved",description:"Priority and story points have been updated."}),r.onSuccess?.(s)}});return{saveOverride:i.mutate,isSaving:i.isPending,isError:i.isError,error:i.error}}function J(e,r){const[u,y]=c.useState(e?.priority||"medium"),[l,i]=c.useState((e?.storyPoints||0).toString()),[s,n]=c.useState(""),[t,a]=c.useState(e?.resourceType||"unknown"),[p,v]=c.useState(""),f=c.useMemo(()=>T(u,l,s),[u,l,s]),h=c.useCallback(()=>{y(e.priority||"medium"),i((e.storyPoints||0).toString()),n(""),a(e.resourceType||"unknown"),v("")},[e]),d=c.useCallback(g=>{if(g===""){i("");return}isNaN(parseInt(g,10))||i(g)},[]);return c.useEffect(()=>{r&&h()},[r,h]),{state:{priority:u,storyPoints:l,reason:s,resourceType:t,validationError:p},validation:f,setters:{setPriority:y,setStoryPoints:i,setReason:n,setResourceType:a,setValidationError:v},handlers:{resetForm:h,handleStoryPointsChange:d}}}const $=({isOpen:e,workItem:r,capacityConfig:u,onClose:y,onSave:l})=>{const{state:i,validation:s,setters:n,handlers:t}=J(r,e),{saveOverride:a,isSaving:p}=H(r,{onSuccess:d=>{l?.(d),v()},onError:()=>{}},r?.workspaceId),v=c.useCallback(()=>{t.resetForm(),y()},[t,y]),f=c.useCallback(async()=>{if(!s.isFormValid){n.setValidationError("Please fix validation errors before saving");return}if(!r)return;const d={priority:i.priority,storyPoints:s.storyPoints.value,resourceType:r.resourceDetectionConfidence<.9?i.resourceType:void 0,overrideReason:i.reason};a(d)},[s,i,r,a,n]),h=c.useCallback(d=>{d.key==="Escape"&&v()},[v]);return r?o.jsx(E,{open:e,onOpenChange:d=>{d||v()},children:o.jsxs(C,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",onKeyDown:h,children:[o.jsxs(R,{children:[o.jsxs(F,{className:"text-lg font-semibold",children:["Edit Item: ",r.jiraKey," (",r.title,")"]}),o.jsx(N,{children:"Edit priority, story points, and resource type overrides for this work item."})]}),o.jsxs("div",{className:"space-y-6 py-4",children:[o.jsx(O,{item:r}),o.jsxs("div",{className:"space-y-4",children:[o.jsx("h3",{className:"text-sm font-semibold text-gray-900",children:"DeepWind Overrides"}),o.jsx(D,{value:i.priority,onChange:n.setPriority}),o.jsx(V,{value:i.storyPoints,onChange:t.handleStoryPointsChange,isValid:s.storyPoints.isValid}),o.jsx(w,{value:i.reason,onChange:n.setReason,error:!s.reason.isValid&&i.reason.length>0?s.reason.message:void 0})]}),r.resourceDetectionConfidence<.9&&o.jsx("div",{className:"space-y-4 rounded-lg border border-yellow-200 bg-yellow-50 p-4",children:o.jsx(M,{currentResourceType:r.resourceType||"unknown",confidence:r.resourceDetectionConfidence,reasoning:r.resourceDetectionReasoning,selected:i.resourceType,onCh
1ange:n.setResourceType})}),o.jsx(Q,{priority:i.priority,storyPoints:s.storyPoints.value}),u&&o.jsx(W,{currentStoryPoints:r.storyPoints||0,newStoryPoints:s.storyPoints.value,currentResourceType:r.resourceType,newResourceType:i.resourceType,capacityConfig:u}),i.validationError&&o.jsx("div",{className:"rounded-lg border border-red-200 bg-red-50 p-3",role:"alert",children:o.jsx("p",{className:"text-sm text-red-700 font-medium",children:i.validationError})})]}),o.jsxs(A,{className:"gap-2",children:[o.jsx(m,{variant:"outline",onClick:v,disabled:p,children:"Cancel"}),o.jsxs(m,{onClick:f,disabled:!s.isFormValid||p,className:"min-w-fit",children:[p&&o.jsx(b,{className:"mr-2 h-4 w-4 animate-spin"}),p?"Saving...":"Save Edit"]})]})]})}):null};export{$ as InlineEditModal};

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.