diff --git a/docs/src/components/LandingPage/GithubInfo.jsx b/docs/src/components/LandingPage/GithubInfo.jsx index bd8d9f57..d3299119 100644 --- a/docs/src/components/LandingPage/GithubInfo.jsx +++ b/docs/src/components/LandingPage/GithubInfo.jsx @@ -7,15 +7,15 @@ const GithubInfo = ({ owner, repo }) => { return (
-
+
star
-
+
{favorites || 4621}
-
+ {/*
language
@@ -24,18 +24,18 @@ const GithubInfo = ({ owner, repo }) => { {language || "java"}
-
+
*/}
-
+
forks
-
+
{forks || 1020}
-
+ {/*
license
@@ -44,7 +44,7 @@ const GithubInfo = ({ owner, repo }) => { Apache 2
-
+
*/}
); }; diff --git a/docs/src/components/LandingPage/Hero.jsx b/docs/src/components/LandingPage/Hero.jsx index 3be732c6..ec730c3b 100644 --- a/docs/src/components/LandingPage/Hero.jsx +++ b/docs/src/components/LandingPage/Hero.jsx @@ -9,29 +9,31 @@ const Hero = () => { const bgUrl = useBaseUrl("/img/bg.jpg"); return ( -
+
-
+
+ +
{/* */}
{/* title and desc */}
-

- Hippo4j +

+ Hippo4j Thread Pool

-

+ {/*

Thread Pool Framework For Java -

-

+

*/} +

{ {/* button group */}

- - - + */} + + + {/* + + + + */} + {/* + + + + */} + + Start Learning + + + + + + + + + {" "} + + Github + + {/*
+ + GitHub +
*/} +
+
{/* github info */}
+ + {/* button test */} +
{/* */} -
+
Hippo4j System diff --git a/docs/src/components/LandingPage/Introduction.jsx b/docs/src/components/LandingPage/Introduction.jsx index 41a78df5..5ff03882 100644 --- a/docs/src/components/LandingPage/Introduction.jsx +++ b/docs/src/components/LandingPage/Introduction.jsx @@ -3,18 +3,19 @@ import useBaseUrl from "@docusaurus/useBaseUrl"; import Translate from "@docusaurus/Translate"; const Introduction = () => { return ( -
+
-
-
+
+
Hippo4j System + {/*
*/}
-

+

{

-
+

@@ -90,21 +91,21 @@ const Introduction = () => {
{/* */} Hippo4j System

-
+
Hippo4j System
-
+

{
{/* */} Hippo4j System
diff --git a/docs/src/css/custom.css b/docs/src/css/custom.css index 8701dc1b..92a830cb 100644 --- a/docs/src/css/custom.css +++ b/docs/src/css/custom.css @@ -11,7 +11,7 @@ @tailwind utilities; @import url("https://fonts.googleapis.com/css2?family=Poppins:wght@200;300;400;500;600;700&display=swap"); - +@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@700&display=swap"); :root { /* See css var + hsl color palette technique: @@ -47,6 +47,9 @@ html[data-theme="dark"] { --ifm-color-primary-lightest: hsl( var(--site-primary-hue-saturation-light) 58% ); + + --ifm-breadcrumb-item-background-active: #0000000d; + --ifm-breadcrumb-color-active: #2160fd; } [data-theme="dark"] { @@ -62,6 +65,9 @@ html[data-theme="dark"] { --ifm-color-primary-lightest: hsl( var(--site-primary-hue-saturation-light) 73% ); + + /* --ifm-breadcrumb-item-background-active: #333333; */ + --ifm-breadcrumb-color-active: #ffffff; } .docusaurus-highlight-code-line { @@ -220,30 +226,36 @@ div[class^="announcementBar_"] { } } -/* Custom by youbo */ +/* Custom */ .bg-cousom { background-position: 50% 65%; } -.bg-svg { - background-color: #ffffff; - background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='192' height='192' viewBox='0 0 192 192'%3E%3Cpath fill='%23c2b9cf' fill-opacity='0.31' d='M192 15v2a11 11 0 0 0-11 11c0 1.94 1.16 4.75 2.53 6.11l2.36 2.36a6.93 6.93 0 0 1 1.22 7.56l-.43.84a8.08 8.08 0 0 1-6.66 4.13H145v35.02a6.1 6.1 0 0 0 3.03 4.87l.84.43c1.58.79 4 .4 5.24-.85l2.36-2.36a12.04 12.04 0 0 1 7.51-3.11 13 13 0 1 1 .02 26 12 12 0 0 1-7.53-3.11l-2.36-2.36a4.93 4.93 0 0 0-5.24-.85l-.84.43a6.1 6.1 0 0 0-3.03 4.87V143h35.02a8.08 8.08 0 0 1 6.66 4.13l.43.84a6.91 6.91 0 0 1-1.22 7.56l-2.36 2.36A10.06 10.06 0 0 0 181 164a11 11 0 0 0 11 11v2a13 13 0 0 1-13-13 12 12 0 0 1 3.11-7.53l2.36-2.36a4.93 4.93 0 0 0 .85-5.24l-.43-.84a6.1 6.1 0 0 0-4.87-3.03H145v35.02a8.08 8.08 0 0 1-4.13 6.66l-.84.43a6.91 6.91 0 0 1-7.56-1.22l-2.36-2.36A10.06 10.06 0 0 0 124 181a11 11 0 0 0-11 11h-2a13 13 0 0 1 13-13c2.47 0 5.79 1.37 7.53 3.11l2.36 2.36a4.94 4.94 0 0 0 5.24.85l.84-.43a6.1 6.1 0 0 0 3.03-4.87V145h-35.02a8.08 8.08 0 0 1-6.66-4.13l-.43-.84a6.91 6.91 0 0 1 1.22-7.56l2.36-2.36A10.06 10.06 0 0 0 107 124a11 11 0 0 0-22 0c0 1.94 1.16 4.75 2.53 6.11l2.36 2.36a6.93 6.93 0 0 1 1.22 7.56l-.43.84a8.08 8.08 0 0 1-6.66 4.13H49v35.02a6.1 6.1 0 0 0 3.03 4.87l.84.43c1.58.79 4 .4 5.24-.85l2.36-2.36a12.04 12.04 0 0 1 7.51-3.11A13 13 0 0 1 81 192h-2a11 11 0 0 0-11-11c-1.94 0-4.75 1.16-6.11 2.53l-2.36 2.36a6.93 6.93 0 0 1-7.56 1.22l-.84-.43a8.08 8.08 0 0 1-4.13-6.66V145H11.98a6.1 6.1 0 0 0-4.87 3.03l-.43.84c-.79 1.58-.4 4 .85 5.24l2.36 2.36a12.04 12.04 0 0 1 3.11 7.51A13 13 0 0 1 0 177v-2a11 11 0 0 0 11-11c0-1.94-1.16-4.75-2.53-6.11l-2.36-2.36a6.93 6.93 0 0 1-1.22-7.56l.43-.84a8.08 8.08 0 0 1 6.66-4.13H47v-35.02a6.1 6.1 0 0 0-3.03-4.87l-.84-.43c-1.59-.8-4-.4-5.24.85l-2.36 2.36A12 12 0 0 1 28 109a13 13 0 1 1 0-26c2.47 0 5.79 1.37 7.53 3.11l2.36 2.36a4.94 4.94 0 0 0 5.24.85l.84-.43A6.1 6.1 0 0 0 47 84.02V49H11.98a8.08 8.08 0 0 1-6.66-4.13l-.43-.84a6.91 6.91 0 0 1 1.22-7.56l2.36-2.36A10.06 10.06 0 0 0 11 28 11 11 0 0 0 0 17v-2a13 13 0 0 1 13 13c0 2.47-1.37 5.79-3.11 7.53l-2.36 2.36a4.94 4.94 0 0 0-.85 5.24l.43.84A6.1 6.1 0 0 0 11.98 47H47V11.98a8.08 8.08 0 0 1 4.13-6.66l.84-.43a6.91 6.91 0 0 1 7.56 1.22l2.36 2.36A10.06 10.06 0 0 0 68 11 11 11 0 0 0 79 0h2a13 13 0 0 1-13 13 12 12 0 0 1-7.53-3.11l-2.36-2.36a4.93 4.93 0 0 0-5.24-.85l-.84.43A6.1 6.1 0 0 0 49 11.98V47h35.02a8.08 8.08 0 0 1 6.66 4.13l.43.84a6.91 6.91 0 0 1-1.22 7.56l-2.36 2.36A10.06 10.06 0 0 0 85 68a11 11 0 0 0 22 0c0-1.94-1.16-4.75-2.53-6.11l-2.36-2.36a6.93 6.93 0 0 1-1.22-7.56l.43-.84a8.08 8.08 0 0 1 6.66-4.13H143V11.98a6.1 6.1 0 0 0-3.03-4.87l-.84-.43c-1.59-.8-4-.4-5.24.85l-2.36 2.36A12 12 0 0 1 124 13a13 13 0 0 1-13-13h2a11 11 0 0 0 11 11c1.94 0 4.75-1.16 6.11-2.53l2.36-2.36a6.93 6.93 0 0 1 7.56-1.22l.84.43a8.08 8.08 0 0 1 4.13 6.66V47h35.02a6.1 6.1 0 0 0 4.87-3.03l.43-.84c.8-1.59.4-4-.85-5.24l-2.36-2.36A12 12 0 0 1 179 28a13 13 0 0 1 13-13zM84.02 143a6.1 6.1 0 0 0 4.87-3.03l.43-.84c.8-1.59.4-4-.85-5.24l-2.36-2.36A12 12 0 0 1 83 124a13 13 0 1 1 26 0c0 2.47-1.37 5.79-3.11 7.53l-2.36 2.36a4.94 4.94 0 0 0-.85 5.24l.43.84a6.1 6.1 0 0 0 4.87 3.03H143v-35.02a8.08 8.08 0 0 1 4.13-6.66l.84-.43a6.91 6.91 0 0 1 7.56 1.22l2.36 2.36A10.06 10.06 0 0 0 164 107a11 11 0 0 0 0-22c-1.94 0-4.75 1.16-6.11 2.53l-2.36 2.36a6.93 6.93 0 0 1-7.56 1.22l-.84-.43a8.08 8.08 0 0 1-4.13-6.66V49h-35.02a6.1 6.1 0 0 0-4.87 3.03l-.43.84c-.79 1.58-.4 4 .85 5.24l2.36 2.36a12.04 12.04 0 0 1 3.11 7.51A13 13 0 1 1 83 68a12 12 0 0 1 3.11-7.53l2.36-2.36a4.93 4.93 0 0 0 .85-5.24l-.43-.84A6.1 6.1 0 0 0 84.02 49H49v35.02a8.08 8.08 0 0 1-4.13 6.66l-.84.43a6.91 6.91 0 0 1-7.56-1.22l-2.36-2.36A10.06 10.06 0 0 0 28 85a11 11 0 0 0 0 22c1.94 0 4.75-1.16 6.11-2.53l2.36-2.36a6.93 6.93 0 0 1 7.56-1.22l.84.43a8.08 8.08 0 0 1 4.13 6.66V143h35.02z'%3E%3C/path%3E%3C/svg%3E"); -} - :root[data-theme="light"] { --hero-image-url: url("../../static/img/hero/hero-removebg.png"); - --hero-bg-url: url("../../static/img/hero/bg.jpg"); + --bg-background-color: #f9fafb; + --bg-background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cg fill='%23bfbfbf' fill-opacity='0.4'%3E%3Cpath fill-rule='evenodd' d='M5 3.59L1.46.05.05 1.46 3.59 5 .05 8.54l1.41 1.41L5 6.41l3.54 3.54 1.41-1.41L6.41 5l3.54-3.54L8.54.05 5 3.59zM17 2h24v2H17V2zm0 4h24v2H17V6zM2 17h2v24H2V17zm4 0h2v24H6V17z'/%3E%3C/g%3E%3C/svg%3E"); } :root[data-theme="dark"] { - --hero-image-url: url("../../static/img/hero/hero.jpg"); - /* --hero-bg-url:url("../../static/img/bg.jpg"); */ + --hero-image-url: url("../../static/img/hero/hero-removebg.png"); + --bg-background-color: #1b1b1d; + --bg-background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cg fill='%239C92AC' fill-opacity='0.4'%3E%3Cpath fill-rule='evenodd' d='M5 3.59L1.46.05.05 1.46 3.59 5 .05 8.54l1.41 1.41L5 6.41l3.54 3.54 1.41-1.41L6.41 5l3.54-3.54L8.54.05 5 3.59zM17 2h24v2H17V2zm0 4h24v2H17V6zM2 17h2v24H2V17zm4 0h2v24H6V17z'/%3E%3C/g%3E%3C/svg%3E"); +} + +.bg-svg { + background-color: var(--bg-background-color); + background-image: var(--bg-background-image); } .hero-img { content: var(--hero-image-url); } -.hero-bg-img { - background-image: var(--hero-bg-url); +.h-custom { + height: 65vh; +} + +.font-jakarta { + font-family: "Plus Jakarta Sans", sans-serif; } diff --git a/docs/src/pages/users.js b/docs/src/pages/users.js index be8b207c..a782dc7f 100644 --- a/docs/src/pages/users.js +++ b/docs/src/pages/users.js @@ -6,39 +6,31 @@ import Translate from "@docusaurus/Translate"; function CompanyCards({ companies }) { return (
- {companies.map((company) => ( -
window.open(company.url)} - key={company.url} - className="bg-white rounded-lg overflow-hidden shadow-sm transform cursor-pointer transition-all duration-500 hover:scale-110" - style={{ border: "1px solid #E5E7EB" }} - > -
-
- {`${company.name}`} { - e.target.style.display = "none"; // Hide the image if it fails to load - e.target.nextSibling.style.display = "flex"; // Show the alt text - }} - /> + {/* Filter out those without a logo. */} + {companies + .filter((comapny) => comapny.logo.length > 0) + .map((company) => ( +
window.open(company.url)} + key={company.url} + // className="bg-white rounded-lg overflow-hidden shadow-sm transform cursor-pointer transition-all duration-500 hover:scale-110" + className="bg-white rounded-lg overflow-hidden shadow-sm transform cursor-pointer transition-all duration-500 hover:scale-110" + style={{ border: "1px solid #E5E7EB" }} + > +
- {company.name} + {`${company.name}`}
-
- ))} + ))}
); } @@ -81,7 +73,7 @@ export default function OurUsers() { {" "} - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + diff --git a/docs/static/img/company_logos/duofriend.png b/docs/static/img/company_logos/duofriend.png index 3fc1dfff..fea60c3f 100644 Binary files a/docs/static/img/company_logos/duofriend.png and b/docs/static/img/company_logos/duofriend.png differ diff --git a/docs/static/img/company_logos/geely.jpg b/docs/static/img/company_logos/geely.jpg index 3655d56c..ca5ce4ee 100644 Binary files a/docs/static/img/company_logos/geely.jpg and b/docs/static/img/company_logos/geely.jpg differ diff --git a/docs/static/img/company_logos/hua-cloud.jpg b/docs/static/img/company_logos/hua-cloud.jpg new file mode 100644 index 00000000..0bb358b9 Binary files /dev/null and b/docs/static/img/company_logos/hua-cloud.jpg differ diff --git a/docs/static/img/company_logos/hua-cloud.png b/docs/static/img/company_logos/hua-cloud.png deleted file mode 100644 index bda7a85c..00000000 Binary files a/docs/static/img/company_logos/hua-cloud.png and /dev/null differ diff --git a/docs/static/img/company_logos/lbdj.png b/docs/static/img/company_logos/lbdj.png deleted file mode 100644 index 80b839cf..00000000 Binary files a/docs/static/img/company_logos/lbdj.png and /dev/null differ diff --git a/docs/static/img/company_logos/lbdj.svg b/docs/static/img/company_logos/lbdj.svg new file mode 100644 index 00000000..e4c5c141 --- /dev/null +++ b/docs/static/img/company_logos/lbdj.svg @@ -0,0 +1,146 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/static/img/company_logos/qyzl.jpg b/docs/static/img/company_logos/qyzl.jpg new file mode 100644 index 00000000..109d1aed Binary files /dev/null and b/docs/static/img/company_logos/qyzl.jpg differ diff --git a/docs/static/img/company_logos/qyzl.png b/docs/static/img/company_logos/qyzl.png deleted file mode 100644 index 98c08793..00000000 Binary files a/docs/static/img/company_logos/qyzl.png and /dev/null differ diff --git a/docs/static/img/company_logos/tophant.png b/docs/static/img/company_logos/tophant.png index 560e9262..570adcd9 100644 Binary files a/docs/static/img/company_logos/tophant.png and b/docs/static/img/company_logos/tophant.png differ diff --git a/docs/static/img/company_logos/uyess.jpg b/docs/static/img/company_logos/uyess.jpg new file mode 100644 index 00000000..63f6c575 Binary files /dev/null and b/docs/static/img/company_logos/uyess.jpg differ diff --git a/docs/static/img/company_logos/ziroom.png b/docs/static/img/company_logos/ziroom.png index c4b650c3..e3b625d4 100644 Binary files a/docs/static/img/company_logos/ziroom.png and b/docs/static/img/company_logos/ziroom.png differ diff --git a/docs/static/img/company_logos/zzltsw.jpg b/docs/static/img/company_logos/zzltsw.jpg new file mode 100644 index 00000000..35eec51e Binary files /dev/null and b/docs/static/img/company_logos/zzltsw.jpg differ diff --git a/docs/static/img/company_logos/zzltsw.png b/docs/static/img/company_logos/zzltsw.png deleted file mode 100644 index e3c05be3..00000000 Binary files a/docs/static/img/company_logos/zzltsw.png and /dev/null differ diff --git a/docs/static/img/introduction/p11.svg b/docs/static/img/introduction/p11.svg new file mode 100644 index 00000000..5286c350 --- /dev/null +++ b/docs/static/img/introduction/p11.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/static/img/introduction/p22.svg b/docs/static/img/introduction/p22.svg new file mode 100644 index 00000000..9a82acb0 --- /dev/null +++ b/docs/static/img/introduction/p22.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/static/img/introduction/p3.svg b/docs/static/img/introduction/p3.svg index b5c179e2..d7078a32 100644 --- a/docs/static/img/introduction/p3.svg +++ b/docs/static/img/introduction/p3.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/docs/static/img/introduction/p33.svg b/docs/static/img/introduction/p33.svg new file mode 100644 index 00000000..cb7e6e12 --- /dev/null +++ b/docs/static/img/introduction/p33.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/static/img/introduction/t2.svg b/docs/static/img/introduction/t2.svg new file mode 100644 index 00000000..6d9f7370 --- /dev/null +++ b/docs/static/img/introduction/t2.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/static/img/introduction/title-image.svg b/docs/static/img/introduction/title-image.svg deleted file mode 100644 index d7078a32..00000000 --- a/docs/static/img/introduction/title-image.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/docs/static/json/company_logo.json b/docs/static/json/company_logo.json index d9b7fafb..8f61fc5b 100644 --- a/docs/static/json/company_logo.json +++ b/docs/static/json/company_logo.json @@ -26,7 +26,7 @@ }, { "name": "轻松到家", - "logo": "", + "logo": "/img/company_logos/uyess.jpg", "url": "http://www.uyess.com/index.html" }, { @@ -41,7 +41,7 @@ }, { "name": "萨科(深圳)科技有限公司", - "logo": "/img/company_logos/lbdj.png", + "logo": "/img/company_logos/lbdj.svg", "url": "https://www.lbdj.com/" }, { @@ -66,8 +66,8 @@ }, { "name": "众合云科(51社保)", - "logo": "", - "url": "https://home.101hr.com/" + "logo": "/img/company_logos/51shebao.png", + "url": "https://www.51shebao.com/?baidupz&guanfang/" }, { "name": "好货云店", @@ -96,7 +96,7 @@ }, { "name": "浙江吉利控股集团有限公司", - "logo": "/img/company_logos/geely.png", + "logo": "/img/company_logos/geely.jpg", "url": "https://www.geely.com/" }, { @@ -111,7 +111,7 @@ }, { "name": "郑州力通水务", - "logo": "/img/company_logos/zzltsw.png", + "logo": "/img/company_logos/zzltsw.jpg", "url": "http://www.zzltsw.com/" }, { @@ -126,7 +126,7 @@ }, { "name": "中新软件(上海)有限公司", - "logo": "", + "logo": "/img/company_logos/5000m.jpg", "url": "http://www.5000m.com" }, { @@ -136,12 +136,12 @@ }, { "name": "兰亭集势(成都)科技有限公司", - "logo": "/img/company_logos/lightinthebox.png", + "logo": "/img/company_logos/lightinthebox.avif", "url": "https://www.lightinthebox.com/" }, { "name": "杭州数理大数据有限公司", - "logo": "", + "logo": "/img/company_logos/data4truth.jpg", "url": "https://www.data4truth.com/#/" }, { @@ -151,7 +151,7 @@ }, { "name": "新华智云科技有限公司", - "logo": "/img/company_logos/xinhuazhiyun.png", + "logo": "/img/company_logos/xinhuazhiyun.svg", "url": "https://www.xinhuazhiyun.com" }, { @@ -161,7 +161,7 @@ }, { "name": "深圳市帮客帮科技有限公司", - "logo": "/img/company_logos/bangkebang.png", + "logo": "/img/company_logos/bangkebang.jpg", "url": "https://www.bangkebang.com" }, { @@ -181,7 +181,7 @@ }, { "name": "广联达科技股份有限公司", - "logo": "/img/company_logos/glodon.png", + "logo": "/img/company_logos/glodon.jpg", "url": "https://www.glodon.com" }, { @@ -201,12 +201,12 @@ }, { "name": "成都全域智旅科技有限公司", - "logo": "/img/company_logos/qyzl.png", + "logo": "/img/company_logos/qyzl.jpg", "url": "http://qyzl.com" }, { "name": "深圳市华云中盛科技股份有限公司", - "logo": "/img/company_logos/hua-cloud.png", + "logo": "/img/company_logos/hua-cloud.jpg", "url": "http://www.hua-cloud.cn" }, { diff --git a/threadpool/console-new/package.json b/threadpool/console-new/package.json index cef35383..3a166404 100644 --- a/threadpool/console-new/package.json +++ b/threadpool/console-new/package.json @@ -4,6 +4,7 @@ "private": true, "dependencies": { "@ahooksjs/use-url-state": "^3.5.1", + "@ant-design/happy-work-theme": "^1.0.0", "@ant-design/icons": "^5.2.6", "@tanem/react-nprogress": "^5.0.51", "@testing-library/jest-dom": "^5.16.5", @@ -13,6 +14,8 @@ "antd": "^5.4.7", "classnames": "^2.3.2", "dayjs": "^1.11.9", + "echarts": "^5.4.3", + "echarts-for-react": "^3.0.2", "i18next": "^23.5.1", "i18next-browser-languagedetector": "^7.1.0", "lodash": "^4.17.21", diff --git a/threadpool/console-new/src/App.tsx b/threadpool/console-new/src/App.tsx index 3dba11da..7ac3dc57 100644 --- a/threadpool/console-new/src/App.tsx +++ b/threadpool/console-new/src/App.tsx @@ -1,3 +1,4 @@ +// import { Suspense } from 'react'; import LayoutCom from './components/layout-com'; import { Routes, Route, Link } from 'react-router-dom'; import routeList from './route'; @@ -5,6 +6,7 @@ import { MenuProps } from 'antd'; import { useTran } from './hooks'; import { STR_MAP } from './config/i18n/locales/constants'; import IconFont from './components/icon'; +import { HappyProvider } from '@ant-design/happy-work-theme'; type MenuItem = Required['items'][number]; @@ -15,19 +17,44 @@ const App = () => { key: STR_MAP.DYNAMIC_THREAD_POOL, icon: , children: [ - { label: {useTran(STR_MAP.THREAD_POOL)}, key: '/thread-poll/index' }, + { + label: {useTran(STR_MAP.THREAD_POOL_MANAGE)}, + key: '/thread-poll/index', + }, ], }, + { + label: {useTran(STR_MAP.TENANT_MANAGE)}, + key: '/tenant', + icon: , + }, + { + label: {useTran(STR_MAP.PROJECT_MANAGE)}, + key: '/item', + icon: , + }, + { + label: {useTran(STR_MAP.USER_MANAGE)}, + key: '/user', + icon: , + }, + { + label: {useTran(STR_MAP.LOG_MANAGE)}, + key: '/log', + icon: , + }, ]; return ( - - - {routeList.map(item => ( - - ))} - - + + + + {routeList.map(item => ( + + ))} + + + ); }; diff --git a/threadpool/console-new/src/components/header/index.tsx b/threadpool/console-new/src/components/header/index.tsx index fdea38d5..8f90676a 100644 --- a/threadpool/console-new/src/components/header/index.tsx +++ b/threadpool/console-new/src/components/header/index.tsx @@ -39,7 +39,7 @@ const HeaderChild = () => { return (
navigate('/home')}> - +
diff --git a/threadpool/console-new/src/components/icon/index.module.less b/threadpool/console-new/src/components/icon/index.module.less new file mode 100644 index 00000000..20361481 --- /dev/null +++ b/threadpool/console-new/src/components/icon/index.module.less @@ -0,0 +1,3 @@ +// .custom-icon { +// color: red !important; +// } \ No newline at end of file diff --git a/threadpool/console-new/src/components/icon/index.tsx b/threadpool/console-new/src/components/icon/index.tsx index fee31ec8..a41d3f8b 100644 --- a/threadpool/console-new/src/components/icon/index.tsx +++ b/threadpool/console-new/src/components/icon/index.tsx @@ -1,15 +1,15 @@ import { createFromIconfontCN } from '@ant-design/icons'; - -interface Props { - type: string; -} +import React from 'react'; +import style from './index.module.less'; const MyIcon = createFromIconfontCN({ - scriptUrl: '//at.alicdn.com/t/c/font_4254722_3l4m6by7h34.js', // 在 iconfont.cn 上生成 + scriptUrl: '//at.alicdn.com/t/c/font_4254722_vw34zn7su2.js', // 在 iconfont.cn 上生成 }); -const IconFont = (props: Props) => { - return ; +type MyComponentProps = React.HTMLProps & { type: string }; + +const IconFont: React.FC = props => { + return ; }; export default IconFont; diff --git a/threadpool/console-new/src/components/with-button/index.tsx b/threadpool/console-new/src/components/with-button/index.tsx new file mode 100644 index 00000000..0ec5c460 --- /dev/null +++ b/threadpool/console-new/src/components/with-button/index.tsx @@ -0,0 +1,27 @@ +import { Button, ButtonProps } from 'antd'; +import React from 'react'; +import { SearchOutlined, PlusOutlined, RedoOutlined } from '@ant-design/icons'; + +function withSearchIconButton

(WrappedComponent: React.ComponentType

) { + return function EnhancedComponent(props: P) { + return } {...props} />; + }; +} + +function withAddIconButton

(WrappedComponent: React.ComponentType

) { + return function EnhancedComponent(props: P) { + return } {...props}>; + }; +} + +function withResetIconButton

(WrappedComponent: React.ComponentType

) { + return function EnhancedComponent(props: P) { + return }>; + }; +} + +export const SearchButton = withSearchIconButton(Button); + +export const AddButton = withAddIconButton(Button); + +export const ResetButton = withResetIconButton(Button); diff --git a/threadpool/console-new/src/config/i18n/locales/constants.ts b/threadpool/console-new/src/config/i18n/locales/constants.ts index 84fe02d5..613fda9d 100644 --- a/threadpool/console-new/src/config/i18n/locales/constants.ts +++ b/threadpool/console-new/src/config/i18n/locales/constants.ts @@ -1,4 +1,5 @@ export enum STR_MAP { + GLOBAL_TITLE = 'globalTitle', DYNAMIC_THREAD_POOL = 'dynamicThreadPool', THREAD_POOL_MANAGE = 'threadPoolManage', PROJECT = 'project', @@ -15,6 +16,21 @@ export enum STR_MAP { EXECUTION_TIMEOUT = 'executionTimeout', ALARM_OR_NOT = 'alarmOrNot', CREATION_TIME = 'creationTime', - UPDATE_TIME = 'update time', + UPDATE_TIME = 'updateTime', EDIT = 'edit', + TENANT_MANAGE = 'tenantManage', + LOG_MANAGE = 'logManage', + PROJECT_MANAGE = 'projectManage', + USER_MANAGE = 'userManage', + LOGIN_SUCCESSFUL = 'loginSuccessful', + USER_INPUT_MESSAGE = 'userInputMessage', + USRE_NAME = 'username', + PASSWORD_INPUT_MESSAGE = 'passwordInputMessage', + REMERBER_PASSWORD = 'rememberPassWord', + FORGOT_PASSWORD = 'forgotPassword', + ACCOUNT_PASSWORD_LOGIN = 'accountPasswordLogin', + PASSWOR = 'password', + LOGIN = 'login', + PHONE_LOGIN = 'phoneLogin', + ALARM_EDITING_SUCCESS = 'alarmEditingSuccess', } diff --git a/threadpool/console-new/src/config/i18n/locales/en.ts b/threadpool/console-new/src/config/i18n/locales/en.ts index ab05675d..978f5e0b 100644 --- a/threadpool/console-new/src/config/i18n/locales/en.ts +++ b/threadpool/console-new/src/config/i18n/locales/en.ts @@ -19,6 +19,22 @@ const enTranslationMap: { [key: string]: string } = { [STR_MAP.CREATION_TIME]: 'creation time', [STR_MAP.UPDATE_TIME]: 'update time', [STR_MAP.EDIT]: 'edit', + [STR_MAP.TENANT_MANAGE]: 'tenant management', + [STR_MAP.PROJECT_MANAGE]: 'project management', + [STR_MAP.USER_MANAGE]: 'user management', + [STR_MAP.LOG_MANAGE]: 'log management', + [STR_MAP.LOGIN_SUCCESSFUL]: 'login successful', + [STR_MAP.USER_INPUT_MESSAGE]: 'please enter your username', + [STR_MAP.USRE_NAME]: 'username', + [STR_MAP.PASSWORD_INPUT_MESSAGE]: 'please enter password', + [STR_MAP.REMERBER_PASSWORD]: 'remember the password', + [STR_MAP.FORGOT_PASSWORD]: 'forgot password', + [STR_MAP.ACCOUNT_PASSWORD_LOGIN]: 'account password login', + [STR_MAP.GLOBAL_TITLE]: `The world's best thread pool management tool`, + [STR_MAP.PASSWOR]: 'password', + [STR_MAP.LOGIN]: 'login', + [STR_MAP.PHONE_LOGIN]: 'Mobile login', + [STR_MAP.ALARM_EDITING_SUCCESS]: 'alarm editing success', }; export default enTranslationMap; diff --git a/threadpool/console-new/src/config/i18n/locales/zh.ts b/threadpool/console-new/src/config/i18n/locales/zh.ts index 05544c3b..5acde9dd 100644 --- a/threadpool/console-new/src/config/i18n/locales/zh.ts +++ b/threadpool/console-new/src/config/i18n/locales/zh.ts @@ -19,6 +19,22 @@ const zhTranslationMap: { [key: string]: string } = { [STR_MAP.CREATION_TIME]: '创建时间', [STR_MAP.UPDATE_TIME]: '更新时间', [STR_MAP.EDIT]: '操作', + [STR_MAP.TENANT_MANAGE]: '租户管理', + [STR_MAP.PROJECT_MANAGE]: '项目管理', + [STR_MAP.USER_MANAGE]: '用户权限', + [STR_MAP.LOG_MANAGE]: '日志管理', + [STR_MAP.LOGIN_SUCCESSFUL]: '登录成功', + [STR_MAP.USER_INPUT_MESSAGE]: '请输入用户名', + [STR_MAP.USRE_NAME]: '用户名', + [STR_MAP.PASSWORD_INPUT_MESSAGE]: '请输入密码', + [STR_MAP.REMERBER_PASSWORD]: '记住密码', + [STR_MAP.FORGOT_PASSWORD]: '忘记密码', + [STR_MAP.ACCOUNT_PASSWORD_LOGIN]: '账号密码登录', + [STR_MAP.GLOBAL_TITLE]: `全球最好用的线程池管理工具`, + [STR_MAP.PASSWOR]: '密码', + [STR_MAP.LOGIN]: '登录', + [STR_MAP.PHONE_LOGIN]: '手机号登录', + [STR_MAP.ALARM_EDITING_SUCCESS]: '报警编辑成功', }; export default zhTranslationMap; diff --git a/threadpool/console-new/src/config/theme/dark-algorithm.ts b/threadpool/console-new/src/config/theme/dark-algorithm.ts index 054da61e..dcd15994 100644 --- a/threadpool/console-new/src/config/theme/dark-algorithm.ts +++ b/threadpool/console-new/src/config/theme/dark-algorithm.ts @@ -22,7 +22,7 @@ export const darkAlgorithm = { // padding: 10, // paddingXS: 5, // margin: 0, - // fontSize: 14, + // cellFontSize: 12, // colorBorderSecondary: darkDefaultTheme.borderColor.bl1, // paddingContentVerticalLG: 4, }, diff --git a/threadpool/console-new/src/config/theme/default-algnorithm.ts b/threadpool/console-new/src/config/theme/default-algnorithm.ts index b22cbcaf..f9c6e766 100644 --- a/threadpool/console-new/src/config/theme/default-algnorithm.ts +++ b/threadpool/console-new/src/config/theme/default-algnorithm.ts @@ -20,17 +20,17 @@ export const defaultAlgorithm = { // padding: 10, // paddingXS: 5, // margin: 0, - // fontSize: 14, + // cellFontSize: 12, // colorBorderSecondary: lightDefaultTheme.borderColor.bl1, // paddingContentVerticalLG: 4, }, Modal: { - borderRadiusLG: 2, - borderRadiusSM: 2, - colorText: lightDefaultTheme.fontColor.fc3, - borderRadius: 2, - paddingContentHorizontalLG: 0, - paddingMD: 0, + // borderRadiusLG: 2, + // borderRadiusSM: 2, + // colorText: lightDefaultTheme.fontColor.fc3, + // borderRadius: 2, + // paddingContentHorizontalLG: 0, + // paddingMD: 0, }, Menu: { itemBg: lightDefaultTheme.backgroundColor.bg1, diff --git a/threadpool/console-new/src/index.tsx b/threadpool/console-new/src/index.tsx index 682dd7f7..f46fb217 100644 --- a/threadpool/console-new/src/index.tsx +++ b/threadpool/console-new/src/index.tsx @@ -1,10 +1,11 @@ -import React from 'react'; +import React, { Suspense } from 'react'; import ReactDOM from 'react-dom/client'; import App from './App'; import { BrowserRouter } from 'react-router-dom'; import { MyStore } from './context'; import './config/i18n'; import 'antd/dist/reset.css'; +import { Spin } from 'antd'; const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement); @@ -14,7 +15,9 @@ root.render( {/* theme context */} {/* theme config context */} - + }> + + diff --git a/threadpool/console-new/src/page/item/create.tsx b/threadpool/console-new/src/page/item/create.tsx new file mode 100644 index 00000000..f04fa140 --- /dev/null +++ b/threadpool/console-new/src/page/item/create.tsx @@ -0,0 +1,108 @@ +import { useRequest } from 'ahooks'; +import { Form, Modal, Input, Select, notification } from 'antd'; +import React, { useEffect } from 'react'; +import { fetchTenantOptions } from '../tenant/service'; +import { fetchAddItem, fetchUpdateItem } from './service'; + +interface IProps { + type: string; + data: any; + visible: boolean; + onClose: () => void; + reset: () => void; +} + +const ItemCreate: React.FC = props => { + const { visible, onClose, data, type, reset } = props; + const [form] = Form.useForm(); + const tenantRequest = useRequest(fetchTenantOptions, { + ready: !!type, + }); + const updateRequest = useRequest(fetchUpdateItem, { + manual: true, + onSuccess: () => { + notification.success({ message: '更新成功' }); + form.resetFields(); + onClose(); + reset(); + }, + onError: err => { + notification.error({ message: err.message }); + }, + }); + const addRequest = useRequest(fetchAddItem, { + manual: true, + onSuccess: () => { + notification.success({ message: '创建成功' }); + form.resetFields(); + onClose(); + reset(); + }, + onError: err => { + notification.error({ message: err.message }); + }, + }); + const onSave = () => { + form + .validateFields() + .then(values => { + addRequest.run({ ...values }); + }) + .catch(info => { + console.log('Validate Failed:', info); + }); + }; + const onUpdate = () => { + form + .validateFields() + .then(values => { + updateRequest.run({ id: data.id, ...values }); + }) + .catch(info => { + console.log('Validate Failed:', info); + }); + }; + useEffect(() => { + if (type === 'edit') { + form.setFieldsValue({ + ...data, + }); + } + }, [type, data, form]); + + return ( + +

+ + + + + + + + + + + + +
+ + ); +}; + +export default ItemCreate; diff --git a/threadpool/console-new/src/page/item/index.tsx b/threadpool/console-new/src/page/item/index.tsx index 8684894a..4d35bac8 100644 --- a/threadpool/console-new/src/page/item/index.tsx +++ b/threadpool/console-new/src/page/item/index.tsx @@ -1,27 +1,41 @@ -import { useAntdTable } from 'ahooks'; -import { Button, Form, Input, Row, Space, Table, Col } from 'antd'; +import { useAntdTable, useRequest } from 'ahooks'; +import { Button, Form, Input, Row, Space, Table, Col, Modal, notification, message } from 'antd'; import { SearchOutlined, EditOutlined } from '@ant-design/icons'; import React, { useState } from 'react'; -import { fetchItemList } from './service'; +import { fetchDeleteItem, fetchItemList } from './service'; import { useUrlSet } from '@/hooks/useUrlSet'; import style from './index.module.less'; +import ItemCreate from './create'; const baseColumns = [ { title: '序号', dataIndex: 'index', + with: 200, }, { title: '租户', dataIndex: 'tenantId', + with: 200, + }, + { + title: '项目', + dataIndex: 'itemId', + with: 200, + }, + { + title: '项目', + dataIndex: 'itemId', }, { title: '项目名称', dataIndex: 'itemName', + with: 200, }, { title: '负责人', dataIndex: 'owner', + with: 200, }, { title: '修改时间', @@ -32,37 +46,54 @@ const baseColumns = [ const Tenant: React.FC = () => { const [editVisible, setEditVisible] = useState(false); const [type, setType] = useState('add'); + const [curItem, setCurItem] = useState({}); const [form] = Form.useForm(); const { setUrl } = useUrlSet({ form }); const { tableProps, search } = useAntdTable(fetchItemList, { form }); - // const {run: delete} = useRequest(fetchDeleteTenant, { manual: true }); + const deleteRequest = useRequest(fetchDeleteItem, { manual: true }); + + const handleSearch = () => { + setUrl(); + search.submit(); + }; + const handleDelete = (item: any) => { + Modal.confirm({ + title: '提示', + content: `此操作将删除 ${item.itemId}, 是否继续?`, + onOk: async () => { + try { + const res = await deleteRequest.runAsync(item.itemId); + if (res && res.success) { + notification.success({ message: '删除成功' }); + search.reset(); + } + } catch (e: any) { + message.error(e.message || '服务器开小差啦~'); + } + }, + }); + }; const actions = (type: string, item?: any) => { switch (type) { case 'add': + setType('add'); setEditVisible(true); break; case 'edit': + setType('edit'); + setCurItem(item); setEditVisible(true); break; case 'delete': - // handleDelete(); + handleDelete(item); break; default: break; } }; - const handleSearch = () => { - setUrl(); - search.submit(); + const handleClose = () => { + setEditVisible(false); }; - // const handleDelete = (item: any) => { - // Modal.confirm({ - // title: `此操作将删除${item.tenantName}, 是否继续?`, - // onOk: () => { - // search.submit(); - // }, - // }); - // }; return (
@@ -70,7 +101,7 @@ const Tenant: React.FC = () => { - + @@ -78,7 +109,7 @@ const Tenant: React.FC = () => { - @@ -91,8 +122,8 @@ const Tenant: React.FC = () => { { - @@ -113,6 +144,15 @@ const Tenant: React.FC = () => { }, ]} /> + {editVisible && ( + search.reset()} + /> + )} ); }; diff --git a/threadpool/console-new/src/page/item/service.ts b/threadpool/console-new/src/page/item/service.ts index cd426860..0e8bbdf9 100644 --- a/threadpool/console-new/src/page/item/service.ts +++ b/threadpool/console-new/src/page/item/service.ts @@ -6,12 +6,6 @@ const fetchItemList = async ( ): Promise<{ total: number; list: Array }> => { const res: any = await request('/hippo4j/v1/cs/item/query/page', { method: 'POST', - headers: { - Authorization: - 'Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiI3LGJhb3hpbnlpX2FkbWluIiwiaXNzIjoiYWRtaW4iLCJleHAiOjE2OTUzOTg4NDksImlhdCI6MTY5NDc5NDA0OSwicm9sIjoiUk9MRV9BRE1JTiJ9.syRDshKpd-xETsSdeMPRtk956f4BJkPt4utVsUl4smgH71Woj8SUq4w2RX1YtGTC4aTZRJYdKOfkTqwK0g_dHQ', - cookie: - 'Admin-Token=Bearer%20eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiI3LGJhb3hpbnlpX2FkbWluIiwiaXNzIjoiYWRtaW4iLCJleHAiOjE2OTUzOTg4NDksImlhdCI6MTY5NDc5NDA0OSwicm9sIjoiUk9MRV9BRE1JTiJ9.syRDshKpd-xETsSdeMPRtk956f4BJkPt4utVsUl4smgH71Woj8SUq4w2RX1YtGTC4aTZRJYdKOfkTqwK0g_dHQ; userName=baoxinyi_admin', - }, body: { ...formData, current: pageProps.current, @@ -25,10 +19,10 @@ const fetchItemList = async ( list: res.data.records.map((item: any, index: number) => ({ index: index + 1, ...item })), }; } - throw new Error(res.msg || '服务器开小差啦~'); + throw new Error(res.message || '服务器开小差啦~'); }; -const fetchAddTenant = async (params: { +const fetchAddItem = async (params: { itemDesc: string; // 项目简介 itemId: string; // 项目 itemName: string; // 项目名称 @@ -37,39 +31,47 @@ const fetchAddTenant = async (params: { tenantDesc?: string; tenantName?: string; }) => { - const res = await request('/hippo4j/v1/cs/tenant/save', { + const res = await request('/hippo4j/v1/cs/item/save', { method: 'POST', body: { ...params }, }); - if (res && res.success) { return res; } - throw new Error(res.msg || '服务器开小差啦~'); + throw new Error(res.message || '服务器开小差啦~'); }; -const fetchDeleteItem = async (id: string) => { - const url = 'hippo4j/v1/cs/item/delete/prescription/' + id; - const res = await request(url, { - method: 'DELETE', +const fetchUpdateItem = async (params: { + id: string; + itemDesc: string; // 项目简介 + itemId: string; // 项目 + itemName: string; // 项目名称 + owner: string; // 负责人 + tenantId: string; // 租户 + tenantDesc?: string; + tenantName?: string; +}) => { + const res = await request('/hippo4j/v1/cs/item/update', { + method: 'POST', + body: { ...params }, }); if (res && res.success) { return res; } - throw new Error(res.msg || '服务器开小差啦~'); + throw new Error(res.message || '服务器开小差啦~'); }; -const fetchUpdateItem = async (id: string) => { - const res = await request('/hippo4j/v1/cs/item/update', { - method: 'POST', - params: { id }, +const fetchDeleteItem = async (id: string) => { + const url = 'hippo4j/v1/cs/item/delete/prescription/' + id; + const res = await request(url, { + method: 'DELETE', }); if (res && res.success) { return res; } - throw new Error(res.msg || '服务器开小差啦~'); + throw new Error(res.message || '服务器开小差啦~'); }; -export { fetchItemList, fetchAddTenant, fetchDeleteItem, fetchUpdateItem }; +export { fetchItemList, fetchAddItem, fetchDeleteItem, fetchUpdateItem }; diff --git a/threadpool/console-new/src/page/log/detail.tsx b/threadpool/console-new/src/page/log/detail.tsx new file mode 100644 index 00000000..fd753f20 --- /dev/null +++ b/threadpool/console-new/src/page/log/detail.tsx @@ -0,0 +1,33 @@ +import { Descriptions, Modal } from 'antd'; +import React from 'react'; + +const LogDetail: React.FC<{ + data: any; + visible: boolean; + onClose: () => void; +}> = props => { + const { visible, onClose, data } = props; + return ( + + + + {data.category} + + + {data.bizNo} + + + {data.operator} + + + {data.createTime} + + + {data.action} + + + + ); +}; + +export default LogDetail; diff --git a/threadpool/console-new/src/page/log/index.tsx b/threadpool/console-new/src/page/log/index.tsx index a7c0b23f..eb120e05 100644 --- a/threadpool/console-new/src/page/log/index.tsx +++ b/threadpool/console-new/src/page/log/index.tsx @@ -1,85 +1,90 @@ import { useAntdTable } from 'ahooks'; -import { Button, Form, Input, Row, Space, Table, Col, Modal } from 'antd'; -import { SearchOutlined, EditOutlined } from '@ant-design/icons'; +import { Button, Form, Input, Row, Space, Table, Col } from 'antd'; +import { SearchOutlined, RedoOutlined } from '@ant-design/icons'; import React, { useState } from 'react'; -import { fetchTenantList } from './service'; +import { fetchLogList } from './service'; import { useUrlSet } from '@/hooks/useUrlSet'; import style from './index.module.less'; +import LogDetail from './detail'; const baseColumns = [ { title: '序号', dataIndex: 'id', + width: 100, + // fixed: 'left', }, { - title: '租户', - dataIndex: 'tenantId', + title: '业务类型', + dataIndex: 'category', + width: 200, }, { - title: '租户名称', - dataIndex: 'tenantName', + title: '业务标识', + dataIndex: 'bizNo', + width: 380, }, { - title: '负责人', - dataIndex: 'owner', + title: '日志内容', + dataIndex: 'action', + width: 380, }, { - title: '修改时间', - dataIndex: 'gmtModified', + title: '操作人', + dataIndex: 'operator', + width: 100, + }, + { + title: '操作时间', + dataIndex: 'createTime', + width: 200, }, ]; const Tenant: React.FC = () => { - const [editVisible, setEditVisible] = useState(false); - const [type, setType] = useState('add'); + const [visible, setVisible] = useState(false); const [form] = Form.useForm(); const { setUrl } = useUrlSet({ form }); - const { tableProps, search } = useAntdTable(fetchTenantList, { form }); - // const {run: delete} = useRequest(fetchDeleteTenant, { manual: true }); - const actions = (type: string, item?: any) => { - switch (type) { - case 'add': - setEditVisible(true); - break; - case 'edit': - setEditVisible(true); - break; - case 'delete': - // handleDelete(); - break; - default: - break; - } - }; + const { tableProps, search } = useAntdTable(fetchLogList, { form }); + const [curItems, setCurItems] = useState({}); const handleSearch = () => { setUrl(); search.submit(); }; - // const handleDelete = (item: any) => { - // Modal.confirm({ - // title: `此操作将删除${item.tenantName}, 是否继续?`, - // onOk: () => { - // search.submit(); - // }, - // }); - // }; + const handleDetail = (item: any) => { + setVisible(!visible); + setCurItems(item); + }; + const handleClose = () => { + setVisible(false); + }; return (
-
- - + + + - + + + + + + + + + + + - @@ -91,28 +96,26 @@ const Tenant: React.FC = () => {
{ return ( - - - - + ); }, }, ]} /> + ); }; diff --git a/threadpool/console-new/src/page/log/service.ts b/threadpool/console-new/src/page/log/service.ts index 2fab1ef7..d135380c 100644 --- a/threadpool/console-new/src/page/log/service.ts +++ b/threadpool/console-new/src/page/log/service.ts @@ -1,79 +1,24 @@ import request from '@/utils'; -const fetchTenantList = async ( +const fetchLogList = async ( pageProps: { current: number; pageSize: number }, - formData: { tencent: string | number } + formData: { category: string | number; bizNo: string; operator: string } ): Promise<{ total: number; list: Array }> => { - const res: any = await request('/hippo4j/v1/cs/tenant/query/page', { + const res: any = await request('/hippo4j/v1/cs/log/query/page', { method: 'POST', - headers: { - Authorization: - 'Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiI3LGJhb3hpbnlpX2FkbWluIiwiaXNzIjoiYWRtaW4iLCJleHAiOjE2OTUzOTg4NDksImlhdCI6MTY5NDc5NDA0OSwicm9sIjoiUk9MRV9BRE1JTiJ9.syRDshKpd-xETsSdeMPRtk956f4BJkPt4utVsUl4smgH71Woj8SUq4w2RX1YtGTC4aTZRJYdKOfkTqwK0g_dHQ', - cookie: - 'Admin-Token=Bearer%20eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiI3LGJhb3hpbnlpX2FkbWluIiwiaXNzIjoiYWRtaW4iLCJleHAiOjE2OTUzOTg4NDksImlhdCI6MTY5NDc5NDA0OSwicm9sIjoiUk9MRV9BRE1JTiJ9.syRDshKpd-xETsSdeMPRtk956f4BJkPt4utVsUl4smgH71Woj8SUq4w2RX1YtGTC4aTZRJYdKOfkTqwK0g_dHQ; userName=baoxinyi_admin', - }, body: { ...formData, current: pageProps.current, size: pageProps.pageSize, - desc: true, }, }); if (res && res.success) { return { total: res.data.total, - list: res.data.records, + list: res.data.records.map((item: any, index: number) => ({ id: index + 1, ...item })), }; } throw new Error(res.msg || '服务器开小差啦~'); }; -const fetchAddTenant = async (id: string) => { - const res = await request('/hippo4j/v1/cs/tenant/save', { - method: 'POST', - params: { id }, - }); - - if (res && res.success) { - return res; - } - throw new Error(res.msg || '服务器开小差啦~'); -}; - -const fetchDeleteTenant = async (id: string) => { - const res = await request('/tenants', { - method: 'POST', - params: { id }, - }); - - if (res && res.success) { - return res; - } - throw new Error(res.msg || '服务器开小差啦~'); -}; - -const fetchUpdateTenant = async (id: string) => { - const res = await request('hippo4j/v1/cs/tenant/update', { - method: 'POST', - params: { id }, - }); - - if (res && res.success) { - return res; - } - throw new Error(res.msg || '服务器开小差啦~'); -}; - -const fetchTenantDetail = async (id: string) => { - const res = await request('/tenants', { - method: 'POST', - params: { id }, - }); - - if (res && res.success) { - return res; - } - throw new Error(res.msg || '服务器开小差啦~'); -}; - -export { fetchTenantList, fetchAddTenant, fetchDeleteTenant, fetchUpdateTenant, fetchTenantDetail }; +export { fetchLogList }; diff --git a/threadpool/console-new/src/page/login/index.tsx b/threadpool/console-new/src/page/login/index.tsx index 60348ad0..b35443b1 100644 --- a/threadpool/console-new/src/page/login/index.tsx +++ b/threadpool/console-new/src/page/login/index.tsx @@ -6,6 +6,8 @@ import style from './index.module.less'; import { useRequest } from 'ahooks'; import { setToken } from '@/utils'; import { useNavigate } from 'react-router-dom'; +import { STR_MAP } from '@/config/i18n/locales/constants'; +import { useTranslation } from 'react-i18next'; const { Paragraph } = Typography; @@ -19,12 +21,13 @@ const Login = () => { const navigate = useNavigate(); const { validateFields } = form; const [remenberMe, setRemenberMe] = useState(0); + const { t } = useTranslation(); const { run, loading } = useRequest(service.fetchLogin, { manual: true, onSuccess: res => { if (res) { - message.success('登陆成功'); + message.success(t(STR_MAP.LOGIN_SUCCESSFUL)); navigate('/thread-poll/index'); setToken(res?.data); } @@ -54,12 +57,12 @@ const Login = () => { rules={[ { required: true, - message: '请输入用户名!', + message: t(STR_MAP.USER_INPUT_MESSAGE), }, ]} > } size="large" allowClear @@ -71,12 +74,12 @@ const Login = () => { rules={[ { required: true, - message: '请输入密码!', + message: t(STR_MAP.PASSWORD_INPUT_MESSAGE), }, ]} > } size="large" allowClear @@ -91,9 +94,9 @@ const Login = () => { setRemenberMe(e.target.checked ? 1 : 0); }} > - 记住密码 + {t(STR_MAP.REMERBER_PASSWORD)} - + {t(STR_MAP.FORGOT_PASSWORD)} @@ -105,23 +108,23 @@ const Login = () => { onClick={handleLogin} loading={loading} > - 登陆 + {t(STR_MAP.LOGIN)} ), - [form, loading, handleLogin] + [form, loading, handleLogin, t] ); const items: TabsProps['items'] = [ { key: TABS_KEY.LOGIN, - label: '账号密码登陆', + label: t(STR_MAP.ACCOUNT_PASSWORD_LOGIN), children: formNode, }, { key: TABS_KEY.PHONE, - label: '手机号登陆', + label: t(STR_MAP.PHONE_LOGIN), children: formNode, }, ]; @@ -132,7 +135,7 @@ const Login = () => {
- 全球最好用的线程池管理工具 + {t(STR_MAP.GLOBAL_TITLE)}
diff --git a/threadpool/console-new/src/page/tenant/create.tsx b/threadpool/console-new/src/page/tenant/create.tsx new file mode 100644 index 00000000..ee4c065e --- /dev/null +++ b/threadpool/console-new/src/page/tenant/create.tsx @@ -0,0 +1,96 @@ +import { useRequest } from 'ahooks'; +import { Form, Modal, Input, notification } from 'antd'; +import React, { useEffect } from 'react'; +import { fetchAddTenant, fetchUpdateTenant } from './service'; + +interface IProps { + type: string; + data: any; + visible: boolean; + onClose: () => void; + reset: () => void; +} + +const TenantCreate: React.FC = props => { + const { visible, onClose, data, type, reset } = props; + const [form] = Form.useForm(); + const updateRequest = useRequest(fetchUpdateTenant, { + manual: true, + onSuccess: () => { + notification.success({ message: '更新成功' }); + form.resetFields(); + onClose(); + reset(); + }, + onError: err => { + notification.error({ message: err.message }); + }, + }); + const addRequest = useRequest(fetchAddTenant, { + manual: true, + onSuccess: () => { + notification.success({ message: '创建成功' }); + form.resetFields(); + onClose(); + reset(); + }, + onError: err => { + notification.error({ message: err.message }); + }, + }); + const onSave = () => { + form + .validateFields() + .then(values => { + addRequest.run({ ...values }); + }) + .catch(info => { + console.log('Validate Failed:', info); + }); + }; + const onUpdate = () => { + form + .validateFields() + .then(values => { + updateRequest.run({ id: data.id, ...values }); + }) + .catch(info => { + console.log('Validate Failed:', info); + }); + }; + useEffect(() => { + if (type === 'edit') { + form.setFieldsValue({ + ...data, + }); + } + }, [type, data, form]); + + return ( + +
+ + + + + + + + + + + + + +
+ ); +}; + +export default TenantCreate; diff --git a/threadpool/console-new/src/page/tenant/index.tsx b/threadpool/console-new/src/page/tenant/index.tsx index 0d80beff..1651531c 100644 --- a/threadpool/console-new/src/page/tenant/index.tsx +++ b/threadpool/console-new/src/page/tenant/index.tsx @@ -1,16 +1,16 @@ import React, { useState } from 'react'; -import { useAntdTable } from 'ahooks'; -import { Button, Form, Input, Row, Space, Table, Col, Modal } from 'antd'; +import { useAntdTable, useRequest } from 'ahooks'; +import { Button, Form, Input, Row, Space, Table, Col, Modal, notification, message } from 'antd'; import { SearchOutlined, EditOutlined } from '@ant-design/icons'; import { useUrlSet } from '@/hooks/useUrlSet'; -import { fetchTenantList } from './service'; - +import { fetchDeleteTenant, fetchTenantList } from './service'; import style from './index.module.less'; +import TenantCreate from './create'; const baseColumns = [ { title: '序号', - dataIndex: 'id', + dataIndex: 'index', }, { title: '租户', @@ -32,38 +32,55 @@ const baseColumns = [ const Tenant: React.FC = () => { const [editVisible, setEditVisible] = useState(false); + const [curItem, setCurItem] = useState({}); const [type, setType] = useState('add'); const [form] = Form.useForm(); const { setUrl } = useUrlSet({ form }); const { tableProps, search } = useAntdTable(fetchTenantList, { form }); - // const {run: delete} = useRequest(fetchDeleteTenant, { manual: true }); + const deleteRequest = useRequest(fetchDeleteTenant, { manual: true }); + + const handleSearch = () => { + setUrl(); + search.submit(); + }; + const handleDelete = (item: any) => { + Modal.confirm({ + title: '提示', + content: `此操作将删除 ${item.tenantId},是否继续?`, + onOk: async () => { + try { + const res = await deleteRequest.runAsync(item.tenantId); + if (res && res.success) { + notification.success({ message: '删除成功' }); + search.reset(); + } + } catch (e: any) { + message.error(e.message || '服务器开小差啦~'); + } + }, + }); + }; const actions = (type: string, item?: any) => { switch (type) { case 'add': + setType('add'); setEditVisible(true); break; case 'edit': + setType('edit'); + setCurItem(item); setEditVisible(true); break; case 'delete': - // handleDelete(); + handleDelete(item); break; default: break; } }; - const handleSearch = () => { - setUrl(); - search.submit(); + const handleClose = () => { + setEditVisible(false); }; - // const handleDelete = (item: any) => { - // Modal.confirm({ - // title: `此操作将删除${item.tenantName}, 是否继续?`, - // onOk: () => { - // search.submit(); - // }, - // }); - // }; return (
@@ -71,7 +88,7 @@ const Tenant: React.FC = () => {
- + @@ -79,7 +96,7 @@ const Tenant: React.FC = () => { - @@ -92,7 +109,6 @@ const Tenant: React.FC = () => {
{ - @@ -114,6 +130,15 @@ const Tenant: React.FC = () => { }, ]} /> + {editVisible && ( + search.reset()} + /> + )} ); }; diff --git a/threadpool/console-new/src/page/tenant/service.ts b/threadpool/console-new/src/page/tenant/service.ts index 2fab1ef7..31dfc940 100644 --- a/threadpool/console-new/src/page/tenant/service.ts +++ b/threadpool/console-new/src/page/tenant/service.ts @@ -1,17 +1,27 @@ import request from '@/utils'; +const fetchTenantOptions = async (tencent: string) => { + const res: any = await request('/hippo4j/v1/cs/tenant/query/page', { + method: 'POST', + body: { + tencent, + current: 1, + size: 10, + desc: true, + }, + }); + if (res && res.success) { + return res.data && res.data.records.map((item: any) => ({ value: item.tenantId, label: item.tenantId })); + } + throw new Error(res.message || '服务器开小差啦~'); +}; + const fetchTenantList = async ( pageProps: { current: number; pageSize: number }, formData: { tencent: string | number } ): Promise<{ total: number; list: Array }> => { const res: any = await request('/hippo4j/v1/cs/tenant/query/page', { method: 'POST', - headers: { - Authorization: - 'Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiI3LGJhb3hpbnlpX2FkbWluIiwiaXNzIjoiYWRtaW4iLCJleHAiOjE2OTUzOTg4NDksImlhdCI6MTY5NDc5NDA0OSwicm9sIjoiUk9MRV9BRE1JTiJ9.syRDshKpd-xETsSdeMPRtk956f4BJkPt4utVsUl4smgH71Woj8SUq4w2RX1YtGTC4aTZRJYdKOfkTqwK0g_dHQ', - cookie: - 'Admin-Token=Bearer%20eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiI3LGJhb3hpbnlpX2FkbWluIiwiaXNzIjoiYWRtaW4iLCJleHAiOjE2OTUzOTg4NDksImlhdCI6MTY5NDc5NDA0OSwicm9sIjoiUk9MRV9BRE1JTiJ9.syRDshKpd-xETsSdeMPRtk956f4BJkPt4utVsUl4smgH71Woj8SUq4w2RX1YtGTC4aTZRJYdKOfkTqwK0g_dHQ; userName=baoxinyi_admin', - }, body: { ...formData, current: pageProps.current, @@ -22,58 +32,53 @@ const fetchTenantList = async ( if (res && res.success) { return { total: res.data.total, - list: res.data.records, + list: res.data.records.map((item: any, index: number) => ({ index: index + 1, ...item })), }; } - throw new Error(res.msg || '服务器开小差啦~'); + throw new Error(res.message || '服务器开小差啦~'); }; -const fetchAddTenant = async (id: string) => { +const fetchAddTenant = async (params: { + tenantDesc: string; // 项目简介 + tenantId: string; // 项目 + tenantName: string; // 项目名称 + owner: string; // 负责人 +}) => { const res = await request('/hippo4j/v1/cs/tenant/save', { method: 'POST', - params: { id }, + body: { ...params }, }); - if (res && res.success) { return res; } - throw new Error(res.msg || '服务器开小差啦~'); + throw new Error(res.message || '服务器开小差啦~'); }; -const fetchDeleteTenant = async (id: string) => { - const res = await request('/tenants', { - method: 'POST', - params: { id }, - }); - - if (res && res.success) { - return res; - } - throw new Error(res.msg || '服务器开小差啦~'); -}; - -const fetchUpdateTenant = async (id: string) => { +const fetchUpdateTenant = async (params: { + tenantDesc: string; // 项目简介 + tenantId: string; // 项目 + tenantName: string; // 项目名称 + owner: string; // 负责人 +}) => { const res = await request('hippo4j/v1/cs/tenant/update', { method: 'POST', - params: { id }, + body: { ...params }, }); - if (res && res.success) { return res; } - throw new Error(res.msg || '服务器开小差啦~'); + throw new Error(res.message || '服务器开小差啦~'); }; -const fetchTenantDetail = async (id: string) => { - const res = await request('/tenants', { - method: 'POST', - params: { id }, +const fetchDeleteTenant = async (id: string) => { + const url = 'hippo4j/v1/cs/item/delete/prescription/' + id; + const res = await request(url, { + method: 'DELETE', }); - if (res && res.success) { return res; } - throw new Error(res.msg || '服务器开小差啦~'); + throw new Error(res.message || '服务器开小差啦~'); }; -export { fetchTenantList, fetchAddTenant, fetchDeleteTenant, fetchUpdateTenant, fetchTenantDetail }; +export { fetchTenantOptions, fetchTenantList, fetchAddTenant, fetchDeleteTenant, fetchUpdateTenant }; diff --git a/threadpool/console-new/src/page/thread-pool-monitor/index.module.less b/threadpool/console-new/src/page/thread-pool-monitor/index.module.less new file mode 100644 index 00000000..e69de29b diff --git a/threadpool/console-new/src/page/thread-pool-monitor/index.tsx b/threadpool/console-new/src/page/thread-pool-monitor/index.tsx new file mode 100644 index 00000000..ee7f0f2b --- /dev/null +++ b/threadpool/console-new/src/page/thread-pool-monitor/index.tsx @@ -0,0 +1,34 @@ +import * as echarts from 'echarts/core'; +import { GridComponent } from 'echarts/components'; +import { LineChart } from 'echarts/charts'; +import { UniversalTransition } from 'echarts/features'; +import { CanvasRenderer } from 'echarts/renderers'; +import { useEffect } from 'react'; +echarts.use([GridComponent, LineChart, CanvasRenderer, UniversalTransition]); + +const ThreadPoolMonitor = () => { + useEffect(() => { + let chartDom = document.getElementById('main'); + let myChart = echarts.init(chartDom); + let option; + option = { + xAxis: { + type: 'category', + data: ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'], + }, + yAxis: { + type: 'value', + }, + series: [ + { + data: [150, 230, 224, 218, 135, 147, 260], + type: 'line', + }, + ], + }; + option && myChart.setOption(option); + }); + return
; +}; + +export default ThreadPoolMonitor; diff --git a/threadpool/console-new/src/page/thread-pool-monitor/router.ts b/threadpool/console-new/src/page/thread-pool-monitor/router.ts new file mode 100644 index 00000000..13e1e53b --- /dev/null +++ b/threadpool/console-new/src/page/thread-pool-monitor/router.ts @@ -0,0 +1,11 @@ +import { IRouterList } from '@/typings'; +import ThreadPoolMonitor from '.'; + +const routerList: IRouterList[] = [ + { + path: '/echarts', + component: ThreadPoolMonitor, + }, +]; + +export default routerList; diff --git a/threadpool/console-new/src/page/thread-pool/constants.ts b/threadpool/console-new/src/page/thread-pool/constants.ts new file mode 100644 index 00000000..8ed76cdf --- /dev/null +++ b/threadpool/console-new/src/page/thread-pool/constants.ts @@ -0,0 +1,23 @@ +export const QUEUE_TYPE_MAP: { [key: string]: string } = { + '1': 'ArrayBlockingQueue', + '2': 'LinkedBlockingQueue', + '3': 'LinkedBlockingDeque', + '4': 'SynchronousQueue', + '5': 'LinkedTransferQueue', + '6': 'PriorityBlockingQueue', + '9': 'ResizableLinkedBlockingQueue', +}; + +export const REJECT_TYPE_MAP: { [key: string]: string } = { + '1': 'CallerRunsPolicy', + '2': 'AbortPolicy', + '3': 'DiscardPolicy', + '4': 'DiscardOldestPolicy', + '5': 'RunsOldestTaskPolicy', + '6': 'SyncPutQueuePolicy', +}; + +export const paramsType = { project: 0, thpool: 0 }; +export const eBtnStyle = { + padding: '0 6px', +}; diff --git a/threadpool/console-new/src/page/thread-pool/index.tsx b/threadpool/console-new/src/page/thread-pool/index.tsx index ed2dc227..4072244f 100644 --- a/threadpool/console-new/src/page/thread-pool/index.tsx +++ b/threadpool/console-new/src/page/thread-pool/index.tsx @@ -1,73 +1,162 @@ -import { Button, Form, Select, Space, Table, Typography } from 'antd'; +import { Button, Form, Select, Space, Switch, Table, Typography, message } from 'antd'; import { useFormStateToUrl, useTran } from '@/hooks'; import { STR_MAP } from '@/config/i18n/locales/constants'; import { ColumnProps } from 'antd/es/table'; +import { SearchButton, AddButton } from '@/components/with-button'; +import { useAntdTable } from 'ahooks'; +import service from './service'; +import { Result, Record } from './type'; +import { QUEUE_TYPE_MAP, REJECT_TYPE_MAP, eBtnStyle, paramsType } from './constants'; +import { useTranslation } from 'react-i18next'; +import request from '@/utils'; const { Title } = Typography; const { Item } = Form; -const params = { project: 0, thpool: 0 }; +interface CustomTableParams { + pageSize: number; + current: number; + tpId: string; + itemId: string; +} + const ThreadPoll = () => { const [form] = Form.useForm(); - const { handleSetUrlState } = useFormStateToUrl<{ project: number; thpool: number }>(form, params); - const columns: ColumnProps[] = [ + const { handleSetUrlState } = useFormStateToUrl<{ project: number; thpool: number }>(form, paramsType); + const { t } = useTranslation(); + + const columns: ColumnProps[] = [ { title: useTran(STR_MAP.SERIAL_NUMBER), - dataIndex: 'order', + dataIndex: '', + render: (col, num, index) => { + return index + 1; + }, + fixed: 'left', + width: 80, }, { title: useTran(STR_MAP.PROJECT), - dataIndex: 'project', + dataIndex: 'tenantId', + width: 150, }, { - title: useTran(STR_MAP.TENANTRY), - dataIndex: 'tenantry', + title: useTran(STR_MAP.THREAD_POOL), + dataIndex: 'tpId', + width: 150, }, { - title: useTran(STR_MAP.THREAD_POOL), - dataIndex: 'thread_pool', + title: useTran(STR_MAP.CORE_THREAD), + dataIndex: 'coreSize', + render: col => {col}, + width: 100, }, { title: useTran(STR_MAP.MAXIMUM_THREAD), - dataIndex: 'maximum_thread', + dataIndex: 'maxSize', + render: col => {col}, + width: 100, }, { title: useTran(STR_MAP.QUEUE_TYPE), - dataIndex: 'queue_type', + dataIndex: 'queueType', + render: (col: number) => QUEUE_TYPE_MAP[String(col)], + width: 150, + }, + { + title: useTran(STR_MAP.QUEUE_CAPACITY), + dataIndex: 'capacity', + width: 150, }, { title: useTran(STR_MAP.REJECTION_STRATEGY), - dataIndex: 'tenantry', + dataIndex: 'rejectedType', + render: (col: number) => REJECT_TYPE_MAP[String(col)] ?? 'CustomRejectedPolicy_' + col, + width: 150, }, { title: useTran(STR_MAP.EXECUTION_TIMEOUT), - dataIndex: 'tenantry', + dataIndex: 'executeTimeOut', + render: (col: number) => col ?? 0, + width: 100, }, { title: useTran(STR_MAP.ALARM_OR_NOT), - dataIndex: 'tenantry', + dataIndex: 'isAlarm', + render: (col: number, row) => ( + handleAlarm({ id: row?.id, alarm: Number(!col) })} /> + ), + width: 100, }, { title: useTran(STR_MAP.CREATION_TIME), - dataIndex: 'tenantry', + dataIndex: 'gmtCreate', + width: 150, + align: 'center', }, { title: useTran(STR_MAP.UPDATE_TIME), - dataIndex: 'tenantry', + dataIndex: 'gmtModified', + width: 150, + align: 'center', }, { title: useTran(STR_MAP.EDIT), - dataIndex: 'tenantry', + dataIndex: 'eidt', + fixed: 'right', + width: 150, + render: () => ( + <> + + + + ), }, ]; - const handleSubmit = () => { - handleSetUrlState(); + const getTableData = (params: CustomTableParams): Promise => { + const { pageSize, current } = params; + return service.fetchThreadPoolTable({ + current, + size: pageSize, + tpId: '', + itemId: '', + }); + }; + + const { tableProps, search } = useAntdTable(getTableData, { + defaultPageSize: 5, + form: form, + }); + + const { submit } = search; + + const handleAlarm = async (params: { id: string; alarm: number }) => { + const { id, alarm } = params; + request(`/hippo4j/v1/cs/thread/pool/alarm/enable/${id}/${alarm}`, { + method: 'post', + }) + .then(res => { + if (res.success) { + message.success(t(STR_MAP.ALARM_EDITING_SUCCESS)); + submit(); + } + }) + .catch(err => { + console.log('err:::', err); + }); }; return ( - - {useTran(STR_MAP.THREAD_POOL)} + + {useTran(STR_MAP.THREAD_POOL_MANAGE)}
+ + + @@ -76,14 +165,21 @@ const ThreadPoll = () => { - - + + {useTran(STR_MAP.ADD)} -
+
); }; diff --git a/threadpool/console-new/src/page/thread-pool/service.ts b/threadpool/console-new/src/page/thread-pool/service.ts new file mode 100644 index 00000000..c1fd99c4 --- /dev/null +++ b/threadpool/console-new/src/page/thread-pool/service.ts @@ -0,0 +1,17 @@ +import request from '@/utils'; +import { Result, ThreadPoolTableBody, ThreadPoolTableRes } from './type'; + +const fetchThreadPoolTable = async (body: ThreadPoolTableBody): Promise => { + const { data } = await request('/hippo4j/v1/cs/thread/pool/query/page', { + method: 'POST', + body, + }); + return { + total: data?.total, + list: data?.records, + }; +}; + +export default { + fetchThreadPoolTable, +}; diff --git a/threadpool/console-new/src/page/thread-pool/type.ts b/threadpool/console-new/src/page/thread-pool/type.ts new file mode 100644 index 00000000..2be9b23b --- /dev/null +++ b/threadpool/console-new/src/page/thread-pool/type.ts @@ -0,0 +1,123 @@ +import { Params } from 'ahooks/lib/useAntdTable/types'; + +// body +export interface ThreadPoolTableBody { + /** + * current page + */ + current: number; + /** + * project id + */ + itemId?: string; + /** + * page size + */ + size: number; + /** + *tenant Id + */ + tenantId?: string; + /** + * thread pool ID + */ + tpId?: string; +} + +export interface Record { + /** + * 是否超时 + */ + allowCoreThreadTimeOut?: number; + /** + * 队列容量 + */ + capacity?: number; + /** + * 容量报警 + */ + capacityAlarm?: number; + /** + * 核心线程数 + */ + coreSize?: number; + /** + * 执行超市 + */ + executeTimeOut?: number; + /** + * 创建时间 + */ + gmtCreate?: string; + /** + * 修改时间 + */ + gmtModified?: string; + /** + * ID + */ + id: string; + /** + * 是否报警 + */ + isAlarm?: number; + /** + * 项目ID + */ + itemId?: string; + /** + * 空闲回收 + */ + keepAliveTime?: number; + /** + * 活跃度报警 + */ + livenessAlarm?: number; + /** + * 最大线程数 + */ + maxSize?: number; + /** + * 队列名称 + */ + queueName?: null; + /** + * 队列类型 + */ + queueType?: number; + /** + * 拒绝策略类型 + */ + rejectedType?: number; + /** + * 租户ID + */ + tenantId?: string; + /** + * 线程池ID + */ + tpId?: string; +} + +export interface ThreadPoolTableRes { + countId: null; + current: number; + desc: boolean; + hitCount: boolean; + itemId: string; + maxLimit: null; + optimizeCountSql: boolean; + orders: string[]; + pages: number; + records: Record[]; + searchCount: boolean; + size: number; + tenantId: string; + total: number; + tpId: string; +} + +export interface Result { + total: number; + list: Record[]; +} diff --git a/threadpool/console-new/src/page/user/create.tsx b/threadpool/console-new/src/page/user/create.tsx new file mode 100644 index 00000000..6a397a3b --- /dev/null +++ b/threadpool/console-new/src/page/user/create.tsx @@ -0,0 +1,115 @@ +import { useRequest } from 'ahooks'; +import { Form, Modal, Input, notification, Select, Checkbox, message } from 'antd'; +import React, { useEffect } from 'react'; +import { fetchAddUser, fetchUpdateUser } from './service'; +import { fetchTenantOptions } from '../tenant/service'; + +interface IProps { + type: string; + data: any; + visible: boolean; + onClose: () => void; + reset: () => void; +} + +const ROLE_OPTIONS = [ + { + label: 'ROLE_USER', + value: 'ROLE_USER', + }, + { + label: 'ROLE_ADMIN', + value: 'ROLE_ADMIN', + }, + { + label: 'ROLE_MANAGE', + value: 'ROLE_MANAGE', + }, +]; + +const UserCreate: React.FC = props => { + const { visible, onClose, data, type, reset } = props; + const [form] = Form.useForm(); + const tenantRequest = useRequest(fetchTenantOptions, { + ready: !!type, + }); + const updateRequest = useRequest(fetchUpdateUser, { + manual: true, + onSuccess: () => { + notification.success({ message: '更新成功' }); + form.resetFields(); + onClose(); + reset(); + }, + onError: err => { + message.error(err.message); + }, + }); + const addRequest = useRequest(fetchAddUser, { + manual: true, + onSuccess: () => { + notification.success({ message: '创建成功' }); + form.resetFields(); + onClose(); + reset(); + }, + onError: err => { + message.error(err.message); + }, + }); + const onSave = () => { + form + .validateFields() + .then(values => { + addRequest.run({ ...values }); + }) + .catch(info => { + console.log('Validate Failed:', info); + }); + }; + const onUpdate = () => { + form + .validateFields() + .then(values => { + updateRequest.run({ id: data.id, ...values }); + }) + .catch(info => { + console.log('Validate Failed:', info); + }); + }; + useEffect(() => { + if (type === 'edit') { + form.setFieldsValue({ + ...data, + }); + } + }, [type, data, form]); + + return ( + +
+ + + + + + + + + @@ -78,7 +96,7 @@ const Tenant: React.FC = () => { - @@ -91,7 +109,6 @@ const Tenant: React.FC = () => {
{ - @@ -113,6 +135,15 @@ const Tenant: React.FC = () => { }, ]} /> + {editVisible && ( + search.reset()} + /> + )} ); }; diff --git a/threadpool/console-new/src/page/user/service.ts b/threadpool/console-new/src/page/user/service.ts index 51e68bff..6c9c5e33 100644 --- a/threadpool/console-new/src/page/user/service.ts +++ b/threadpool/console-new/src/page/user/service.ts @@ -6,12 +6,6 @@ const fetchUserList = async ( ): Promise<{ total: number; list: Array }> => { const res: any = await request('/hippo4j/v1/cs/auth/users/page', { method: 'POST', - headers: { - Authorization: - 'Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiI3LGJhb3hpbnlpX2FkbWluIiwiaXNzIjoiYWRtaW4iLCJleHAiOjE2OTUzOTg4NDksImlhdCI6MTY5NDc5NDA0OSwicm9sIjoiUk9MRV9BRE1JTiJ9.syRDshKpd-xETsSdeMPRtk956f4BJkPt4utVsUl4smgH71Woj8SUq4w2RX1YtGTC4aTZRJYdKOfkTqwK0g_dHQ', - cookie: - 'Admin-Token=Bearer%20eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiI3LGJhb3hpbnlpX2FkbWluIiwiaXNzIjoiYWRtaW4iLCJleHAiOjE2OTUzOTg4NDksImlhdCI6MTY5NDc5NDA0OSwicm9sIjoiUk9MRV9BRE1JTiJ9.syRDshKpd-xETsSdeMPRtk956f4BJkPt4utVsUl4smgH71Woj8SUq4w2RX1YtGTC4aTZRJYdKOfkTqwK0g_dHQ; userName=baoxinyi_admin', - }, body: { ...formData, current: pageProps.current, @@ -24,55 +18,67 @@ const fetchUserList = async ( list: res.data.records.map((item: any, index: number) => ({ index: index + 1, ...item })), }; } - throw new Error(res.msg || '服务器开小差啦~'); + throw new Error(res.message || '服务器开小差啦~'); }; -const fetchAddTenant = async (id: string) => { - const res = await request('/hippo4j/v1/cs/tenant/save', { +const fetchAddUser = async (params: { + password?: string; + permission?: string; + role: string; + userName: string; + tempResources: Array; + tenant: Array; + resources?: Array<{ resource: string; action: 'rw' }>; +}) => { + const { tempResources = [] } = params; + const res = await request('/hippo4j/v1/cs/auth/users/add', { method: 'POST', - params: { id }, + body: { + ...params, + tempResources: tempResources.length > 0 ? true : false, + resources: tempResources.map(item => ({ resource: item, action: 'rw' })), + }, }); if (res && res.success) { return res; } - throw new Error(res.msg || '服务器开小差啦~'); + throw new Error(res.message || '服务器开小差啦~'); }; -const fetchDeleteTenant = async (id: string) => { - const res = await request('/tenants', { - method: 'POST', - params: { id }, - }); - - if (res && res.success) { - return res; +const fetchUpdateUser = async (params: { + password?: string; + permission?: string; + role: string; + userName: string; + tempResources: Array; + resources?: Array<{ resource: string; action: 'rw' }>; +}) => { + const { tempResources = [] } = params; + if (tempResources.length > 0) { + params.resources = tempResources.map(item => ({ resource: item, action: 'rw' })); } - throw new Error(res.msg || '服务器开小差啦~'); -}; - -const fetchUpdateTenant = async (id: string) => { - const res = await request('hippo4j/v1/cs/tenant/update', { - method: 'POST', - params: { id }, + const res = await request('/hippo4j/v1/cs/auth/users/update', { + method: 'PUT', + body: { ...params }, }); if (res && res.success) { return res; } - throw new Error(res.msg || '服务器开小差啦~'); + throw new Error(res.message || '服务器开小差啦~'); }; -const fetchTenantDetail = async (id: string) => { - const res = await request('/tenants', { - method: 'POST', - params: { id }, +const fetchDeleteUser = async (id: string) => { + const url = '/hippo4j/v1/cs/auth/users/remove/' + id; + const res = await request(url, { + method: 'DELETE', }); if (res && res.success) { return res; } - throw new Error(res.msg || '服务器开小差啦~'); + throw new Error(res.message || '服务器开小差啦~'); }; -export { fetchUserList, fetchAddTenant, fetchDeleteTenant, fetchUpdateTenant, fetchTenantDetail }; +export { fetchUserList, fetchAddUser, fetchDeleteUser, fetchUpdateUser }; diff --git a/threadpool/console-new/src/route/index.tsx b/threadpool/console-new/src/route/index.tsx index 54d9f987..082299a4 100644 --- a/threadpool/console-new/src/route/index.tsx +++ b/threadpool/console-new/src/route/index.tsx @@ -4,9 +4,20 @@ import aboutRouter from '@/page/about/router'; import ThreadPoolRouter from '@/page/thread-pool/router'; import tenantRouter from '@/page/tenant/router'; import LoginRouter from '@/page/login/router'; -// import itemRouter from '@/page/item/router'; -// import userRouter from '@/page/user/router'; -// import logRouter from '@/page/log/router'; +import itemRouter from '@/page/item/router'; +import userRouter from '@/page/user/router'; +import logRouter from '@/page/log/router'; +import ThreadPoolMonitorRouter from '@/page/thread-pool-monitor/router'; -const routerList: IRouterList[] = [...homeRouter, ...aboutRouter, ...tenantRouter, ...ThreadPoolRouter, ...LoginRouter]; +const routerList: IRouterList[] = [ + ...homeRouter, + ...aboutRouter, + ...tenantRouter, + ...ThreadPoolRouter, + ...LoginRouter, + ...itemRouter, + ...userRouter, + ...logRouter, + ...ThreadPoolMonitorRouter, +]; export default routerList; diff --git a/threadpool/console-new/src/utils/common/index.ts b/threadpool/console-new/src/utils/common/index.ts index 8ae65582..a087d7f4 100644 --- a/threadpool/console-new/src/utils/common/index.ts +++ b/threadpool/console-new/src/utils/common/index.ts @@ -49,9 +49,19 @@ const isPlainObject = (obj: { [key: string]: any }): boolean => { }; const setToken = (token: string) => { + localStorage.setItem(TokenKey, token); Cookie.set(TokenKey, token); }; +const removeToken = () => { + localStorage.removeItem(TokenKey); + Cookie.remove(TokenKey); +}; + +const getToken = () => { + return localStorage.getItem(TokenKey) || Cookie.get(TokenKey); +}; + /** * @description 忽略 object 中 value 为空的元素 * @param obj @@ -79,4 +89,4 @@ const isEmpty = (value: any) => { return typeof value === 'object' ? _.isEmpty(value) : isNilValue(value); }; -export { isPlainObject, isEmpty, filterEmptyField, setToken }; +export { isPlainObject, isEmpty, filterEmptyField, setToken, removeToken, getToken }; diff --git a/threadpool/console-new/src/utils/request/index.ts b/threadpool/console-new/src/utils/request/index.ts index 7a537a87..14b244a8 100644 --- a/threadpool/console-new/src/utils/request/index.ts +++ b/threadpool/console-new/src/utils/request/index.ts @@ -1,4 +1,4 @@ -import { isPlainObject } from '../common'; +import { getToken, isPlainObject } from '../common'; import { notification, message } from 'antd'; import Qs from 'qs'; @@ -24,7 +24,7 @@ interface RequestOptions { type Response = { success: boolean; - data?: T; + data: T; module?: T; msg?: string; status?: number; @@ -40,9 +40,8 @@ const inital: RequestOptions = { body: null, headers: { 'Content-Type': 'application/json', - Authorization: - 'Bearer eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIxMCxiYW94aW55aV91c2VyIiwiaXNzIjoiYWRtaW4iLCJleHAiOjE2OTU3MzAwNzYsImlhdCI6MTY5NTEyNTI3Niwicm9sIjoiUk9MRV9VU0VSIn0.4cWyhllP7u-aoRAIHs3nMggsgl4-LUCVBas8WE0FJYIe-YNS0wGf1_0RJq3TUGw00KmSaSRPKdoPgRTFqEphZA', }, + // headers, credentials: true, responseType: 'JSON', cache: 'no-cache', @@ -85,7 +84,13 @@ function request(url: string, config: RequestOptions): Promise> { } if (config.headers && isPlainObject(config.headers)) { config.headers = Object.assign({}, inital.headers, config.headers); + if (!config.headers?.Authorization) { + config.headers.Authorization = getToken(); + } + } else { + config.headers = { Authorization: getToken(), 'Content-Type': 'application/json' }; } + let { method, params, body, headers, credentials, responseType } = Object.assign({}, inital, config) as any; if (typeof url !== 'string') throw new TypeError('url is not an string'); if (!/^http(s?):\/\//i.test(url)) url = baseURL + url; diff --git a/threadpool/console-new/yarn.lock b/threadpool/console-new/yarn.lock index 9bebc0fc..c6cc6cbc 100644 --- a/threadpool/console-new/yarn.lock +++ b/threadpool/console-new/yarn.lock @@ -41,7 +41,7 @@ dependencies: "@ctrl/tinycolor" "^3.4.0" -"@ant-design/cssinjs@^1.16.0": +"@ant-design/cssinjs@^1.16.0", "@ant-design/cssinjs@^1.16.1": version "1.17.0" resolved "https://registry.npmmirror.com/@ant-design/cssinjs/-/cssinjs-1.17.0.tgz#a3f69cf5131539b76ccdbfced43d242557599fea" integrity sha512-MgGCZ6sfD3yQB0XW0hN4jgixMxApTlDYyct+pc7fRZNO4CaqWWm/9iXkkljNR27lyWLZmm+XiDfcIOo1bnrnMA== @@ -54,6 +54,18 @@ rc-util "^5.35.0" stylis "^4.0.13" +"@ant-design/happy-work-theme@^1.0.0": + version "1.0.0" + resolved "https://registry.npmmirror.com/@ant-design/happy-work-theme/-/happy-work-theme-1.0.0.tgz#b18e2d2cb37df496def5c5773c146885c6cac87c" + integrity sha512-BKuz5PZkGZwXqzDwTE9fiHYlpKdDyoGnApEih2MG1GF79/a/YekxBc4tdqocykDtWzt3z1wwmHv8AiB7EUTWsQ== + dependencies: + "@ant-design/cssinjs" "^1.16.1" + "@babel/runtime" "^7.18.3" + "@ctrl/tinycolor" "^3.6.0" + classnames "^2.3.2" + rc-motion "^2.7.3" + rc-util "^5.33.0" + "@ant-design/icons-svg@^4.3.0": version "4.3.1" resolved "https://registry.npmmirror.com/@ant-design/icons-svg/-/icons-svg-4.3.1.tgz#4b2f65a17d4d32b526baa6414aca2117382bf8da" @@ -4468,6 +4480,22 @@ eastasianwidth@^0.2.0: resolved "https://registry.npmmirror.com/eastasianwidth/-/eastasianwidth-0.2.0.tgz#696ce2ec0aa0e6ea93a397ffcf24aa7840c827cb" integrity sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA== +echarts-for-react@^3.0.2: + version "3.0.2" + resolved "https://registry.npmmirror.com/echarts-for-react/-/echarts-for-react-3.0.2.tgz#ac5859157048a1066d4553e34b328abb24f2b7c1" + integrity sha512-DRwIiTzx8JfwPOVgGttDytBqdp5VzCSyMRIxubgU/g2n9y3VLUmF2FK7Icmg/sNVkv4+rktmrLN9w22U2yy3fA== + dependencies: + fast-deep-equal "^3.1.3" + size-sensor "^1.0.1" + +echarts@^5.4.3: + version "5.4.3" + resolved "https://registry.npmmirror.com/echarts/-/echarts-5.4.3.tgz#f5522ef24419164903eedcfd2b506c6fc91fb20c" + integrity sha512-mYKxLxhzy6zyTi/FaEbJMOZU1ULGEQHaeIeuMR5L+JnJTpz+YR03mnnpBhbR4+UYJAgiXgpyTVLffPAjOTLkZA== + dependencies: + tslib "2.3.0" + zrender "5.4.4" + ee-first@1.1.1: version "1.1.1" resolved "https://registry.npmmirror.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" @@ -8733,7 +8761,7 @@ rc-menu@~9.12.0: rc-overflow "^1.3.1" rc-util "^5.27.0" -rc-motion@^2.0.0, rc-motion@^2.0.1, rc-motion@^2.3.0, rc-motion@^2.3.4, rc-motion@^2.4.3, rc-motion@^2.4.4, rc-motion@^2.6.0, rc-motion@^2.6.1, rc-motion@^2.6.2, rc-motion@^2.9.0: +rc-motion@^2.0.0, rc-motion@^2.0.1, rc-motion@^2.3.0, rc-motion@^2.3.4, rc-motion@^2.4.3, rc-motion@^2.4.4, rc-motion@^2.6.0, rc-motion@^2.6.1, rc-motion@^2.6.2, rc-motion@^2.7.3, rc-motion@^2.9.0: version "2.9.0" resolved "https://registry.npmmirror.com/rc-motion/-/rc-motion-2.9.0.tgz#9e18a1b8d61e528a97369cf9a7601e9b29205710" integrity sha512-XIU2+xLkdIr1/h6ohPZXyPBMvOmuyFZQ/T0xnawz+Rh+gh4FINcnZmMT5UTIj6hgI0VLDjTaPeRd+smJeSPqiQ== @@ -9647,6 +9675,11 @@ sisteransi@^1.0.5: resolved "https://registry.npmmirror.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed" integrity sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg== +size-sensor@^1.0.1: + version "1.0.2" + resolved "https://registry.npmmirror.com/size-sensor/-/size-sensor-1.0.2.tgz#b8f8da029683cf2b4e22f12bf8b8f0a1145e8471" + integrity sha512-2NCmWxY7A9pYKGXNBfteo4hy14gWu47rg5692peVMst6lQLPKrVjhY+UTEsPI5ceFRJSl3gVgMYaUi/hKuaiKw== + slash@^2.0.0: version "2.0.0" resolved "https://registry.npmmirror.com/slash/-/slash-2.0.0.tgz#de552851a1759df3a8f206535442f5ec4ddeab44" @@ -10318,6 +10351,11 @@ tsconfig-paths@^3.14.2: minimist "^1.2.6" strip-bom "^3.0.0" +tslib@2.3.0: + version "2.3.0" + resolved "https://registry.npmmirror.com/tslib/-/tslib-2.3.0.tgz#803b8cdab3e12ba581a4ca41c8839bbb0dacb09e" + integrity sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg== + tslib@^1.8.1: version "1.14.1" resolved "https://registry.npmmirror.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" @@ -11152,3 +11190,10 @@ yocto-queue@^0.1.0: version "0.1.0" resolved "https://registry.npmmirror.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== + +zrender@5.4.4: + version "5.4.4" + resolved "https://registry.npmmirror.com/zrender/-/zrender-5.4.4.tgz#8854f1d95ecc82cf8912f5a11f86657cb8c9e261" + integrity sha512-0VxCNJ7AGOMCWeHVyTrGzUgrK4asT4ml9PEkeGirAkKNYXYzoPJCLvmyfdoOXcjTHPs10OZVMfD1Rwg16AZyYw== + dependencies: + tslib "2.3.0" diff --git a/threadpool/console/src/views/hippo4j/instance/index.vue b/threadpool/console/src/views/hippo4j/instance/index.vue index 3d95ddaa..76c6756b 100755 --- a/threadpool/console/src/views/hippo4j/instance/index.vue +++ b/threadpool/console/src/views/hippo4j/instance/index.vue @@ -81,7 +81,6 @@ -