[WIP] s/set_value/set/g for entities

This commit is contained in:
Fabio Manganiello 2023-02-11 03:56:56 +01:00
parent b0cc80ceb0
commit 4365352331
Signed by: blacklight
GPG key ID: D90FBA7F76362774
24 changed files with 31 additions and 31 deletions

View file

@ -1 +1 @@
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><link rel="stylesheet" href="/fonts/poppins.css"><title>platypush</title><script defer="defer" type="module" src="/static/js/chunk-vendors.95bedba1.js"></script><script defer="defer" type="module" src="/static/js/app.c6ad79d3.js"></script><link href="/static/css/chunk-vendors.0fcd36f0.css" rel="stylesheet"><link href="/static/css/app.d7cb662c.css" rel="stylesheet"><script defer="defer" src="/static/js/chunk-vendors-legacy.79dede0c.js" nomodule></script><script defer="defer" src="/static/js/app-legacy.0a704e98.js" nomodule></script></head><body><noscript><strong>We're sorry but platypush doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html> <!doctype html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><link rel="stylesheet" href="/fonts/poppins.css"><title>platypush</title><script defer="defer" type="module" src="/static/js/chunk-vendors.95bedba1.js"></script><script defer="defer" type="module" src="/static/js/app.9397ac28.js"></script><link href="/static/css/chunk-vendors.0fcd36f0.css" rel="stylesheet"><link href="/static/css/app.d7cb662c.css" rel="stylesheet"><script defer="defer" src="/static/js/chunk-vendors-legacy.79dede0c.js" nomodule></script><script defer="defer" src="/static/js/app-legacy.22d80610.js" nomodule></script></head><body><noscript><strong>We're sorry but platypush doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,2 +0,0 @@
"use strict";(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[1897,3459],{3459:function(e,t,l){l.r(t),l.d(t,{default:function(){return v}});var a=l(6252),n=l(3577),o=l(3540);const i={key:0,src:o,class:"loading"},s={key:1,class:"fas fa-circle-exclamation error"};function c(e,t,l,o,c,u){const r=(0,a.up)("Icon");return(0,a.wg)(),(0,a.iD)("div",{class:(0,n.C_)(["entity-icon-container",{"with-color-fill":!!u.colorFill}]),style:(0,n.j5)(u.colorFillStyle)},[l.loading?((0,a.wg)(),(0,a.iD)("img",i)):l.error?((0,a.wg)(),(0,a.iD)("i",s)):((0,a.wg)(),(0,a.j4)(r,(0,n.vs)((0,a.dG)({key:2},u.computedIconNormalized)),null,16))],6)}var u=l(1478),r={name:"EntityIcon",components:{Icon:u.Z},props:{loading:{type:Boolean,default:!1},error:{type:Boolean,default:!1},entity:{type:Object,required:!0},icon:{type:Object,default:()=>{}},hasColorFill:{type:Boolean,default:!1}},data(){return{component:null,modalVisible:!1}},computed:{computedIcon(){let e={...this.entity?.meta?.icon||{}};return Object.keys(this.icon||{}).length&&(e=this.icon),{...e}},colorFill(){return this.hasColorFill&&this.computedIcon.color},colorFillStyle(){return this.colorFill&&!this.error?{background:this.colorFill}:{}},computedIconNormalized(){const e={...this.computedIcon};return this.colorFill&&delete e.color,e},type(){let e=this.entity.type||"";return e.charAt(0).toUpperCase()+e.slice(1)}}},d=l(3744);const p=(0,d.Z)(r,[["render",c],["__scopeId","data-v-4fad24e6"]]);var v=p},1897:function(e,t,l){l.r(t),l.d(t,{default:function(){return b}});var a=l(6252),n=l(3577),o=l(9963);const i={class:"entity switch-container"},s={class:"col-1 icon"},c={class:"col-s-8 col-m-9 label"},u=["textContent"],r={class:"col-s-3 col-m-2 buttons pull-right"},d=["textContent"],p={class:"row"},v={class:"input"},h=["disabled"],y={key:0,value:"",selected:""},g=["value","selected","textContent"];function f(e,t,l,f,m,w){const _=(0,a.up)("EntityIcon");return(0,a.wg)(),(0,a.iD)("div",i,[(0,a._)("div",{class:(0,n.C_)(["head",{collapsed:e.collapsed}])},[(0,a._)("div",s,[(0,a.Wm)(_,{entity:e.value,loading:e.loading,error:e.error},null,8,["entity","loading","error"])]),(0,a._)("div",c,[(0,a._)("div",{class:"name",textContent:(0,n.zw)(e.value.name)},null,8,u)]),(0,a._)("div",r,[w.hasValues?((0,a.wg)(),(0,a.iD)("button",{key:0,onClick:t[0]||(t[0]=(0,o.iM)((t=>e.collapsed=!e.collapsed),["stop"]))},[(0,a._)("i",{class:(0,n.C_)(["fas",{"fa-angle-up":!e.collapsed,"fa-angle-down":e.collapsed}])},null,2)])):(0,a.kq)("",!0),null!=e.value?.value?((0,a.wg)(),(0,a.iD)("span",{key:1,class:"value",textContent:(0,n.zw)(e.value.values[e.value.value]||e.value.value)},null,8,d)):(0,a.kq)("",!0)])],2),e.collapsed?(0,a.kq)("",!0):((0,a.wg)(),(0,a.iD)("div",{key:0,class:"body",onClick:t[2]||(t[2]=(0,o.iM)(((...e)=>w.prevent&&w.prevent(...e)),["stop"]))},[(0,a._)("div",p,[(0,a._)("div",v,[(0,a._)("select",{onInput:t[1]||(t[1]=(...e)=>w.setValue&&w.setValue(...e)),ref:"values",disabled:e.loading},[e.value.is_write_only?((0,a.wg)(),(0,a.iD)("option",y,"--")):(0,a.kq)("",!0),((0,a.wg)(!0),(0,a.iD)(a.HY,null,(0,a.Ko)(w.displayValues,((t,l)=>((0,a.wg)(),(0,a.iD)("option",{value:l,selected:l==e.value.value,key:l,textContent:(0,n.zw)(t)},null,8,g)))),128))],40,h)])])]))])}var m=l(7909),w=l(3459),_={name:"EnumSwitch",components:{EntityIcon:w["default"]},mixins:[m["default"]],computed:{hasValues(){return!!Object.values(this?.value?.values||{}).length},displayValues(){return this.value?.values instanceof Array?this.value.values.reduce(((e,t)=>(e[t]=t,e)),{}):this.value?.values||{}}},methods:{prevent(e){return e.stopPropagation(),!1},async setValue(e){if(e.target.value?.length){if(this.$emit("loading",!0),this.value.is_write_only){const e=this;setTimeout((()=>{e.$refs.values.value=""}),1e3)}try{await this.request("entities.execute",{id:this.value.id,action:"set_value",data:e.target.value})}finally{this.$emit("loading",!1)}}}}},k=l(3744);const C=(0,k.Z)(_,[["render",f],["__scopeId","data-v-3404ecf7"]]);var b=C},3540:function(e,t,l){e.exports=l.p+"static/img/spinner.c0bee445.gif"}}]);
//# sourceMappingURL=1897.d577146b.js.map

View file

@ -1,2 +1,2 @@
"use strict";(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[1897,3459],{3459:function(e,t,n){n.r(t),n.d(t,{default:function(){return f}});var l=n(6252),o=n(3577),i=n(3540),a={key:0,src:i,class:"loading"},u={key:1,class:"fas fa-circle-exclamation error"};function r(e,t,n,i,r,s){var c=(0,l.up)("Icon");return(0,l.wg)(),(0,l.iD)("div",{class:(0,o.C_)(["entity-icon-container",{"with-color-fill":!!s.colorFill}]),style:(0,o.j5)(s.colorFillStyle)},[n.loading?((0,l.wg)(),(0,l.iD)("img",a)):n.error?((0,l.wg)(),(0,l.iD)("i",u)):((0,l.wg)(),(0,l.j4)(c,(0,o.vs)((0,l.dG)({key:2},s.computedIconNormalized)),null,16))],6)}var s=n(4648),c=(n(7941),n(7042),n(1478)),d={name:"EntityIcon",components:{Icon:c.Z},props:{loading:{type:Boolean,default:!1},error:{type:Boolean,default:!1},entity:{type:Object,required:!0},icon:{type:Object,default:function(){}},hasColorFill:{type:Boolean,default:!1}},data:function(){return{component:null,modalVisible:!1}},computed:{computedIcon:function(){var e,t,n=(0,s.Z)({},(null===(e=this.entity)||void 0===e||null===(t=e.meta)||void 0===t?void 0:t.icon)||{});return Object.keys(this.icon||{}).length&&(n=this.icon),(0,s.Z)({},n)},colorFill:function(){return this.hasColorFill&&this.computedIcon.color},colorFillStyle:function(){return this.colorFill&&!this.error?{background:this.colorFill}:{}},computedIconNormalized:function(){var e=(0,s.Z)({},this.computedIcon);return this.colorFill&&delete e.color,e},type:function(){var e=this.entity.type||"";return e.charAt(0).toUpperCase()+e.slice(1)}}},v=n(3744);const p=(0,v.Z)(d,[["render",r],["__scopeId","data-v-4fad24e6"]]);var f=p},1897:function(e,t,n){n.r(t),n.d(t,{default:function(){return x}});n(8309),n(1539),n(3948);var l=n(6252),o=n(3577),i=n(9963),a={class:"entity switch-container"},u={class:"col-1 icon"},r={class:"col-s-8 col-m-9 label"},s=["textContent"],c={class:"col-s-3 col-m-2 buttons pull-right"},d=["textContent"],v={class:"row"},p={class:"input"},f=["disabled"],h={key:0,value:"",selected:""},y=["value","selected","textContent"];function g(e,t,n,g,m,w){var k,_=(0,l.up)("EntityIcon");return(0,l.wg)(),(0,l.iD)("div",a,[(0,l._)("div",{class:(0,o.C_)(["head",{collapsed:e.collapsed}])},[(0,l._)("div",u,[(0,l.Wm)(_,{entity:e.value,loading:e.loading,error:e.error},null,8,["entity","loading","error"])]),(0,l._)("div",r,[(0,l._)("div",{class:"name",textContent:(0,o.zw)(e.value.name)},null,8,s)]),(0,l._)("div",c,[w.hasValues?((0,l.wg)(),(0,l.iD)("button",{key:0,onClick:t[0]||(t[0]=(0,i.iM)((function(t){return e.collapsed=!e.collapsed}),["stop"]))},[(0,l._)("i",{class:(0,o.C_)(["fas",{"fa-angle-up":!e.collapsed,"fa-angle-down":e.collapsed}])},null,2)])):(0,l.kq)("",!0),null!=(null===(k=e.value)||void 0===k?void 0:k.value)?((0,l.wg)(),(0,l.iD)("span",{key:1,class:"value",textContent:(0,o.zw)(e.value.values[e.value.value]||e.value.value)},null,8,d)):(0,l.kq)("",!0)])],2),e.collapsed?(0,l.kq)("",!0):((0,l.wg)(),(0,l.iD)("div",{key:0,class:"body",onClick:t[2]||(t[2]=(0,i.iM)((function(){return w.prevent&&w.prevent.apply(w,arguments)}),["stop"]))},[(0,l._)("div",v,[(0,l._)("div",p,[(0,l._)("select",{onInput:t[1]||(t[1]=function(){return w.setValue&&w.setValue.apply(w,arguments)}),ref:"values",disabled:e.loading},[e.value.is_write_only?((0,l.wg)(),(0,l.iD)("option",h,"--")):(0,l.kq)("",!0),((0,l.wg)(!0),(0,l.iD)(l.HY,null,(0,l.Ko)(w.displayValues,(function(t,n){return(0,l.wg)(),(0,l.iD)("option",{value:n,selected:n==e.value.value,key:n,textContent:(0,o.zw)(t)},null,8,y)})),128))],40,f)])])]))])}var m=n(8534),w=(n(5666),n(2479),n(7909)),k=n(3459),_={name:"EnumSwitch",components:{EntityIcon:k["default"]},mixins:[w["default"]],computed:{hasValues:function(){var e;return!!Object.values((null===this||void 0===this||null===(e=this.value)||void 0===e?void 0:e.values)||{}).length},displayValues:function(){var e,t;return(null===(e=this.value)||void 0===e?void 0:e.values)instanceof Array?this.value.values.reduce((function(e,t){return e[t]=t,e}),{}):(null===(t=this.value)||void 0===t?void 0:t.values)||{}}},methods:{prevent:function(e){return e.stopPropagation(),!1},setValue:function(e){var t=this;return(0,m.Z)(regeneratorRuntime.mark((function n(){var l,o;return regeneratorRuntime.wrap((function(n){while(1)switch(n.prev=n.next){case 0:if(null!==(l=e.target.value)&&void 0!==l&&l.length){n.next=2;break}return n.abrupt("return");case 2:return t.$emit("loading",!0),t.value.is_write_only&&(o=t,setTimeout((function(){o.$refs.values.value=""}),1e3)),n.prev=4,n.next=7,t.request("entities.execute",{id:t.value.id,action:"set_value",data:e.target.value});case 7:return n.prev=7,t.$emit("loading",!1),n.finish(7);case 10:case"end":return n.stop()}}),n,null,[[4,,7,10]])})))()}}},b=n(3744);const C=(0,b.Z)(_,[["render",g],["__scopeId","data-v-3404ecf7"]]);var x=C},3540:function(e,t,n){e.exports=n.p+"static/img/spinner.c0bee445.gif"}}]); "use strict";(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[3398,3459],{3459:function(e,t,n){n.r(t),n.d(t,{default:function(){return f}});var l=n(6252),o=n(3577),i=n(3540),a={key:0,src:i,class:"loading"},u={key:1,class:"fas fa-circle-exclamation error"};function r(e,t,n,i,r,s){var c=(0,l.up)("Icon");return(0,l.wg)(),(0,l.iD)("div",{class:(0,o.C_)(["entity-icon-container",{"with-color-fill":!!s.colorFill}]),style:(0,o.j5)(s.colorFillStyle)},[n.loading?((0,l.wg)(),(0,l.iD)("img",a)):n.error?((0,l.wg)(),(0,l.iD)("i",u)):((0,l.wg)(),(0,l.j4)(c,(0,o.vs)((0,l.dG)({key:2},s.computedIconNormalized)),null,16))],6)}var s=n(4648),c=(n(7941),n(7042),n(1478)),d={name:"EntityIcon",components:{Icon:c.Z},props:{loading:{type:Boolean,default:!1},error:{type:Boolean,default:!1},entity:{type:Object,required:!0},icon:{type:Object,default:function(){}},hasColorFill:{type:Boolean,default:!1}},data:function(){return{component:null,modalVisible:!1}},computed:{computedIcon:function(){var e,t,n=(0,s.Z)({},(null===(e=this.entity)||void 0===e||null===(t=e.meta)||void 0===t?void 0:t.icon)||{});return Object.keys(this.icon||{}).length&&(n=this.icon),(0,s.Z)({},n)},colorFill:function(){return this.hasColorFill&&this.computedIcon.color},colorFillStyle:function(){return this.colorFill&&!this.error?{background:this.colorFill}:{}},computedIconNormalized:function(){var e=(0,s.Z)({},this.computedIcon);return this.colorFill&&delete e.color,e},type:function(){var e=this.entity.type||"";return e.charAt(0).toUpperCase()+e.slice(1)}}},v=n(3744);const p=(0,v.Z)(d,[["render",r],["__scopeId","data-v-4fad24e6"]]);var f=p},3398:function(e,t,n){n.r(t),n.d(t,{default:function(){return x}});n(8309),n(1539),n(3948);var l=n(6252),o=n(3577),i=n(9963),a={class:"entity switch-container"},u={class:"col-1 icon"},r={class:"col-s-8 col-m-9 label"},s=["textContent"],c={class:"col-s-3 col-m-2 buttons pull-right"},d=["textContent"],v={class:"row"},p={class:"input"},f=["disabled"],h={key:0,value:"",selected:""},y=["value","selected","textContent"];function g(e,t,n,g,m,w){var k,_=(0,l.up)("EntityIcon");return(0,l.wg)(),(0,l.iD)("div",a,[(0,l._)("div",{class:(0,o.C_)(["head",{collapsed:e.collapsed}])},[(0,l._)("div",u,[(0,l.Wm)(_,{entity:e.value,loading:e.loading,error:e.error},null,8,["entity","loading","error"])]),(0,l._)("div",r,[(0,l._)("div",{class:"name",textContent:(0,o.zw)(e.value.name)},null,8,s)]),(0,l._)("div",c,[w.hasValues?((0,l.wg)(),(0,l.iD)("button",{key:0,onClick:t[0]||(t[0]=(0,i.iM)((function(t){return e.collapsed=!e.collapsed}),["stop"]))},[(0,l._)("i",{class:(0,o.C_)(["fas",{"fa-angle-up":!e.collapsed,"fa-angle-down":e.collapsed}])},null,2)])):(0,l.kq)("",!0),null!=(null===(k=e.value)||void 0===k?void 0:k.value)?((0,l.wg)(),(0,l.iD)("span",{key:1,class:"value",textContent:(0,o.zw)(e.value.values[e.value.value]||e.value.value)},null,8,d)):(0,l.kq)("",!0)])],2),e.collapsed?(0,l.kq)("",!0):((0,l.wg)(),(0,l.iD)("div",{key:0,class:"body",onClick:t[2]||(t[2]=(0,i.iM)((function(){return w.prevent&&w.prevent.apply(w,arguments)}),["stop"]))},[(0,l._)("div",v,[(0,l._)("div",p,[(0,l._)("select",{onInput:t[1]||(t[1]=function(){return w.setValue&&w.setValue.apply(w,arguments)}),ref:"values",disabled:e.loading},[e.value.is_write_only?((0,l.wg)(),(0,l.iD)("option",h,"--")):(0,l.kq)("",!0),((0,l.wg)(!0),(0,l.iD)(l.HY,null,(0,l.Ko)(w.displayValues,(function(t,n){return(0,l.wg)(),(0,l.iD)("option",{value:n,selected:n==e.value.value,key:n,textContent:(0,o.zw)(t)},null,8,y)})),128))],40,f)])])]))])}var m=n(8534),w=(n(5666),n(2479),n(7909)),k=n(3459),_={name:"EnumSwitch",components:{EntityIcon:k["default"]},mixins:[w["default"]],computed:{hasValues:function(){var e;return!!Object.values((null===this||void 0===this||null===(e=this.value)||void 0===e?void 0:e.values)||{}).length},displayValues:function(){var e,t;return(null===(e=this.value)||void 0===e?void 0:e.values)instanceof Array?this.value.values.reduce((function(e,t){return e[t]=t,e}),{}):(null===(t=this.value)||void 0===t?void 0:t.values)||{}}},methods:{prevent:function(e){return e.stopPropagation(),!1},setValue:function(e){var t=this;return(0,m.Z)(regeneratorRuntime.mark((function n(){var l,o;return regeneratorRuntime.wrap((function(n){while(1)switch(n.prev=n.next){case 0:if(null!==(l=e.target.value)&&void 0!==l&&l.length){n.next=2;break}return n.abrupt("return");case 2:return t.$emit("loading",!0),t.value.is_write_only&&(o=t,setTimeout((function(){o.$refs.values.value=""}),1e3)),n.prev=4,n.next=7,t.request("entities.execute",{id:t.value.id,action:"set",value:e.target.value});case 7:return n.prev=7,t.$emit("loading",!1),n.finish(7);case 10:case"end":return n.stop()}}),n,null,[[4,,7,10]])})))()}}},b=n(3744);const C=(0,b.Z)(_,[["render",g],["__scopeId","data-v-ba5c657c"]]);var x=C},3540:function(e,t,n){e.exports=n.p+"static/img/spinner.c0bee445.gif"}}]);
//# sourceMappingURL=1897-legacy.657985da.js.map //# sourceMappingURL=3398-legacy.f60988fb.js.map

View file

@ -0,0 +1,2 @@
"use strict";(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[3398,3459],{3459:function(e,t,l){l.r(t),l.d(t,{default:function(){return v}});var n=l(6252),a=l(3577),o=l(3540);const i={key:0,src:o,class:"loading"},s={key:1,class:"fas fa-circle-exclamation error"};function c(e,t,l,o,c,u){const r=(0,n.up)("Icon");return(0,n.wg)(),(0,n.iD)("div",{class:(0,a.C_)(["entity-icon-container",{"with-color-fill":!!u.colorFill}]),style:(0,a.j5)(u.colorFillStyle)},[l.loading?((0,n.wg)(),(0,n.iD)("img",i)):l.error?((0,n.wg)(),(0,n.iD)("i",s)):((0,n.wg)(),(0,n.j4)(r,(0,a.vs)((0,n.dG)({key:2},u.computedIconNormalized)),null,16))],6)}var u=l(1478),r={name:"EntityIcon",components:{Icon:u.Z},props:{loading:{type:Boolean,default:!1},error:{type:Boolean,default:!1},entity:{type:Object,required:!0},icon:{type:Object,default:()=>{}},hasColorFill:{type:Boolean,default:!1}},data(){return{component:null,modalVisible:!1}},computed:{computedIcon(){let e={...this.entity?.meta?.icon||{}};return Object.keys(this.icon||{}).length&&(e=this.icon),{...e}},colorFill(){return this.hasColorFill&&this.computedIcon.color},colorFillStyle(){return this.colorFill&&!this.error?{background:this.colorFill}:{}},computedIconNormalized(){const e={...this.computedIcon};return this.colorFill&&delete e.color,e},type(){let e=this.entity.type||"";return e.charAt(0).toUpperCase()+e.slice(1)}}},d=l(3744);const p=(0,d.Z)(r,[["render",c],["__scopeId","data-v-4fad24e6"]]);var v=p},3398:function(e,t,l){l.r(t),l.d(t,{default:function(){return C}});var n=l(6252),a=l(3577),o=l(9963);const i={class:"entity switch-container"},s={class:"col-1 icon"},c={class:"col-s-8 col-m-9 label"},u=["textContent"],r={class:"col-s-3 col-m-2 buttons pull-right"},d=["textContent"],p={class:"row"},v={class:"input"},h=["disabled"],y={key:0,value:"",selected:""},g=["value","selected","textContent"];function f(e,t,l,f,m,w){const k=(0,n.up)("EntityIcon");return(0,n.wg)(),(0,n.iD)("div",i,[(0,n._)("div",{class:(0,a.C_)(["head",{collapsed:e.collapsed}])},[(0,n._)("div",s,[(0,n.Wm)(k,{entity:e.value,loading:e.loading,error:e.error},null,8,["entity","loading","error"])]),(0,n._)("div",c,[(0,n._)("div",{class:"name",textContent:(0,a.zw)(e.value.name)},null,8,u)]),(0,n._)("div",r,[w.hasValues?((0,n.wg)(),(0,n.iD)("button",{key:0,onClick:t[0]||(t[0]=(0,o.iM)((t=>e.collapsed=!e.collapsed),["stop"]))},[(0,n._)("i",{class:(0,a.C_)(["fas",{"fa-angle-up":!e.collapsed,"fa-angle-down":e.collapsed}])},null,2)])):(0,n.kq)("",!0),null!=e.value?.value?((0,n.wg)(),(0,n.iD)("span",{key:1,class:"value",textContent:(0,a.zw)(e.value.values[e.value.value]||e.value.value)},null,8,d)):(0,n.kq)("",!0)])],2),e.collapsed?(0,n.kq)("",!0):((0,n.wg)(),(0,n.iD)("div",{key:0,class:"body",onClick:t[2]||(t[2]=(0,o.iM)(((...e)=>w.prevent&&w.prevent(...e)),["stop"]))},[(0,n._)("div",p,[(0,n._)("div",v,[(0,n._)("select",{onInput:t[1]||(t[1]=(...e)=>w.setValue&&w.setValue(...e)),ref:"values",disabled:e.loading},[e.value.is_write_only?((0,n.wg)(),(0,n.iD)("option",y,"--")):(0,n.kq)("",!0),((0,n.wg)(!0),(0,n.iD)(n.HY,null,(0,n.Ko)(w.displayValues,((t,l)=>((0,n.wg)(),(0,n.iD)("option",{value:l,selected:l==e.value.value,key:l,textContent:(0,a.zw)(t)},null,8,g)))),128))],40,h)])])]))])}var m=l(7909),w=l(3459),k={name:"EnumSwitch",components:{EntityIcon:w["default"]},mixins:[m["default"]],computed:{hasValues(){return!!Object.values(this?.value?.values||{}).length},displayValues(){return this.value?.values instanceof Array?this.value.values.reduce(((e,t)=>(e[t]=t,e)),{}):this.value?.values||{}}},methods:{prevent(e){return e.stopPropagation(),!1},async setValue(e){if(e.target.value?.length){if(this.$emit("loading",!0),this.value.is_write_only){const e=this;setTimeout((()=>{e.$refs.values.value=""}),1e3)}try{await this.request("entities.execute",{id:this.value.id,action:"set",value:e.target.value})}finally{this.$emit("loading",!1)}}}}},_=l(3744);const b=(0,_.Z)(k,[["render",f],["__scopeId","data-v-ba5c657c"]]);var C=b},3540:function(e,t,l){e.exports=l.p+"static/img/spinner.c0bee445.gif"}}]);
//# sourceMappingURL=3398.4f840e02.js.map

View file

@ -80,8 +80,8 @@ export default {
try { try {
await this.request('entities.execute', { await this.request('entities.execute', {
id: this.value.id, id: this.value.id,
action: 'set_value', action: 'set',
data: +event.target.value, value: +event.target.value,
}) })
} finally { } finally {
this.$emit('loading', false) this.$emit('loading', false)

View file

@ -88,8 +88,8 @@ export default {
try { try {
await this.request('entities.execute', { await this.request('entities.execute', {
id: this.value.id, id: this.value.id,
action: 'set_value', action: 'set',
data: event.target.value, value: event.target.value,
}) })
} finally { } finally {
this.$emit('loading', false) this.$emit('loading', false)