iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
1 lines • 3.35 kB
JavaScript
export const __rspack_esm_id=81493;export const __rspack_esm_ids=[81493];export const __webpack_modules__={44244(a,o,t){t.a(a,async function(a,i){try{t.r(o);var e=t(62826),s=t(5124),n=t(22441),r=t(1087),c=t(38962),l=t(18350),p=t(72554),d=(t(93444),t(91485)),h=t(31420),_=t(14503),g=t(63993),u=a([c,l,p,d,h,g]);[c,l,p,d,h,g]=u.then?(await u)():u;class y extends s.WF{showDialog(a){this._open=!0,this._params=a}closeDialog(){return this._open=!1,!0}_dialogClosed(){this._open&&(0,r.r)(this,"dialog-closed",{dialog:this.localName}),this._open=!1,this._params=void 0,this._encryptionKey="",this._error=""}render(){return this._params?s.qy` <ha-dialog .open="${this._open}" header-title="${this.hass.localize("ui.panel.config.backup.dialogs.download.title")}" prevent-scrim-close ="${this._dialogClosed}"> <p> ${this.hass.localize("ui.panel.config.backup.dialogs.download.description")} </p> <p> ${this.hass.localize("ui.panel.config.backup.dialogs.download.download_backup_encrypted",{download_it_encrypted:s.qy`<button class="link" ="${this._downloadEncrypted}"> ${this.hass.localize("ui.panel.config.backup.dialogs.download.download_it_encrypted")} </button>`})} </p> <ha-input type="password" password-toggle .label="${this.hass.localize("ui.panel.config.backup.dialogs.download.encryption_key")}" ="${this._keyChanged}"></ha-input> ${this._error?s.qy`<ha-alert alert-type="error">${this._error}</ha-alert>`:s.s6} <ha-dialog-footer slot="footer"> <ha-button slot="secondaryAction" appearance="plain" ="${this._cancel}"> ${this.hass.localize("ui.common.cancel")} </ha-button> <ha-button slot="primaryAction" ="${this._submit}"> ${this.hass.localize("ui.panel.config.backup.dialogs.download.download")} </ha-button> </ha-dialog-footer> </ha-dialog> `:s.s6}_cancel(){this.closeDialog()}async _submit(){if(""!==this._encryptionKey)try{await(0,h.Zm)(this.hass,this._params.backup.backup_id,this._agentId,this._encryptionKey),(0,g.s)(this.hass,this._params.backup.backup_id,this._agentId,this._encryptionKey),this.closeDialog()}catch(a){"password_incorrect"===a?.code?this._error=this.hass.localize("ui.panel.config.backup.dialogs.download.incorrect_encryption_key"):"decrypt_not_supported"===a?.code?this._error=this.hass.localize("ui.panel.config.backup.dialogs.download.decryption_not_supported"):alert(a.message)}}_keyChanged(a){this._encryptionKey=a.currentTarget.value,this._error=""}get _agentId(){return this._params?.agentId?this._params.agentId:(0,h.EB)(Object.keys(this._params.backup.agents))}async _downloadEncrypted(){(0,g.s)(this.hass,this._params.backup.backup_id,this._agentId),this.closeDialog()}static get styles(){return[_.RF,_.nA,s.AH`ha-dialog{--dialog-content-padding:var(--ha-space-2) var(--ha-space-6)}button.link{background:0 0;border:none;padding:0;font-size:var(--ha-font-size-m);color:var(--primary-color);text-decoration:underline;cursor:pointer}`]}constructor(...a){super(...a),this._open=!1,this._encryptionKey="",this._error=""}}(0,e.Cg)([(0,n.MZ)({attribute:!1})],y.prototype,"hass",void 0),(0,e.Cg)([(0,n.wk)()],y.prototype,"_open",void 0),(0,e.Cg)([(0,n.wk)()],y.prototype,"_params",void 0),(0,e.Cg)([(0,n.wk)()],y.prototype,"_encryptionKey",void 0),(0,e.Cg)([(0,n.wk)()],y.prototype,"_error",void 0),y=(0,e.Cg)([(0,n.EM)("ha-dialog-download-decrypted-backup")],y),i()}catch(a){i(a)}})}};