cc-dashboard/src/static/assets/PlannerView-CaKoMOa-.js
Vadym Samoilenko 48b2e71daa
Some checks failed
CI / backend (push) Has been cancelled
CI / frontend (push) Has been cancelled
fix(devops): account-wide WIQL sync + priority/project columns in UI
- ADO client: query_work_items_account + get_work_items_batch_account
  use org-level URLs, removing the project-scoped URL that 400'd on
  projects with spaces in their names
- sync.py: switched to account-scope methods, added System.CreatedDate
  and Microsoft.VSTS.Common.Priority to FIELDS list
- AzureWorkItem model: @property team_project/priority/created_date
  derived from fields_json (no migration needed)
- AzureWorkItemOut schema: exposed the 3 new derived fields
- DevopsView: table layout with Project / Priority / Created / State columns

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-07 12:04:10 +01:00

1 line
7.4 KiB
JavaScript

import{u as N,_ as E}from"./TaskForm.vue_vue_type_script_setup_true_lang-y1bs1uEE.js";import{d as T,o as n,c as l,a as t,n as P,t as x,F as D,r as V,A,i as w,e as p,w as y,p as L,h as _,C as z,j,y as H,D as U,k as K,q as b,x as q,v as I,K as h}from"./index-CgLSFOTi.js";import{_ as O}from"./Badge.vue_vue_type_script_setup_true_lang-COW77Eo8.js";import{f as F,i as B}from"./utils-7WVCegLb.js";import{_ as $}from"./Button.vue_vue_type_script_setup_true_lang-2QVxqpnK.js";import{_ as S}from"./Input.vue_vue_type_script_setup_true_lang-CM55zCqq.js";import"./Dialog.vue_vue_type_script_setup_true_lang-Dwscb3of.js";import"./devops-Di141h0c.js";import"./Spinner.vue_vue_type_script_setup_true_lang-Her3XtBX.js";const G=["draggable"],J={class:"flex items-start gap-2"},Q=["title"],R={class:"flex-1 min-w-0"},W={class:"text-sm font-medium text-foreground leading-tight truncate"},X={key:0,class:"flex items-center gap-1 mt-1 flex-wrap"},Y={class:"flex items-center gap-2 mt-1.5 flex-wrap"},Z={key:0,class:"text-xs text-muted-foreground"},ee={key:1,class:"text-xs text-emerald-400"},te={key:2,class:"text-xs text-blue-400 ml-auto",title:"Azure DevOps"},se={class:"flex items-center gap-1 opacity-0 group-hover:opacity-100 shrink-0"},oe=T({__name:"TaskCard",props:{task:{},draggable:{type:Boolean}},emits:["edit","complete","delete"],setup(s,{emit:r}){const a=r,m=d=>({todo:"outline",doing:"default",done:"success",cancelled:"secondary"})[d],f=d=>["","Low","Medium","High","Critical","Blocker"][d]??"Unknown",v=d=>d>=4?"bg-red-500":d===3?"bg-amber-500":"bg-emerald-500";return(d,o)=>{var k;return n(),l("div",{draggable:s.draggable,class:"rounded-lg border border-border bg-card p-3 hover:border-primary/50 transition-colors cursor-pointer group",onClick:o[2]||(o[2]=u=>a("edit",s.task))},[t("div",J,[t("div",{class:P(["h-2 w-2 rounded-full mt-1.5 shrink-0",v(s.task.priority)]),title:f(s.task.priority)},null,10,Q),t("div",R,[t("p",W,x(s.task.title),1),(k=s.task.tags)!=null&&k.length?(n(),l("div",X,[(n(!0),l(D,null,V(s.task.tags,u=>(n(),l("span",{key:u.id,class:"inline-flex items-center px-1.5 py-0.5 rounded text-xs font-medium",style:A({background:`${u.color_hex}22`,color:u.color_hex})},x(u.name),5))),128))])):w("",!0),t("div",Y,[p(O,{variant:m(s.task.status),class:"text-xs py-0"},{default:y(()=>[L(x(s.task.status),1)]),_:1},8,["variant"]),s.task.estimate_hours?(n(),l("span",Z," ~"+x(_(F)(s.task.estimate_hours)),1)):w("",!0),s.task.actual_hours?(n(),l("span",ee,x(_(F)(s.task.actual_hours))+" actual ",1)):w("",!0),s.task.azure_work_item_id?(n(),l("span",te," #"+x(s.task.azure_work_item_id),1)):w("",!0)])]),t("div",se,[s.task.status!=="done"?(n(),l("button",{key:0,class:"p-1 rounded hover:bg-emerald-500/20 text-emerald-400",title:"Mark done",onClick:o[0]||(o[0]=z(u=>a("complete",s.task),["stop"]))},[...o[3]||(o[3]=[t("svg",{class:"h-3.5 w-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 13l4 4L19 7"})],-1)])])):w("",!0),t("button",{class:"p-1 rounded hover:bg-red-500/20 text-red-400",title:"Delete",onClick:o[1]||(o[1]=z(u=>a("delete",s.task),["stop"]))},[...o[4]||(o[4]=[t("svg",{class:"h-3.5 w-3.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})],-1)])])])])],8,G)}}}),ae={class:"space-y-6"},ne={key:0,class:"text-sm text-muted-foreground py-4 text-center"},le={class:"flex items-center gap-2 mb-2"},re={class:"text-xs font-semibold uppercase tracking-wide text-muted-foreground"},ie={class:"text-xs text-muted-foreground bg-muted px-1.5 py-0.5 rounded-full"},de={class:"space-y-2"},ue={key:0,class:"text-sm text-muted-foreground text-center py-8"},ce=T({__name:"TaskList",props:{tasks:{},loading:{type:Boolean}},emits:["edit","complete","delete"],setup(s,{emit:r}){const a=s,m=r,f=j(()=>{var o;const d={doing:[],todo:[],done:[],cancelled:[]};for(const k of a.tasks)(o=d[k.status])==null||o.push(k);return d}),v={doing:"In Progress",todo:"To Do",done:"Done",cancelled:"Cancelled"};return(d,o)=>(n(),l("div",ae,[s.loading?(n(),l("div",ne,"Loading tasks...")):(n(),l(D,{key:1},[(n(!0),l(D,null,V(f.value,(k,u)=>H((n(),l("div",{key:u},[t("div",le,[t("h3",re,x(v[u]),1),t("span",ie,x(k.length),1)]),t("div",de,[(n(!0),l(D,null,V(k,g=>(n(),K(oe,{key:g.id,task:g,draggable:"",onEdit:C=>m("edit",g),onComplete:C=>m("complete",g),onDelete:C=>m("delete",g)},null,8,["task","onEdit","onComplete","onDelete"]))),128))])])),[[U,k.length>0]])),128)),a.tasks.length?w("",!0):(n(),l("div",ue," No tasks found "))],64))]))}}),me={class:"p-6"},ke={class:"flex items-center gap-3 mb-6 flex-wrap"},fe={class:"flex items-center gap-1"},$e=T({__name:"PlannerView",setup(s){const r=N(),a=b(B(new Date)),m=b(!1),f=b(null),v=b("");q(()=>{r.fetchForDate(a.value)}),I(a,()=>{r.fetchForDate(a.value)});const d=j(()=>v.value?r.tasks.filter(i=>{var e;return((e=i.project_id)==null?void 0:e.toLowerCase().includes(v.value.toLowerCase()))||i.title.toLowerCase().includes(v.value.toLowerCase())}):r.tasks);function o(){f.value=null,m.value=!0}function k(i){f.value=i,m.value=!0}async function u(i,e){try{if(f.value)await r.update(f.value.id,i),h.success("Task updated");else{const c=await r.create(i);e&&(c!=null&&c.id)&&await r.createBlock(c.id,e),h.success("Task created")}m.value=!1,r.fetchForDate(a.value)}catch{h.error("Failed to save task")}}async function g(i){try{await r.complete(i.id),h.success("Task completed")}catch{h.error("Failed to complete task")}}async function C(i){if(confirm(`Delete "${i.title}"?`))try{await r.remove(i.id),h.success("Task deleted")}catch{h.error("Failed to delete task")}}function M(i){const e=new Date(a.value);e.setDate(e.getDate()+i),a.value=B(e)}return(i,e)=>(n(),l("div",me,[t("div",ke,[e[10]||(e[10]=t("h2",{class:"text-lg font-semibold text-foreground flex-1"},"Planner",-1)),t("div",fe,[p($,{variant:"outline",size:"sm",onClick:e[0]||(e[0]=c=>M(-1))},{default:y(()=>[...e[6]||(e[6]=[t("svg",{class:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 19l-7-7 7-7"})],-1)])]),_:1}),p(S,{modelValue:a.value,"onUpdate:modelValue":e[1]||(e[1]=c=>a.value=c),type:"date",class:"h-8 w-36 text-xs"},null,8,["modelValue"]),p($,{variant:"outline",size:"sm",onClick:e[2]||(e[2]=c=>M(1))},{default:y(()=>[...e[7]||(e[7]=[t("svg",{class:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 5l7 7-7 7"})],-1)])]),_:1}),p($,{variant:"outline",size:"sm",onClick:e[3]||(e[3]=c=>a.value=_(B)(new Date))},{default:y(()=>[...e[8]||(e[8]=[L("Today",-1)])]),_:1})]),p(S,{modelValue:v.value,"onUpdate:modelValue":e[4]||(e[4]=c=>v.value=c),placeholder:"Search tasks...",class:"h-8 w-40 text-xs"},null,8,["modelValue"]),p($,{size:"sm",onClick:o},{default:y(()=>[...e[9]||(e[9]=[t("svg",{class:"h-4 w-4 mr-1.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4v16m8-8H4"})],-1),L(" New Task ",-1)])]),_:1})]),p(ce,{tasks:d.value,loading:_(r).loading,onEdit:k,onComplete:g,onDelete:C},null,8,["tasks","loading"]),p(E,{open:m.value,task:f.value,"default-date":a.value,onClose:e[5]||(e[5]=c=>m.value=!1),onSave:u},null,8,["open","task","default-date"])]))}});export{$e as default};