feat: 新增日志中心、功能优化与代码重构
- 新增 log_datasource.go / log_proxy.go / user_api_token.go 后端控制器 - 新增 log_datasource.go model - 新增 monitor/log-center.ts API 模块 - 新增 LogCenter 前端组件及页面 - 重构 deployment 相关组件 (HPDA/UpdateImageModal/bundle-yaml 等) - 新增 ResetPasswordDialog / code-snippet-block / copy-button 等 UI 组件 - 重构多个 k8s 相关组件 (TopologyView/ResourceVisualEditor/PodFileBrowser 等) - 更新多个 API 和工具函数 (auth.ts/monitor/index.ts/request.ts 等) - 更新静态资源 (index.html + 新 JS/CSS bundle) - 删除废弃静态资源文件
This commit is contained in:
1 parent
5ca0e6d83a
commit
8d46e8f352
197 files changed
+5014
-815
No files matched your search
@@ -0,0 +1 @@
|
||||
import{r as t,j as e}from"./vendor-codemirror-B1SGo4xl.js";import{T as me,a as de,b as K,c as M}from"./tabs-CVrkiNvd.js";import{D as Z,a as ee,b as te,c as oe,d as se,e as re,B as j,f as ge,av as xe}from"./index-lgmWPQDG.js";import{I as k}from"./input-DBDfXZx0.js";import{L as p}from"./label-Bzhjv1tR.js";import{T as W}from"./textarea-ym7reYBG.js";import{S as $,a as z,b as B,c as q,d as O}from"./select-Bv_WioDg.js";import{u as _}from"./use-toast-DNZLibQY.js";import{l as T}from"./log-center-Cyw2AhE7.js";import{S as U}from"./switch-BGnej0rz.js";import{L as F,aW as pe,P as H,R as G,z as ne,d as he,T as ue,b5 as ve,aD as ye,I as be,a7 as Le}from"./vendor-icons-BlY7QrxS.js";import{B as R}from"./badge-Ca5YHtna.js";import{C as X,a as Y}from"./card-CdN7vcLa.js";import{a as I}from"./alert-CifuiQtF.js";import{A as je}from"./AlertRuleDialog-B7BGtl_o.js";import"./index-5FEebgvX.js";const ae=t.createContext(null);function fe({children:s}){const[r,o]=t.useState(null),n=t.useCallback(i=>o(i),[]);return e.jsx(ae.Provider,{"code-path":"src/components/monitor/log-center/LogQueryContext.tsx:16:5",value:{context:r,setContext:n},children:s})}function J(){const s=t.useContext(ae);if(!s)throw new Error("useLogQueryContext must be used within LogQueryProvider");return s}function ce({open:s,onOpenChange:r,engine:o,editing:n,onSaved:i}){const{toast:h}=_(),[g,u]=t.useState(""),[d,x]=t.useState(""),[v,N]=t.useState("logstash-*"),[b,P]=t.useState(!1),[Q,c]=t.useState(""),[f,y]=t.useState(""),[m,C]=t.useState(!1),[A,l]=t.useState(!1),[S,a]=t.useState(!1),[D,E]=t.useState(!1);t.useEffect(()=>{s&&(n?(u(n.name),x(n.url),N(n.default_index||"logstash-*"),P(!!n.basic_auth),c(n.basic_auth_user||""),y(""),C(!!n.skip_tls_verify),l(!!n.is_default)):(u(o==="loki"?"Loki":"Elasticsearch"),x(o==="loki"?"http://localhost:3100":"http://localhost:9200"),N("logstash-*"),P(!1),c(""),y(""),C(!1),l(!1)))},[s,n,o]);const w=()=>({name:g.trim(),type:o,url:d.trim(),basic_auth:b,basic_auth_user:Q,basic_auth_pass:f,skip_tls_verify:m,default_index:o==="elasticsearch"?v:void 0,is_default:A}),V=async()=>{E(!0);try{await T.testDatasource(w()),h({title:"连接成功"})}catch(L){h({title:"连接失败",description:L?.message||String(L),variant:"destructive"})}finally{E(!1)}},ie=async()=>{if(!(!g.trim()||!d.trim())){a(!0);try{n?await T.updateDatasource(n.id,w()):await T.createDatasource(w()),h({title:"已保存"}),r(!1),i()}catch(L){h({title:"保存失败",description:L?.message||String(L),variant:"destructive"})}finally{a(!1)}}};return e.jsx(Z,{"code-path":"src/components/monitor/log-center/LogDatasourceDialog.tsx:103:5",open:s,onOpenChange:r,children:e.jsxs(ee,{"code-path":"src/components/monitor/log-center/LogDatasourceDialog.tsx:104:7",className:"bg-[var(--dg-bg-secondary)] border-[var(--dg-border)] max-w-md max-h-[85vh] overflow-y-auto",children:[e.jsxs(te,{"code-path":"src/components/monitor/log-center/LogDatasourceDialog.tsx:105:9",children:[e.jsxs(oe,{"code-path":"src/components/monitor/log-center/LogDatasourceDialog.tsx:106:11",className:"text-[var(--dg-text-primary)]",children:[n?"编辑":"添加",o==="loki"?" Loki":" Elasticsearch"," 数据源"]}),e.jsx(se,{"code-path":"src/components/monitor/log-center/LogDatasourceDialog.tsx:109:11",className:"text-[var(--dg-text-muted)]",children:"仅保存连接信息,日志本体存储在您的 Loki / ES 集群"})]}),e.jsxs("div",{"code-path":"src/components/monitor/log-center/LogDatasourceDialog.tsx:113:9",className:"space-y-3 py-1",children:[e.jsxs("div",{"code-path":"src/components/monitor/log-center/LogDatasourceDialog.tsx:114:11",children:[e.jsx(p,{"code-path":"src/components/monitor/log-center/LogDatasourceDialog.tsx:115:13",className:"text-xs text-[var(--dg-text-muted)]",children:"名称"}),e.jsx(k,{"code-path":"src/components/monitor/log-center/LogDatasourceDialog.tsx:116:13",value:g,onChange:L=>u(L.target.value),className:"mt-1 h-9 bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)]"})]}),e.jsxs("div",{"code-path":"src/components/monitor/log-center/LogDatasourceDialog.tsx:118:11",children:[e.jsx(p,{"code-path":"src/components/monitor/log-center/LogDatasourceDialog.tsx:119:13",className:"text-xs text-[var(--dg-text-muted)]",children:"地址"}),e.jsx(k,{"code-path":"src/components/monitor/log-center/LogDatasourceDialog.tsx:120:13",value:d,onChange:L=>x(L.target.value),placeholder:"http://host:port",className:"mt-1 h-9 font-mono text-xs bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)]"})]}),o==="elasticsearch"&&e.jsxs("div",{"code-path":"src/components/monitor/log-center/LogDatasourceDialog.tsx:123:13",children:[e.jsx(p,{"code-path":"src/components/monitor/log-center/LogDatasourceDialog.tsx:124:15",className:"text-xs text-[var(--dg-text-muted)]",children:"默认索引"}),e.jsx(k,{"code-path":"src/components/monitor/log-center/LogDatasourceDialog.tsx:125:15",value:v,onChange:L=>N(L.target.value),className:"mt-1 h-9 font-mono text-xs bg-[var(--dg-bg-tertiary)] border-[var(--dg-border)]"})]}),e.jsxs("div",{"codeLine truncated
|
||||
Reference in new issue
Block a user