zwave-js-ui
Version:
Z-Wave Control Panel and MQTT Gateway
3 lines (2 loc) • 13.5 kB
JavaScript
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ExpandedNode-DWXRrPlC.js","./index-B9yS4Bcc.js","./index-Bm7DxUwf.css","./VTextarea-BABdvF5b.js","./VTextarea-BTR7f0gW.css","./ExpandedNode-D92CBnYH.css","./RichValue-BEvxy1kn.js","./RichValue-C1OidLuR.css","./StatisticsArrows-CWMNYH2M.js","./StatisticsArrows-d3MYDRGU.css","./ReinterviewBadge-Cww8bq0-.js","./VFab-OEmwwbnb.js","./VFab-MHxCNJTw.css"])))=>i.map(i=>d[i]);
import{a2 as Y,bj as A,bk as G,bl as we,bm as he,bn as Ve,bo as xe,bp as _e,a4 as ke,a5 as Pe,bq as M,br as Se,a6 as De,b as s,bs as Ie,bt as Ce,U as c,n as Be,a1 as Re,_ as Ne,d as x,z as _,m as ze,u as Le,j as Te,b0 as W,bu as Z,bv as Ae,bw as Ee,b2 as L,b7 as Fe,b8 as Ue,b9 as Oe,bx as je,by as $e,b1 as Ge,b3 as Me,b4 as We,b5 as Ze,ba as Ke,r as k,o as m,l as P,w as r,W as qe,Q as He,bz as Qe,h as K,i as S,k as w,V as h,e as V,f as D,af as q,c as I,an as Je,am as Xe,N as H,p as T,O as Q,v as J,t as f,ao as X,bA as Ye,bB as et,$ as tt,bC as at,a7 as st,ag as rt,bb as ot,bc as lt,bd as it,be as nt,bf as dt,bg as ut,bh as ct}from"./index-B9yS4Bcc.js";import{c as i}from"./colors-DoZdCu1D.js";import{m as mt,a as pt,b as gt,c as ft,d as yt,e as vt,f as bt,p as wt,g as ht,u as Vt,h as xt,i as _t,j as kt,k as Pt,l as St,n as Dt}from"./sort-CSOGXH9I.js";import{V as It}from"./VFab-OEmwwbnb.js";const Ct=Y({items:{type:Array,default:()=>[]},itemValue:{type:[String,Array,Function],default:"id"},itemSelectable:{type:[String,Array,Function],default:null},returnObject:Boolean},"DataIterator-items");function Bt(t,e){const a=t.returnObject?e:G(e,t.itemValue),d=G(e,t.itemSelectable,!0);return{type:"item",value:a,selectable:d,raw:e}}function Rt(t,e){const a=[];for(const d of e)a.push(Bt(t,d));return a}function Nt(t){return{items:A(()=>Rt(t,t.items))}}const zt=Y({search:String,loading:Boolean,...we(),...Ct(),...mt(),...pt(),...gt({itemsPerPage:5}),...ft(),...yt(),...he(),...Ve(),...xe({transition:{component:_e,hideOnLeave:!0}})},"VDataIterator"),Lt=ke()({name:"VDataIterator",props:zt(),emits:{"update:modelValue":t=>!0,"update:groupBy":t=>!0,"update:page":t=>!0,"update:itemsPerPage":t=>!0,"update:sortBy":t=>!0,"update:options":t=>!0,"update:expanded":t=>!0,"update:currentItems":t=>!0},setup(t,e){let{slots:a}=e;const d=Pe(t,"groupBy"),l=M(()=>t.search),{items:u}=Nt(t),{filteredItems:p}=Se(t,u,l,{transform:v=>v.raw}),{sortBy:y,multiSort:C,mustSort:B}=vt(t),{page:n,itemsPerPage:g}=bt(t),{toggleSort:R}=wt({sortBy:y,multiSort:C,mustSort:B,page:n}),{sortByWithGroups:o,opened:b,extractRows:ee,isGroupOpen:te,toggleGroup:ae}=ht({groupBy:d,sortBy:y}),{sortedItems:se}=Vt(t,p,o,{transform:v=>v.raw}),{flatItems:E}=xt(se,d,b),re=M(()=>E.value.length),{startIndex:oe,stopIndex:le,pageCount:ie,prevPage:ne,nextPage:de,setItemsPerPage:ue,setPage:ce}=_t({page:n,itemsPerPage:g,itemsLength:re}),{paginatedItems:N}=kt({items:E,startIndex:oe,stopIndex:le,itemsPerPage:g}),F=A(()=>ee(N.value)),{isSelected:me,select:pe,selectAll:ge,toggleSelect:fe}=Pt(t,{allItems:u,currentPage:F}),{isExpanded:ye,toggleExpand:ve}=St(t);Dt({page:n,itemsPerPage:g,sortBy:y,groupBy:d,search:l});const z=A(()=>({page:n.value,itemsPerPage:g.value,sortBy:y.value,pageCount:ie.value,toggleSort:R,prevPage:ne,nextPage:de,setPage:ce,setItemsPerPage:ue,isSelected:me,select:pe,selectAll:ge,toggleSelect:fe,isExpanded:ye,toggleExpand:ve,isGroupOpen:te,toggleGroup:ae,items:F.value,groupedItems:N.value}));return De(()=>s(t.tag,{class:Be(["v-data-iterator",{"v-data-iterator--loading":t.loading},t.class]),style:Re(t.style)},{default:()=>{var v,U;return[(v=a.header)==null?void 0:v.call(a,z.value),s(Ie,{transition:t.transition},{default:()=>{var O,j;return[t.loading?s(Ce,{key:"loader",name:"v-data-iterator",active:!0},{default:be=>{var $;return($=a.loader)==null?void 0:$.call(a,be)}}):c("div",{key:"items"},[N.value.length?(j=a.default)==null?void 0:j.call(a,z.value):(O=a["no-data"])==null?void 0:O.call(a)])]}}),(U=a.footer)==null?void 0:U.call(a,z.value)]}})),{}}}),Tt={props:{socket:Object},components:{ExpandedNode:x(()=>_(()=>import("./ExpandedNode-DWXRrPlC.js"),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)),RichValue:x(()=>_(()=>import("./RichValue-BEvxy1kn.js"),__vite__mapDeps([6,1,2,7]),import.meta.url)),StatisticsArrows:x(()=>_(()=>import("./StatisticsArrows-CWMNYH2M.js"),__vite__mapDeps([8,1,2,9]),import.meta.url)),ReinterviewBadge:x(()=>_(()=>import("./ReinterviewBadge-Cww8bq0-.js"),__vite__mapDeps([10,1,2,11,12]),import.meta.url))},watch:{selected(){this.$emit("selected",this.selected)}},computed:{...ze(Le,["nodes"]),sortingRules(){return{key:this.sortBy.toLowerCase(),order:this.sortDesc?"desc":"asc"}}},data(){return{search:"",sortBy:"id",keys:[{title:"ID",value:"id"},{title:"Name",value:"name"},{title:"Location",value:"loc"},{title:"Status",value:"status"},{title:"Ready",value:"ready"}],sortDesc:!1,selected:[],loading:!1,expandedNode:null,expandedNodeDialog:!1}},methods:{padId(t){return t.toString().padStart(3,"0")},nodeInfo(t){return Te({Manufacturer:t.manufacturer,"Product Description":t.productDescription,"Product Label":t.productLabel,"Zwave+ Version":t.zwavePlusVersion||"N/A"})},showNodeDialog(t){this.expandedNode=t,this.expandedNodeDialog=!0},closeDialog(){this.expandedNode=null,this.expandedNodeDialog=!1},getProgress(t){return t.firmwareUpdate?Math.round(t.firmwareUpdate.sentFragments/t.firmwareUpdate.totalFragments*100):null},readyRichValue(t){const e=t.ready||!1;let a={align:"center",icon:"",iconStyle:`color: ${i.grey.base}`,description:e?"Ready":"Not ready",size:18};return e?(a.icon=W,a.iconStyle=`color: ${i.green.base}`):(a.icon=Z,a.iconStyle=`color: ${i.red.base}`),a},rebuildRoutesRichValue(t){const e=t.rebuildRoutesProgress||"done";let a={align:"center",icon:"",iconStyle:`color: ${i.grey.base}`,description:"Rebuild routes "+e,size:18};switch(e){case"done":a.icon=Ee,a.iconStyle=`color: ${i.green.base}`;break;case"failed":a.icon=Z,a.iconStyle=`color: ${i.red.base}`;break;case"skipped":a.icon=Ae,a.iconStyle=`color: ${i.blue.base}`;break;case"pending":a.loading=!0}return a},statusRichValue(t){let e={align:"center",icon:L,iconStyle:`color: ${i.grey.base}`,description:t.status,size:40};switch(t.status){case"Asleep":e.icon=Oe,e.iconStyle=`color: ${i.orange.base}`;break;case"Awake":e.icon=Ue,e.iconStyle=`color: ${i.green.base}`;break;case"Dead":e.icon=Fe,e.iconStyle=`color: ${i.red.base}`;break;case"Alive":e.icon=W,e.iconStyle=`color: ${i.green.base}`;break}return e},securityRichValue(t){let e={align:"center",icon:L,iconStyle:`color: ${i.grey.base}`,description:"Unknown security status",size:18};return t.isSecure===!0?(e.icon=je,e.iconStyle=t.security==="S0_Legacy"?`color: ${i.orange.base}`:`color: ${i.green.base}`,e.description=t.security):t.isSecure===!1&&(e.icon=$e,e.iconStyle=`color: ${i.red.base}`,e.description="No security"),e},zwavePlusRichValue(t){let e={align:"center",icon:t.ready?Ge:L,iconStyle:t.ready?`color: ${i.red.base}`:"color: grey",description:t.ready?"No":"Unknown ZWave+ version",size:18};return t.zwavePlusVersion===void 0||(e.description=`ZWave+ version: ${t.zwavePlusVersion}`,e.iconStyle=`color: ${i.green.base}`,t.zwavePlusVersion===1?e.icon=Me:t.zwavePlusVersion===2?e.icon=We:(e.icon=Ze,e.displayValue=`${t.zwavePlusVersion}`)),e},powerRichValue(t){let e=t.minBatteryLevel,a=`color: ${i.green.base};`,d="",l="";return t.isListening?(d=ot,l="Main power source"):(l=Ke(t),e<=10?(d=lt,a=`color: ${i.red.base}`):e<=30?(d=it,a=`color: ${i.orange.base}`):e<=70?d=nt:e<=90?d=dt:e>90?d=ut:(d=ct,l="Battery level: unknown",a=`color: ${i.grey.base}`)),{align:"center",icon:d,size:18,iconStyle:a,displayStyle:"",description:l,rawValue:e}}}},At={class:"my-2 d-flex justify-center",style:{"column-gap":"10px","flex-wrap":"wrap"}},Et=["onClick"],Ft={class:"text-caption pb-0 font-weight-bold text-primary text-truncate text-capitalize"},Ut={class:"text-caption pb-0 font-weight-bold text-truncate text-capitalize"},Ot=["textContent"],jt={key:2,class:"mt-2"},$t={class:"text-caption font-weight-bold mb-0 mt-1"};function Gt(t,e,a,d,l,u){const p=k("rich-value"),y=k("reinterview-badge"),C=k("statistics-arrows"),B=k("expanded-node");return m(),P(h,{fluid:"",class:"fill pa-0"},{default:r(()=>[s(Lt,{loading:l.loading,items:t.nodes,search:l.search,modelValue:l.selected,"onUpdate:modelValue":e[4]||(e[4]=n=>l.selected=n),"item-key":"id","sort-by":u.sortingRules,"hide-default-footer":"",itemsPerPage:-1},{header:r(()=>[c("div",At,[c("div",null,[s(qe,{modelValue:l.search,"onUpdate:modelValue":e[0]||(e[0]=n=>l.search=n),clearable:"",flat:"",variant:"solo-inverted","hide-details":"","single-line":"",class:"mx-auto my-1",style:{"max-width":"250px","min-width":"250px"},"prepend-inner-icon":"search",label:"Search"},null,8,["modelValue"])]),c("div",null,[s(He,{modelValue:l.sortBy,"onUpdate:modelValue":e[1]||(e[1]=n=>l.sortBy=n),flat:"",variant:"solo-inverted","single-line":"","hide-details":"",class:"mx-auto my-1",style:{"max-width":"150px"},items:l.keys,"prepend-inner-icon":"sort",label:"Sort by"},null,8,["modelValue","items"])]),c("div",null,[s(Qe,{class:"mx-auto my-2",modelValue:l.sortDesc,"onUpdate:modelValue":e[2]||(e[2]=n=>l.sortDesc=n),mandatory:""},{default:r(()=>[s(K,{variant:"flat",modelValue:!1},{default:r(()=>[s(S,null,{default:r(()=>e[8]||(e[8]=[w("arrow_upward")])),_:1,__:[8]})]),_:1}),s(K,{variant:"flat",modelValue:!0},{default:r(()=>[s(S,null,{default:r(()=>e[9]||(e[9]=[w("arrow_downward")])),_:1,__:[9]})]),_:1})]),_:1},8,["modelValue"])])])]),"no-data":r(()=>[s(h,null,{default:r(()=>[s(V,{class:"pa-0"},{default:r(()=>[s(D,{cols:"12",class:"text-center"},{default:r(()=>[s(S,{class:"text-h1"},{default:r(()=>e[10]||(e[10]=[w("search")])),_:1,__:[10]}),e[11]||(e[11]=c("h3",{class:"font-weight-light"},"No nodes Found",-1))]),_:1,__:[11]})]),_:1})]),_:1})]),"no-results":r(()=>[s(h,null,{default:r(()=>[s(V,{class:"pa-0"},{default:r(()=>[s(D,{cols:"12",class:"text-center"},{default:r(()=>[s(S,{class:"text-h1"},{default:r(()=>e[12]||(e[12]=[w("search")])),_:1,__:[12]}),e[13]||(e[13]=c("h3",{class:"font-weight-light"},"No nodes Found",-1))]),_:1,__:[13]})]),_:1})]),_:1})]),loading:r(()=>[s(h,null,{default:r(()=>[s(V,{class:"pa-0"},{default:r(()=>[s(D,{cols:"12",class:"text-center"},{default:r(()=>[e[14]||(e[14]=c("h3",{class:"font-weight-light"},"Loading Nodes...",-1)),s(q,{indeterminate:""})]),_:1,__:[14]})]),_:1})]),_:1})]),default:r(({items:n,isSelected:g,select:R})=>[s(h,{style:{"min-height":"600px"}},{default:r(()=>[s(V,{justify:"center",class:"pa-0"},{default:r(()=>[(m(!0),I(Je,null,Xe(n,o=>(m(),P(D,{key:o.raw.id,width:"170px",style:{"max-width":"170px"}},{default:r(()=>[s(H,{onClick:T(b=>u.showNodeDialog(o.raw),["stop"]),hover:"",border:"",height:"150",width:"150",color:g(o)?t.$vuetify.theme.current.colors.primary:t.$vuetify.theme.current.colors.surface},{default:r(()=>[s(Q,{class:"text-center pa-1 d-flex flex-column"},{default:r(()=>[s(V,{class:"pa-0 ma-0",justify:"space-between"},{default:r(()=>[J((m(),I("strong",{onClick:T(b=>R([o],!g(o)),["stop"]),style:{"font-size":"14px","line-height":"1.3",padding:"2px",border:"1px solid #ccc","border-radius":"4px"}},[w(f(u.padId(o.raw.id)),1)],8,Et)),[[X,"Click to select","bottom"]]),s(p,{value:u.powerRichValue(o.raw)},null,8,["value"]),s(p,{value:u.rebuildRoutesRichValue(o.raw)},null,8,["value"]),s(p,{value:u.securityRichValue(o.raw)},null,8,["value"]),s(p,{value:u.readyRichValue(o.raw)},null,8,["value"])]),_:2},1024),c("span",Ft,f(o.raw._name||"---"),1),c("span",Ut,f(o.raw.loc||""),1),o.raw.interviewStage==="Complete"?(m(),P(Ye,{key:0,class:"align-self-center",bordered:"","offset-y":"2",content:"v"+o.raw.firmwareVersion,"model-value":!!o.raw.firmwareVersion},{default:r(()=>[c("div",null,[s(et,{location:"bottom"},{activator:r(({props:b})=>[c("div",tt({ref_for:!0},b,{class:"text-h4"}),[s(p,{value:u.statusRichValue(o.raw)},null,8,["value"])],16)]),default:r(()=>[c("span",{style:{"white-space":"pre-wrap"},textContent:f(u.nodeInfo(o.raw))},null,8,Ot)]),_:2},1024),s(y,{node:o.raw,"b-style":{position:"absolute",top:"0",left:"31px"}},null,8,["node"])])]),_:2},1032,["content","model-value"])):(m(),I("div",{key:1,onClick:e[3]||(e[3]=T(()=>{},["stop"])),class:"text-center"},[J(s(q,{indeterminate:"",class:"ma-1",size:"32",color:"primary"},null,512),[[X,"Interview stage: "+o.raw.interviewStage,"bottom"]])])),o.raw.firmwareUpdate&&!o.raw.isControllerNode?(m(),I("div",jt,[s(at,{"model-value":o.raw.firmwareUpdate.progress,height:"5",class:"mt-1",color:"primary"},null,8,["model-value"]),c("p",$t,f(o.raw.firmwareUpdate.currentFile)+"/"+f(o.raw.firmwareUpdate.totalFiles)+": "+f(u.getProgress(o.raw))+"% ",1)])):(m(),P(C,{key:3,node:o.raw},null,8,["node"]))]),_:2},1024)]),_:2},1032,["onClick","color"])]),_:2},1024))),128))]),_:2},1024)]),_:2},1024)]),_:1},8,["loading","items","search","modelValue","sort-by"]),s(st,{fullscreen:t.$vuetify.display.xs,"max-width":"1200px",modelValue:l.expandedNodeDialog,"onUpdate:modelValue":e[6]||(e[6]=n=>l.expandedNodeDialog=n),persistent:"",onKeydown:e[7]||(e[7]=rt(n=>u.closeDialog(),["exit"]))},{default:r(()=>[s(H,{"min-height":"90vh"},{default:r(()=>[s(It,{style:{position:"absolute",right:"5px",top:"5px"},size:"small",variant:"text",onClick:e[5]||(e[5]=n=>u.closeDialog()),icon:"close"}),s(Q,{class:"pt-5"},{default:r(()=>[s(B,{node:l.expandedNode,socket:a.socket},null,8,["node","socket"])]),_:1})]),_:1})]),_:1},8,["fullscreen","modelValue"])]),_:1})}const qt=Ne(Tt,[["render",Gt]]);export{qt as default};