homebridge-config-ui-x
Version:
A web based management, configuration and control platform for Homebridge.
1 lines • 4.33 kB
JavaScript
import{a as E}from"./chunk-D39XL-zh.js";import{$ as Le,Ct as Qo,E as Dy,Fr as se,Gr as uy,Jr as ve,Kr as v3,M as Fe,Pr as sc,Q as Ko,Rt as Te,Tn as ac,Un as g,Vt as U3,Yr as vy,Yt as Va,dt as Nf,hr as nc,jt as S_,pt as Ot,rr as jd,sr as kt,ui as z0,ut as N_,vt as Py,wr as q}from"./chunk-D96TCRAL.js";import{l as le}from"./chunk-DZYp0NQB.js";import{n as zt}from"./chunk-CdJ3i4Aq.js";import{r as Y,t as m,ut as si}from"./main-E3N63CH7.js";import{t as A$1}from"./chunk-nWnpef0a.js";import{t as O}from"./chunk-C-2fYS21.js";function A(e,x){if(e&1){let t=sc();Va(0,`p`,5)(1,`button`,6),ac(`click`,function(){Ko(t);return Qo(ve().restartServer())}),Ot(2),S_(3,`translate`),jd()()}e&2&&(se(2),kt(` `,N_(3,1,`menu.linux.label_restart_server`),` `))}function F(e,x){if(e&1){let t=sc();Va(0,`p`,5)(1,`button`,6),ac(`click`,function(){Ko(t);return Qo(ve().shutdownServer())}),Ot(2),S_(3,`translate`),jd()()}e&2&&(se(2),kt(` `,N_(3,1,`menu.linux.label_shutdown_server`),` `))}function L(e,x){if(e&1){let t=sc();Va(0,`p`,5)(1,`button`,6),ac(`click`,function(){Ko(t);return Qo(ve().dockerRestartContainer())}),Ot(2),S_(3,`translate`),jd()()}e&2&&(se(2),kt(` `,N_(3,1,`menu.docker.restart_container`),` `))}var it=(()=>{class e{injector=g(Te);$api=g(U3);$errors=g(m);$modal=g(si);$router=g(le);$settings=g(zt);$toastr=g(z0);$translate=g(Nf);canShutdownRestartHost=q(this.$settings.env.canShutdownRestartHost);runningInDocker=q(this.$settings.env.runningInDocker);ngOnInit(){let t=this.$translate.instant(`menu.restart.title`);this.$settings.setPageTitle(t)}closeRestartToast(){this.$settings.restartToastRef&&(this.$toastr.clear(this.$settings.restartToastRef.toastId),this.$settings.restartToastRef=null)}restartHomebridge(){this.closeRestartToast(),this.$router.navigate([`/restart`])}restartHomebridgeService(){return E(this,null,function*(){this.closeRestartToast();try{yield this.$api.put(`/platform-tools/hb-service/set-full-service-restart-flag`,{}),this.$router.navigate([`/restart`])}catch(t){console.error(t),this.$toastr.error(this.$errors.toToastMessage(t),this.$translate.instant(`toast.title_error`))}})}restartServer(){this.closeRestartToast(),this.$router.navigate([`/platform-tools/linux/restart-server`])}shutdownServer(){return E(this,null,function*(){this.closeRestartToast();let t=uy([{provide:A$1,useValue:{title:this.$translate.instant(`menu.linux.label_shutdown_server`),message:this.$translate.instant(`menu.linux.label_shutdown_modal`),confirmButtonLabel:this.$translate.instant(`form.button_continue`),faIconClass:`fas fa-power-off primary-text`}}],this.injector),r=this.$modal.open(O,{size:`lg`,backdrop:`static`,injector:t});try{yield r.result,this.$router.navigate([`/platform-tools/linux/shutdown-server`])}catch(n){}})}dockerRestartContainer(){this.closeRestartToast(),this.$router.navigate([`/platform-tools/docker/restart-container`])}static ɵfac=function(r){return new(r||e)};static ɵcmp=nc({type:e,selectors:[[`app-power-options`]],decls:19,vars:16,consts:[[1,`d-flex`,`justify-content-between`],[1,`primary-text`,`m-0`],[1,`my-4`,`align-items-center`,`container-narrow`],[1,`w-100`,`text-center`,`primary-text`,`mb-5`],[`aria-hidden`,`true`,1,`fas`,`fa-power-off`,`icon-xl`],[1,`w-100`,`text-center`,`my-5`],[`type`,`button`,1,`btn`,`btn-primary`,`p-3`,`my-0`,`w-85`,3,`click`],[`type`,`button`,`container`,`body`,`triggers`,`hover`,1,`btn`,`btn-primary`,`p-3`,`my-0`,`w-85`,3,`click`,`openDelay`,`ngbTooltip`]],template:function(r,n){r&1&&(Va(0,`div`,0)(1,`h3`,1),Ot(2),S_(3,`translate`),jd()(),Va(4,`div`,2)(5,`div`,3),Dy(6,`i`,4),jd(),Va(7,`p`,5)(8,`button`,6),ac(`click`,function(){return n.restartHomebridge()}),Ot(9),S_(10,`translate`),jd()(),Va(11,`p`,5)(12,`button`,7),S_(13,`translate`),ac(`click`,function(){return n.restartHomebridgeService()}),Ot(14),S_(15,`translate`),jd()(),Fe(16,A,4,3,`p`,5),Fe(17,F,4,3,`p`,5),Fe(18,L,4,3,`p`,5),jd()),r&2&&(se(2),Py(N_(3,8,`menu.restart.title`)),se(7),kt(` `,N_(10,10,`menu.hbrestart.confirm_hb`),` `),se(3),vy(`openDelay`,150)(`ngbTooltip`,N_(13,12,`reset.force_restart_hb_help_text`)),se(2),kt(` `,N_(15,14,`menu.hbrestart.confirm_ui`),` `),se(2),Le(n.canShutdownRestartHost()?16:-1),se(),Le(n.canShutdownRestartHost()?17:-1),se(),Le(n.runningInDocker()?18:-1))},dependencies:[Y,v3],encapsulation:2})}return e})();export{it as PowerOptionsComponent};