platypush/platypush/backend/http/webapp/dist/static/js/3785.940990df.js

2 lines
7.1 KiB
JavaScript

"use strict";(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[3785],{6:function(e,t,n){n.d(t,{Z:function(){return h}});var i=n(6252),s=n(3577),o=n(9963);const l=e=>((0,i.dD)("data-v-a6396ae8"),e=e(),(0,i.Cn)(),e),a=["checked"],c=l((()=>(0,i._)("div",{class:"switch"},[(0,i._)("div",{class:"dot"})],-1))),d={class:"label"};function v(e,t,n,l,v,u){return(0,i.wg)(),(0,i.iD)("div",{class:(0,s.C_)(["power-switch",{disabled:n.disabled}]),onClick:t[0]||(t[0]=(0,o.iM)(((...e)=>u.onInput&&u.onInput(...e)),["stop"]))},[(0,i._)("input",{type:"checkbox",checked:n.value},null,8,a),(0,i._)("label",null,[c,(0,i._)("span",d,[(0,i.WI)(e.$slots,"default",{},void 0,!0)])])],2)}var u={name:"ToggleSwitch",emits:["input"],props:{value:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},methods:{onInput(e){if(this.disabled)return!1;this.$emit("input",e)}}},r=n(3744);const w=(0,r.Z)(u,[["render",v],["__scopeId","data-v-a6396ae8"]]);var h=w},4004:function(e,t,n){n.d(t,{Z:function(){return l}});var i=n(6813),s={name:"SwitchesMixin",mixins:[i.Z],props:{pluginName:{type:String,required:!0},bus:{type:Object,required:!0},config:{type:Object,default:()=>({})},selected:{type:Boolean,default:!1}},data(){return{loading:!1,initialized:!1,selectedDevice:null,devices:{}}},methods:{onRefreshEvent(e){e===this.pluginName&&this.refresh()},async toggle(e,t){null==t&&(t=e);const n=await this.request(`${this.pluginName}.toggle`,{device:t});this.devices[e].on=n.on},async refresh(){this.loading=!0;try{this.devices=(await this.request(`${this.pluginName}.switch_status`)).reduce(((e,t)=>{const n=t.name?.length?t.name:t.id;return e[n]=t,e}),{})}finally{this.loading=!1}}},mounted(){this.$watch((()=>this.selected),(e=>{e&&!this.initialized&&(this.refresh(),this.initialized=!0)})),this.bus.on("refresh",this.onRefreshEvent)},unmounted(){this.bus.off("refresh",this.onRefreshEvent)}};const o=s;var l=o},8671:function(e,t,n){n.d(t,{Z:function(){return _}});var i=n(6252),s=n(9963),o=n(3577);const l=e=>((0,i.dD)("data-v-38eb9831"),e=e(),(0,i.Cn)(),e),a={class:"name col-l-10 col-m-9 col-s-8"},c=l((()=>(0,i._)("i",{class:"fa fa-info"},null,-1))),d=[c],v=["textContent"],u={class:"toggler col-l-2 col-m-3 col-s-4"};function r(e,t,n,l,c,r){const w=(0,i.up)("Loading"),h=(0,i.up)("ToggleSwitch");return(0,i.wg)(),(0,i.iD)("div",{class:"switch",onClick:t[1]||(t[1]=(0,s.iM)(((...e)=>r.onToggle&&r.onToggle(...e)),["stop"]))},[n.loading?((0,i.wg)(),(0,i.j4)(w,{key:0})):(0,i.kq)("",!0),(0,i._)("div",a,[n.hasInfo?((0,i.wg)(),(0,i.iD)("button",{key:0,onClick:t[0]||(t[0]=(0,s.iM)(((...e)=>r.onInfo&&r.onInfo(...e)),["prevent"]))},d)):(0,i.kq)("",!0),(0,i._)("span",{class:"name-content",textContent:(0,o.zw)(n.name)},null,8,v)]),(0,i._)("div",u,[(0,i.Wm)(h,{disabled:n.loading,value:n.state,onInput:r.onToggle},null,8,["disabled","value","onInput"])])])}var w=n(6),h=n(1232),f={name:"Switch",components:{Loading:h.Z,ToggleSwitch:w.Z},emits:["toggle","info"],props:{name:{type:String,required:!0},state:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},hasInfo:{type:Boolean,default:!1},id:{type:String}},methods:{onInfo(e){return e.stopPropagation(),this.$emit("info"),!1},onToggle(e){return e.stopPropagation(),this.$emit("toggle"),!1}}},g=n(3744);const p=(0,g.Z)(f,[["render",r],["__scopeId","data-v-38eb9831"]]);var _=p},3785:function(e,t,n){n.r(t),n.d(t,{default:function(){return K}});var i=n(6252),s=n(3577);const o=e=>((0,i.dD)("data-v-e259fb36"),e=e(),(0,i.Cn)(),e),l={class:"switches tplink-switches"},a={key:1,class:"no-content"},c={key:0,class:"switch-info"},d={class:"row"},v=o((()=>(0,i._)("div",{class:"name"},"Name",-1))),u=["textContent"],r={class:"row"},w=o((()=>(0,i._)("div",{class:"name"},"On",-1))),h=["textContent"],f={class:"row"},g=o((()=>(0,i._)("div",{class:"name"},"IP",-1))),p=["textContent"],_={key:0,class:"row"},m=o((()=>(0,i._)("div",{class:"name"},"MAC",-1))),D=["textContent"],k={key:1,class:"row"},C=o((()=>(0,i._)("div",{class:"name"},"Current Consumption",-1))),y=["textContent"],x={key:2,class:"row"},I=o((()=>(0,i._)("div",{class:"name"},"Device Type",-1))),b=["textContent"],q={key:3,class:"row"},z=o((()=>(0,i._)("div",{class:"name"},"Firmware ID",-1))),Z=["textContent"],S={key:4,class:"row"},T=o((()=>(0,i._)("div",{class:"name"},"Hardware ID",-1))),M=["textContent"],$={key:5,class:"row"},j=o((()=>(0,i._)("div",{class:"name"},"Hardware Version",-1))),B=["textContent"],N={key:6,class:"row"},L=o((()=>(0,i._)("div",{class:"name"},"Software Version",-1))),O=["textContent"];function P(e,t,n,o,P,E){const H=(0,i.up)("Loading"),R=(0,i.up)("Switch"),W=(0,i.up)("Modal");return(0,i.wg)(),(0,i.iD)("div",l,[e.loading?((0,i.wg)(),(0,i.j4)(H,{key:0})):Object.keys(e.devices).length?(0,i.kq)("",!0):((0,i.wg)(),(0,i.iD)("div",a,"No TP-Link switches found.")),((0,i.wg)(!0),(0,i.iD)(i.HY,null,(0,i.Ko)(e.devices,((t,n)=>((0,i.wg)(),(0,i.j4)(R,{loading:e.loading,name:n,state:t.on,onToggle:t=>e.toggle(n),key:n,"has-info":!0,onInfo:t=>{e.selectedDevice=n,e.$refs.switchInfoModal.show()}},null,8,["loading","name","state","onToggle","onInfo"])))),128)),(0,i.Wm)(W,{title:"Device Info",ref:"switchInfoModal"},{default:(0,i.w5)((()=>[e.selectedDevice?((0,i.wg)(),(0,i.iD)("div",c,[(0,i._)("div",d,[v,(0,i._)("div",{class:"value",textContent:(0,s.zw)(e.devices[e.selectedDevice].name)},null,8,u)]),(0,i._)("div",r,[w,(0,i._)("div",{class:"value",textContent:(0,s.zw)(e.devices[e.selectedDevice].on)},null,8,h)]),(0,i._)("div",f,[g,(0,i._)("div",{class:"value",textContent:(0,s.zw)(e.devices[e.selectedDevice].ip)},null,8,p)]),e.devices[e.selectedDevice].hw_info?.mac?((0,i.wg)(),(0,i.iD)("div",_,[m,(0,i._)("div",{class:"value",textContent:(0,s.zw)(e.devices[e.selectedDevice].hw_info.mac)},null,8,D)])):(0,i.kq)("",!0),null!=e.devices[e.selectedDevice].current_consumption?((0,i.wg)(),(0,i.iD)("div",k,[C,(0,i._)("div",{class:"value",textContent:(0,s.zw)(e.devices[e.selectedDevice].current_consumption)},null,8,y)])):(0,i.kq)("",!0),e.devices[e.selectedDevice].hw_info?.dev_name?((0,i.wg)(),(0,i.iD)("div",x,[I,(0,i._)("div",{class:"value",textContent:(0,s.zw)(e.devices[e.selectedDevice].hw_info.dev_name)},null,8,b)])):(0,i.kq)("",!0),e.devices[e.selectedDevice].hw_info?.fwId?((0,i.wg)(),(0,i.iD)("div",q,[z,(0,i._)("div",{class:"value",textContent:(0,s.zw)(e.devices[e.selectedDevice].hw_info.fwId)},null,8,Z)])):(0,i.kq)("",!0),e.devices[e.selectedDevice].hw_info?.hwId?((0,i.wg)(),(0,i.iD)("div",S,[T,(0,i._)("div",{class:"value",textContent:(0,s.zw)(e.devices[e.selectedDevice].hw_info.hwId)},null,8,M)])):(0,i.kq)("",!0),e.devices[e.selectedDevice].hw_info?.hw_ver?((0,i.wg)(),(0,i.iD)("div",$,[j,(0,i._)("div",{class:"value",textContent:(0,s.zw)(e.devices[e.selectedDevice].hw_info.hw_ver)},null,8,B)])):(0,i.kq)("",!0),e.devices[e.selectedDevice].hw_info?.sw_ver?((0,i.wg)(),(0,i.iD)("div",N,[L,(0,i._)("div",{class:"value",textContent:(0,s.zw)(e.devices[e.selectedDevice].hw_info.sw_ver)},null,8,O)])):(0,i.kq)("",!0)])):(0,i.kq)("",!0)])),_:1},512)])}var E=n(1232),H=n(4004),R=n(8671),W=n(8453),V={name:"SwitchTplink",components:{Modal:W.Z,Switch:R.Z,Loading:E.Z},mixins:[H.Z]},A=n(3744);const F=(0,A.Z)(V,[["render",P],["__scopeId","data-v-e259fb36"]]);var K=F}}]);
//# sourceMappingURL=3785.940990df.js.map