Files

17 lines
7.4 KiB
JavaScript
Raw Permalink Normal View History

2026-07-27 10:45:47 +08:00
import{_ as D,a as F}from"./EventItem.vue_vue_type_script_setup_true_lang--aBz0q7s.js";import{_ as J}from"./PageHeader.vue_vue_type_script_setup_true_lang-CD1KTXEu.js";import{_ as N}from"./Badge.vue_vue_type_script_setup_true_lang-DSNeqlXx.js";import{c as V,d as A,x as M,a as i,p as r,w as c,u as e,l as t,b as l,y as G,t as s,j as p,_ as H,m as f,g as _,o as n,s as g,h as P,k,F as x,r as S,z as T,A as K,q as Q}from"./index-DIqASLVQ.js";import{S as R,_ as W,T as X}from"./Modal.vue_vue_type_script_setup_true_lang-DNsJ6686.js";import{_ as O}from"./Select.vue_vue_type_script_setup_true_lang-CzaVl8rJ.js";import{a as Y,e as U}from"./format-B6sc_rZ4.js";import"./Collection-CwtwoTtI.js";/**
* @license lucide-vue-next v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const Z=V("CopyIcon",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
* @license lucide-vue-next v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const ee=V("PauseIcon",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);/**
* @license lucide-vue-next v0.469.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const te=V("PlayIcon",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]),se={class:"hidden sm:inline"},le={class:"hidden sm:inline"},ae={class:"mb-3 flex flex-col gap-2 sm:flex-row"},oe={class:"relative flex-1"},ne={class:"grid grid-cols-2 gap-2 sm:flex"},re={key:0,class:"text-muted-foreground mb-2 flex items-center justify-between gap-2 text-xs"},ue={key:0},ie={key:0,class:"flex flex-col"},de={key:1,class:"text-muted-foreground py-12 text-center text-sm"},ce={key:0,class:"flex flex-col gap-3 text-sm"},ve={class:"flex flex-wrap items-center gap-2"},me={class:"text-muted-foreground text-xs"},pe={class:"grid grid-cols-[auto_1fr] gap-x-4 gap-y-2 text-xs sm:text-sm"},fe={class:"text-muted-foreground"},_e={class:"font-mono break-all"},xe={class:"text-muted-foreground"},he={class:"font-mono break-all"},ye={class:"text-muted-foreground"},ge={class:"font-mono break-all"},ke={class:"text-muted-foreground"},be={class:"font-mono break-all"},we={class:"text-muted-foreground"},Ce={class:"break-all"},Pe={class:"text-muted-foreground"},Ve={class:"text-destructive break-all"},ze={class:"text-muted-foreground mb-1.5 text-xs font-medium"},$e={key:0,class:"flex flex-col gap-2"},Ie={class:"border-b px-2.5 py-1.5 text-xs font-medium"},Le={class:"overflow-x-auto px-2.5 py-2 font-mono text-[11px] leading-relaxed"},Ne={key:1,class:"text-muted-foreground text-xs"},Fe=A({__name:"EventsView",setup(Se){const{events:b}=Q(),v=f(!1),h=f([]),w=f(""),m=f("all"),y=f("all"),a=f(null);M(v,d=>{h.value=d?b.value:[]});const z=_(()=>v.value?h.value:b.value),$=_(()=>v.value?Math.max(0,b.value.length-h.value.length):0),I=_(()=>{const d=w.value.trim().toLowerCase();return z.value.filter(o=>{if(m.value!=="all"){if(m.value==="log"||m.value==="error"){if(o.kind!==m.value)return!1}else if(o.kind!=="action"||o.action!==m.value)return!1}return y.value!=="all"&&o.proto!==y.value?!1:d?o.srcIP.toLowerCase().includes(d)||o.dstIP.toLowerCase().includes(d)||(o.host??"").toLowerCase().includes(d)||(o.rule??"").toLowerCase().includes(d):!0})}),j=_(()=>[{value:"all",label:t("common.all")},{value:"block",label:t("action.block")},{value:"drop",label:t("action.drop")},{value:"allow",label:t("action.allow")},{value:"modify",label:t("action.modify")},{value:"log",label:t("action.log")},{value:"error",label:t("action.error")}]),q=_(()=>[{value:"all",label:t("common.all")},{value:"tcp",label:"TCP"},{value:"udp",label:"UDP"}]),L=_(()=>{var d;return Object.entries(((d=a.value)==null?void 0:d.props)??{})});async function B(){if(a.value)try{await navigator.clipboard.writeText(JSON.stringify(a.value,null,2)),T.success(t("common.copied"))}catch{T.error(t("common.error"))}}function E(){K(),h.value=[]}return(d,o)=>(n(),i("div",null,[r(J,{title:e(t)("events.title"),description:e(t)("events.subtitle")},{actions:c(()=>[r(e(g),{variant:"outline",size:"sm",onClick:o[0]||(o[0]=u=>v.value=!v.value)},{default:c(()=>[v.value?(n(),P(e(te),{key:0,class:"size-3.5"})):(n(),P(e(ee),{key:1,class:"size-3.5"})),l("span",se,s(v.value?e(t)("events.resume"):e(t)("events.pause")),1)]),_:1}),r(e(g),{variant:"outline",size:"sm",onClick:E},{default:c(()=>[r(e(X),{class:"size-3.5"}),l("span",le,s(e(t)("events.clear")),1)]),_:1})]),_:1},8,["title","description"]),l("div",ae,[l("div",oe,[r(e(R),{class:"text-muted-foreground absolute top-1/2 left-3 size-4 -translate-y-1/2"}),r(e(G),{modelValue:w.value,"onUpdate:modelValue":o[1]||(o[1]=u=>w.value=u),placeholder:e(t)("events.searchPlaceholder"),class:"pl-9",type:"search"},null,8,["modelValue","placeholder"])]),l("div",ne,[r(e(O),{modelValue:m.value,"onUpdate:modelValue":o[2]||(o[2]=u=>m.value=u),options:j.value,"aria-label":e(t)("events.filterAction"),class:"sm:w-32"},null,8,["modelValue","options","aria-label"]),r(e(O),{modelValue:y.value,"onUpdate:modelValue":o[3]||(o[3]=u=>y.value=u),options:q.value,"aria-label":e(t)("events.filterProto"),class:"sm:w-28"},null,8,["modelValue","options","aria-label"])])]),v.value?(n(),i("div",re,[r(e(N),{variant:"drop"},{default:c(()=>[k(s(e(t)("events.paused")),1)]),_:1}),$.value>0?(n(),i("span",ue,s(e(t)("events.buffered",{