import{I as C}from"./IdnodeGrid-U6EqXqja.js";import{I as k}from"./IdnodeConfigForm-BL6DOswR.js";import{M as b}from"./MasterDetailLayout-oilsSeUU.js";import{A as w}from"./ActionMenu-B3aKIJFu.js";import{d as A,u as D,c as x,o as d,e as f,f as c,g as u,P as I,t as R,h as p,r as m,k as S,L as N,_ as P}from"./index-D92x6h1h.js";import{a as V,b as E}from"./useMasterDetailActions-7f-vDWd7.js";import"./DataGrid-CbtTsx8d.js";import"./index-BG9mM10J.js";import"./index-7HNOjfAo.js";import"./localDay-CoEbUe3O.js";import"./SearchInput-DBHWpJgW.js";import"./useGridLayout-DCIiMD42.js";import"./CollapsibleSection.vue_vue_type_style_index_0_lang-Cq2AVc9p.js";import"./sliders-horizontal-Am8f4Xsv.js";import"./useStaleDataRecovery-BuNK-94T.js";const B={class:"dvr-profiles"},M={key:1,class:"dvr-profiles__empty"},T=A({__name:"ConfigRecordingDvrProfilesView",setup(z){const{t:e}=D(),n=x(),t=m(null),l=m(!1),s=V({selected:t,createEndpoint:"dvr/config/create"}),a=E({selected:t,confirmText:e("Do you really want to delete this DVR profile?")}),g=[{field:"text",label:e("Profile Name"),sortable:!0,filterType:"string",width:280,minVisible:"phone",phoneRole:"primary"}];async function v(){if(!l.value){l.value=!0;try{const o=await N("dvr/config/create",{conf:JSON.stringify({name:"! New config"})});typeof o.uuid=="string"&&o.uuid?(t.value=o.uuid,n.success(e("Profile created. Edit name + settings on the right."))):n.error(e("Server returned no profile uuid."),{summary:e("Add failed")})}catch(o){n.error(o instanceof Error?o.message:String(o),{summary:e("Add failed")})}finally{l.value=!1}}}function y(o,r){const i=o.uuid;r(typeof i=="string"?i:null)}const _=S(()=>[{id:"add",label:l.value?e("Adding…"):e("Add"),disabled:l.value,onClick:v},{id:"clone",label:s.inflight.value?e("Cloning…"):e("Clone"),disabled:!t.value||s.inflight.value,onClick:s.run},{id:"delete",label:a.inflight.value?e("Deleting…"):e("Delete"),disabled:!t.value||a.inflight.value,onClick:a.run}]);return(o,r)=>(d(),f("div",B,[c(b,{"selected-uuid":t.value,"onUpdate:selectedUuid":r[0]||(r[0]=i=>t.value=i),"storage-key":"config-recording-dvr-profiles"},{master:u(({select:i})=>[c(C,{endpoint:"idnode/load","help-page":"class/dvrconfig","entity-class":"dvrconfig",columns:g,"extra-params":{class:"dvrconfig"},"store-key":"config-recording-dvr-profiles","default-sort":{key:"text",dir:"ASC"},"virtual-scroller-options":{itemSize:36,lazy:!1},"count-label":p(e)("profiles"),"client-side-filter":"",selectable:"single",class:"dvr-profiles__grid",onRowClick:h=>y(h,i)},{toolbarActions:u(()=>[c(w,{actions:_.value},null,8,["actions"])]),_:1},8,["count-label","onRowClick"])]),detail:u(({selectedUuid:i})=>[i?(d(),I(k,{key:0,uuid:i},null,8,["uuid"])):(d(),f("p",M,R(p(e)("Select a profile on the left to view and edit its configuration.")),1))]),_:1},8,["selected-uuid"])]))}}),$=P(T,[["__scopeId","data-v-fdd99a00"]]);export{$ as default};
