homebridge-config-ui-x
Version:
A web based management, configuration and control platform for Homebridge.
1 lines • 4.21 kB
JavaScript
import {O}from'./chunk-BtxeAJ3m.js';import {A as A$1}from'./chunk-BWu8OGjA.js';import {g,ag as we,X as I3,Z as m,ah as si,l as le,z as zt,a1 as M0,a2 as bf,W,E,ai as ty,J as Ja,bj as Y,k as K8,m as La,s as At,t as f_,R as Rd,o as dy,q as rc,u as Re,y as ie,N as Ny,G as h_,I as Rt,D as ly,O as Oe,a8 as nc,a9 as Go,U as ye,aa as Wo}from'./main-ONDCASUV.js';function A(e,x){if(e&1){let t=nc();La(0,"p",5)(1,"button",6),rc("click",function(){Go(t);let n=ye();return Wo(n.restartServer())}),At(2),f_(3,"translate"),Rd()();}e&2&&(ie(2),Rt(" ",h_(3,1,"menu.linux.label_restart_server")," "));}function F(e,x){if(e&1){let t=nc();La(0,"p",5)(1,"button",6),rc("click",function(){Go(t);let n=ye();return Wo(n.shutdownServer())}),At(2),f_(3,"translate"),Rd()();}e&2&&(ie(2),Rt(" ",h_(3,1,"menu.linux.label_shutdown_server")," "));}function L(e,x){if(e&1){let t=nc();La(0,"p",5)(1,"button",6),rc("click",function(){Go(t);let n=ye();return Wo(n.dockerRestartContainer())}),At(2),f_(3,"translate"),Rd()();}e&2&&(ie(2),Rt(" ",h_(3,1,"menu.docker.restart_container")," "));}var it=(()=>{class e{injector=g(we);$api=g(I3);$errors=g(m);$modal=g(si);$router=g(le);$settings=g(zt);$toastr=g(M0);$translate=g(bf);canShutdownRestartHost=W(this.$settings.env.canShutdownRestartHost);runningInDocker=W(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=ty([{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 \u0275fac=function(r){return new(r||e)};static \u0275cmp=Ja({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&&(La(0,"div",0)(1,"h3",1),At(2),f_(3,"translate"),Rd()(),La(4,"div",2)(5,"div",3),dy(6,"i",4),Rd(),La(7,"p",5)(8,"button",6),rc("click",function(){return n.restartHomebridge()}),At(9),f_(10,"translate"),Rd()(),La(11,"p",5)(12,"button",7),f_(13,"translate"),rc("click",function(){return n.restartHomebridgeService()}),At(14),f_(15,"translate"),Rd()(),Re(16,A,4,3,"p",5),Re(17,F,4,3,"p",5),Re(18,L,4,3,"p",5),Rd()),r&2&&(ie(2),Ny(h_(3,8,"menu.restart.title")),ie(7),Rt(" ",h_(10,10,"menu.hbrestart.confirm_hb")," "),ie(3),ly("openDelay",150)("ngbTooltip",h_(13,12,"reset.force_restart_hb_help_text")),ie(2),Rt(" ",h_(15,14,"menu.hbrestart.confirm_ui")," "),ie(2),Oe(n.canShutdownRestartHost()?16:-1),ie(),Oe(n.canShutdownRestartHost()?17:-1),ie(),Oe(n.runningInDocker()?18:-1));},dependencies:[Y,K8],encapsulation:2})}return e})();export{it as PowerOptionsComponent};