homebridge-config-ui-x
Version:
A web based management, configuration and control platform for Homebridge.
1 lines • 10.2 kB
JavaScript
import {Z}from'./chunk-BwPN3JEB.js';import'./chunk-CCTcrEQI.js';import'./chunk-BtxeAJ3m.js';import'./chunk-BWu8OGjA.js';import'./chunk-KTYlT6lA.js';import {g,n as ne$1,a as ae$1,z as zt,a2 as bf,B as BH,aF as $$1,W,$,S as Se,H as Hf,aJ as Uf,A as An,J as Ja,bj as Y,i as Jn,d as zn,Y as Ye,e as Hn,L as Ln,C as Cn,_ as _n,k as K8,m as La,s as At,t as f_,R as Rd,u as Re,o as dy,y as ie$1,N as Ny,G as h_,O as Oe,x as Cy,q as rc,M as Ey,P as ST,a8 as nc,U as ye$1,D as ly,a6 as vr,aw as Qt,Q as KC,T as JC,a9 as Go,aa as Wo,bq as pw}from'./main-ONDCASUV.js';import'./chunk-DL7vVfE4.js';import'./chunk-WUyBXYN7.js';var ie=["logoutput"],oe=["searchInput"];function ne(o,T){if(o&1){let e=nc();La(0,"div",5)(1,"button",9),f_(2,"translate"),f_(3,"translate"),rc("click",function(){Go(e);let i=ye$1();return Wo(i.showSearch())}),dy(4,"i",10),Rd(),La(5,"button",11),f_(6,"translate"),f_(7,"translate"),rc("click",function(){Go(e);let i=ye$1();return Wo(i.downloadLogFile())}),dy(8,"i",12),Rd(),La(9,"button",13),f_(10,"translate"),f_(11,"translate"),rc("click",function(){Go(e);let i=ye$1();return Wo(i.truncateLogFile())}),dy(12,"i",14),Rd()();}if(o&2){let e=ye$1();ie$1(),ly("openDelay",150)("ngbTooltip",h_(2,12,"form.search")),vr("aria-label",h_(3,14,"form.search"))("aria-expanded",e.showSearchBar()),ie$1(3),Qt(`fas fa-search${e.showSearchBar()?" primary-text":""}`),ie$1(),ly("openDelay",150)("ngbTooltip",h_(6,16,"form.button_download")),vr("aria-label",h_(7,18,"form.button_download")),ie$1(4),ly("openDelay",150)("ngbTooltip",h_(10,20,"form.button_delete")),vr("aria-label",h_(11,22,"form.button_delete"));}}function re(o,T){if(o&1){let e=nc();La(0,"button",19),f_(1,"translate"),rc("click",function(){Go(e);let i=ye$1(2);return Wo(i.onClearSearch())}),dy(2,"i",20),Rd();}o&2&&vr("aria-label",h_(1,1,"form.button_clear"));}function ae(o,T){if(o&1){let e=nc();La(0,"div",6)(1,"div",15)(2,"form",16),rc("ngSubmit",function(){Go(e);let i=ye$1();return Wo(i.onSubmit(i.form.value))}),dy(3,"input",17,1),f_(5,"translate"),KC(),Re(6,re,3,3,"button",18),Rd()()();}if(o&2){let e=ye$1();ie$1(2),ly("formGroup",e.form),ie$1(),Cy("search-bar-light",e.terminalTheme==="light")("is-invalid",e.searchInputInvalid),ly("placeholder",h_(5,7,"logs.placeholder_search_logs")),JC(),ie$1(3),Oe(e.form.get("query")?.value?6:-1);}}var ye=(()=>{class o{destroyRef=g(ne$1);$auth=g(ae$1);$log=g(Z);$settings=g(zt);$translate=g(bf);termTarget=BH("logoutput");searchInput=BH("searchInput");resizeEvent=new $$1;isAdmin=this.$auth.user.admin;showSearchBar=W(false);showExitButton=W(false);terminalTheme="dark";form=new $({query:new Se("")});get searchInputInvalid(){let e=(this.form.get("query")?.value||"").trim();return e.length>0&&e.length<3}onWindowResize(){this.resizeEvent.next(void 0);}patchXtermLiveRegion(){let e=this.termTarget()?.nativeElement;if(!e)return;let t=e.querySelector("[aria-live]");t&&(t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"));}ngOnInit(){let e=this.$translate.instant("menu.linux.label_logs");if(this.$settings.setPageTitle(e),this.terminalTheme=this.$settings.getEffectiveTerminalLightingMode(),this.terminalTheme==="dark"?window.document.querySelector("body").classList.add("bg-black"):window.document.querySelector("body").classList.add("bg-white"),this.$settings.actualLightingMode==="light"&&this.terminalTheme==="dark"){window.document.querySelector("body").classList.add("theme-transition");let i=this.termTarget()?.nativeElement;i&&i.classList.add("theme-transition");}this.$log.startTerminal(this.termTarget(),this.$settings.getTerminalOptions({disableStdin:true}),this.resizeEvent),requestAnimationFrame(()=>this.patchXtermLiveRegion()),this.form.get("query")?.valueChanges.pipe(Hf(500),Uf(),An(this.destroyRef)).subscribe(i=>{let p=i||"",m=p.trim();m!==p&&this.form.get("query")?.setValue(m,{emitEvent:false}),m.length>=3?(this.showExitButton.set(true),this.$log.setSearchFilter(m),this.$log.scrollToBottom()):m.length<3&&this.showExitButton()&&(this.showExitButton.set(false),this.$log.clearSearchFilter(),this.$log.scrollToBottom());});}showSearch(){this.showSearchBar()?(this.showSearchBar.set(false),this.showExitButton.set(false),this.form.setValue({query:""}),this.$log.clearSearchFilter()):(this.showSearchBar.set(true),setTimeout(()=>this.searchInput()?.nativeElement.focus(),10)),setTimeout(()=>this.resizeEvent.next(void 0),10),this.$log.scrollToBottom();}onSubmit(e){let t=(e.query||"").trim();!t.length||t.length<3?(t.length||this.showSearchBar.set(false),this.form.setValue({query:""}),this.showExitButton.set(false),this.$log.clearSearchFilter()):(this.showExitButton.set(true),this.$log.setSearchFilter(t)),this.$log.scrollToBottom();}onClearSearch(){this.form.setValue({query:""}),this.showExitButton.set(false),this.$log.clearSearchFilter(),this.$log.scrollToBottom();}canDeactivate(e){let t=this.$settings.getEffectiveTerminalLightingMode();return this.$settings.actualLightingMode==="light"&&t==="dark"?(this.showSearchBar()&&this.showSearchBar.set(false),window.document.querySelector("body").classList.remove("theme-transition"),new Promise(p=>{let m=e&&(e.includes("/platform-tools/terminal")||e.includes("/logs")),B=this.termTarget()?.nativeElement;B&&B.classList.add("fade-out"),m?setTimeout(()=>{p(true);},250):(setTimeout(()=>{window.document.querySelector("body").classList.remove("bg-black"),window.document.querySelector("body").classList.remove("bg-white");},250),setTimeout(()=>{p(true);},500));})):(window.document.querySelector("body").classList.remove("bg-black"),window.document.querySelector("body").classList.remove("bg-white"),Promise.resolve(true))}ngOnDestroy(){window.document.querySelector("body").classList.remove("light-mode"),this.resizeEvent.complete(),this.$log.destroyTerminal();}downloadLogFile(){return this.$log.downloadLogFile()}truncateLogFile(){return this.$log.truncateLogFile()}static \u0275fac=function(t){return new(t||o)};static \u0275cmp=Ja({type:o,selectors:[["app-logs"]],viewQuery:function(t,i){t&1&&Ey(i.termTarget,ie,5)(i.searchInput,oe,5),t&2&&ST(2);},hostBindings:function(t,i){t&1&&rc("resize",function(){return i.onWindowResize()},pw);},decls:10,vars:9,consts:[["logoutput",""],["searchInput",""],[1,"row","mb-3"],[1,"col-6"],[1,"primary-text","m-0"],[1,"col-6","text-end"],["id","logs-search-region",1,"row"],[1,"flex-column","d-flex","align-items-stretch"],["id","log-output",1,"align-self-end","w-100","h-100","mb-1"],["type","button","container","body","placement","bottom","triggers","hover","aria-controls","logs-search-region",1,"btn","btn-elegant","my-0","me-2",3,"click","openDelay","ngbTooltip"],["aria-hidden","true"],["type","button","container","body","placement","bottom","triggers","hover",1,"btn","btn-elegant","my-0","me-2",3,"click","openDelay","ngbTooltip"],["aria-hidden","true",1,"fas","fa-download"],["type","button","container","body","placement","bottom","triggers","hover",1,"btn","btn-elegant","my-0","me-0",3,"click","openDelay","ngbTooltip"],["aria-hidden","true",1,"fas","fa-trash-alt"],[1,"col-md-12"],["novalidate","",3,"ngSubmit","formGroup"],["type","text","id","logs-search","formControlName","query",1,"search-bar",3,"placeholder"],["type","button",1,"search-bar-clear"],["type","button",1,"search-bar-clear",3,"click"],["aria-hidden","true",1,"fas","fa-square-xmark"]],template:function(t,i){t&1&&(La(0,"div",2)(1,"div",3)(2,"h3",4),At(3),f_(4,"translate"),Rd()(),Re(5,ne,13,24,"div",5),Rd(),Re(6,ae,7,9,"div",6),La(7,"div",7),dy(8,"div",8,0),Rd()),t&2&&(ie$1(3),Ny(h_(4,7,"menu.linux.label_logs")),ie$1(2),Oe(i.isAdmin?5:-1),ie$1(),Oe(i.showSearchBar()?6:-1),ie$1(),Cy("adjust-for-mobile",!i.showSearchBar())("adjust-for-mobile-with-search",i.showSearchBar()));},dependencies:[Y,Jn,zn,Ye,Hn,Ln,Cn,_n,K8],styles:["#log-output.theme-transition[_ngcontent-%COMP%]{opacity:0;animation:_ngcontent-%COMP%_fadeIn .25s ease-in-out .25s forwards}#log-output.theme-transition.fade-out[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_fadeOut .25s ease-in-out forwards!important;opacity:1}@keyframes _ngcontent-%COMP%_fadeIn{to{opacity:1}}@keyframes _ngcontent-%COMP%_fadeOut{to{opacity:0}}.search-bar[_ngcontent-%COMP%]{outline:none;box-sizing:inherit!important;height:50px!important;width:100%;padding:10px 45px 10px 10px;margin-bottom:15px;background-color:#111!important;color:#999!important;border:0 #242424!important}@media(hover:hover){.search-bar[_ngcontent-%COMP%]:hover{border:1px solid #242424!important}}.search-bar[_ngcontent-%COMP%]:focus{border:1px solid #242424!important;box-shadow:inherit!important;color:#eee!important}.search-bar[_ngcontent-%COMP%]::placeholder{color:#636363!important;opacity:1!important}.search-bar.search-bar-light[_ngcontent-%COMP%]{background-color:#fff!important;color:#000!important;border:.5px solid #d0d0d0!important}@media(hover:hover){.search-bar.search-bar-light[_ngcontent-%COMP%]:hover{border:1px solid #000000!important}}.search-bar.search-bar-light[_ngcontent-%COMP%]:focus{border:1px solid #000000!important;box-shadow:0 1px #000!important;color:#000!important}.search-bar.search-bar-light[_ngcontent-%COMP%]::placeholder{color:#757575!important;opacity:1!important}.search-bar.is-invalid[_ngcontent-%COMP%]{border:1px solid #d32f2f!important;box-shadow:0 1px #d32f2f!important}@media(hover:hover){.search-bar.is-invalid[_ngcontent-%COMP%]:hover{border:1px solid #d32f2f!important;box-shadow:0 1px #d32f2f!important}}.search-bar.is-invalid[_ngcontent-%COMP%]:focus{border:1px solid #d32f2f!important;box-shadow:0 1px #d32f2f!important}.search-bar-clear[_ngcontent-%COMP%]{position:absolute;right:8px;top:8px;height:50px;background:transparent;border:none;font-size:20px;color:#636363;cursor:pointer;padding:0 8px;display:flex;align-items:center}.search-bar-clear[_ngcontent-%COMP%]:hover{color:#999}.search-bar-badge[_ngcontent-%COMP%]{position:absolute;right:10px;top:16px;font-size:.75rem;padding:.25em .5em}.adjust-for-mobile-with-search[_ngcontent-%COMP%]{height:calc(100% - 97px);width:calc(100% + 17px);overflow:hidden}@media(max-width:767px){.adjust-for-mobile-with-search[_ngcontent-%COMP%]{height:calc(100% - 125px);width:calc(100% + 16px)}}"]})}return o})();export{ye as LogsComponent};