import{d as f,G as y,b as D,t as b,y as c,K as w}from"./registerWidgets.fff064a1.js";import{e as C,f as _,g as k}from"./icons.907f45d7.js";import{a as g}from"./CircularLoading.59d7fd3d.js";import{D as r}from"./dashes.f5f65b41.js";import{R as x}from"./RuntimeList.106b52b7.js";import"./utils.3371dfe5.js";import"./runnerData.81f4c073.js";const P=f({__name:"Dashes",setup(R){const l=w(),{loading:d,result:o,refetch:n}=g(()=>r.list()),i=({key:e})=>l.push({path:`/_editor/dash/${encodeURIComponent(e)}`}),p=async({key:e})=>{var a,t;await((t=(a=o.value)==null?void 0:a.find(s=>s.path===e))==null?void 0:t.duplicate()),n()},h=async()=>{const e=await r.create();i({key:e.path})},u=async({key:e})=>{var a,t;confirm("Are you sure you want to delete this dash?")&&(await((t=(a=o.value)==null?void 0:a.find(s=>s.path===e))==null?void 0:t.delete()),n())},m=y(()=>{var e,a;return{columns:[{name:"Dash Name"},{name:"Path"},{name:"Dash Actions"}],rows:(a=(e=o.value)==null?void 0:e.map(t=>({key:t.path,cells:[{text:t.title,classes:["title","centered"],link:`/_editor/dash/${encodeURIComponent(t.path)}`},{text:t.path},{text:"",classes:["centered"],actions:[{icon:C,label:"Delete",onClick:u,dangerous:!0},{icon:_,label:"Edit Dash",onClick:i},{icon:k,label:"Duplicate",onClick:p}]}]})))!=null?a:[]}});return(e,a)=>(D(),b(x,{loading:c(d),title:"Python Dashes",description:"Create a dashboard page with charts and inputs interacting with your python code.","create-button-text":"Create Dash","empty-title":"No dashes here yet","video-url":"https://www.youtube.com/embed/oYMptrk7QNE",table:c(m),onCreate:h},null,8,["loading","table"]))}});export{P as default};
//# sourceMappingURL=Dashes.c740c421.js.map
