zwave-js-ui
Version:
Z-Wave Control Panel and MQTT Gateway
5 lines (4 loc) • 10.2 kB
JavaScript
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-O_Ofu6Ug.js","./index-DwzE-W2i.js","./index-B2zoqM3Y.css","./vuedraggable.umd-Df3l8PgK.js","./colors-DoZdCu1D.js","./VDataTable-D8DZXD9Y.js","./sort-C8HQTCiq.js","./VTable-Cxuwit5L.js","./VTable-BsI6FsWH.css","./VDataTable-CLcLRj9B.css","./index-CoNQ0Kii.css","./DialogAdvanced-BzlXZa0Z.js","./DialogAdvanced-D5h3KQey.css","./StatisticsCard-DHyEKBDD.js","./SmartView-CKFkrtJj.js","./VFab-BoiUHyPJ.js","./VFab-ByB_rPoF.css","./BaseFab-BwvwxwY8.js","./BaseFab-BUyXt8fM.css"])))=>i.map(i=>d[i]);
import{_ as R,j as V,m as N,a as D,d as r,I,c as M,b as o,w as n,e as u,V as f,f as g,n as T,g as P,h as w,i as v,k as m,l as b,t as E,o as O,p as L,q as B,v as U,r as j,s as l,u as F,C as _,L as Z,x as p,S as W,y as c,z as d}from"./index-DwzE-W2i.js";const y=Z.get("ControlPanel"),z={name:"ControlPanel",props:{socket:Object},mixins:[I],components:{NodesTable:r(()=>c(()=>import("./index-O_Ofu6Ug.js").then(e=>e.i),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10]),import.meta.url)),DialogAdvanced:r(()=>c(()=>import("./DialogAdvanced-BzlXZa0Z.js"),__vite__mapDeps([11,1,2,12]),import.meta.url)),StatisticsCard:r(()=>c(()=>import("./StatisticsCard-DHyEKBDD.js"),__vite__mapDeps([13,1,2]),import.meta.url)),SmartView:r(()=>c(()=>import("./SmartView-CKFkrtJj.js"),__vite__mapDeps([14,1,2,4,6,15,16]),import.meta.url)),BaseFab:r(()=>c(()=>import("./BaseFab-BwvwxwY8.js"),__vite__mapDeps([17,1,2,15,16,18]),import.meta.url))},computed:{...D(p,["nodes","zwave","controllerNode"]),fabItems(){const e=[];return this.selected.length===0&&e.push({icon:"all_inclusive",color:"success",tooltip:"Manage nodes",action:()=>this.showNodesManager()}),e.push({icon:"auto_fix_high",color:"purple",tooltip:"Advanced actions",action:()=>{this.advancedShowDialog=!0}}),e},timeoutMs(){return this.zwave.commandsTimeout*1e3+800},statisticsOpeningIndicator(){return this.showControllerStatistics?"arrow_drop_up":"arrow_drop_down"},compact(){return this.$vuetify.display.smAndDown||this.compactMode},compactMode:{get(){return p().ui.compactMode},set(e){p().setCompactMode(e)}},actions(){return this.selected.length===0?this.generalActions:this.selectedActions},advancedDialogTitle(){return this.selected.length===0?"General actions":`Actions for ${this.selected.length} selected node${this.selected.length>1?"s":""}`}},data(){return{fab:!1,selected:[],settings:new W(localStorage),advancedShowDialog:!1,generalActions:[{text:"Backup",options:[{name:"Import",action:"import"},{name:"Export",action:"export"}],icon:"save",desc:"Save or load `nodes.json` file with names and locations"},{text:"Dump",options:[{name:"Export",action:"exportDump"}],icon:"bug_report",desc:"Export all nodes in a json file. Useful for debugging purposes"},{text:"Re-interview Nodes",options:[{name:"Start",action:"refreshInfo",args:{broadcast:!0}}],icon:"history",color:"warning",desc:"Clear all info about all nodes and make a new full interview. Use when nodes has wrong or missing capabilities"},{text:"Rebuild Routes",options:[{name:"Begin",action:"beginRebuildingRoutes"},{name:"Stop",action:"stopRebuildingRoutes"}],icon:"healing",color:"warning",desc:"Force nodes to establish new connections to the controller"},{text:"Hard Reset",options:[{name:"Factory Reset",action:"hardReset"}],icon:"warning",color:"error",desc:"Reset controller to factory defaults (all paired devices will be removed)"},{text:"Soft Reset",options:[{name:"Soft Reset",action:"softReset",args:{confirm:`<p>Are you sure you want to soft-reset your controller?</p>
<p>USB modules will reconnect, meaning that they might get a new address. Make sure to configure your device address in a way that prevents it from changing, e.g. by using <code>/dev/serial/by-id/...</code> on Linux.</p>
<p><strong>This method may cause problems in Docker containers with certain Z-Wave stick.</strong> If that happens, you may need to restart your host OS and docker container.</p>`}}],icon:"refresh",color:"warning",desc:"Instruct the controller to soft-reset (restart)"},{text:"Failed Nodes",options:[{name:"Remove all",action:"removeFailedNode",args:{broadcast:!0,confirm:"This action will remove all failed nodes. ATTENTION: this will skip sleeping nodes to prevent unwanted behaviours"}}],icon:"dangerous",color:"error",desc:"Manage nodes that are dead and/or marked as failed with the controller"},{text:"Driver function",options:[{name:"Write",action:"driverFunction"}],icon:"code",desc:"Write a custom JS function using the ZwaveJS Driver"},{text:"NVM Management",options:[{name:"Backup",action:"backupNVMRaw"},{name:"Restore",action:"restoreNVM"}],icon:"update",color:"warning",desc:"Backup/Restore controller's NVM (Non Volatile Memory)"},{text:"Firmware update OTW",options:[{name:"Update",action:"firmwareUpdateOTW"}],icon:"update",color:"error",desc:"Perform a firmware update OTW (Over The Wire)"},{text:"Shutdown Zwave API",options:[{name:"Shutdown",action:"shutdownZwaveAPI",args:{confirm:"Are you sure you want to shutdown the Zwave API? You will have to unplug and replug the Zwave stick manually to restart it.",confirmLevel:"warning"}}],icon:"power_off",color:"warning",desc:"Allows to shutdown the Zwave API to safely unplug the Zwave stick."},{text:"Learn mode",options:[{name:"Start",action:"startLearnMode",args:{confirm:"Initiate learn mode on primary controller first and then click OK here."}},{name:"Stop",action:"stopLearnMode"}],icon:"join_inner",desc:"Instruct controller to run learning mode (can join pre-existing network)"}],rules:{required:e=>{let t=!1;return e instanceof Array?t=e.length>0:t=!isNaN(e)||!!e,t||"This field is required."}},selectedActions:[{text:"Re-interview Node",options:[{name:"Interview",action:"refreshInfo"}],icon:"history",desc:"Clear all info about this node and make a new full interview. Use when the node has wrong or missing capabilities"},{text:"Refresh Values",options:[{name:"Refresh",action:"refreshValues",args:{confirm:"Are you sure you want to refresh values of this node? This action increases network traffic"}}],icon:"cached",desc:"Update all CC values and metadata. Use only when many values seems stale"},{text:"Rebuild Node Routes",options:[{name:"Rebuild",action:"rebuildNodeRoutes",args:{confirm:"Rebuilding routes of a specific node. This action causes a lot of traffic, can take minutes up to hours and you can expect degraded performance while it is going on"}}],icon:"healing",color:"warning",desc:"Discover and assign new routes between a specific node to the controller and his neighbors"},{text:"Ping",options:[{name:"Ping",action:"pingNode"}],icon:"swap_horiz",desc:"Ping node to check if it is alive"},{text:"Failed Nodes",options:[{name:"Remove",action:"removeFailedNode"}],color:"error",icon:"dangerous",desc:"Manage nodes that are dead and/or marked as failed with the controller"}],showControllerStatistics:!1}},methods:{...N(p,["setRebuildRoutesProgress"]),jsonToList:V,showNodesManager(){this.app.showNodesManager()},async onAction(e,t={}){e==="import"?this.importConfiguration():e==="export"?this.exportConfiguration():e==="exportDump"?this.exportDump():this.sendAction(e,{...t,nodes:this.selected})},async importConfiguration(){if(await this.app.confirm("Attention","This will override all existing nodes names and locations","alert"))try{const{data:e}=await this.app.importFile("json"),t=await _.importConfig({data:e});this.showSnackbar(t.message,t.success?"success":"error")}catch(e){y.error(e)}},async exportConfiguration(){try{const e=await _.exportConfig();this.showSnackbar(e.message,e.success?"success":"error"),e.success&&this.app.exportConfiguration(e.data,"nodes","json")}catch(e){y.error(e)}},exportDump(){this.app.exportConfiguration(this.nodes,"nodes_dump","json")},toggleControllerStatistics(){this.showControllerStatistics=!this.showControllerStatistics}},mounted(){this.subscribeChannels(["rebuild"]),this.bindEvent("rebuildRoutesProgress",this.setRebuildRoutesProgress.bind(this))},beforeUnmount(){this.socket&&this.unbindEvents()}};function q(e,t,h,G,a,s){const C=l("StatisticsCard"),x=l("nodes-table"),S=l("smart-view"),k=l("DialogAdvanced"),A=l("base-fab");return d(),M("div",null,[o(F,{fluid:"",class:"pa-4"},{default:n(()=>[o(f,{class:"py-4 align-center","no-gutters":""},{default:n(()=>[o(g,{class:T(s.compact?"text-center":"text-end")},{default:n(()=>[o(P,{multiple:""},{default:n(()=>[o(v,{active:a.showControllerStatistics,color:"primary",variant:"outlined",onClick:s.toggleControllerStatistics},{default:n(()=>[o(b,{start:""},{default:n(()=>[m(E(s.statisticsOpeningIndicator),1)]),_:1}),t[7]||(t[7]=m(" Controller statistics ",-1)),o(b,{color:"primary",end:""},{default:n(()=>[...t[6]||(t[6]=[m(" multiline_chart ",-1)])]),_:1})]),_:1},8,["active","onClick"]),e.$vuetify.display.mdAndUp?(d(),u(v,{key:0,color:"primary",variant:"flat",active:s.compactMode,onClick:t[0]||(t[0]=O(i=>s.compactMode=!s.compactMode,["stop"]))},{default:n(()=>[...t[8]||(t[8]=[m(" Compact ",-1)])]),_:1},8,["active"])):w("",!0)]),_:1})]),_:1},8,["class"])]),_:1}),o(L,null,{default:n(()=>[B(o(f,null,{default:n(()=>[o(g,{class:"mb-8"},{default:n(()=>[o(j,{border:"",rounded:""},{default:n(()=>[e.controllerNode?(d(),u(C,{key:0,title:"Controller Statistics",node:this.controllerNode},null,8,["node"])):w("",!0)]),_:1})]),_:1})]),_:1},512),[[U,a.showControllerStatistics]])]),_:1}),s.compact?(d(),u(S,{key:1,socket:h.socket,onSelected:t[2]||(t[2]=i=>a.selected=i),onAction:e.sendAction},null,8,["socket","onAction"])):(d(),u(x,{key:0,class:"pb-8",socket:h.socket,onAction:e.sendAction,onSelected:t[1]||(t[1]=i=>a.selected=i)},null,8,["socket","onAction"]))]),_:1}),o(k,{modelValue:a.advancedShowDialog,"onUpdate:modelValue":t[3]||(t[3]=i=>a.advancedShowDialog=i),onClose:t[4]||(t[4]=i=>a.advancedShowDialog=!1),actions:s.actions,onAction:s.onAction,title:s.advancedDialogTitle},null,8,["modelValue","actions","onAction","title"]),o(A,{modelValue:a.fab,"onUpdate:modelValue":t[5]||(t[5]=i=>a.fab=i),location:"bottom end",color:a.selected.length===0?"primary":"success","icon-open":"menu","icon-close":"close",items:s.fabItems},null,8,["modelValue","color","items"])])}const H=R(z,[["render",q]]);export{H as default};