UNPKG

iobroker.lovelace

Version:

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

1 lines 3.7 kB
export const __rspack_esm_id=39031;export const __rspack_esm_ids=[39031];export const __webpack_modules__={96273(a,t,o){o.d(t,{Bt:()=>c,Qf:()=>n,Su:()=>u,Wu:()=>i,bK:()=>l,dd:()=>p,f3:()=>s,h1:()=>e,wZ:()=>r});var i=function(a){return a.BIND="bind",a.CIFS="cifs",a.NFS="nfs",a}({}),e=function(a){return a.BACKUP="backup",a.MEDIA="media",a.SHARE="share",a}({}),s=function(a){return a.ACTIVE="active",a.FAILED="failed",a.UNKNOWN="unknown",a}({});const l=async a=>a.callWS({type:"supervisor/api",endpoint:"/mounts",method:"get",timeout:null}),n=async(a,t)=>a.callWS({type:"supervisor/api",endpoint:"/mounts",method:"post",timeout:null,data:t}),c=async(a,t)=>a.callWS({type:"supervisor/api",endpoint:`/mounts/${t.name}`,method:"put",timeout:null,data:t}),r=async(a,t)=>a.callWS({type:"supervisor/api",endpoint:`/mounts/${t}`,method:"delete",timeout:null}),p=async(a,t)=>a.callWS({type:"supervisor/api",endpoint:`/mounts/${t.name}/reload`,method:"post",timeout:null}),u=async(a,t)=>a.callWS({type:"supervisor/api",endpoint:"/mounts/options",method:"post",timeout:null,data:t})},74186(a,t,o){o.a(a,async function(a,i){try{o.r(t);var e=o(62826),s=o(5124),l=o(22441),n=o(1087),c=o(38962),r=o(18350),p=(o(93444),o(72554)),u=o(52763),d=o(47351),h=o(96273),_=o(14503),m=a([c,r,p,u]);[c,r,p,u]=m.then?(await m)():m;const g=[{name:"default_backup_mount",required:!0,selector:{backup_location:{}}}];class b extends s.WF{async showDialog(a){this._dialogParams=a,this._open=!0}closeDialog(){this._open=!1}_dialogClosed(){this._data=void 0,this._error=void 0,this._waiting=void 0,this._dialogParams=void 0,(0,n.r)(this,"dialog-closed",{dialog:this.localName})}render(){return this._dialogParams?s.qy` <ha-dialog .open="${this._open}" header-title="${this.hass.localize("ui.panel.config.backup.dialogs.local_backup_location.title")}" prevent-scrim-close @closed="${this._dialogClosed}"> ${this._error?s.qy`<ha-alert alert-type="error">${this._error}</ha-alert>`:s.s6} <p> ${this.hass.localize("ui.panel.config.backup.dialogs.local_backup_location.description")} </p> <ha-form autofocus .hass="${this.hass}" .data="${this._data}" .schema="${g}" .computeLabel="${this._computeLabelCallback}" @value-changed="${this._valueChanged}"></ha-form> <ha-alert alert-type="info"> ${this.hass.localize("ui.panel.config.backup.dialogs.local_backup_location.note")} </ha-alert> <ha-dialog-footer slot="footer"> <ha-button slot="secondaryAction" appearance="plain" @click="${this.closeDialog}"> ${this.hass.localize("ui.common.cancel")} </ha-button> <ha-button .disabled="${this._waiting||!this._data}" slot="primaryAction" @click="${this._changeMount}"> ${this.hass.localize("ui.common.save")} </ha-button> </ha-dialog-footer> </ha-dialog> `:s.s6}_valueChanged(a){const t=a.detail.value.default_backup_mount;this._data={default_backup_mount:"/backup"===t?null:t}}async _changeMount(){if(this._data){this._error=void 0,this._waiting=!0;try{await(0,h.Su)(this.hass,this._data)}catch(a){return this._error=(0,d.VR)(a),void(this._waiting=!1)}this.closeDialog()}}static get styles(){return[_.RF,_.nA,s.AH`ha-form{display:block;margin-bottom:16px}`]}constructor(...a){super(...a),this._open=!1,this._computeLabelCallback=a=>this.hass.localize(`ui.panel.config.backup.dialogs.local_backup_location.options.${a.name}.name`)||a.name}}(0,e.Cg)([(0,l.MZ)({attribute:!1})],b.prototype,"hass",void 0),(0,e.Cg)([(0,l.wk)()],b.prototype,"_dialogParams",void 0),(0,e.Cg)([(0,l.wk)()],b.prototype,"_data",void 0),(0,e.Cg)([(0,l.wk)()],b.prototype,"_waiting",void 0),(0,e.Cg)([(0,l.wk)()],b.prototype,"_error",void 0),(0,e.Cg)([(0,l.wk)()],b.prototype,"_open",void 0),b=(0,e.Cg)([(0,l.EM)("dialog-local-backup-location")],b),i()}catch(a){i(a)}})}};