platypush/platypush/backend/http/webapp/dist/static/js/3785-legacy.5ec00494.js

2 lines
8.2 KiB
JavaScript

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