22 lines
7.6 KiB
JavaScript
22 lines
7.6 KiB
JavaScript
import{_ as D,a as F}from"./EventItem.vue_vue_type_script_setup_true_lang-DS497KtL.js";import{_ as J}from"./PageHeader.vue_vue_type_script_setup_true_lang-CDyKzgiP.js";import{_ as q}from"./Badge.vue_vue_type_script_setup_true_lang--8bF8KCa.js";import{c as b,d as A,x as M,a as i,p as r,w as d,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 V,k,F as x,r as N,z as S,A as K,q as Q}from"./index-D3ZCYstt.js";import{_ as R,T as W}from"./Modal.vue_vue_type_script_setup_true_lang-gNNtNPLv.js";import{_ as T}from"./Select.vue_vue_type_script_setup_true_lang-C15l-n0X.js";import{a as X,e as j}from"./format-B6sc_rZ4.js";import"./Collection-D-pf6tmY.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 Y=b("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 Z=b("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 ee=b("PlayIcon",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
|
||
|
|
* @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=b("SearchIcon",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]),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"},ce={key:1,class:"text-muted-foreground py-12 text-center text-sm"},de={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"},qe={key:1,class:"text-muted-foreground text-xs"},Fe=A({__name:"EventsView",setup(Ne){const{events:w}=Q(),v=f(!1),h=f([]),C=f(""),m=f("all"),y=f("all"),a=f(null);M(v,c=>{h.value=c?w.value:[]});const z=_(()=>v.value?h.value:w.value),$=_(()=>v.value?Math.max(0,w.value.length-h.value.length):0),I=_(()=>{const c=C.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:c?o.srcIP.toLowerCase().includes(c)||o.dstIP.toLowerCase().includes(c)||(o.host??"").toLowerCase().includes(c)||(o.rule??"").toLowerCase().includes(c):!0})}),O=_(()=>[{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")}]),U=_(()=>[{value:"all",label:t("common.all")},{value:"tcp",label:"TCP"},{value:"udp",label:"UDP"}]),L=_(()=>{var c;return Object.entries(((c=a.value)==null?void 0:c.props)??{})});async function B(){if(a.value)try{await navigator.clipboard.writeText(JSON.stringify(a.value,null,2)),S.success(t("common.copied"))}catch{S.error(t("common.error"))}}function E(){K(),h.value=[]}return(c,o)=>(n(),i("div",null,[r(J,{title:e(t)("events.title"),description:e(t)("events.subtitle")},{actions:d(()=>[r(e(g),{variant:"outline",size:"sm",onClick:o[0]||(o[0]=u=>v.value=!v.value)},{default:d(()=>[v.value?(n(),V(e(ee),{key:0,class:"size-3.5"})):(n(),V(e(Z),{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:d(()=>[r(e(W),{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(te),{class:"text-muted-foreground absolute top-1/2 left-3 size-4 -translate-y-1/2"}),r(e(G),{modelValue:C.value,"onUpdate:modelValue":o[1]||(o[1]=u=>C.value=u),placeholder:e(t)("events.searchPlaceholder"),class:"pl-9",type:"search"},null,8,["modelValue","placeholder"])]),l("div",ne,[r(e(T),{modelValue:m.value,"onUpdate:modelValue":o[2]||(o[2]=u=>m.value=u),options:O.value,"aria-label":e(t)("events.filterAction"),class:"sm:w-32"},null,8,["modelValue","options","aria-label"]),r(e(T),{modelValue:y.value,"onUpdate:modelValue":o[3]||(o[3]=u=>y.value=u),options:U.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(q),{variant:"drop"},{default:d(()=>[k(s(e(t)("events.paused")),1)]),_:1}),$.value>0?(n(),
|