UNPKG

iobroker.lovelace

Version:

With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI

1 lines 9.85 kB
export const __rspack_esm_id=88661;export const __rspack_esm_ids=[88661];export const __webpack_modules__={82262(a,s,i){i.d(s,{S:()=>e});var t=i(1087);const e=(a,s)=>{(0,t.r)(a,"show-dialog",{dialogTag:"dialog-local-backup-location",dialogImport:()=>i.e(39031).then(i.bind(i,74186)),dialogParams:s})}},12084(a,s,i){i.a(a,async function(a,t){try{i.r(s);var e=i(62826),o=i(5124),n=i(22441),c=i(36312),r=i(1087),l=i(9899),d=i(12587),h=i(38962),g=i(18350),p=(i(76776),i(29823)),u=(i(70947),i(26300)),_=(i(43661),i(67094),i(31420)),f=i(26581),v=i(81310),b=i(44144),C=i(36918),k=i(30619),m=i(59717),$=i(40840),y=i(82262),w=a([h,g,p,u,v,k,m,$,_]);[h,g,p,u,v,k,m,$,_]=w.then?(await w)():w;const A="M12,16A2,2 0 0,1 14,18A2,2 0 0,1 12,20A2,2 0 0,1 10,18A2,2 0 0,1 12,16M12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12A2,2 0 0,1 12,10M12,4A2,2 0 0,1 14,6A2,2 0 0,1 12,8A2,2 0 0,1 10,6A2,2 0 0,1 12,4Z",x="M6,2H18A2,2 0 0,1 20,4V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V4A2,2 0 0,1 6,2M12,4A6,6 0 0,0 6,10C6,13.31 8.69,16 12.1,16L11.22,13.77C10.95,13.29 11.11,12.68 11.59,12.4L12.45,11.9C12.93,11.63 13.54,11.79 13.82,12.27L15.74,14.69C17.12,13.59 18,11.9 18,10A6,6 0 0,0 12,4M12,9A1,1 0 0,1 13,10A1,1 0 0,1 12,11A1,1 0 0,1 11,10A1,1 0 0,1 12,9M7,18A1,1 0 0,0 6,19A1,1 0 0,0 7,20A1,1 0 0,0 8,19A1,1 0 0,0 7,18M12.09,13.27L14.58,19.58L17.17,18.08L12.95,12.77L12.09,13.27Z",z="M14,3V5H17.59L7.76,14.83L9.17,16.24L19,6.41V10H21V3M19,19H5V5H12V3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V12H19V19Z";class U extends o.WF{willUpdate(a){super.willUpdate(a),a.has("config")&&!this._config&&(this._config=this.config),!this.hasUpdated&&(0,c.x)(this.hass.config,"hassio")&&this._getSupervisorUpdateConfig()}connectedCallback(){super.connectedCallback(),this._scrollToSection(),this._config=this.config}async _getSupervisorUpdateConfig(){try{this._supervisorUpdateConfig=await(0,f.y)(this.hass)}catch(a){console.error(a),this._supervisorUpdateConfigError=this.hass.localize("ui.panel.config.backup.settings.schedule.error_load",{error:a?.message||a})}}async _scrollToSection(){if("locations"===window.location.hash.substring(1)&&(0,c.x)(this.hass.config,"hassio")&&!this._config?.create_backup.include_all_addons&&this._config?.create_backup.include_addons?.length)return this.addEventListener("backup-addons-fetched",async()=>{await(0,d.E)(),this._scrolltoHash()}),void setTimeout(()=>{this._clearHash()},500);await(0,d.E)(),this._scrolltoHash()}_scrolltoHash(){const a=window.location.hash.substring(1);if(a){const s=this.shadowRoot.getElementById(a);s?.scrollIntoView(),this._clearHash()}}_clearHash(){history.replaceState(null,"",window.location.pathname)}render(){if(!this._config)return o.s6;const a=(0,c.x)(this.hass.config,"hassio");return o.qy` <hass-subpage back-path="/config/backup" .hass="${this.hass}" .narrow="${this.narrow}" .header="${this.hass.localize("ui.panel.config.backup.settings.header")}"> ${a?o.qy` <ha-dropdown slot="toolbar-icon" @wa-select="${this._handleDropdownSelect}"> <ha-icon-button slot="trigger" .label="${this.hass.localize("ui.common.menu")}" .path="${A}"></ha-icon-button> <ha-dropdown-item value="change_local_location"> <ha-svg-icon slot="icon" .path="${x}"></ha-svg-icon> ${this.hass.localize("ui.panel.config.backup.settings.menu.change_default_location")} </ha-dropdown-item> </ha-dropdown> `:o.s6} <div class="content"> <ha-card id="schedule"> <div class="card-header"> ${this.hass.localize("ui.panel.config.backup.settings.schedule.title")} </div> <div class="card-content"> <p> ${this.hass.localize("ui.panel.config.backup.settings.schedule.description")} </p> ${this._supervisorUpdateConfigError?o.qy`<ha-alert alert-type="error"> ${this._supervisorUpdateConfigError} </ha-alert>`:o.s6} <ha-backup-config-schedule .hass="${this.hass}" .value="${this._config}" .supervisor="${a}" .supervisorUpdateConfig="${this._supervisorUpdateConfig}" @update-config-changed="${this._supervisorUpdateConfigChanged}" @value-changed="${this._scheduleConfigChanged}"></ha-backup-config-schedule> </div> </ha-card> <ha-card id="data"> <div class="card-header"> ${this.hass.localize("ui.panel.config.backup.settings.data.title")} </div> <div class="card-content"> <ha-backup-config-data .hass="${this.hass}" .value="${this._dataConfig}" @value-changed="${this._dataConfigChanged}" force-home-assistant hide-addon-version></ha-backup-config-data> </div> </ha-card> <ha-card class="agents" id="locations"> <div class="card-header"> ${this.hass.localize("ui.panel.config.backup.settings.locations.title")} </div> <div class="card-content"> <p> ${this.hass.localize("ui.panel.config.backup.settings.locations.description")} </p> <ha-backup-config-agents .hass="${this.hass}" .value="${this._config.create_backup.agent_ids}" .agentsConfig="${this._config.agents}" .cloudStatus="${this.cloudStatus}" .agents="${this.agents}" @value-changed="${this._agentsConfigChanged}" show-settings></ha-backup-config-agents> ${this._config.create_backup.agent_ids.length?o.s6:o.qy` <ha-alert alert-type="warning" .title="${this.hass.localize("ui.panel.config.backup.settings.locations.no_location")}"> ${this.hass.localize("ui.panel.config.backup.settings.locations.no_location_description")} </ha-alert> <br> `} </div> ${!this.cloudStatus?.logged_in&&(0,c.x)(this.hass.config,"cloud")?o.qy`<ha-card class="cloud-info"> <div class="cloud-header"> <img .src="${(0,b.MR)({domain:"cloud",type:"icon",darkOptimized:this.hass.themes?.darkMode},this.hass.auth.data.hassUrl)}" crossorigin="anonymous" referrerpolicy="no-referrer" alt="Nabu Casa logo" slot="start"> <span>${this.hass.localize("ui.panel.config.backup.settings.locations.ha_cloud_backup",{home_assistant_cloud:"ioBroker Cloud"})}</span> </div> <div class="card-content"> ${this.hass.localize("ui.panel.config.backup.settings.locations.ha_cloud_description")} </div> <div class="card-actions"> <ha-button appearance="plain" href="/config/cloud/login"> ${this.hass.localize("ui.panel.config.voice_assistants.assistants.cloud.sign_in")} </ha-button> <ha-button href="/config/cloud/register" appearance="filled"> ${this.hass.localize("ui.panel.config.voice_assistants.assistants.cloud.try_one_month")} </ha-button> </div> </ha-card>`:o.s6} <div class="card-actions"> <ha-button size="small" href="${(0,C.o)(this.hass,"/integrations/#backup")}" target="_blank" rel="noreferrer" appearance="plain"> <ha-svg-icon slot="start" .path="${z}"></ha-svg-icon> ${this.hass.localize("ui.panel.config.backup.settings.locations.more_locations")} </ha-button> ${a?o.qy`<ha-button size="small" appearance="plain" href="/config/storage"> ${this.hass.localize("ui.panel.config.backup.settings.locations.manage_network_storage")} </ha-button>`:o.s6} </div> </ha-card> </div> </hass-subpage> `}async _supervisorUpdateConfigChanged(a){const s=a.detail.value;this._supervisorUpdateConfig={...this._supervisorUpdateConfig,...s},this._debounceSaveSupervisorUpdateConfig()}_scheduleConfigChanged(a){const s=a.detail.value;this._config={...this._config,schedule:s.schedule,retention:s.retention},this._debounceSave()}get _dataConfig(){const{include_addons:a,include_all_addons:s,include_database:i,include_folders:t}=this._config.create_backup;return{include_homeassistant:!0,include_database:i,include_folders:t||void 0,include_all_addons:s,include_addons:a||void 0}}_dataConfigChanged(a){const s=a.detail.value;this._config={...this._config,create_backup:{...this.config.create_backup,include_database:s.include_database,include_folders:s.include_folders||null,include_all_addons:s.include_all_addons,include_addons:s.include_addons||null}},this._debounceSave()}_agentsConfigChanged(a){const s=a.detail.value;this._config={...this._config,create_backup:{...this._config.create_backup,agent_ids:s}},this._debounceSave()}async _saveSupervisorUpdateConfig(){if(this._supervisorUpdateConfig)try{await(0,f.r)(this.hass,this._supervisorUpdateConfig)}catch(a){console.error(a),this._supervisorUpdateConfigError=this.hass.localize("ui.panel.config.backup.settings.schedule.error_save",{error:a?.message||a?.toString()})}}async _save(){await(0,_.gF)(this.hass,this._config),(0,r.r)(this,"ha-refresh-backup-config")}_handleDropdownSelect(a){const s=a.detail?.item?.value;"change_local_location"===s&&this._changeLocalLocation()}constructor(...a){super(...a),this.narrow=!1,this.agents=[],this._changeLocalLocation=()=>{(0,y.S)(this,{})},this._debounceSaveSupervisorUpdateConfig=(0,l.s)(()=>this._saveSupervisorUpdateConfig(),500),this._debounceSave=(0,l.s)(()=>this._save(),500)}}U.styles=o.AH`ha-card{scroll-margin-top:16px}p{color:var(--secondary-text-color)}p.error{color:var(--error-color)}.content{padding:28px 20px 0;max-width:690px;margin:0 auto;gap:var(--ha-space-6);display:flex;flex-direction:column;margin-bottom:24px}.alert{--mdc-theme-primary:var(--error-color)}.card-header{padding-bottom:8px}.card-content{padding-bottom:0}a{text-decoration:none}.cloud-info{margin:0 16px 16px}.cloud-info .cloud-header{display:flex;gap:var(--ha-space-4);font-size:var(--ha-font-size-xl);align-items:center;padding:16px}.cloud-info .cloud-header img{width:48px}.cloud-info .card-content{padding-bottom:16px}.cloud-info .card-actions{display:flex;justify-content:space-between}ha-button[size=small] ha-svg-icon{--mdc-icon-size:16px}`,(0,e.Cg)([(0,n.MZ)({attribute:!1})],U.prototype,"hass",void 0),(0,e.Cg)([(0,n.MZ)({attribute:!1})],U.prototype,"cloudStatus",void 0),(0,e.Cg)([(0,n.MZ)({type:Boolean})],U.prototype,"narrow",void 0),(0,e.Cg)([(0,n.MZ)({attribute:!1})],U.prototype,"config",void 0),(0,e.Cg)([(0,n.MZ)({attribute:!1})],U.prototype,"agents",void 0),(0,e.Cg)([(0,n.wk)()],U.prototype,"_config",void 0),(0,e.Cg)([(0,n.wk)()],U.prototype,"_supervisorUpdateConfig",void 0),(0,e.Cg)([(0,n.wk)()],U.prototype,"_supervisorUpdateConfigError",void 0),U=(0,e.Cg)([(0,n.EM)("ha-config-backup-settings")],U),t()}catch(a){t(a)}})}};