iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
2 lines • 11.8 kB
JavaScript
export const __webpack_ids__=["67800"];export const __webpack_modules__={33544:function(e,a,i){i.d(a,{yt:()=>n,fU:()=>o,kP:()=>d});i(9359),i(1331);var s=i(17803),t=i(56785);const n=async e=>(0,s.I)(e.config.version,2021,2,4)?e.callWS({type:"supervisor/api",endpoint:"/addons",method:"get"}):(0,t.rY)(await e.callApi("GET","hassio/addons")),d=async(e,a)=>(0,s.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`),o=async(e,a)=>{(0,s.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 s=i(44249),t=(i(92745),i(9359),i(56475),i(1331),i(70104),i(57243)),n=i(15093),d=i(27486),o=i(36522),l=i(1416);i(83456),i(55486),i(15369);(0,s.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:()=>!1},{kind:"field",decorators:[(0,n.Cb)({type:Boolean})],key:"disabled",value:()=>!1},{kind:"field",key:"_addons",value(){return(0,d.Z)((e=>e.sort(((e,a)=>(0,l.$K)(e.name,a.name,this.hass?.locale?.language)))))}},{kind:"method",key:"render",value:function(){return t.dy` <div class="items"> ${this._addons(this.addons).map((e=>t.dy` <ha-formfield> <ha-backup-formfield-label slot="label" .label="${e.name}" .version="${this.hideVersion?void 0:e.version}" .iconPath="${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"}" .imageUrl="${this.addons?.find((a=>a.slug===e.slug))?.icon?`/api/hassio/addons/${e.slug}/icon`:void 0}"> </ha-backup-formfield-label> <ha-checkbox .id="${e.slug}" .checked="${this.value?.includes(e.slug)||!1}" ="${this._checkboxChanged}" .disabled="${this.disabled}"></ha-checkbox> </ha-formfield> `))} </div> `}},{kind:"method",key:"_checkboxChanged",value:function(e){e.stopPropagation();let a=this.value??[];const i=e.currentTarget;i.checked?a.push(i.id):a=a.filter((e=>e!==i.id)),(0,o.B)(this,"value-changed",{value:a})}},{kind:"field",static:!0,key:"styles",value:()=>t.iv`.items{display:flex;flex-direction:column}`}]}}),t.oi)},29232:function(e,a,i){var s=i(44249),t=i(72621),n=(i(92745),i(9359),i(56475),i(70104),i(48136),i(57243)),d=i(15093),o=i(27486),l=i(72344),r=i(36522),c=i(87733),h=(i(83456),i(55486),i(33544)),u=i(30511);i(92712),i(15369);const p="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",f={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:p,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,s.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:()=>[]},{kind:"field",decorators:[(0,d.Cb)({attribute:"translation-key-panel"})],key:"translationKeyPanel",value:()=>"config.backup"},{kind:"field",decorators:[(0,d.Cb)({type:Boolean,attribute:!1})],key:"addonsDisabled",value:()=>!1},{kind:"field",decorators:[(0,d.SB)()],key:"_addonIcons",value:()=>({})},{kind:"method",key:"firstUpdated",value:function(e){(0,t.Z)(i,"firstUpdated",this,3)([e]),this.hass&&(0,l.p)(this.hass,"hassio")&&this._fetchAddonInfo()}},{kind:"method",key:"_fetchAddonInfo",value:async function(){const{addons:e}=await(0,h.yt)(this.hass);this._addonIcons=e.reduce(((e,a)=>({...e,[a.slug]:a.icon})),{})}},{kind:"field",key:"_homeAssistantItems",value(){return(0,o.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,c.f)(e)}},{kind:"field",key:"_addonsItems",value:()=>(0,o.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:()=>(0,o.Z)((e=>{if(!e)return{homeassistant:[],addons:[]};const a=[],i=[];e.homeassistant_included&&a.push("config");const s=e.folders;a.push(...s);const t=e.addons.map((e=>e.slug));return i.push(...t),{homeassistant:a,addons:i}}))},{kind:"field",key:"_formatValue",value:()=>(0,o.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 s=this._formatValue(a,this.data);(0,r.B)(this,"value-changed",{value:s})}},{kind:"method",key:"_addonsChanged",value:function(e){e.stopPropagation();const a=this._parseValue(this.value),i=e.detail.value;a.addons=i;const s=this._formatValue(a,this.data);(0,r.B)(this,"value-changed",{value:s})}},{kind:"method",key:"_sectionChanged",value:function(e){const a=this._parseValue(this.value),i=this._parseValue(this.data),s=e.currentTarget,t=s.id;s.checked?a[t]=i[t]:a[t]=[];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),s=this._parseValue(this.value);return n.dy` ${a.length?n.dy` <div class="section"> <ha-formfield> <ha-backup-formfield-label slot="label" label="ioBroker" .iconPath="${u.mdiHomeAssistant}"> </ha-backup-formfield-label> <ha-checkbox .id="${"homeassistant"}" .checked="${s.homeassistant.length===a.length}" .indeterminate="${s.homeassistant.length>0&&s.homeassistant.length<a.length}" ="${this._sectionChanged}" ?disabled="${this.requiredItems.length>0}"></ha-checkbox> </ha-formfield> <div class="items"> ${a.map((e=>n.dy` <ha-formfield> <ha-backup-formfield-label slot="label" .label="${e.label}" .version="${e.version}" .iconPath="${f[e.id]||p}"> </ha-backup-formfield-label> <ha-checkbox .id="${e.id}" .checked="${s.homeassistant.includes(e.id)}" ="${this._homeassistantChanged}" .disabled="${this.requiredItems.includes(e.id)}"></ha-checkbox> </ha-formfield> `))} </div> </div> `:n.Ld} ${i.length?n.dy` <div class="section"> <ha-formfield> <ha-backup-formfield-label slot="label" .label="${e(`ui.panel.${this.translationKeyPanel}.data_picker.addons`)}" .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"}"> </ha-backup-formfield-label> <ha-checkbox .id="${"addons"}" .checked="${s.addons.length===i.length}" .indeterminate="${s.addons.length>0&&s.addons.length<i.length}" ="${this._sectionChanged}" .disabled="${this.addonsDisabled}"></ha-checkbox> </ha-formfield> <ha-backup-addons-picker .hass="${this.hass}" .value="${s.addons}" -changed="${this._addonsChanged}" .addons="${i}" .disabled="${this.addonsDisabled}"> </ha-backup-addons-picker> </div> `:n.Ld} `}},{kind:"field",static:!0,key:"styles",value:()=>n.iv`.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 s=i(44249),t=i(57243),n=i(15093);i(37583);(0,s.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 t.dy` ${this.imageUrl?t.dy`<img loading="lazy" alt="" src="${this.imageUrl}" class="icon">`:this.iconPath?t.dy` <ha-svg-icon .path="${this.iconPath}" class="icon"></ha-svg-icon> `:t.Ld} <span class="label"> ${this.label} ${this.version?t.dy`<span class="version">(${this.version})</span>`:t.Ld} </span> `}},{kind:"field",static:!0,key:"styles",value:()=>t.iv`: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}`}]}}),t.oi)}};
//# sourceMappingURL=67800.c2b49d07bb083c2a.js.map