diff --git a/kernel/dynamic/api/src/main/java/cn/hippo4j/threadpool/dynamic/api/BootstrapPropertiesInterface.java b/kernel/dynamic/api/src/main/java/cn/hippo4j/threadpool/dynamic/api/BootstrapPropertiesInterface.java index 110c3f5e..ab743fd2 100644 --- a/kernel/dynamic/api/src/main/java/cn/hippo4j/threadpool/dynamic/api/BootstrapPropertiesInterface.java +++ b/kernel/dynamic/api/src/main/java/cn/hippo4j/threadpool/dynamic/api/BootstrapPropertiesInterface.java @@ -94,4 +94,11 @@ public interface BootstrapPropertiesInterface { return null; } + /** + * Get Zookeeper. + */ + default Map getZookeeper() { + return null; + } + } diff --git a/threadpool/console-new/craco.config.js b/threadpool/console-new/craco.config.js index 109f8e2c..f94068ae 100644 --- a/threadpool/console-new/craco.config.js +++ b/threadpool/console-new/craco.config.js @@ -41,7 +41,6 @@ module.exports = { webpack: { alias: { '@': resolve('src'), - '@i18': resolve('public/locales'), }, }, devServer: { diff --git a/threadpool/console-new/public/locales/en.json b/threadpool/console-new/public/locales/en.json deleted file mode 100644 index e69de29b..00000000 diff --git a/threadpool/console-new/public/locales/zh.json b/threadpool/console-new/public/locales/zh.json deleted file mode 100644 index e69de29b..00000000 diff --git a/threadpool/console-new/src/App.tsx b/threadpool/console-new/src/App.tsx index 6bd2bf62..6ba9ca5b 100644 --- a/threadpool/console-new/src/App.tsx +++ b/threadpool/console-new/src/App.tsx @@ -1,52 +1,28 @@ import { Suspense } from 'react'; import LayoutCom from './components/layout-com'; -import { Link, Route, Routes } from 'react-router-dom'; +import { Routes, Route, Link } from 'react-router-dom'; + import routeList from './route'; import Login from '@/page/login'; -import { - AppstoreOutlined, - MailOutlined, - UsergroupDeleteOutlined, - DiffOutlined, - UserOutlined, - ProjectOutlined, -} from '@ant-design/icons'; -import { Spin, ConfigProvider } from 'antd'; +import { MenuProps, Spin, ConfigProvider } from 'antd'; +import { useTran } from './hooks'; +import { STR_MAP } from './config/i18n/locales/constants'; +import IconFont from './components/icon'; -const sideMenuList = [ - { - label: about, - key: 'mail', - icon: , - }, - { - label: 主页, - key: 'app', - icon: , - }, - { - label: 租户管理, - key: 'tenant', - icon: , - }, - { - label: 项目管理, - key: 'item', - icon: , - }, - { - label: 用户权限, - key: 'user', - icon: , - }, - { - label: 日志管理, - key: 'log', - icon: , - }, -]; +type MenuItem = Required['items'][number]; const App = () => { + const sideMenuList: MenuItem[] = [ + { + label: useTran(STR_MAP.DYNAMIC_THREAD_POOL), + key: STR_MAP.DYNAMIC_THREAD_POOL, + icon: , + children: [ + { label: {useTran(STR_MAP.THREAD_POOL)}, key: '/thread-poll/index' }, + ], + }, + ]; + return ( }> diff --git a/threadpool/console-new/src/components/header/index.tsx b/threadpool/console-new/src/components/header/index.tsx index a1858371..dddb3252 100644 --- a/threadpool/console-new/src/components/header/index.tsx +++ b/threadpool/console-new/src/components/header/index.tsx @@ -2,7 +2,7 @@ import React, { useContext } from 'react'; import style from './index.module.less'; import { UserOutlined } from '@ant-design/icons'; import { Avatar, Button, Col, Dropdown, Row, Switch } from 'antd'; -import useThemeMode from '@/hooks/useThemeMode'; +import { useThemeMode } from '@/hooks'; import { MyContext } from '@/context'; import IconFont from '@/components/icon'; diff --git a/threadpool/console-new/src/components/icon/index.tsx b/threadpool/console-new/src/components/icon/index.tsx index 335ec6a6..fee31ec8 100644 --- a/threadpool/console-new/src/components/icon/index.tsx +++ b/threadpool/console-new/src/components/icon/index.tsx @@ -5,7 +5,7 @@ interface Props { } const MyIcon = createFromIconfontCN({ - scriptUrl: '//at.alicdn.com/t/c/font_4254722_1xl4w1k5c53.js', // 在 iconfont.cn 上生成 + scriptUrl: '//at.alicdn.com/t/c/font_4254722_3l4m6by7h34.js', // 在 iconfont.cn 上生成 }); const IconFont = (props: Props) => { diff --git a/threadpool/console-new/src/components/layout-com/index.module.less b/threadpool/console-new/src/components/layout-com/index.module.less index 2b52ccf5..073f6d40 100644 --- a/threadpool/console-new/src/components/layout-com/index.module.less +++ b/threadpool/console-new/src/components/layout-com/index.module.less @@ -9,20 +9,13 @@ align-items: center; } .sider { - height: calc(100vh - 48px); - // padding-top: 24px; - } - .menu { - height: 100vh; - } - .breadcrumb { - margin: 16px 0; + padding-top: 24px; } .content { margin: 0; border-radius: 12px 12px 0 0; - min-height: 100%; flex: 1; - padding: 10px 0; + padding: 16px; + overflow-y: auto; } } diff --git a/threadpool/console-new/src/components/layout-com/index.tsx b/threadpool/console-new/src/components/layout-com/index.tsx index bb1f3271..cffa0f30 100644 --- a/threadpool/console-new/src/components/layout-com/index.tsx +++ b/threadpool/console-new/src/components/layout-com/index.tsx @@ -1,50 +1,63 @@ -import { useState, useContext, ReactNode } from 'react'; +import { useState, useContext, ReactNode, useEffect } from 'react'; import { DefaultTheme, ThemeContext } from 'styled-components'; -import { Breadcrumb, Layout, Menu } from 'antd'; +import { Layout, Menu, MenuProps } from 'antd'; import HeaderChild from '../header'; -import { IMenuList } from '@/typings'; import style from './index.module.less'; +import { useLocation } from 'react-router-dom'; +import { useThemeMode } from '@/hooks'; +type MenuItem = Required['items'][number]; const { Header, Sider, Content } = Layout; interface ILayoutCom { children?: ReactNode; - sideMenuList: IMenuList[]; + sideMenuList: MenuItem[]; isSider?: boolean; + isHeader?: boolean; } const LayoutCom = (props: ILayoutCom) => { - const { sideMenuList, children, isSider = true } = props; + const { sideMenuList, children, isSider = true, isHeader = true } = props; const myThemes: DefaultTheme = useContext(ThemeContext); - const [current, setCurrent] = useState('mail'); + const [currentKey, setCurrentKey] = useState(''); + const { isDark } = useThemeMode(); + + const location = useLocation(); + useEffect(() => { + setCurrentKey(location.pathname); + }, [location]); + const onClick = (e: any) => { - setCurrent(e.key); + setCurrentKey(e.key); }; + useEffect(() => { + document.body.style.backgroundColor = myThemes.backgroundColor.bg1; + }, [isDark, myThemes]); + return (
-
- -
- + {isHeader && ( +
+ +
+ )} + {isSider && ( - - + + )} - - - Home - List - App - - {children} - + + {children} +
); diff --git a/threadpool/console-new/src/config/i18n/locales/constants.ts b/threadpool/console-new/src/config/i18n/locales/constants.ts new file mode 100644 index 00000000..84fe02d5 --- /dev/null +++ b/threadpool/console-new/src/config/i18n/locales/constants.ts @@ -0,0 +1,20 @@ +export enum STR_MAP { + DYNAMIC_THREAD_POOL = 'dynamicThreadPool', + THREAD_POOL_MANAGE = 'threadPoolManage', + PROJECT = 'project', + SEARCH = 'search', + ADD = 'add', + SERIAL_NUMBER = 'serialNumber', + TENANTRY = 'tenantry', + THREAD_POOL = 'threadPool', + CORE_THREAD = 'coreThread', + MAXIMUM_THREAD = 'maximumThread', + QUEUE_TYPE = 'queueType', + QUEUE_CAPACITY = 'queueCapacity', + REJECTION_STRATEGY = 'rejectionStrategy', + EXECUTION_TIMEOUT = 'executionTimeout', + ALARM_OR_NOT = 'alarmOrNot', + CREATION_TIME = 'creationTime', + UPDATE_TIME = 'update time', + EDIT = 'edit', +} diff --git a/threadpool/console-new/src/config/i18n/locales/en.ts b/threadpool/console-new/src/config/i18n/locales/en.ts index 9c4e9957..ab05675d 100644 --- a/threadpool/console-new/src/config/i18n/locales/en.ts +++ b/threadpool/console-new/src/config/i18n/locales/en.ts @@ -1,5 +1,24 @@ +import { STR_MAP } from './constants'; + const enTranslationMap: { [key: string]: string } = { - hello: 'hello', + [STR_MAP.DYNAMIC_THREAD_POOL]: 'Dynamic thread pool', + [STR_MAP.THREAD_POOL_MANAGE]: 'Thread pool management', + [STR_MAP.PROJECT]: 'project', + [STR_MAP.SEARCH]: 'search', + [STR_MAP.ADD]: 'add', + [STR_MAP.SERIAL_NUMBER]: 'number', + [STR_MAP.TENANTRY]: 'tenantry', + [STR_MAP.THREAD_POOL]: 'thread pool', + [STR_MAP.CORE_THREAD]: 'core thread', + [STR_MAP.MAXIMUM_THREAD]: 'maximum thread', + [STR_MAP.QUEUE_TYPE]: 'queue type', + [STR_MAP.QUEUE_CAPACITY]: 'queue capacity', + [STR_MAP.REJECTION_STRATEGY]: 'rejection strategy', + [STR_MAP.EXECUTION_TIMEOUT]: 'execution timeout', + [STR_MAP.ALARM_OR_NOT]: 'alarm or not', + [STR_MAP.CREATION_TIME]: 'creation time', + [STR_MAP.UPDATE_TIME]: 'update time', + [STR_MAP.EDIT]: 'edit', }; 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 dbf8591d..05544c3b 100644 --- a/threadpool/console-new/src/config/i18n/locales/zh.ts +++ b/threadpool/console-new/src/config/i18n/locales/zh.ts @@ -1,5 +1,24 @@ +import { STR_MAP } from './constants'; + const zhTranslationMap: { [key: string]: string } = { - hello: '你好', + [STR_MAP.DYNAMIC_THREAD_POOL]: '动态线程池', + [STR_MAP.THREAD_POOL_MANAGE]: '线程池管理', + [STR_MAP.PROJECT]: '项目', + [STR_MAP.SEARCH]: '搜索', + [STR_MAP.ADD]: '添加', + [STR_MAP.SERIAL_NUMBER]: '序号', + [STR_MAP.TENANTRY]: '租户', + [STR_MAP.THREAD_POOL]: '线程池', + [STR_MAP.CORE_THREAD]: '核心线程', + [STR_MAP.MAXIMUM_THREAD]: '最大线程', + [STR_MAP.QUEUE_TYPE]: '队列类型', + [STR_MAP.QUEUE_CAPACITY]: '队列容量', + [STR_MAP.REJECTION_STRATEGY]: '拒绝策略', + [STR_MAP.EXECUTION_TIMEOUT]: '执行超时', + [STR_MAP.ALARM_OR_NOT]: '是否报警', + [STR_MAP.CREATION_TIME]: '创建时间', + [STR_MAP.UPDATE_TIME]: '更新时间', + [STR_MAP.EDIT]: '操作', }; 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 5e1fea63..054da61e 100644 --- a/threadpool/console-new/src/config/theme/dark-algorithm.ts +++ b/threadpool/console-new/src/config/theme/dark-algorithm.ts @@ -4,25 +4,28 @@ export const darkAlgorithm = { token: { colorPrimary: darkDefaultTheme.primary, fontSize: 14, + fontSizeHeading1: 18, }, components: { Layout: { bodyBg: darkDefaultTheme.backgroundColor.bg1, headerBg: darkDefaultTheme.backgroundColor.bgHeader, + triggerBg: darkDefaultTheme.backgroundColor.bg1, + triggerColor: darkDefaultTheme.fontColor.fc1, }, Button: { - fontSize: 14, + // fontSize: 14, + }, + Table: { + // borderRadius: 0, + // borderRadiusLG: 0, + // padding: 10, + // paddingXS: 5, + // margin: 0, + // fontSize: 14, + // colorBorderSecondary: darkDefaultTheme.borderColor.bl1, + // paddingContentVerticalLG: 4, }, - // Table: { - // borderRadius: 0, - // borderRadiusLG: 0, - // padding: 10, - // paddingXS: 5, - // margin: 0, - // fontSize: 14, - // colorBorderSecondary: darkDefaultTheme.borderColor.bl1, - // paddingContentVerticalLG: 4, - // }, Modal: { borderRadiusLG: 2, borderRadiusSM: 2, @@ -33,12 +36,14 @@ export const darkAlgorithm = { }, Menu: { itemBg: darkDefaultTheme.backgroundColor.bg1, + // itemSelectedBg: darkDefaultTheme.primary, + // itemSelectedColor: darkDefaultTheme.fontColor.fc1, activeBarWidth: 0, activeBarHeight: 0, activeBarBorderWidth: 0, - subMenuItemBorderRadius: 8, - horizontalItemBorderRadius: 8, - itemBorderRadius: 8, + // subMenuItemBorderRadius: 8, + // horizontalItemBorderRadius: 8, + // itemBorderRadius: 8, }, }, algorithm: theme.darkAlgorithm, diff --git a/threadpool/console-new/src/config/theme/default-algnorithm.ts b/threadpool/console-new/src/config/theme/default-algnorithm.ts index 4ebe96e7..b22cbcaf 100644 --- a/threadpool/console-new/src/config/theme/default-algnorithm.ts +++ b/threadpool/console-new/src/config/theme/default-algnorithm.ts @@ -4,41 +4,45 @@ export const defaultAlgorithm = { token: { colorPrimary: lightDefaultTheme.primary, fontSize: 14, - // colorBgBase: lightDefaultTheme.backgroundColor.bg1, + fontSizeHeading1: 18, }, components: { Layout: { bodyBg: lightDefaultTheme.backgroundColor.bg1, headerBg: lightDefaultTheme.backgroundColor.bgHeader, + triggerBg: lightDefaultTheme.backgroundColor.bg1, + triggerColor: lightDefaultTheme.fontColor.fc1, + }, + Button: { + // fontSize: 14, + }, + Table: { + // padding: 10, + // paddingXS: 5, + // margin: 0, + // fontSize: 14, + // colorBorderSecondary: lightDefaultTheme.borderColor.bl1, + // paddingContentVerticalLG: 4, + }, + Modal: { + borderRadiusLG: 2, + borderRadiusSM: 2, + colorText: lightDefaultTheme.fontColor.fc3, + borderRadius: 2, + paddingContentHorizontalLG: 0, + paddingMD: 0, + }, + Menu: { + itemBg: lightDefaultTheme.backgroundColor.bg1, + // itemSelectedBg: lightDefaultTheme.primary, + // itemSelectedColor: lightDefaultTheme.fontColor.fc1, + activeBarWidth: 0, + activeBarHeight: 0, + activeBarBorderWidth: 0, + // subMenuItemBorderRadius: 8, + // horizontalItemBorderRadius: 8, + // itemBorderRadius: 8, }, - // Button: { - // fontSize: 14, - // }, - // Table: { - // padding: 10, - // paddingXS: 5, - // margin: 0, - // fontSize: 14, - // colorBorderSecondary: lightDefaultTheme.borderColor.bl1, - // paddingContentVerticalLG: 4, - // }, - // Modal: { - // borderRadiusLG: 2, - // borderRadiusSM: 2, - // colorText: lightDefaultTheme.fontColor.fc3, - // borderRadius: 2, - // paddingContentHorizontalLG: 0, - // paddingMD: 0, - // }, - // Menu: { - // itemBg: lightDefaultTheme.backgroundColor.bg1, - // activeBarWidth: 0, - // activeBarHeight: 0, - // activeBarBorderWidth: 0, - // subMenuItemBorderRadius: 8, - // horizontalItemBorderRadius: 8, - // itemBorderRadius: 8, - // }, }, algorithm: theme.defaultAlgorithm, }; diff --git a/threadpool/console-new/src/hooks/index.ts b/threadpool/console-new/src/hooks/index.ts new file mode 100644 index 00000000..2d6b5b00 --- /dev/null +++ b/threadpool/console-new/src/hooks/index.ts @@ -0,0 +1,3 @@ +export * from './useThemeMode'; +export * from './useTransLate'; +export * from './useFormToUrl'; diff --git a/threadpool/console-new/src/hooks/useFormToUrl.ts b/threadpool/console-new/src/hooks/useFormToUrl.ts new file mode 100644 index 00000000..664d54c3 --- /dev/null +++ b/threadpool/console-new/src/hooks/useFormToUrl.ts @@ -0,0 +1,52 @@ +import { useEffect, useMemo, useState } from 'react'; +import { parse } from 'qs'; +import useUrlState from '@ahooksjs/use-url-state'; +import { FormInstance } from 'antd'; + +export function useFormStateToUrl>( + form: FormInstance, + params?: T +): { + urlState: any; + isFirstMount: boolean; + handleSetUrlState: () => void; +} { + const [state, setState] = useState(); + const [urlState, setUrlState] = useUrlState(); + const [count, setCount] = useState(0); + + useEffect(() => { + const url = window.location.search.split('?')[1] ?? null; + const urlParams = parse(url) as T; + const result: Partial = {}; + setState(urlParams); + for (const key in params) { + if (Object.prototype.hasOwnProperty.call(params, key)) { + const paramValue = urlParams[key]; + if (paramValue ?? false) { + if (typeof params[key] === 'number') { + const parsedValue = parseFloat(paramValue); + if (!isNaN(parsedValue)) { + result[key] = parsedValue as T[keyof T]; + } + } else { + result[key] = paramValue as T[keyof T]; + } + } + } + } + form.setFieldsValue(result); + setCount(count => count + 1); + }, [setState, setCount, form, params]); + + const handleSetUrlState = () => { + const values = form.getFieldsValue(); + setUrlState({ ...state, ...values }); + }; + + const isFirstMount = useMemo(() => { + return count === 1; + }, [count]); + + return { urlState, isFirstMount, handleSetUrlState }; +} diff --git a/threadpool/console-new/src/hooks/useThemeMode.tsx b/threadpool/console-new/src/hooks/useThemeMode.ts similarity index 78% rename from threadpool/console-new/src/hooks/useThemeMode.tsx rename to threadpool/console-new/src/hooks/useThemeMode.ts index 502a31dd..170b3afe 100644 --- a/threadpool/console-new/src/hooks/useThemeMode.tsx +++ b/threadpool/console-new/src/hooks/useThemeMode.ts @@ -2,7 +2,7 @@ import { useContext, useEffect } from 'react'; import { useLocalStorageState } from 'ahooks'; import { MyContext, THEME_NAME } from '@/context'; -const useThemeMode = (): { isDark: boolean | undefined; setIsDark: (isDark: boolean) => void } => { +export const useThemeMode = (): { isDark: boolean | undefined; setIsDark: (isDark: boolean) => void } => { const [isDark, setIsDark] = useLocalStorageState('current-mode', { defaultValue: false }); const { setThemeName } = useContext(MyContext); @@ -12,5 +12,3 @@ const useThemeMode = (): { isDark: boolean | undefined; setIsDark: (isDark: bool return { isDark, setIsDark }; }; - -export default useThemeMode; diff --git a/threadpool/console-new/src/hooks/useTransLate.ts b/threadpool/console-new/src/hooks/useTransLate.ts new file mode 100644 index 00000000..de37118e --- /dev/null +++ b/threadpool/console-new/src/hooks/useTransLate.ts @@ -0,0 +1,6 @@ +import { useTranslation } from 'react-i18next'; + +export const useTran = (str: string): string => { + const { t } = useTranslation(); + return t(str); +}; diff --git a/threadpool/console-new/src/page/thread-pool/index.tsx b/threadpool/console-new/src/page/thread-pool/index.tsx new file mode 100644 index 00000000..ed2dc227 --- /dev/null +++ b/threadpool/console-new/src/page/thread-pool/index.tsx @@ -0,0 +1,90 @@ +import { Button, Form, Select, Space, Table, Typography } from 'antd'; +import { useFormStateToUrl, useTran } from '@/hooks'; +import { STR_MAP } from '@/config/i18n/locales/constants'; +import { ColumnProps } from 'antd/es/table'; +const { Title } = Typography; +const { Item } = Form; + +const params = { project: 0, thpool: 0 }; +const ThreadPoll = () => { + const [form] = Form.useForm(); + const { handleSetUrlState } = useFormStateToUrl<{ project: number; thpool: number }>(form, params); + const columns: ColumnProps[] = [ + { + title: useTran(STR_MAP.SERIAL_NUMBER), + dataIndex: 'order', + }, + { + title: useTran(STR_MAP.PROJECT), + dataIndex: 'project', + }, + { + title: useTran(STR_MAP.TENANTRY), + dataIndex: 'tenantry', + }, + { + title: useTran(STR_MAP.THREAD_POOL), + dataIndex: 'thread_pool', + }, + { + title: useTran(STR_MAP.MAXIMUM_THREAD), + dataIndex: 'maximum_thread', + }, + { + title: useTran(STR_MAP.QUEUE_TYPE), + dataIndex: 'queue_type', + }, + { + title: useTran(STR_MAP.REJECTION_STRATEGY), + dataIndex: 'tenantry', + }, + { + title: useTran(STR_MAP.EXECUTION_TIMEOUT), + dataIndex: 'tenantry', + }, + { + title: useTran(STR_MAP.ALARM_OR_NOT), + dataIndex: 'tenantry', + }, + { + title: useTran(STR_MAP.CREATION_TIME), + dataIndex: 'tenantry', + }, + { + title: useTran(STR_MAP.UPDATE_TIME), + dataIndex: 'tenantry', + }, + { + title: useTran(STR_MAP.EDIT), + dataIndex: 'tenantry', + }, + ]; + + const handleSubmit = () => { + handleSetUrlState(); + }; + + return ( + + {useTran(STR_MAP.THREAD_POOL)} +
+ + + + + + + + + + + + +
+
+
+ ); +}; +export default ThreadPoll; diff --git a/threadpool/console-new/src/page/thread-pool/router.ts b/threadpool/console-new/src/page/thread-pool/router.ts new file mode 100644 index 00000000..a981458d --- /dev/null +++ b/threadpool/console-new/src/page/thread-pool/router.ts @@ -0,0 +1,11 @@ +import { IRouterList } from '@/typings'; +import ThreadPoll from '.'; + +const routerList: IRouterList[] = [ + { + path: '/thread-poll/index', + component: ThreadPoll, + }, +]; + +export default routerList; diff --git a/threadpool/console-new/src/route/index.tsx b/threadpool/console-new/src/route/index.tsx index bb0cfeba..a75fc16a 100644 --- a/threadpool/console-new/src/route/index.tsx +++ b/threadpool/console-new/src/route/index.tsx @@ -1,6 +1,7 @@ import { IRouterList } from '@/typings'; import homeRouter from '@/page/home/router'; import aboutRouter from '@/page/about/router'; +import ThreadPoolRouter from '@/page/thread-pool/router'; import tenantRouter from '@/page/tenant/router'; import itemRouter from '@/page/item/router'; import userRouter from '@/page/user/router'; @@ -10,6 +11,7 @@ const routerList: IRouterList[] = [ ...homeRouter, ...aboutRouter, ...tenantRouter, + ...ThreadPoolRouter, ...itemRouter, ...userRouter, ...logRouter, diff --git a/threadpool/console-new/yarn.lock b/threadpool/console-new/yarn.lock index 6d118190..dcdbc5fb 100644 --- a/threadpool/console-new/yarn.lock +++ b/threadpool/console-new/yarn.lock @@ -12,6 +12,15 @@ resolved "https://registry.npmmirror.com/@adobe/css-tools/-/css-tools-4.3.1.tgz#abfccb8ca78075a2b6187345c26243c1a0842f28" integrity sha512-/62yikz7NLScCGAAST5SHdnjaDJQBDq0M2muyRTpf2VQhw6StBg2ALiu73zSJQ4fMVLA+0uBhBHAle7Wg+2kSg== +"@ahooksjs/use-url-state@^3.5.1": + version "3.5.1" + resolved "https://registry.npmmirror.com/@ahooksjs/use-url-state/-/use-url-state-3.5.1.tgz#c3ad04e98cbcbc8f9eba476bcbd3237e9809aa5b" + integrity sha512-XTrOLZKOAXahDD1Evg+aSN6qNzoh/FuvRKbUtB/0RhYvz57tyXRPbED0KXK4h2C3ZyHUKBJcVCSDcd6EsTyMyQ== + dependencies: + ahooks "^3.4.1" + query-string "^6.9.0" + tslib "^2.4.1" + "@alloc/quick-lru@^5.2.0": version "5.2.0" resolved "https://registry.npmmirror.com/@alloc/quick-lru/-/quick-lru-5.2.0.tgz#7bf68b20c0a350f936915fcae06f58e32007ce30" @@ -2793,7 +2802,7 @@ ahooks-v3-count@^1.0.0: resolved "https://registry.npmmirror.com/ahooks-v3-count/-/ahooks-v3-count-1.0.0.tgz#ddeb392e009ad6e748905b3cbf63a9fd8262ca80" integrity sha512-V7uUvAwnimu6eh/PED4mCDjE7tokeZQLKlxg9lCTMPhN+NjsSbtdacByVlR1oluXQzD3MOw55wylDmQo4+S9ZQ== -ahooks@^3.7.8: +ahooks@^3.4.1, ahooks@^3.7.8: version "3.7.8" resolved "https://registry.npmmirror.com/ahooks/-/ahooks-3.7.8.tgz#3fa3c491cd153e884a32b0c4192fc72cf84c4332" integrity sha512-e/NMlQWoCjaUtncNFIZk3FG1ImSkV/JhScQSkTqnftakRwdfZWSw6zzoWSG9OMYqPNs2MguDYBUFFC6THelWXA== @@ -4178,6 +4187,11 @@ decimal.js@^10.2.1: resolved "https://registry.npmmirror.com/decimal.js/-/decimal.js-10.4.3.tgz#1044092884d245d1b7f65725fa4ad4c6f781cc23" integrity sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA== +decode-uri-component@^0.2.0: + version "0.2.2" + resolved "https://registry.npmmirror.com/decode-uri-component/-/decode-uri-component-0.2.2.tgz#e69dbe25d37941171dd540e024c444cd5188e1e9" + integrity sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ== + dedent@^0.7.0: version "0.7.0" resolved "https://registry.npmmirror.com/dedent/-/dedent-0.7.0.tgz#2495ddbaf6eb874abb0e1be9df22d2e5a544326c" @@ -5188,6 +5202,11 @@ fill-range@^7.0.1: dependencies: to-regex-range "^5.0.1" +filter-obj@^1.1.0: + version "1.1.0" + resolved "https://registry.npmmirror.com/filter-obj/-/filter-obj-1.1.0.tgz#9b311112bc6c6127a16e016c6c5d7f19e0805c5b" + integrity sha512-8rXg1ZnX7xzy2NGDVkBVaAy+lSlPNwad13BtgSlLuxfIslyt5Vg64U7tFcCt4WS1R0hvtnQybT/IyCkGZ3DpXQ== + finalhandler@1.2.0: version "1.2.0" resolved "https://registry.npmmirror.com/finalhandler/-/finalhandler-1.2.0.tgz#7d23fe5731b207b4640e4fcd00aec1f9207a7b32" @@ -8505,6 +8524,16 @@ qs@^6.11.2: dependencies: side-channel "^1.0.4" +query-string@^6.9.0: + version "6.14.1" + resolved "https://registry.npmmirror.com/query-string/-/query-string-6.14.1.tgz#7ac2dca46da7f309449ba0f86b1fd28255b0c86a" + integrity sha512-XDxAeVmpfu1/6IjyT/gXHOl+S0vQ9owggJ30hhWKdHAsNPOcasn5o9BW0eejZqL2e4vMjhAxoW3jVHcD6mbcYw== + dependencies: + decode-uri-component "^0.2.0" + filter-obj "^1.1.0" + split-on-first "^1.0.0" + strict-uri-encode "^2.0.0" + querystringify@^2.1.1: version "2.2.0" resolved "https://registry.npmmirror.com/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6" @@ -9702,6 +9731,11 @@ spdy@^4.0.2: select-hose "^2.0.0" spdy-transport "^3.0.0" +split-on-first@^1.0.0: + version "1.1.0" + resolved "https://registry.npmmirror.com/split-on-first/-/split-on-first-1.1.0.tgz#f610afeee3b12bce1d0c30425e76398b78249a5f" + integrity sha512-43ZssAJaMusuKWL8sKUBQXHWOpq8d6CfN/u1p4gUzfJkM05C8rxTmYrkIPTXapZpORA6LkkzcUulJ8FqA7Uudw== + sprintf-js@~1.0.2: version "1.0.3" resolved "https://registry.npmmirror.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c" @@ -9748,6 +9782,11 @@ stop-iteration-iterator@^1.0.0: dependencies: internal-slot "^1.0.4" +strict-uri-encode@^2.0.0: + version "2.0.0" + resolved "https://registry.npmmirror.com/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz#b9c7330c7042862f6b142dc274bbcc5866ce3546" + integrity sha512-QwiXZgpRcKkhTj2Scnn++4PKtWsH0kpzZ62L2R6c/LUVYv7hVnZqcg2+sMuT6R7Jusu1vviK/MFsu6kNJfWlEQ== + string-argv@0.3.2: version "0.3.2" resolved "https://registry.npmmirror.com/string-argv/-/string-argv-0.3.2.tgz#2b6d0ef24b656274d957d54e0a4bbf6153dc02b6" diff --git a/threadpool/core/src/main/java/cn/hippo4j/core/enable/BeforeCheckConfiguration.java b/threadpool/core/src/main/java/cn/hippo4j/core/enable/BeforeCheckConfiguration.java index e1f6fed1..5265faf6 100644 --- a/threadpool/core/src/main/java/cn/hippo4j/core/enable/BeforeCheckConfiguration.java +++ b/threadpool/core/src/main/java/cn/hippo4j/core/enable/BeforeCheckConfiguration.java @@ -115,6 +115,35 @@ public class BeforeCheckConfiguration { "Please check whether the [spring.dynamic.thread-pool.apollo.namespace] configuration is empty or an empty string."); } } + + Map zookeeper = properties.getZookeeper(); + if (MapUtil.isNotEmpty(zookeeper)) { + String zkConnectStr = zookeeper.get("zk-connect-str"); + if ((StringUtil.isBlank(zkConnectStr))) { + throw new ConfigEmptyException( + "Web server failed to start. The dynamic thread pool zookeeper zk-connect-str is empty.", + "Please check whether the [spring.dynamic.thread-pool.zookeeper.zk-connect-str] configuration is empty or an empty string."); + } + String configVersion = zookeeper.get("config-version"); + if ((StringUtil.isBlank(configVersion))) { + throw new ConfigEmptyException( + "Web server failed to start. The dynamic thread pool zookeeper config-version is empty.", + "Please check whether the [spring.dynamic.thread-pool.zookeeper.config-version] configuration is empty or an empty string."); + } + String rootNode = zookeeper.get("root-node"); + if ((StringUtil.isBlank(rootNode))) { + throw new ConfigEmptyException( + "Web server failed to start. The dynamic thread pool zookeeper root-node is empty.", + "Please check whether the [spring.dynamic.thread-pool.zookeeper.root-node] configuration is empty or an empty string."); + } + String node = zookeeper.get("node"); + if ((StringUtil.isBlank(node))) { + throw new ConfigEmptyException( + "Web server failed to start. The dynamic thread pool zookeeper node is empty.", + "Please check whether the [spring.dynamic.thread-pool.zookeeper.node] configuration is empty or an empty string."); + } + } + break; } default: