= 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 8632ba92..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,10 +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 45be09f0..978f5e0b 100644
--- a/threadpool/console-new/src/config/i18n/locales/en.ts
+++ b/threadpool/console-new/src/config/i18n/locales/en.ts
@@ -23,6 +23,18 @@ const enTranslationMap: { [key: string]: string } = {
[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 301d4a4b..5acde9dd 100644
--- a/threadpool/console-new/src/config/i18n/locales/zh.ts
+++ b/threadpool/console-new/src/config/i18n/locales/zh.ts
@@ -21,8 +21,20 @@ const zhTranslationMap: { [key: string]: string } = {
[STR_MAP.EDIT]: '操作',
[STR_MAP.TENANT_MANAGE]: '租户管理',
[STR_MAP.PROJECT_MANAGE]: '项目管理',
- [STR_MAP.USER_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 bcb8e6b9..f9c6e766 100644
--- a/threadpool/console-new/src/config/theme/default-algnorithm.ts
+++ b/threadpool/console-new/src/config/theme/default-algnorithm.ts
@@ -20,7 +20,7 @@ export const defaultAlgorithm = {
// padding: 10,
// paddingXS: 5,
// margin: 0,
- // fontSize: 14,
+ // cellFontSize: 12,
// colorBorderSecondary: lightDefaultTheme.borderColor.bl1,
// paddingContentVerticalLG: 4,
},
diff --git a/threadpool/console-new/src/page/item/create.tsx b/threadpool/console-new/src/page/item/create.tsx
index 860aef60..f04fa140 100644
--- a/threadpool/console-new/src/page/item/create.tsx
+++ b/threadpool/console-new/src/page/item/create.tsx
@@ -1,29 +1,104 @@
import { useRequest } from 'ahooks';
-import { Form, Modal, Input, Select } from 'antd';
-import React from 'react';
-import { fetchTenantList } from '../tenant/service';
+import { Form, Modal, Input, Select, notification } from 'antd';
+import React, { useEffect } from 'react';
+import { fetchTenantOptions } from '../tenant/service';
+import { fetchAddItem, fetchUpdateItem } from './service';
-const ItemCreate: React.FC<{
+interface IProps {
type: string;
data: any;
visible: boolean;
onClose: () => void;
-}> = props => {
- const { visible, onClose, data, type } = props;
- const { data: tenant } = useRequest(fetchTenantList);
- console.log('tenant', tenant);
+ 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 (
-
-
- {/* */}
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
+
+
diff --git a/threadpool/console-new/src/page/item/index.tsx b/threadpool/console-new/src/page/item/index.tsx
index ea506206..4d35bac8 100644
--- a/threadpool/console-new/src/page/item/index.tsx
+++ b/threadpool/console-new/src/page/item/index.tsx
@@ -1,8 +1,8 @@
-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 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';
@@ -23,6 +23,10 @@ const baseColumns = [
dataIndex: 'itemId',
with: 200,
},
+ {
+ title: '项目',
+ dataIndex: 'itemId',
+ },
{
title: '项目名称',
dataIndex: 'itemName',
@@ -46,16 +50,26 @@ const Tenant: React.FC = () => {
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: `此操作将删除${item.itemName}, 是否继续?`,
- onOk: () => {
- search.submit();
+ 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 || '服务器开小差啦~');
+ }
},
});
};
@@ -87,7 +101,7 @@ const Tenant: React.FC = () => {
-
+
@@ -95,7 +109,7 @@ const Tenant: React.FC = () => {
handleSearch()} type="primary" icon={ }>
搜索
- setEditVisible(true)} type="primary" icon={ }>
+ actions('add')} type="primary" icon={ }>
添加
@@ -108,7 +122,6 @@ 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 babf4216..0e8bbdf9 100644
--- a/threadpool/console-new/src/page/item/service.ts
+++ b/threadpool/console-new/src/page/item/service.ts
@@ -19,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; // 项目名称
@@ -31,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/index.tsx b/threadpool/console-new/src/page/log/index.tsx
index 0bcfcde4..eb120e05 100644
--- a/threadpool/console-new/src/page/log/index.tsx
+++ b/threadpool/console-new/src/page/log/index.tsx
@@ -96,7 +96,6 @@ const Tenant: React.FC = () => {
{
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 71e93db1..1651531c 100644
--- a/threadpool/console-new/src/page/tenant/index.tsx
+++ b/threadpool/console-new/src/page/tenant/index.tsx
@@ -1,15 +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: '租户',
@@ -31,11 +32,13 @@ 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();
@@ -43,18 +46,29 @@ const Tenant: React.FC = () => {
const handleDelete = (item: any) => {
Modal.confirm({
title: '提示',
- content: `此操作将删除${item.tenantName},是否继续?`,
- onOk: () => {
- search.submit();
+ 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':
@@ -64,6 +78,9 @@ const Tenant: React.FC = () => {
break;
}
};
+ const handleClose = () => {
+ setEditVisible(false);
+ };
return (
@@ -71,7 +88,7 @@ const Tenant: React.FC = () => {
-
+
@@ -79,7 +96,7 @@ const Tenant: React.FC = () => {
handleSearch()} type="primary" icon={ }>
搜索
- setEditVisible(true)} type="primary" icon={ }>
+ actions('add')} type="primary" icon={ }>
添加
@@ -92,7 +109,6 @@ 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 181163e4..31dfc940 100644
--- a/threadpool/console-new/src/page/tenant/service.ts
+++ b/threadpool/console-new/src/page/tenant/service.ts
@@ -1,5 +1,21 @@
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 }
@@ -16,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 },
- });
-
- 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 },
+ body: { ...params },
});
-
if (res && res.success) {
return res;
}
- throw new Error(res.msg || '服务器开小差啦~');
+ throw new Error(res.message || '服务器开小差啦~');
};
-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)}
-
+
);
};
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 (
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+};
+
+export default UserCreate;
diff --git a/threadpool/console-new/src/page/user/index.tsx b/threadpool/console-new/src/page/user/index.tsx
index fb2504fd..78cdbb95 100644
--- a/threadpool/console-new/src/page/user/index.tsx
+++ b/threadpool/console-new/src/page/user/index.tsx
@@ -1,10 +1,11 @@
-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 { fetchUserList } from './service';
+import { fetchDeleteUser, fetchUserList } from './service';
import { useUrlSet } from '@/hooks/useUrlSet';
import style from './index.module.less';
+import UserCreate from './create';
const baseColumns = [
{
@@ -32,37 +33,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(fetchUserList, { form });
- // const {run: delete} = useRequest(fetchDeleteTenant, { manual: true });
+ const deleteRequest = useRequest(fetchDeleteUser, { manual: true });
+
+ const handleSearch = () => {
+ setUrl();
+ search.submit();
+ };
+ const handleDelete = (item: any) => {
+ Modal.confirm({
+ title: '提示',
+ content: `此操作将删除 ${item.userName},是否继续?`,
+ onOk: async () => {
+ try {
+ const res = await deleteRequest.runAsync(item.userName);
+ 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 +88,7 @@ const Tenant: React.FC = () => {
-
+
@@ -78,7 +96,7 @@ const Tenant: React.FC = () => {
handleSearch()} type="primary" icon={ }>
搜索
- setEditVisible(true)} type="primary" icon={ }>
+ actions('add')} type="primary" icon={ }>
添加
@@ -91,7 +109,6 @@ const Tenant: React.FC = () => {
{
actions('edit', record)} type="link" className={style.opreate_btn}>
编辑
- actions('edit', record)} type="link" className={style.opreate_btn}>
+ actions('delete', record)}
+ type="link"
+ className={style.opreate_btn}
+ disabled={record.userName === 'admin'}
+ >
删除
@@ -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 285b5f77..082299a4 100644
--- a/threadpool/console-new/src/route/index.tsx
+++ b/threadpool/console-new/src/route/index.tsx
@@ -7,6 +7,7 @@ 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 ThreadPoolMonitorRouter from '@/page/thread-pool-monitor/router';
const routerList: IRouterList[] = [
...homeRouter,
@@ -17,5 +18,6 @@ const routerList: IRouterList[] = [
...itemRouter,
...userRouter,
...logRouter,
+ ...ThreadPoolMonitorRouter,
];
export default routerList;
diff --git a/threadpool/console-new/src/utils/request/index.ts b/threadpool/console-new/src/utils/request/index.ts
index 6186d547..14b244a8 100644
--- a/threadpool/console-new/src/utils/request/index.ts
+++ b/threadpool/console-new/src/utils/request/index.ts
@@ -24,7 +24,7 @@ interface RequestOptions {
type Response = {
success: boolean;
- data?: T;
+ data: T;
module?: T;
msg?: string;
status?: number;
@@ -41,6 +41,7 @@ const inital: RequestOptions = {
headers: {
'Content-Type': 'application/json',
},
+ // headers,
credentials: true,
responseType: 'JSON',
cache: 'no-cache',
@@ -89,6 +90,7 @@ function request(url: string, config: RequestOptions): Promise> {
} 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 @@
{{ scope.$index + 1 }}
-
{{ scope.row.identify }}