UNPKG

@bull-board/ui

Version:

A Dashboard UI built on top of bull or bullmq.

1 lines 4.02 kB
"use strict";(self.webpackChunk_bull_board_ui=self.webpackChunk_bull_board_ui||[]).push([["70617"],{80760(e,t,i){i.d(t,{a:()=>d});var r=i(31085),l=i(23157),n=i(54357);i(14041);var a=i(42348),o=i(84382),s=i(43697);let d=e=>{let{open:t,title:i,onClose:d,children:c,width:u,actionButton:b}=e,{t:h}=(0,a.Bd)();return(0,r.jsx)(l.bL,{open:t,modal:!0,onOpenChange:e=>{e||d()},children:(0,r.jsxs)(l.ZL,{children:[(0,r.jsx)(l.hJ,{className:s.A.overlay}),(0,r.jsx)("div",{className:s.A.contentWrapper,children:(0,r.jsxs)(l.UC,{className:(0,n.A)(s.A.content,s.A[u||""]),children:[!!i&&(0,r.jsx)(l.hE,{children:i}),(0,r.jsx)(l.VY,{asChild:!0,children:(0,r.jsx)("div",{className:s.A.description,children:c})}),(0,r.jsxs)("div",{className:s.A.actions,children:[b,(0,r.jsx)(l.bm,{asChild:!0,children:(0,r.jsx)(o.$,{theme:"basic",children:h("MODAL.CLOSE_BTN")})})]})]})})]})})}},38816(e,t,i){i.d(t,{RedisStatsModal:()=>v});var r=i(31085),l=i(53846);let n=["B","kB","MB","GB","TB","PB","EB","ZB","YB"],a=["B","KiB","MiB","GiB","TiB","PiB","EiB","ZiB","YiB"],o=["b","kbit","Mbit","Gbit","Tbit","Pbit","Ebit","Zbit","Ybit"],s=["b","kibit","Mibit","Gibit","Tibit","Pibit","Eibit","Zibit","Yibit"],d=(e,t,i)=>{let r=e;return"string"==typeof t||Array.isArray(t)?r=e.toLocaleString(t,i):(!0===t||void 0!==i)&&(r=e.toLocaleString(void 0,i)),r},c=e=>{if("number"==typeof e)return Math.log10(e);let t=e.toString(10);return t.length+Math.log10(`0.${t.slice(0,15)}`)},u=(e,t)=>{if(void 0===t)return e;if("number"!=typeof t||!Number.isSafeInteger(t)||t<0)throw TypeError(`Expected fixedWidth to be a non-negative integer, got ${typeof t}: ${t}`);return 0===t?e:e.length<t?e.padStart(t," "):e};function b(e,t){let i;if("bigint"!=typeof e&&!Number.isFinite(e))throw TypeError(`Expected a finite number, got ${typeof e}: ${e}`);let r=(t={bits:!1,binary:!1,space:!0,nonBreakingSpace:!1,...t}).bits?t.binary?s:o:t.binary?a:n,l=t.space?t.nonBreakingSpace?"\xa0":" ":"",b="number"==typeof e?0===e:0n===e;if(t.signed&&b)return u(` 0${l}${r[0]}`,t.fixedWidth);let h=e<0,m=h?"-":t.signed?"+":"";h&&(e=-e);let E=(e=>{let{minimumFractionDigits:t,maximumFractionDigits:i}=e;if(void 0!==t||void 0!==i)return{...void 0!==t&&{minimumFractionDigits:t},...void 0!==i&&{maximumFractionDigits:i},roundingMode:"trunc"}})(t);if(e<1)i=m+d(e,t.locale,E)+l+r[0];else{var g;let n=Math.min(Math.floor(t.binary?("number"==typeof(g=e)?Math.log(g):c(g)*Math.log(10))/Math.log(1024):c(e)/3),r.length-1);if(e=((e,t)=>{if("number"==typeof e)return e/t;let i=e/BigInt(t),r=e%BigInt(t);return Number(i)+Number(r)/t})(e,(t.binary?1024:1e3)**n),!E){let t=Math.max(3,Math.floor(e).toString().length);e=e.toPrecision(t)}i=m+d(Number(e),t.locale,E)+l+r[n]}return u(i,t.fixedWidth)}var h=i(14041),m=i(42348),E=i(36784),g=i(26347),p=i(85891),f=i(80760);let v=e=>{var t,i;let{open:n,onClose:a}=e,{t:o}=(0,m.Bd)(),[s,d]=(0,h.useState)(null),c=(0,E.g)();if((0,g.$)(()=>c.getStats().then(e=>d(e)),5e3),!s)return null;let u=[{title:o("REDIS.MEMORY_USAGE"),value:(0,r.jsxs)(r.Fragment,{children:[s.memory.total&&s.memory.used?(0,r.jsxs)("small",{children:[b(s.memory.used)," of ",b(s.memory.total)]}):(0,r.jsx)("small",{className:"error",children:o("REDIS.ERROR.MEMORY_USAGE")}),(t=s.memory.used,i=s.memory.total,void 0===t?"-":void 0===i?b(t):`${(t/i*100).toFixed(2)}%`)]})},{title:o("REDIS.PEEK_MEMORY"),value:b(s.memory.peak)},{title:o("REDIS.FRAGMENTATION_RATIO"),value:s.memory.fragmentationRatio},{title:o("REDIS.CONNECTED_CLIENTS"),value:s.clients.connected},{title:o("REDIS.BLOCKED_CLIENTS"),value:s.clients.blocked},{title:o("REDIS.VERSION"),value:s.version},{title:o("REDIS.MODE"),value:s.mode},{title:o("REDIS.OS"),value:s.os},{title:o("REDIS.UP_TIME"),value:(0,l.A)(0,1e3*s.uptime,{includeSeconds:!0,locale:p.Q})}];return(0,r.jsx)(f.a,{width:"small",open:n,onClose:a,title:o("REDIS.TITLE"),children:(0,r.jsx)("ul",{className:"redisStats-bLzaEu",children:u.map((e,t)=>(0,r.jsxs)("li",{children:[(0,r.jsx)("span",{children:e.title}),(0,r.jsx)("span",{children:e.value})]},t))})})}}}]);