@tachybase/plugin-log-viewer 0.23.58 → 1.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
(function(e,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("@tachybase/client"),require("react-i18next"),require("react/jsx-runtime"),require("react"),require("@ant-design/icons"),require("ahooks"),require("antd")):typeof define=="function"&&define.amd?define(["exports","@tachybase/client","react-i18next","react/jsx-runtime","react","@ant-design/icons","ahooks","antd"],t):(e=typeof globalThis!="undefined"?globalThis:e||self,t(e["@tachybase/plugin-log-viewer"]={},e["@tachybase/client"],e["react-i18next"],e.jsxRuntime,e.react,e["@ant-design/icons"],e.ahooks,e.antd))})(this,function(e,t,i,r,a,v,C,c){"use strict";var re=Object.defineProperty,se=Object.defineProperties;var ne=Object.getOwnPropertyDescriptors;var Q=Object.getOwnPropertySymbols;var oe=Object.prototype.hasOwnProperty,ie=Object.prototype.propertyIsEnumerable;var J=(e,t,i)=>t in e?re(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,_=(e,t)=>{for(var i in t||(t={}))oe.call(t,i)&&J(e,i,t[i]);if(Q)for(var i of Q(t))ie.call(t,i)&&J(e,i,t[i]);return e},j=(e,t)=>se(e,ne(t));var W=(e,t,i)=>new Promise((r,a)=>{var v=g=>{try{c(i.next(g))}catch(w){a(w)}},C=g=>{try{c(i.throw(g))}catch(w){a(w)}},c=g=>g.done?r(g.value):Promise.resolve(g.value).then(v,C);c((i=i.apply(e,t)).next())});const g="log-viewer";function w(p){return t.i18n.t(p,{ns:[g,"core"]})}function I(){return i.useTranslation([g,"core"])}const{Paragraph:L,Text:E}=c.Typography,B=a.memo(()=>{const{t:p}=I();return r.jsxs(c.Typography,{children:[r.jsxs(L,{children:[r.jsx(E,{code:!0,children:"[app]/request_*.log"})," - ",p("API request and response logs")]}),r.jsxs(L,{children:[r.jsx(E,{code:!0,children:"[app]/system_*.log"})," -"," ",p("Application, database, plugins and other system logs, the error level logs will be sent to")," ",r.jsx(E,{code:!0,children:"[app]/system_error_*.log"})]}),r.jsxs(L,{children:[r.jsx(E,{code:!0,children:"[app]/sql_*.log"})," -"," ",p("SQL execution logs, printed by Sequelize when the db logging is enabled")]})]})});B.displayName="Tips";const O=a.memo(p=>{const{token:f}=c.theme.useToken(),{t:y}=I(),x=C.useMemoizedFn(y),k=t.useAPIClient(),[b,m]=a.useState(["0"]),[T,X]=a.useState(""),[Y,D]=a.useState(!0),[$,F]=a.useState([]),[P,H]=a.useState(),{data:K}=t.useRequest(()=>k.resource("logger").list().then(o=>{var d;return(d=o.data)==null?void 0:d.data})),{data:A,run:Z}=t.useRequest({url:"logger:preview",method:"post",data:{file:P}},{manual:!0});a.useEffect(()=>{P&&Z()},[P]);const M=a.useCallback((o,d)=>o.map((n,u)=>{const s=`${d}-${u}`;return typeof n=="string"?{title:n,key:s,icon:r.jsx(v.FileOutlined,{})}:{title:n.name,key:s,icon:r.jsx(v.FolderOutlined,{}),children:M(n.files,s)}}),[]),S=a.useMemo(()=>{const o=K||[];return[{title:x("All"),key:"0",children:M(o,"0")}]},[K,M,x]),R=o=>{m(o),D(!1)},ee=o=>{const{value:d}=o.target,n=s=>s.reduce((l,h)=>{var q;return(q=h.title)!=null&&q.includes(d)&&l.push(h),h.children?[...l,...n(h.children)]:l},[]),u=n(S).map(s=>s.key);m(u),X(d),D(!0),F([])},N=a.useMemo(()=>{if(!T)return S;const o=d=>{const n=[];for(const u of d){const s=u.title,l=s.indexOf(T),h=s.substring(0,l),q=s.substring(l+T.length),U=l>-1?r.jsxs("span",{children:[h,r.jsx("span",{style:{color:f.colorPrimary},children:T}),q]}):r.jsx("span",{children:s});if(l>-1)n.push(j(_({},u),{title:U}));else if(u.children){const G=o(u.children);G.length&&n.push(j(_({},u),{title:U,children:G}))}}return n};return o(S)},[T,S,f.colorPrimary]),te=()=>{const o=(n,u)=>n.reduce((s,l)=>{let h=l.title;return h=l.key==="0"?h:`${u}/${h}`,l.children?[...s,...o(l.children,l.key==="0"?"":h)]:($.includes(l.key)&&l.key!=="0"&&s.push(h),s)},[]),d=o(S,"");d.length&&k.request({url:"logger:download",method:"post",responseType:"blob",data:{files:d}}).then(n=>{const u=window.URL.createObjectURL(new Blob([n.data],{type:"application/gzip"})),s=document.createElement("a");s.setAttribute("href",u),s.setAttribute("download","logs.tar.gz"),s.click(),s.remove()}).catch(n=>{console.log(n)})};return r.jsxs(c.Card,{style:{minHeight:"700px"},children:[r.jsx(c.Alert,{message:"",description:r.jsx(B,{}),type:"info",showIcon:!0}),r.jsx(c.Input.Search,{style:{marginTop:16,width:"450px"},placeholder:x("Search"),onChange:ee}),r.jsxs("div",{className:t.css`
|
|
2
2
|
display: flex;
|
|
3
|
-
`,children:[r.jsx("div",{style:{maxHeight:"400px",width:"450px",overflow:"auto",border:"1px solid",marginTop:"6px",marginBottom:"10px",borderColor:f.colorBorder},children:N.length?r.jsx(c.Tree,{checkable:!0,showIcon:!0,showLine:!0,checkedKeys:$,expandedKeys:b,autoExpandParent:Y,onExpand:R,onCheck:o=>F(o),treeData:N,selectable:!0,onSelect:(o,d)=>{if(!d.node.children){const n=V(N,o[0],0,"");H(n||void 0)}}}):r.jsx(c.Empty,{image:c.Empty.PRESENTED_IMAGE_SIMPLE})}),r.jsx("div",{style:{maxHeight:"400px",overflow:"auto",border:"1px solid",marginTop:"6px",marginBottom:"10px",borderColor:f.colorBorder,width:"1005px",marginLeft:"10px"},children:P?r.jsx(t.CodeMirror,{value:A==null?void 0:A.data,width:"1000px",height:"398px"}):null})]}),r.jsxs(c.Button,{type:"primary",onClick:te,children:[x("Download")," (.tar.gz)"]})]})});O.displayName="LogsDownloader";const V=(p,f,y,x)=>{const k=f.split("-"),b=k[y];let m=x;if(y>0&&(m+=`/${p[b].title}`),y===k.length-1)return m;if(p[b].children)return V(p[b].children,f,y+1,m)};class z extends t.Plugin{load(){return W(this,null,function*(){this.app.systemSettingsManager.add("system-services.log-viewer",{title:w("Log Viewer"),icon:"FileTextOutlined",Component:O})})}}e.PluginLogViewer=z,e.default=z,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
3
|
+
`,children:[r.jsx("div",{style:{maxHeight:"400px",width:"450px",overflow:"auto",border:"1px solid",marginTop:"6px",marginBottom:"10px",borderColor:f.colorBorder},children:N.length?r.jsx(c.Tree,{checkable:!0,showIcon:!0,showLine:!0,checkedKeys:$,expandedKeys:b,autoExpandParent:Y,onExpand:R,onCheck:o=>F(o),treeData:N,selectable:!0,onSelect:(o,d)=>{if(!d.node.children){const n=V(N,o[0],0,"");H(n||void 0)}}}):r.jsx(c.Empty,{image:c.Empty.PRESENTED_IMAGE_SIMPLE})}),r.jsx("div",{style:{maxHeight:"400px",overflow:"auto",border:"1px solid",marginTop:"6px",marginBottom:"10px",borderColor:f.colorBorder,width:"1005px",marginLeft:"10px"},children:P?r.jsx(t.CodeMirror,{value:A==null?void 0:A.data,width:"1000px",height:"398px"}):null})]}),r.jsxs(c.Button,{type:"primary",onClick:te,children:[x("Download")," (.tar.gz)"]})]})});O.displayName="LogsDownloader";const V=(p,f,y,x)=>{const k=f.split("-"),b=k[y];let m=x;if(y>0&&(m+=`/${p[b].title}`),y===k.length-1)return m;if(p[b].children)return V(p[b].children,f,y+1,m)};class z extends t.Plugin{load(){return W(this,null,function*(){this.app.systemSettingsManager.add("system-services.log-viewer",{title:w("Log Viewer"),icon:"FileTextOutlined",Component:O,aclSnippet:"pm.system-services.log-viewer"})})}}e.PluginLogViewer=z,e.default=z,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/dist/externalVersion.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
"react": "18.3.1",
|
|
3
|
-
"@tachybase/client": "0.
|
|
3
|
+
"@tachybase/client": "1.0.18",
|
|
4
4
|
"@ant-design/icons": "5.5.2",
|
|
5
5
|
"ahooks": "3.8.4",
|
|
6
6
|
"antd": "5.22.5",
|
|
7
|
-
"@tachybase/server": "0.
|
|
7
|
+
"@tachybase/server": "1.0.18",
|
|
8
8
|
"react-i18next": "15.2.0",
|
|
9
|
-
"@tachybase/actions": "0.
|
|
10
|
-
"@tachybase/logger": "0.
|
|
9
|
+
"@tachybase/actions": "1.0.18",
|
|
10
|
+
"@tachybase/logger": "1.0.18"
|
|
11
11
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"tar-fs","version":"3.0.6","description":"filesystem bindings for tar-stream","dependencies":{"pump":"^3.0.0","tar-stream":"^3.1.5"},"optionalDependencies":{"bare-fs":"^2.1.1","bare-path":"^2.1.0"},"imports":{"fs":{"bare":"bare-fs","default":"fs"},"path":{"bare":"bare-path","default":"path"}},"files":["index.js"],"standard":{"ignore":["test/fixtures/**"]},"keywords":["tar","fs","file","tarball","directory","stream"],"devDependencies":{"brittle":"^3.1.3","rimraf":"^2.6.3","standard":"^17.0.1"},"scripts":{"test":"standard && brittle test/index.js"},"bugs":{"url":"https://github.com/mafintosh/tar-fs/issues"},"homepage":"https://github.com/mafintosh/tar-fs","main":"index.js","directories":{"test":"test"},"author":"Mathias Buus","license":"MIT","repository":{"type":"git","url":"https://github.com/mafintosh/tar-fs.git"},"_lastModified":"2025-
|
|
1
|
+
{"name":"tar-fs","version":"3.0.6","description":"filesystem bindings for tar-stream","dependencies":{"pump":"^3.0.0","tar-stream":"^3.1.5"},"optionalDependencies":{"bare-fs":"^2.1.1","bare-path":"^2.1.0"},"imports":{"fs":{"bare":"bare-fs","default":"fs"},"path":{"bare":"bare-path","default":"path"}},"files":["index.js"],"standard":{"ignore":["test/fixtures/**"]},"keywords":["tar","fs","file","tarball","directory","stream"],"devDependencies":{"brittle":"^3.1.3","rimraf":"^2.6.3","standard":"^17.0.1"},"scripts":{"test":"standard && brittle test/index.js"},"bugs":{"url":"https://github.com/mafintosh/tar-fs/issues"},"homepage":"https://github.com/mafintosh/tar-fs","main":"index.js","directories":{"test":"test"},"author":"Mathias Buus","license":"MIT","repository":{"type":"git","url":"https://github.com/mafintosh/tar-fs.git"},"_lastModified":"2025-04-18T20:36:30.275Z"}
|
package/dist/server/plugin.js
CHANGED
|
@@ -41,7 +41,7 @@ class PluginLogViewerServer extends import_server.Plugin {
|
|
|
41
41
|
async load() {
|
|
42
42
|
this.app.resource(import_logger.default);
|
|
43
43
|
this.app.acl.registerSnippet({
|
|
44
|
-
name:
|
|
44
|
+
name: "pm.system-services.log-viewer",
|
|
45
45
|
actions: ["logger:*"]
|
|
46
46
|
});
|
|
47
47
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tachybase/plugin-log-viewer",
|
|
3
3
|
"displayName": "Logger",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "1.0.18",
|
|
5
5
|
"description": "Server-side logs, mainly including API request logs and system runtime logs, and allows to package and download log files.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"Logging and monitoring"
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
"tar-fs": "^3.0.6"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"@tachybase/actions": "0.
|
|
22
|
-
"@tachybase/client": "0.
|
|
23
|
-
"@tachybase/logger": "0.
|
|
24
|
-
"@tachybase/server": "0.
|
|
25
|
-
"@tachybase/test": "0.
|
|
21
|
+
"@tachybase/actions": "1.0.18",
|
|
22
|
+
"@tachybase/client": "1.0.18",
|
|
23
|
+
"@tachybase/logger": "1.0.18",
|
|
24
|
+
"@tachybase/server": "1.0.18",
|
|
25
|
+
"@tachybase/test": "1.0.18"
|
|
26
26
|
},
|
|
27
27
|
"description.zh-CN": "服务端日志,主要包括接口请求日志和系统运行日志,并支持打包和下载日志文件。",
|
|
28
28
|
"displayName.zh-CN": "日志",
|