@whyour/qinglong 2.21.0-10 → 2.21.0-12
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/package.json +1 -1
- package/static/build/app.js +11 -10
- package/static/build/config/util.js +7 -1
- package/static/dist/index.html +2 -2
- package/static/dist/{preload_helper.3048fe5b.js → preload_helper.5fb41cf7.js} +1 -1
- package/static/dist/src__pages__dashboard__index.52ea0532.async.js +1 -0
- package/static/dist/{umi.a54a59f6.js → umi.1e3916ff.js} +1 -1
- package/static/dist/src__pages__dashboard__index.58177357.async.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_whyour_qinglong=self.webpackChunk_whyour_qinglong||[]).push([[635],{63549:function(e,t,n){n.r(t);var l=n(48305),a=n.n(l),i=n(72317),s=n(75271),r=n(32890),d=n(50691),o=n(45520),c=n(93481),u=n(16314),x=n(3475),g=n(56958),Z=n(44084),f=n(34014),h=n(48916),m=n(78060),v=n.n(m),p=n(52676);r.Z.Countdown;t.default=function(e){var t=e.cron,n=e.handleCancel,l=e.data,r=e.logUrl,m=(0,s.useState)(i.ZP.get("启动中...")),j=a()(m,2),P=j[0],y=j[1],w=(0,s.useState)(!0),S=a()(w,2),T=S[0],z=S[1],I=(0,s.useState)(!0),b=a()(I,2),k=b[0],C=b[1],F=(0,s.useState)(!1),W=a()(F,2),R=W[0],q=W[1],K=(0,s.useRef)({value:0,down:!0}),M=r||String(null==t?void 0:t.id),E=function e(n){n&&z(!0),u.W.get(r||"".concat(x.Z.apiPrefix,"crons/").concat(t.id,"/log")).then((function(t){var n=t.code,l=t.data,a=t.logStatus;if(200===n&&localStorage.getItem("logCron")===M&&l!==P){var s=l||i.ZP.get("暂无日志");y(s);var r="running"===a;r||(0,h.x$)(P)||P===i.ZP.get("启动中...")||setTimeout((function(){N()})),C(r),r&&setTimeout((function(){N(),e()}),2e3)}})).finally((function(){n&&z(!1)}))},N=function(){K.current.down&&setTimeout((function(){var e;null===(e=document.querySelector("#log-flag"))||void 0===e||e.scrollIntoView({behavior:"smooth"})}),600)},U=function(){localStorage.removeItem("logCron"),n()};return(0,s.useEffect)((function(){t&&t.id&&E(!0)}),[t]),(0,s.useEffect)((function(){l&&y(l)}),[l]),(0,s.useEffect)((function(){q(document.body.clientWidth<768)}),[]),(0,p.jsx)(o.Z,{title:(0,p.jsxs)("div",{style:{display:"flex",alignItems:"center"},children:[(k||T)&&(0,p.jsx)(g.Z,{spin:!0}),!k&&!T&&(0,p.jsx)(Z.Z,{}),(0,p.jsx)(d.Z.Text,{ellipsis:!0,style:{marginLeft:5},children:t&&t.name})]}),open:!0,centered:!0,className:"log-modal",forceRender:!0,onOk:function(){return U()},onCancel:function(){return U()},footer:[(0,p.jsx)(c.Z,{type:"primary",onClick:function(){return U()},children:i.ZP.get("知道了")})],children:(0,p.jsxs)("div",{onScroll:function(e){var t=e.target.scrollTop;K.current.down&&(K.current={value:t,down:t-K.current.value>-5||!t})},className:"log-container",children:[T?(0,p.jsx)(f.Z,{}):(0,p.jsx)("pre",{style:R?{fontFamily:"Source Code Pro",zoom:.83}:{},children:(0,p.jsx)(v(),{children:P})}),(0,p.jsx)("div",{id:"log-flag"})]})})}},15409:function(e,t,n){n.r(t);var l=n(26068),a=n.n(l),i=n(90228),s=n.n(i),r=n(87999),d=n.n(r),o=n(48305),c=n.n(o),u=n(75271),x=n(20553),g=n(75036),Z=n(91757),f=n(66633),h=n(32890),m=n(98705),v=n(10948),p=n(47667),j=n(25854),P=n(44084),y=n(25361),w=n(86935),S=n(15631),T=n(1704),z=n(47508),I=n(98783),b=n(91879),k=n(37902),C=n(72317),F=n(16314),W=n(63549),R=n(52676),q=function(e){if(e<60)return"".concat(e,"s");if(e<3600)return"".concat(Math.floor(e/60),"m ").concat(e%60,"s");var t=Math.floor(e/3600),n=Math.floor(e%3600/60);return"".concat(t,"h ").concat(n,"m")};t.default=function(){var e,t=(0,I.useOutletContext)(),n=t.headerStyle,l="vs-dark"===t.theme,i=(0,u.useState)(null),r=c()(i,2),o=r[0],K=r[1],M=(0,u.useState)([]),E=c()(M,2),N=E[0],U=E[1],_=(0,u.useState)([]),A=c()(_,2),H=A[0],O=A[1],B=(0,u.useState)([]),D=c()(B,2),L=D[0],V=D[1],Y=(0,u.useState)(null),$=c()(Y,2),G=$[0],J=$[1],Q=(0,u.useState)(null),X=c()(Q,2),ee=X[0],te=X[1],ne=(0,u.useState)([]),le=c()(ne,2),ae=le[0],ie=le[1],se=(0,u.useState)(null),re=c()(se,2),de=re[0],oe=re[1],ce=(0,u.useState)(!0),ue=c()(ce,2),xe=ue[0],ge=ue[1],Ze=(0,u.useCallback)(d()(s()().mark((function e(){var t,n,l,a,i,r,d,o,u;return s()().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,Promise.allSettled([F.W.get("/api/dashboard/overview"),F.W.get("/api/dashboard/trend"),F.W.get("/api/dashboard/top-time"),F.W.get("/api/dashboard/top-count"),F.W.get("/api/dashboard/runtime"),F.W.get("/api/dashboard/system"),F.W.get("/api/dashboard/labels")]);case 3:t=e.sent,n=c()(t,7),l=n[0],a=n[1],i=n[2],r=n[3],d=n[4],o=n[5],u=n[6],"fulfilled"===l.status&&200===l.value.code&&K(l.value.data),"fulfilled"===a.status&&200===a.value.code&&U(a.value.data),"fulfilled"===i.status&&200===i.value.code&&O(i.value.data),"fulfilled"===r.status&&200===r.value.code&&V(r.value.data),"fulfilled"===d.status&&200===d.value.code&&J(d.value.data),"fulfilled"===o.status&&200===o.value.code&&te(o.value.data),"fulfilled"===u.status&&200===u.value.code&&ie(u.value.data),e.next=24;break;case 21:e.prev=21,e.t0=e.catch(0),console.error("[dashboard] fetch error",e.t0);case 24:return e.prev=24,ge(!1),e.finish(24);case 27:case"end":return e.stop()}}),e,null,[[0,21,24,27]])}))),[]);(0,u.useEffect)((function(){var e,t=function(){var n=d()(s()().mark((function n(){return s()().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,Ze();case 2:e=setTimeout(t,3e4);case 3:case"end":return n.stop()}}),n)})));return function(){return n.apply(this,arguments)}}();return Ze(),e=setTimeout(t,3e4),function(){return clearTimeout(e)}}),[Ze]);var fe={data:N.flatMap((function(e){return[{date:e.date,value:e.total,type:C.ZP.get("总执行")},{date:e.date,value:e.success,type:C.ZP.get("成功")},{date:e.date,value:e.fail,type:C.ZP.get("失败")}]})),xField:"date",yField:"value",seriesField:"type",smooth:!0,height:260,color:["#1677ff","#52c41a","#ff4d4f"],legend:{position:"top"},theme:l?"dark":"light",xAxis:{label:{style:{fill:l?"#aaa":"#333"}}},yAxis:{label:{style:{fill:l?"#aaa":"#333"}},grid:{line:{style:{stroke:l?"#333":"#eee"}}}}};return xe?(0,R.jsx)(x.Z,{size:"large",style:{display:"block",marginTop:100}}):(0,R.jsxs)(z.ZP,{title:C.ZP.get("仪表盘"),header:{style:n},className:"ql-container-wrapper dashboard-wrapper",children:[(0,R.jsxs)(g.Z,{gutter:[16,16],children:[(0,R.jsx)(Z.Z,{xs:12,sm:8,md:6,lg:3,children:(0,R.jsx)(f.Z,{size:"small",children:(0,R.jsx)(h.Z,{title:C.ZP.get("总任务"),value:(null==o?void 0:o.total)||0,prefix:(0,R.jsx)(j.Z,{})})})}),(0,R.jsx)(Z.Z,{xs:12,sm:8,md:6,lg:3,children:(0,R.jsx)(f.Z,{size:"small",children:(0,R.jsx)(h.Z,{title:C.ZP.get("已启用"),value:(null==o?void 0:o.enabled)||0,valueStyle:{color:"#1677ff"},prefix:(0,R.jsx)(P.Z,{})})})}),(0,R.jsx)(Z.Z,{xs:12,sm:8,md:6,lg:3,children:(0,R.jsx)(f.Z,{size:"small",children:(0,R.jsx)(h.Z,{title:C.ZP.get("今日执行"),value:(null==o?void 0:o.todayRuns)||0,valueStyle:{color:"#1677ff"},prefix:(0,R.jsx)(y.Z,{})})})}),(0,R.jsx)(Z.Z,{xs:12,sm:8,md:6,lg:3,children:(0,R.jsx)(f.Z,{size:"small",children:(0,R.jsx)(h.Z,{title:C.ZP.get("成功率"),value:"".concat((null==o?void 0:o.successRate)||"0","%"),valueStyle:{color:"#52c41a"}})})}),(0,R.jsx)(Z.Z,{xs:12,sm:8,md:6,lg:3,children:(0,R.jsx)(f.Z,{size:"small",children:(0,R.jsx)(h.Z,{title:C.ZP.get("今日成功"),value:(null==o?void 0:o.todaySuccess)||0,valueStyle:{color:"#52c41a"},prefix:(0,R.jsx)(P.Z,{})})})}),(0,R.jsx)(Z.Z,{xs:12,sm:8,md:6,lg:3,children:(0,R.jsx)(f.Z,{size:"small",children:(0,R.jsx)(h.Z,{title:C.ZP.get("今日失败"),value:(null==o?void 0:o.todayFail)||0,valueStyle:{color:"#ff4d4f"},prefix:(0,R.jsx)(w.Z,{})})})}),(0,R.jsx)(Z.Z,{xs:12,sm:8,md:6,lg:3,children:(0,R.jsx)(f.Z,{size:"small",children:(0,R.jsx)(h.Z,{title:C.ZP.get("平均耗时"),value:null!=o&&o.avgTime?"".concat((o.avgTime/1e3).toFixed(1),"s"):"-",prefix:(0,R.jsx)(S.Z,{})})})}),(0,R.jsx)(Z.Z,{xs:12,sm:8,md:6,lg:3,children:(0,R.jsx)(f.Z,{size:"small",children:(0,R.jsx)(h.Z,{title:C.ZP.get("已禁用"),value:(null==o?void 0:o.disabled)||0,prefix:(0,R.jsx)(T.Z,{})})})})]}),(0,R.jsx)(g.Z,{gutter:[16,16],style:{marginTop:16},children:(0,R.jsx)(Z.Z,{span:24,children:(0,R.jsx)(f.Z,{title:C.ZP.get("近 7 日趋势"),size:"small",children:N.length>0?(0,R.jsx)(b.Z,a()({},fe)):(0,R.jsx)(m.Z,{description:C.ZP.get("暂无数据")})})})}),(0,R.jsxs)(g.Z,{gutter:[16,16],style:{marginTop:16},children:[(0,R.jsx)(Z.Z,{xs:24,lg:12,children:(0,R.jsx)(f.Z,{title:C.ZP.get("今日耗时 Top 5"),size:"small",children:(0,R.jsx)(v.Z,{dataSource:H,rowKey:"rank",pagination:!1,size:"small",columns:[{title:"#",dataIndex:"rank",width:40},{title:C.ZP.get("定时任务"),dataIndex:"name",ellipsis:!0},{title:C.ZP.get("平均耗时"),dataIndex:"avgTime",width:100,render:function(e){return e?"".concat((e/1e3).toFixed(1),"s"):"-"}},{title:C.ZP.get("最长单次"),dataIndex:"maxTime",width:100,render:function(e){return e?"".concat((e/1e3).toFixed(1),"s"):"-"}}]})})}),(0,R.jsx)(Z.Z,{xs:24,lg:12,children:(0,R.jsx)(f.Z,{title:C.ZP.get("今日执行次数 Top 5"),size:"small",children:(0,R.jsx)(v.Z,{dataSource:L,rowKey:"rank",pagination:!1,size:"small",columns:[{title:"#",dataIndex:"rank",width:40},{title:C.ZP.get("定时任务"),dataIndex:"name",ellipsis:!0},{title:C.ZP.get("次数"),dataIndex:"runCount",width:60},{title:C.ZP.get("平均耗时"),dataIndex:"avgTime",width:100,render:function(e){return e?"".concat((e/1e3).toFixed(1),"s"):"-"}},{title:C.ZP.get("成功率"),dataIndex:"successRate",width:80,render:function(e){return"".concat(e,"%")}}]})})})]}),ae.length>0&&(0,R.jsx)(g.Z,{gutter:[16,16],style:{marginTop:16},children:(0,R.jsx)(Z.Z,{span:24,children:(0,R.jsx)(f.Z,{title:C.ZP.get("标签统计"),size:"small",children:(0,R.jsx)(v.Z,{dataSource:ae,rowKey:"label",pagination:!1,size:"small",columns:[{title:C.ZP.get("标签"),dataIndex:"label",width:150,render:function(e){return(0,R.jsx)(p.Z,{children:e})}},{title:C.ZP.get("任务数"),dataIndex:"count",width:80},{title:C.ZP.get("今日执行"),dataIndex:"todayRuns",width:100},{title:C.ZP.get("成功率"),dataIndex:"successRate",width:100,render:function(e){return"".concat(e,"%")}},{title:C.ZP.get("平均耗时"),dataIndex:"avgTime",width:120,render:function(e){return e?"".concat((e/1e3).toFixed(1),"s"):"-"}}]})})})}),(0,R.jsxs)(g.Z,{gutter:[16,16],style:{marginTop:16},children:[(0,R.jsx)(Z.Z,{xs:24,lg:12,children:(0,R.jsxs)(f.Z,{title:C.ZP.get("实时运行态"),size:"small",extra:(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(p.Z,{color:"processing",children:[C.ZP.get("运行中")," ",(null==G?void 0:G.runningCount)||0]}),(0,R.jsxs)(p.Z,{color:"warning",children:[C.ZP.get("排队中")," ",(null==G?void 0:G.queuedCount)||0]})]}),children:[(0,R.jsx)(v.Z,{dataSource:(null==G?void 0:G.running)||[],rowKey:"instanceId",pagination:!!(G&&G.running.length>5)&&{pageSize:5,showSizeChanger:!1,showTotal:function(e){return"共 ".concat(e," 个")}},size:"small",locale:{emptyText:(0,R.jsx)(m.Z,{description:C.ZP.get("暂无运行中任务")})},columns:[{title:C.ZP.get("定时任务"),dataIndex:"name",ellipsis:!0,render:function(e,t){var n=((null==G?void 0:G.running)||[]).filter((function(e){return e.id===t.id})).length;return n>1?(0,R.jsxs)("span",{children:[e," ",(0,R.jsxs)(p.Z,{color:"processing",style:{fontSize:10,lineHeight:"16px"},children:["×",n]})]}):e}},{title:"PID",dataIndex:"pid",width:80},{title:C.ZP.get("已运行"),dataIndex:"elapsed",width:100,render:function(e){return e?q(e):"-"}},{title:C.ZP.get("日志"),dataIndex:"id",width:60,render:function(e,t){return(0,R.jsx)("a",{onClick:function(){localStorage.setItem("logCron",String(e)),oe({id:e,name:t.name})},children:C.ZP.get("查看")})}}]}),(null==G?void 0:G.idleTasks)&&G.idleTasks.length>0&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)("div",{style:{marginTop:12,fontSize:13,color:"#ff7a00"},children:[C.ZP.get("24小时未运行")," (",G.idleTasks.length,")"]}),(0,R.jsx)(v.Z,{dataSource:G.idleTasks,rowKey:"id",pagination:!1,size:"small",showHeader:!1,columns:[{dataIndex:"name",ellipsis:!0},{dataIndex:"lastRun",width:110,render:function(e){return(0,R.jsx)("span",{style:{color:"#999"},children:e})}}]})]})]})}),(0,R.jsx)(Z.Z,{xs:24,lg:12,children:(0,R.jsx)(f.Z,{title:C.ZP.get("系统资源"),size:"small",children:ee&&(0,R.jsxs)(g.Z,{gutter:[16,16],align:"middle",children:[(0,R.jsx)(Z.Z,{span:12,children:(0,R.jsx)(k.Z,{height:300,data:{target:Number(ee.memUsagePercent),total:100,name:"内存使用率"},style:{textY:"70%",textContent:function(e,t){return"".concat(C.ZP.get("内存"),":").concat(e,"%")}}})}),(0,R.jsxs)(Z.Z,{span:12,children:[(0,R.jsx)(h.Z,{title:C.ZP.get("系统运行"),value:q(ee.uptime)}),(0,R.jsx)(h.Z,{title:C.ZP.get("堆内存"),value:"".concat(ee.heapUsed," MB"),valueStyle:{fontSize:16}}),(0,R.jsxs)("div",{style:{marginTop:8,color:"#888",fontSize:12},children:[C.ZP.get("负载 1m"),": ",(null===(e=ee.loadAvg)||void 0===e?void 0:e[0])||"-"," | CPU: ",ee.cpus," ",C.ZP.get("核心")," | ",ee.platform]})]})]})})})]}),de&&(0,R.jsx)(W.default,{cron:de,handleCancel:function(){return oe(null)}})]})}}}]);
|