import{u as T,a as E,r,b as i,o as V,k as A,w as n,f as o,g as C,t as w,j as k,s as q,v as U,A as x,p as z,n as B,e as D,l as P,B as W,F as j,q as K}from"./index.js";import{d as X,e as G}from"./common.js";import{_ as J}from"./_plugin-vue_export-helper.js";const Q=["innerHTML"],Y={__name:"LogLegend",setup(h,{expose:c}){T({useScope:"global"}),E();const u=r(!1),F=r("");let f=new Array("01 Normal Message","02 Security Message","03 FTP Command","04 FTP Response","05 Web Request","06 Web Response","07 SSH Command","08 SSH Response","09 ODBC Error","10 Mysql Error","11 Lua Error","12 Mail Error","13 File Access Error","14 Normal Error"),g=new Array("#009900","#FF0000","#009900","#0000FF","#000","#000","#000","#000","#CCC","#CCC","#00FFCC","#00FF00","#FFFF00","#FFF"),d=new Array("#FFF","#FFF","#FFF","#FFF","#FFFFCC","#FFFFCC","#FFFF99","#FFFF99","#FF0000","#FF0000","#FF0000","#FF0000","#FF0000","#FF0000");new Array("#009900","#FF0000","#009900","#FF0000","#FF0000"),new Array("#FFF","#FFF","#FFF","#FFF","#FFF","#FFF");function p(){u.value=!0;for(var s="",a=0;a<f.length;a++)s+="<tr><td style='line-height:150%;font-size:10pt;background-color:"+d[a]+";color:"+g[a]+";'>"+f[a]+"</td></tr>";F.value="<table width='100%' border='0' cellpadding='0' cellspacing='2'>"+s+" <tr><td style='padding:3px;'></table>"}function l(){u.value=!1}function _(){}function m(){}return c({show:p}),(s,a)=>{const v=i("el-button"),M=i("el-dialog");return V(),A(M,{modelValue:u.value,"onUpdate:modelValue":a[0]||(a[0]=L=>u.value=L),draggable:"","align-center":"","destroy-on-close":"",class:"small_dialog",title:s.$t("str_loglegend"),onOpen:_,onClose:m},{footer:n(()=>[o(v,{type:"primary",class:"w-100px",onClick:l},{default:n(()=>[C(w(s.$t("button_submit")),1)]),_:1})]),default:n(()=>[k("div",{innerHTML:F.value},null,8,Q)]),_:1},8,["modelValue","title"])}}},Z=["innerHTML"],ee={__name:"ViewLog",props:{logtype:{type:String,default:"sys"},domain:{type:String,default:""},idfilter:{type:String,default:""},small:{type:Boolean,default:!1}},setup(h){E();const{t:c}=T({useScope:"global"}),u=r(null),F=r(null),f=r(null),g=r(""),d=r(!1),p=r(!0),l=h;let _="",m="",s=0;q(()=>{l.logtype=="sys"?m="service_get_sys_log.html":l.logtype=="admin"?m="service_get_admin_log.html":l.logtype=="domain"&&(m="service_get_domain_log.html"),v(),s=setInterval(v,1e3*2)}),U(()=>{clearInterval(s)});function a(){return l.small?"small_container":"container"}function v(){let e=`r=${Math.random()}`;l.logtype=="domain"&&(e+=`&domain=${l.domain}`),x.post(m,e).then(({data:t})=>{let S=X(G(t),l.idfilter,_);S!=g.value&&(g.value=S,p.value&&z(()=>u.value.setScrollTop(F.value.clientHeight)))}).catch(t=>{B({message:t.message,grouping:!0,type:"error"})})}function M(){d.value?(s=setInterval(v,1e3*2),d.value=!1):(clearInterval(s),d.value=!0)}function L(){K.prompt(c("str_filterstring"),c("str_addfilter"),{confirmButtonText:c("button_submit"),cancelButtonText:c("button_cancel"),inputValue:_}).then(({value:e})=>{_=e}).catch(()=>{})}function H(){let e="";l.logtype=="sys"?e="systemlog=1":l.logtype=="admin"?e="adminlog=1":l.logtype=="domain"&&(e=`&domain=${l.domain}`),x.post("service_clear_log.html",e+`&r=${Math.random()}`).then().catch(t=>{B({message:t.message,grouping:!0,type:"error"})})}function I(){f.value.show()}return(e,t)=>{const S=i("el-scrollbar"),N=i("el-divider"),$=i("el-button"),y=i("el-col"),R=i("el-switch"),O=i("el-row");return V(),D(j,null,[k("div",{class:W(a())},[o(S,{always:!0,ref_key:"refScrollbar",ref:u,class:"textResponse"},{default:n(()=>[k("div",{ref_key:"refContent",ref:F},[k("div",{innerHTML:g.value},null,8,Z)],512)]),_:1},512),o(N),o(O,{gutter:10,class:"ml-10"},{default:n(()=>[o(y,{xs:8,sm:4,class:"mb-10"},{default:n(()=>[o($,{class:"w-100",onClick:t[0]||(t[0]=b=>M())},{default:n(()=>[C(w(d.value?e.$t("button_resume"):e.$t("button_pause")),1)]),_:1})]),_:1}),o(y,{xs:8,sm:4,class:"mb-10"},{default:n(()=>[o($,{class:"w-100",onClick:t[1]||(t[1]=b=>L())},{default:n(()=>[C(w(e.$t("button_filter")),1)]),_:1})]),_:1}),l.small?P("",!0):(V(),A(y,{key:0,xs:8,sm:5,class:"mb-10"},{default:n(()=>[o($,{class:"w-100",onClick:t[2]||(t[2]=b=>H())},{default:n(()=>[C(w(e.$t("str_clear_domainlog")),1)]),_:1})]),_:1})),o(y,{xs:8,sm:5,class:"mb-10"},{default:n(()=>[o($,{class:"w-100",onClick:t[3]||(t[3]=b=>I())},{default:n(()=>[C(w(e.$t("button_legend")),1)]),_:1})]),_:1}),o(y,{xs:16,sm:6,class:"mb-10"},{default:n(()=>[o(R,{modelValue:p.value,"onUpdate:modelValue":t[4]||(t[4]=b=>p.value=b),"active-text":e.$t("title_autoscroll"),class:"ml-20"},null,8,["modelValue","active-text"])]),_:1})]),_:1})],2),o(Y,{ref_key:"refLegendModal",ref:f},null,512)],64)}}},ne=J(ee,[["__scopeId","data-v-0e31c756"]]);export{ne as V};
