iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
2 lines • 12.6 kB
JavaScript
"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["67800"],{33544:function(e,a,i){i.d(a,{yt:()=>n,fU:()=>l,kP:()=>d});i(52247),i(9359),i(1331),i(40251);var t=i(17803),s=i(56785);const n=async e=>(0,t.I)(e.config.version,2021,2,4)?e.callWS({type:"supervisor/api",endpoint:"/addons",method:"get"}):(0,s.rY)(await e.callApi("GET","hassio/addons")),d=async(e,a)=>(0,t.I)(e.config.version,2021,2,4)?e.callWS({type:"supervisor/api",endpoint:`/addons/${a}/start`,method:"post",timeout:null}):e.callApi("POST",`hassio/addons/${a}/start`),l=async(e,a)=>{(0,t.I)(e.config.version,2021,2,4)?await e.callWS({type:"supervisor/api",endpoint:`/addons/${a}/install`,method:"post",timeout:null}):await e.callApi("POST",`hassio/addons/${a}/install`)}},92712:function(e,a,i){var t=i(61701),s=(i(19083),i(71695),i(92745),i(61893),i(9359),i(56475),i(1331),i(70104),i(61006),i(47021),i(57243)),n=i(50778),d=i(27486),l=i(36522),o=i(1416);i(83456),i(55486),i(15369);let r,h,c,u=e=>e;(0,t.Z)([(0,n.Mo)("ha-backup-addons-picker")],(function(e,a){return{F:class extends a{constructor(...a){super(...a),e(this)}},d:[{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"addons",value:void 0},{kind:"field",decorators:[(0,n.Cb)({attribute:!1})],key:"value",value:void 0},{kind:"field",decorators:[(0,n.Cb)({attribute:"hide-version",type:Boolean})],key:"hideVersion",value(){return!1}},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"disabled",value(){return!1}},{kind:"field",key:"_addons",value(){return(0,d.Z)((e=>e.sort(((e,a)=>{var i;return(0,o.$K)(e.name,a.name,null===(i=this.hass)||void 0===i||null===(i=i.locale)||void 0===i?void 0:i.language)}))))}},{kind:"method",key:"render",value:function(){return(0,s.dy)(r||(r=u` <div class="items"> ${0} </div> `),this._addons(this.addons).map((e=>{var a,i;return(0,s.dy)(h||(h=u` <ha-formfield> <ha-backup-formfield-label slot="label" .label="${0}" .version="${0}" .iconPath="${0}" .imageUrl="${0}"> </ha-backup-formfield-label> <ha-checkbox .id="${0}" .checked="${0}" ="${0}" .disabled="${0}"></ha-checkbox> </ha-formfield> `),e.name,this.hideVersion?void 0:e.version,e.iconPath||"M20.5,11H19V7C19,5.89 18.1,5 17,5H13V3.5A2.5,2.5 0 0,0 10.5,1A2.5,2.5 0 0,0 8,3.5V5H4A2,2 0 0,0 2,7V10.8H3.5C5,10.8 6.2,12 6.2,13.5C6.2,15 5,16.2 3.5,16.2H2V20A2,2 0 0,0 4,22H7.8V20.5C7.8,19 9,17.8 10.5,17.8C12,17.8 13.2,19 13.2,20.5V22H17A2,2 0 0,0 19,20V16H20.5A2.5,2.5 0 0,0 23,13.5A2.5,2.5 0 0,0 20.5,11Z",null!==(a=this.addons)&&void 0!==a&&null!==(a=a.find((a=>a.slug===e.slug)))&&void 0!==a&&a.icon?`/api/hassio/addons/${e.slug}/icon`:void 0,e.slug,(null===(i=this.value)||void 0===i?void 0:i.includes(e.slug))||!1,this._checkboxChanged,this.disabled)})))}},{kind:"method",key:"_checkboxChanged",value:function(e){var a;e.stopPropagation();let i=null!==(a=this.value)&&void 0!==a?a:[];const t=e.currentTarget;t.checked?i.push(t.id):i=i.filter((e=>e!==t.id)),(0,l.B)(this,"value-changed",{value:i})}},{kind:"field",static:!0,key:"styles",value(){return(0,s.iv)(c||(c=u`.items{display:flex;flex-direction:column}`))}}]}}),s.oi)},29232:function(e,a,i){var t=i(61701),s=i(72621),n=(i(19083),i(71695),i(92745),i(52805),i(9359),i(56475),i(70104),i(48136),i(19423),i(40251),i(61006),i(47021),i(57243)),d=i(50778),l=i(27486),o=i(72344),r=i(36522),h=i(87733),c=(i(83456),i(55486),i(33544)),u=i(30511);i(92712),i(15369);let f,p,k,v,m,b=e=>e;const g="M10,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V8C22,6.89 21.1,6 20,6H12L10,4Z",y={config:"M12,15.5A3.5,3.5 0 0,1 8.5,12A3.5,3.5 0 0,1 12,8.5A3.5,3.5 0 0,1 15.5,12A3.5,3.5 0 0,1 12,15.5M19.43,12.97C19.47,12.65 19.5,12.33 19.5,12C19.5,11.67 19.47,11.34 19.43,11L21.54,9.37C21.73,9.22 21.78,8.95 21.66,8.73L19.66,5.27C19.54,5.05 19.27,4.96 19.05,5.05L16.56,6.05C16.04,5.66 15.5,5.32 14.87,5.07L14.5,2.42C14.46,2.18 14.25,2 14,2H10C9.75,2 9.54,2.18 9.5,2.42L9.13,5.07C8.5,5.32 7.96,5.66 7.44,6.05L4.95,5.05C4.73,4.96 4.46,5.05 4.34,5.27L2.34,8.73C2.21,8.95 2.27,9.22 2.46,9.37L4.57,11C4.53,11.34 4.5,11.67 4.5,12C4.5,12.33 4.53,12.65 4.57,12.97L2.46,14.63C2.27,14.78 2.21,15.05 2.34,15.27L4.34,18.73C4.46,18.95 4.73,19.03 4.95,18.95L7.44,17.94C7.96,18.34 8.5,18.68 9.13,18.93L9.5,21.58C9.54,21.82 9.75,22 10,22H14C14.25,22 14.46,21.82 14.5,21.58L14.87,18.93C15.5,18.67 16.04,18.34 16.56,17.94L19.05,18.95C19.27,19.03 19.54,18.95 19.66,18.73L21.66,15.27C21.78,15.05 21.73,14.78 21.54,14.63L19.43,12.97Z",database:"M19 3H5C3.9 3 3 3.9 3 5V19C3 20.1 3.9 21 5 21H19C20.1 21 21 20.1 21 19V5C21 3.9 20.1 3 19 3M9 17H7V10H9V17M13 17H11V7H13V17M17 17H15V13H17V17Z",media:"M4,6H2V20A2,2 0 0,0 4,22H18V20H4V6M20,2H8A2,2 0 0,0 6,4V16A2,2 0 0,0 8,18H20A2,2 0 0,0 22,16V4A2,2 0 0,0 20,2M12,14.5V5.5L18,10L12,14.5Z",share:g,ssl:"M10,17L6,13L7.41,11.59L10,14.17L16.59,7.58L18,9M12,1L3,5V11C3,16.55 6.84,21.74 12,23C17.16,21.74 21,16.55 21,11V5L12,1Z"};(0,t.Z)([(0,d.Mo)("ha-backup-data-picker")],(function(e,a){class i extends a{constructor(...a){super(...a),e(this)}}return{F:i,d:[{kind:"field",decorators:[(0,d.Cb)({attribute:!1})],key:"hass",value:void 0},{kind:"field",decorators:[(0,d.Cb)({attribute:!1})],key:"data",value:void 0},{kind:"field",decorators:[(0,d.Cb)({attribute:!1})],key:"value",value:void 0},{kind:"field",decorators:[(0,d.Cb)({attribute:!1})],key:"localize",value:void 0},{kind:"field",decorators:[(0,d.Cb)({type:Array,attribute:"required-items"})],key:"requiredItems",value(){return[]}},{kind:"field",decorators:[(0,d.Cb)({attribute:"translation-key-panel"})],key:"translationKeyPanel",value(){return"config.backup"}},{kind:"field",decorators:[(0,d.Cb)({type:Boolean,attribute:!1})],key:"addonsDisabled",value(){return!1}},{kind:"field",decorators:[(0,d.SB)()],key:"_addonIcons",value(){return{}}},{kind:"method",key:"firstUpdated",value:function(e){(0,s.Z)(i,"firstUpdated",this,3)([e]),this.hass&&(0,o.p)(this.hass,"hassio")&&this._fetchAddonInfo()}},{kind:"method",key:"_fetchAddonInfo",value:async function(){const{addons:e}=await(0,c.yt)(this.hass);this._addonIcons=e.reduce(((e,a)=>Object.assign(Object.assign({},e),{},{[a.slug]:a.icon})),{})}},{kind:"field",key:"_homeAssistantItems",value(){return(0,l.Z)(((e,a)=>{const i=[];return e.homeassistant_included&&i.push({label:a(`ui.panel.${this.translationKeyPanel}.data_picker.${e.database_included?"settings_and_history":"settings"}`),id:"config",version:e.homeassistant_version}),i.push(...e.folders.map((e=>({label:this._localizeFolder(e),id:e})))),i}))}},{kind:"method",key:"_localizeFolder",value:function(e){const a=this.localize||this.hass.localize;switch(e){case"media":return a(`ui.panel.${this.translationKeyPanel}.data_picker.media`);case"share":return a(`ui.panel.${this.translationKeyPanel}.data_picker.share_folder`);case"ssl":return a(`ui.panel.${this.translationKeyPanel}.data_picker.ssl`);case"addons/local":return a(`ui.panel.${this.translationKeyPanel}.data_picker.local_addons`)}return(0,h.f)(e)}},{kind:"field",key:"_addonsItems",value(){return(0,l.Z)(((e,a,i)=>e.addons.map((e=>({name:e.name,slug:e.slug,version:e.version,icon:i[e.slug]})))))}},{kind:"field",key:"_parseValue",value(){return(0,l.Z)((e=>{if(!e)return{homeassistant:[],addons:[]};const a=[],i=[];e.homeassistant_included&&a.push("config");const t=e.folders;a.push(...t);const s=e.addons.map((e=>e.slug));return i.push(...s),{homeassistant:a,addons:i}}))}},{kind:"field",key:"_formatValue",value(){return(0,l.Z)(((e,a)=>({homeassistant_version:a.homeassistant_version,homeassistant_included:e.homeassistant.includes("config"),database_included:a.database_included&&e.homeassistant.includes("config"),addons:a.addons.filter((a=>e.addons.includes(a.slug))),folders:a.folders.filter((a=>e.homeassistant.includes(a)))})))}},{kind:"method",key:"_homeassistantChanged",value:function(e){const a=this._parseValue(this.value),i=e.currentTarget;i.checked?a.homeassistant.push(i.id):a.homeassistant=a.homeassistant.filter((e=>e!==i.id));const t=this._formatValue(a,this.data);(0,r.B)(this,"value-changed",{value:t})}},{kind:"method",key:"_addonsChanged",value:function(e){e.stopPropagation();const a=this._parseValue(this.value),i=e.detail.value;a.addons=i;const t=this._formatValue(a,this.data);(0,r.B)(this,"value-changed",{value:t})}},{kind:"method",key:"_sectionChanged",value:function(e){const a=this._parseValue(this.value),i=this._parseValue(this.data),t=e.currentTarget,s=t.id;t.checked?a[s]=i[s]:a[s]=[];const n=this._formatValue(a,this.data);(0,r.B)(this,"value-changed",{value:n})}},{kind:"method",key:"render",value:function(){const e=this.localize||this.hass.localize,a=this._homeAssistantItems(this.data,e),i=this._addonsItems(this.data,e,this._addonIcons),t=this._parseValue(this.value);return(0,n.dy)(f||(f=b` ${0} ${0} `),a.length?(0,n.dy)(p||(p=b` <div class="section"> <ha-formfield> <ha-backup-formfield-label slot="label" label="ioBroker" .iconPath="${0}"> </ha-backup-formfield-label> <ha-checkbox .id="${0}" .checked="${0}" .indeterminate="${0}" ="${0}" ?disabled="${0}"></ha-checkbox> </ha-formfield> <div class="items"> ${0} </div> </div> `),u.mdiHomeAssistant,"homeassistant",t.homeassistant.length===a.length,t.homeassistant.length>0&&t.homeassistant.length<a.length,this._sectionChanged,this.requiredItems.length>0,a.map((e=>(0,n.dy)(k||(k=b` <ha-formfield> <ha-backup-formfield-label slot="label" .label="${0}" .version="${0}" .iconPath="${0}"> </ha-backup-formfield-label> <ha-checkbox .id="${0}" .checked="${0}" ="${0}" .disabled="${0}"></ha-checkbox> </ha-formfield> `),e.label,e.version,y[e.id]||g,e.id,t.homeassistant.includes(e.id),this._homeassistantChanged,this.requiredItems.includes(e.id))))):n.Ld,i.length?(0,n.dy)(v||(v=b` <div class="section"> <ha-formfield> <ha-backup-formfield-label slot="label" .label="${0}" .iconPath="${0}"> </ha-backup-formfield-label> <ha-checkbox .id="${0}" .checked="${0}" .indeterminate="${0}" ="${0}" .disabled="${0}"></ha-checkbox> </ha-formfield> <ha-backup-addons-picker .hass="${0}" .value="${0}" -changed="${0}" .addons="${0}" .disabled="${0}"> </ha-backup-addons-picker> </div> `),e(`ui.panel.${this.translationKeyPanel}.data_picker.addons`),"M20.5,11H19V7C19,5.89 18.1,5 17,5H13V3.5A2.5,2.5 0 0,0 10.5,1A2.5,2.5 0 0,0 8,3.5V5H4A2,2 0 0,0 2,7V10.8H3.5C5,10.8 6.2,12 6.2,13.5C6.2,15 5,16.2 3.5,16.2H2V20A2,2 0 0,0 4,22H7.8V20.5C7.8,19 9,17.8 10.5,17.8C12,17.8 13.2,19 13.2,20.5V22H17A2,2 0 0,0 19,20V16H20.5A2.5,2.5 0 0,0 23,13.5A2.5,2.5 0 0,0 20.5,11Z","addons",t.addons.length===i.length,t.addons.length>0&&t.addons.length<i.length,this._sectionChanged,this.addonsDisabled,this.hass,t.addons,this._addonsChanged,i,this.addonsDisabled):n.Ld)}},{kind:"field",static:!0,key:"styles",value(){return(0,n.iv)(m||(m=b`.section{margin-left:-16px;margin-inline-start:-16px;margin-inline-end:initial}.items{padding-left:40px;padding-inline-start:40px;padding-inline-end:initial;display:flex;flex-direction:column}ha-backup-addons-picker{display:block;padding-left:40px;padding-inline-start:40px;padding-inline-end:initial}`))}}]}}),n.oi)},15369:function(e,a,i){var t=i(61701),s=(i(71695),i(47021),i(57243)),n=i(50778);i(37583);let d,l,o,r,h,c=e=>e;(0,t.Z)([(0,n.Mo)("ha-backup-formfield-label")],(function(e,a){return{F:class extends a{constructor(...a){super(...a),e(this)}},d:[{kind:"field",decorators:[(0,n.Cb)({type:String})],key:"label",value:void 0},{kind:"field",decorators:[(0,n.Cb)({type:String,attribute:"image-url"})],key:"imageUrl",value:void 0},{kind:"field",decorators:[(0,n.Cb)({type:String,attribute:"icon-path"})],key:"iconPath",value:void 0},{kind:"field",decorators:[(0,n.Cb)({type:String})],key:"version",value:void 0},{kind:"method",key:"render",value:function(){return(0,s.dy)(d||(d=c` ${0} <span class="label"> ${0} ${0} </span> `),this.imageUrl?(0,s.dy)(l||(l=c`<img loading="lazy" alt="" src="${0}" class="icon">`),this.imageUrl):this.iconPath?(0,s.dy)(o||(o=c` <ha-svg-icon .path="${0}" class="icon"></ha-svg-icon> `),this.iconPath):s.Ld,this.label,this.version?(0,s.dy)(r||(r=c`<span class="version">(${0})</span>`),this.version):s.Ld)}},{kind:"field",static:!0,key:"styles",value(){return(0,s.iv)(h||(h=c`:host{display:flex;flex-direction:row;gap:16px;align-items:center}.label{margin-right:4px;margin-inline-end:4px;margin-inline-start:initial;font-size:14px;font-weight:400;line-height:24px;letter-spacing:.5px}.version{color:var(--secondary-text-color)}.icon{--mdi-icon-size:24px;width:24px;height:24px}`))}}]}}),s.oi)}}]);
//# sourceMappingURL=67800.874a94f9f470f9b3.js.map