diff --git a/hippo4j-example/hippo4j-config-nacos-spring-boot-1x-starter-example/pom.xml b/hippo4j-example/hippo4j-config-nacos-spring-boot-1x-starter-example/pom.xml index cbac1412..6bec3461 100644 --- a/hippo4j-example/hippo4j-config-nacos-spring-boot-1x-starter-example/pom.xml +++ b/hippo4j-example/hippo4j-config-nacos-spring-boot-1x-starter-example/pom.xml @@ -21,7 +21,11 @@ spring-cloud-starter-alibaba-nacos-config 1.5.1.RELEASE - + + + + + org.springframework.boot spring-boot-starter diff --git a/hippo4j-example/hippo4j-config-nacos-spring-boot-1x-starter-example/src/main/resources/application.properties b/hippo4j-example/hippo4j-config-nacos-spring-boot-1x-starter-example/src/main/resources/application.properties new file mode 100644 index 00000000..2e8be029 --- /dev/null +++ b/hippo4j-example/hippo4j-config-nacos-spring-boot-1x-starter-example/src/main/resources/application.properties @@ -0,0 +1,66 @@ +#debug=true +server.port=8089 +server.servlet.context-path=/example + +management.security.enabled=false +management.context-path=/actuator + +spring.profiles.active=dev +spring.application.name=hippo4j-config-nacos-spring-boot-1x-starter-example + +## nacos spring-boot +nacos.config.server-addr=127.0.0.1:8848 +nacos.config.ext-config[0].data-id=hippo4j-nacos.yaml +nacos.config.ext-config[0].group=DEFAULT_GROUP +nacos.config.ext-config[0].auto-refresh=true + +spring.dynamic.thread-pool.enable=true +spring.dynamic.thread-pool.banner=true +spring.dynamic.thread-pool.check-state-interval=5 +spring.dynamic.thread-pool.monitor.enable=true +spring.dynamic.thread-pool.monitor.collect-types=micrometer +spring.dynamic.thread-pool.monitor.thread-pool-types=dynamic,web +spring.dynamic.thread-pool.monitor.initial-delay=10000 +spring.dynamic.thread-pool.monitor.collect-interval=5000 + +spring.dynamic.thread-pool.notify-platforms[0].platform=WECHAT +spring.dynamic.thread-pool.notify-platforms[0].token=ac0426a5-c712-474c-9bff-72b8b8f5caff +spring.dynamic.thread-pool.notify-platforms[1].platform=DING +spring.dynamic.thread-pool.notify-platforms[1].token=56417ebba6a27ca352f0de77a2ae9da66d01f39610b5ee8a6033c60ef9071c55 +spring.dynamic.thread-pool.notify-platforms[2].platform=LARK +spring.dynamic.thread-pool.notify-platforms[2].token=2cbf2808-3839-4c26-a04d-fd201dd51f9e + +spring.dynamic.thread-pool.nacos.data-id=hippo4j-nacos.yaml +spring.dynamic.thread-pool.nacos.group=DEFAULT_GROUP +spring.dynamic.thread-pool.config-file-type=yaml + +spring.dynamic.thread-pool.executors[0].thread-pool-id=message-consume +spring.dynamic.thread-pool.executors[0].thread-name-prefix=message-consume +spring.dynamic.thread-pool.executors[0].core-pool-size=2 +spring.dynamic.thread-pool.executors[0].maximum-pool-size=4 +spring.dynamic.thread-pool.executors[0].queue-capacity=1024 +spring.dynamic.thread-pool.executors[0].blocking-queue=ResizableCapacityLinkedBlockingQueue +spring.dynamic.thread-pool.executors[0].execute-time-out=800 +spring.dynamic.thread-pool.executors[0].rejected-handler=AbortPolicy +spring.dynamic.thread-pool.executors[0].keep-alive-time=6691 +spring.dynamic.thread-pool.executors[0].allow-core-thread-time-out=true +spring.dynamic.thread-pool.executors[0].alarm=true +spring.dynamic.thread-pool.executors[0].active-alarm=80 +spring.dynamic.thread-pool.executors[0].capacity-alarm=80 +spring.dynamic.thread-pool.executors[0].notify.interval=8 +spring.dynamic.thread-pool.executors[0].notify.receives=chen.ma +spring.dynamic.thread-pool.executors[1].thread-pool-id=message-produce +spring.dynamic.thread-pool.executors[1].thread-name-prefix=message-produce +spring.dynamic.thread-pool.executors[1].core-pool-size=2 +spring.dynamic.thread-pool.executors[1].maximum-pool-size=4 +spring.dynamic.thread-pool.executors[1].queue-capacity=1024 +spring.dynamic.thread-pool.executors[1].blocking-queue=ResizableCapacityLinkedBlockingQueue +spring.dynamic.thread-pool.executors[1].execute-time-out=800 +spring.dynamic.thread-pool.executors[1].rejected-handler=AbortPolicy +spring.dynamic.thread-pool.executors[1].keep-alive-time=6691 +spring.dynamic.thread-pool.executors[1].allow-core-thread-time-out=true +spring.dynamic.thread-pool.executors[1].alarm=true +spring.dynamic.thread-pool.executors[1].active-alarm=80 +spring.dynamic.thread-pool.executors[1].capacity-alarm=80 +spring.dynamic.thread-pool.executors[1].notify.interval=8 +spring.dynamic.thread-pool.executors[1].notify.receives=chen.ma diff --git a/hippo4j-example/hippo4j-config-nacos-spring-boot-1x-starter-example/src/main/resources/bootstrap.properties b/hippo4j-example/hippo4j-config-nacos-spring-boot-1x-starter-example/src/main/resources/bootstrap.properties index 4ee562fc..38a8364b 100644 --- a/hippo4j-example/hippo4j-config-nacos-spring-boot-1x-starter-example/src/main/resources/bootstrap.properties +++ b/hippo4j-example/hippo4j-config-nacos-spring-boot-1x-starter-example/src/main/resources/bootstrap.properties @@ -8,6 +8,7 @@ management.context-path=/actuator spring.profiles.active=dev spring.application.name=hippo4j-config-nacos-spring-boot-1x-starter-example +# nacos spring-cloud spring.cloud.nacos.config.server-addr=127.0.0.1:8848 spring.cloud.nacos.config.ext-config[0].data-id=hippo4j-nacos.yaml spring.cloud.nacos.config.ext-config[0].group=DEFAULT_GROUP diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/config/ConfigHandlerConfiguration.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/config/ConfigHandlerConfiguration.java index 4c1dac08..1deac720 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/config/ConfigHandlerConfiguration.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/config/ConfigHandlerConfiguration.java @@ -17,15 +17,21 @@ package cn.hippo4j.config.springboot.starter.config; -import cn.hippo4j.config.springboot.starter.refresher.*; -import com.alibaba.cloud.nacos.NacosConfigManager; +import cn.hippo4j.config.springboot.starter.refresher.ApolloRefresherHandler; +import cn.hippo4j.config.springboot.starter.refresher.BootstrapConfigPropertiesBinderAdapt; +import cn.hippo4j.config.springboot.starter.refresher.ConsulRefresherHandler; +import cn.hippo4j.config.springboot.starter.refresher.DefaultBootstrapConfigPropertiesBinderAdapt; +import cn.hippo4j.config.springboot.starter.refresher.EtcdRefresherHandler; +import cn.hippo4j.config.springboot.starter.refresher.NacosCloudRefresherHandler; +import cn.hippo4j.config.springboot.starter.refresher.NacosRefresherHandler; +import cn.hippo4j.config.springboot.starter.refresher.PolarisRefresherHandler; +import cn.hippo4j.config.springboot.starter.refresher.ZookeeperRefresherHandler; import com.alibaba.cloud.nacos.NacosConfigProperties; import com.alibaba.nacos.api.config.ConfigService; import com.tencent.polaris.configuration.api.core.ConfigFileService; import io.etcd.jetcd.Client; import lombok.RequiredArgsConstructor; import org.apache.curator.framework.CuratorFramework; - import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass; @@ -42,6 +48,8 @@ public class ConfigHandlerConfiguration { private static final String NACOS_CONFIG_MANAGER_KEY = "com.alibaba.cloud.nacos.NacosConfigManager"; + private static final String NACOS_INJECTED_BEAN_NAME = "com.alibaba.nacos.spring.beans.factory.annotation.AnnotationNacosInjectedBeanPostProcessor"; + private static final String NACOS_DATA_ID_KEY = "nacos.data-id"; private static final String APOLLO_NAMESPACE_KEY = "apollo.namespace"; @@ -61,18 +69,18 @@ public class ConfigHandlerConfiguration { } @RequiredArgsConstructor - @ConditionalOnClass(ConfigService.class) + @ConditionalOnClass(value = ConfigService.class, name = NACOS_INJECTED_BEAN_NAME) @ConditionalOnMissingClass(NACOS_CONFIG_MANAGER_KEY) @ConditionalOnProperty(prefix = BootstrapConfigProperties.PREFIX, name = NACOS_DATA_ID_KEY) static class EmbeddedNacos { @Bean - public NacosRefresherHandler nacosRefresherHandler(NacosConfigProperties nacosConfigProperties) { - return new NacosRefresherHandler(nacosConfigProperties); + public NacosRefresherHandler nacosRefresherHandler() { + return new NacosRefresherHandler(); } } - @ConditionalOnClass(NacosConfigManager.class) + @ConditionalOnClass(NacosConfigProperties.class) @ConditionalOnProperty(prefix = BootstrapConfigProperties.PREFIX, name = NACOS_DATA_ID_KEY) static class EmbeddedNacosCloud { diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/NacosCloudRefresherHandler.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/NacosCloudRefresherHandler.java index 445f3cd2..47aae1ed 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/NacosCloudRefresherHandler.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/NacosCloudRefresherHandler.java @@ -18,7 +18,8 @@ package cn.hippo4j.config.springboot.starter.refresher; import cn.hippo4j.common.config.ApplicationContextHolder; -import com.alibaba.cloud.nacos.NacosConfigManager; +import com.alibaba.cloud.nacos.NacosConfigProperties; +import com.alibaba.nacos.api.config.ConfigService; import com.alibaba.nacos.api.config.listener.Listener; import com.alibaba.nacos.api.exception.NacosException; import lombok.SneakyThrows; @@ -37,17 +38,17 @@ public class NacosCloudRefresherHandler extends AbstractConfigThreadPoolDynamicR static final String GROUP = "group"; - private final NacosConfigManager nacosConfigManager; + private final ConfigService configService; public NacosCloudRefresherHandler() { - nacosConfigManager = ApplicationContextHolder.getBean(NacosConfigManager.class); + configService = ApplicationContextHolder.getBean(NacosConfigProperties.class).configServiceInstance(); } @SneakyThrows(NacosException.class) @Override public void initRegisterListener() { Map nacosConfig = bootstrapConfigProperties.getNacos(); - nacosConfigManager.getConfigService().addListener(nacosConfig.get(DATA_ID), + configService.addListener(nacosConfig.get(DATA_ID), nacosConfig.get(GROUP), new Listener() { @Override diff --git a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/NacosRefresherHandler.java b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/NacosRefresherHandler.java index 896d8ad8..0b795b23 100644 --- a/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/NacosRefresherHandler.java +++ b/hippo4j-spring-boot/hippo4j-config-spring-boot-starter/src/main/java/cn/hippo4j/config/springboot/starter/refresher/NacosRefresherHandler.java @@ -17,7 +17,6 @@ package cn.hippo4j.config.springboot.starter.refresher; -import com.alibaba.cloud.nacos.NacosConfigProperties; import com.alibaba.nacos.api.annotation.NacosInjected; import com.alibaba.nacos.api.config.ConfigService; import com.alibaba.nacos.api.config.listener.Listener; @@ -41,8 +40,8 @@ public class NacosRefresherHandler extends AbstractConfigThreadPoolDynamicRefres @NacosInjected private ConfigService configService; - public NacosRefresherHandler(NacosConfigProperties nacosConfigProperties) { - this.configService = nacosConfigProperties.configServiceInstance(); + public NacosRefresherHandler() { + super(); } @SneakyThrows(NacosException.class) diff --git a/hippo4j-spring-boot/hippo4j-spring-boot-starter-monitor/hippo4j-spring-boot-starter-monitor-local-log/src/main/java/cn/hippo4j/springboot/starter/monitor/local/log/LocalLogMonitorAutoConfiguration.java b/hippo4j-spring-boot/hippo4j-spring-boot-starter-monitor/hippo4j-spring-boot-starter-monitor-local-log/src/main/java/cn/hippo4j/springboot/starter/monitor/local/log/LocalLogMonitorAutoConfiguration.java index 7689f35b..d59c8912 100644 --- a/hippo4j-spring-boot/hippo4j-spring-boot-starter-monitor/hippo4j-spring-boot-starter-monitor-local-log/src/main/java/cn/hippo4j/springboot/starter/monitor/local/log/LocalLogMonitorAutoConfiguration.java +++ b/hippo4j-spring-boot/hippo4j-spring-boot-starter-monitor/hippo4j-spring-boot-starter-monitor-local-log/src/main/java/cn/hippo4j/springboot/starter/monitor/local/log/LocalLogMonitorAutoConfiguration.java @@ -17,9 +17,11 @@ package cn.hippo4j.springboot.starter.monitor.local.log; +import cn.hippo4j.adapter.web.WebThreadPoolService; import cn.hippo4j.monitor.local.log.AdapterThreadPoolLocalLogMonitorHandler; import cn.hippo4j.monitor.local.log.DynamicThreadPoolLocalLogMonitorHandler; import cn.hippo4j.monitor.local.log.WebThreadPoolLocalLogMonitorHandler; +import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -38,6 +40,7 @@ public class LocalLogMonitorAutoConfiguration { } @Bean + @ConditionalOnBean(WebThreadPoolService.class) @ConditionalOnExpression("'${spring.dynamic.thread-pool.monitor.thread-pool-types:}'.contains('web')") public WebThreadPoolLocalLogMonitorHandler webThreadPoolLocalLogMonitorHandler() { return new WebThreadPoolLocalLogMonitorHandler(); diff --git a/hippo4j-spring-boot/hippo4j-spring-boot-starter-monitor/hippo4j-spring-boot-starter-monitor-micrometer/src/main/java/cn/hippo4j/springboot/starter/monitor/micrometer/MicrometerMonitorAutoConfiguration.java b/hippo4j-spring-boot/hippo4j-spring-boot-starter-monitor/hippo4j-spring-boot-starter-monitor-micrometer/src/main/java/cn/hippo4j/springboot/starter/monitor/micrometer/MicrometerMonitorAutoConfiguration.java index 130ad862..d523575f 100644 --- a/hippo4j-spring-boot/hippo4j-spring-boot-starter-monitor/hippo4j-spring-boot-starter-monitor-micrometer/src/main/java/cn/hippo4j/springboot/starter/monitor/micrometer/MicrometerMonitorAutoConfiguration.java +++ b/hippo4j-spring-boot/hippo4j-spring-boot-starter-monitor/hippo4j-spring-boot-starter-monitor-micrometer/src/main/java/cn/hippo4j/springboot/starter/monitor/micrometer/MicrometerMonitorAutoConfiguration.java @@ -17,9 +17,11 @@ package cn.hippo4j.springboot.starter.monitor.micrometer; +import cn.hippo4j.adapter.web.WebThreadPoolService; import cn.hippo4j.monitor.micrometer.AdapterThreadPoolMicrometerMonitorHandler; import cn.hippo4j.monitor.micrometer.DynamicThreadPoolMicrometerMonitorHandler; import cn.hippo4j.monitor.micrometer.WebThreadPoolMicrometerMonitorHandler; +import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -38,6 +40,7 @@ public class MicrometerMonitorAutoConfiguration { } @Bean + @ConditionalOnBean(WebThreadPoolService.class) @ConditionalOnExpression("'${spring.dynamic.thread-pool.monitor.thread-pool-types:}'.contains('web')") public WebThreadPoolMicrometerMonitorHandler webThreadPoolMicrometerMonitorHandler() { return new WebThreadPoolMicrometerMonitorHandler(); diff --git a/hippo4j-ui/src/locale/lang/en.js b/hippo4j-ui/src/locale/lang/en.js index 5ea48ce2..6815cebd 100644 --- a/hippo4j-ui/src/locale/lang/en.js +++ b/hippo4j-ui/src/locale/lang/en.js @@ -9,29 +9,38 @@ export default { // 信息 message: { + requiredError: 'this is required', success: 'Success', createdSuccess: 'Created Successfully', - deleteMessage: 'This action will delete {name}, Do you want to continue?' + updateSuccess: 'Update Successfully', + deleteSuccess: 'Delete Successfully', + deleteMessage: 'This action will delete {name}, Do you want to continue?', + selectMessage: 'Please select a {target}', + NoDeletionPermissionTip: 'Contact the administrator to delete it', + emptyWarning: "The '{name}' cannot be empty", + queryFailure: 'The query fails. Please refresh the page' }, // 公共 common: { query: 'Query', insert: 'Insert', - serialNumber: 'Serial Number', operation: 'Operation', create: 'Create', edit: 'Edit', delete: 'Delete', + detail: 'Detail', cancel: 'Cancel', confirm: 'Confirm', + reset: 'Reset', ok: 'Ok', - threadPool: 'Thread Pool', num: 'Num', + close: 'Close', + refresh: 'Refresh', createTime: 'Create Time', updateTime: 'Update Time', - requiredError: 'this is required', - hint: 'Warning' + hint: 'Warning', + info: 'Info' }, // 运行报表 @@ -45,6 +54,7 @@ export default { // 租户管理 tenantManage: { tenant: 'Tenant', + tenantRequired: 'Tenant(Required)', tenantName: 'Tenant Name', owner: 'Owner', tenantIntro: 'Tenant Intro' @@ -53,15 +63,67 @@ export default { // 项目管理 projectManage: { item: 'Item', + itemRequired: 'Item(Required)', itemName: 'Item Name', owner: 'Owner', itemIntro: 'Item Intro' }, - // 线程池 + // 线程池管理 threadPool: { - tenant: 'Tenant', - project: 'Project', + threadPool: 'Thread Pool', + threadPoolRequired: 'ThreadPool(Required)', + coreSize: 'Core Size', + maximumSize: 'Maximum Size', + queueType: 'Queue Type', + queueCapacity: 'Queue Capacity', + rejectedHandler: 'Rejected Handler', + executionTimeout: 'Execution Timeout', + executionTimeoutUnit: 'Execution Timeout (ms)', + keepAliveTime: 'Keep Alive Time', + keepAliveTimeUnit: 'Keep Alive Time(seconds)', + isTimeout: 'Is Timeout', + timeout: 'Timeout', + noTimeout: 'No Timeout', + isAlarm: 'Is Alarm', + alarm: 'Alarm', + noAlarm: 'No Alarm', + activeAlarm: 'Active Alarm', + capacityAlarm: 'Capacity Alarm', + customRejectedHandler: 'Custom Rejected Handler', + customRejectedHandlerTip: 'Please enter a custom SPI Deny Policy ID', + threadsNumErrorTip: 'The maximum thread must be greater than or equal to the core thread' + }, + + // 线程池实例 + threadPoolInstance: { + instanceID: 'Instance ID', + active: 'Active', + stack: 'Stack', + basicInformation: 'Basic Information', + runningState: 'Running state', + activeID: 'Active', + instanceHost: 'Instance Host', + threadPoolID: 'ThreadPool ID', + LoadInformation: 'Load Information', + CurrentLoad: 'Current Load', + PeakLoad: 'Peak Load', + RemainingMemory: 'Remaining Memory', + MemoryRatio: 'Memory Ratio', + threadInformation: 'Thread Information', + currentSize: 'Current Size', + activeSize: 'Active Size', + largestSize: 'Largest Size', + queueInformation: 'Queue Information', + queueCount: 'Queue Count', + queueRemainingCapacity: 'Queue Remaining Capacity', + queueType: 'Queue Type', + otherInformation: 'Other Information', + totalTask: 'Total Task', + totalRejection: 'Total Rejection', + lastUpdateTime: 'Last update time', + allowCoreThreadTimeOut: 'Allow Core Thread Time Out', + changeAll: 'Change All', + stackRequestFail: 'The current thread pool has no stack information' } - } diff --git a/hippo4j-ui/src/locale/lang/zh.js b/hippo4j-ui/src/locale/lang/zh.js index 324041d1..c7ceb010 100644 --- a/hippo4j-ui/src/locale/lang/zh.js +++ b/hippo4j-ui/src/locale/lang/zh.js @@ -9,29 +9,38 @@ export default { // 信息 message: { + requiredError: '这是必填项', success: '成功', createdSuccess: '创建成功', - deleteMessage: '此操作将删除 {name}, 是否继续?' + updateSuccess: '更新成功', + deleteSuccess: '删除成功', + deleteMessage: '此操作将删除 {name}, 是否继续?', + selectMessage: '请选择{target}', + NoDeletionPermissionTip: '请联系管理员删除', + emptyWarning: "{name}不允许为空", + queryFailure: '查询失败,请尝试刷新页面' }, // 公共 common: { query: '搜索', insert: '添加', - serialNumber: '序号', operation: '操作', create: '创建', edit: '编辑', delete: '删除', + detail: '查看', cancel: '取消', confirm: '确认', + reset: '重置', + close: '关闭', + refresh: '刷新', ok: '确定', - threadPool: '线程池', num: '序号', createTime: '创建时间', updateTime: '修改时间', - requiredError: '这是必填项', - hint: '提示' + hint: '提示', + info: '详情' }, // 运行报表 @@ -45,6 +54,7 @@ export default { // 租户管理 tenantManage: { tenant: '租户', + tenantRequired: '租户(必填)', tenantName: '租户名称', owner: '负责人', tenantIntro: '租户简介' @@ -53,14 +63,68 @@ export default { // 项目管理 projectManage: { item: '项目', + itemRequired: '项目(必填)', itemName: '项目名称', owner: '负责人', itemIntro: '项目简介' }, - // 线程池 + // 线程池管理 threadPool: { - tenant: '租户', - project: '项目', + threadPool: '线程池', + threadPoolRequired: '线程池(必填)', + coreSize: '核心线程', + maximumSize: '最大线程', + queueType: '队列类型', + queueCapacity: '队列容量', + rejectedHandler: '拒绝策略', + executionTimeout: '执行超时', + executionTimeoutUnit: '执行超时 (毫秒)', + keepAliveTime: '空闲回收', + keepAliveTimeUnit: '空闲回收(秒)', + isTimeout: '是否超时', + timeout: '超时', + noTimeout: '不超时', + isAlarm: '是否报警', + alarm: '报警', + noAlarm: '不报警', + activeAlarm: '活跃报警', + capacityAlarm: '容量报警', + customRejectedHandler: '自定义拒绝策略', + customRejectedHandlerTip: '请输入自定义 SPI 拒绝策略标识', + threadsNumErrorTip: '最大线程必须大于等于核心线程' + }, + + + // 线程池实例 + threadPoolInstance: { + instanceID: '实例标识', + active: 'Active', + stack: '堆栈', + basicInformation: '基础信息', + runningState: '运行状态', + activeID: '环境标识', + instanceHost: '实例Host', + threadPoolID: '线程池', + LoadInformation: '负载信息', + CurrentLoad: '当前负载', + PeakLoad: '峰值负载', + RemainingMemory: '剩余内存', + MemoryRatio: '内存占比', + threadInformation: '线程信息', + currentSize: '当前线程', + activeSize: '活跃线程', + largestSize: '同存最大线程', + queueInformation: '队列信息', + queueCount: '队列元素', + queueRemainingCapacity: '队列剩余容量', + queueType: '阻塞队列', + otherInformation: '其它信息', + totalTask: '任务总量', + totalRejection: '拒绝次数', + lastUpdateTime: '最后更新时间', + allowCoreThreadTimeOut: '线程超时', + changeAll: '全部修改', + stackRequestFail: '当前线程池暂无堆栈信息' } } diff --git a/hippo4j-ui/src/main.js b/hippo4j-ui/src/main.js index 44f539b8..0cdc6fb5 100755 --- a/hippo4j-ui/src/main.js +++ b/hippo4j-ui/src/main.js @@ -18,6 +18,7 @@ import './permission'; // permission control // import './utils/error-log' // error log import i18n from '@/locale' +import '@/utils/i18n-utils' import * as filters from './filters'; // global filters import echarts from 'echarts'; Vue.prototype.$echarts = echarts; diff --git a/hippo4j-ui/src/utils/i18n-utils.js b/hippo4j-ui/src/utils/i18n-utils.js new file mode 100644 index 00000000..59998340 --- /dev/null +++ b/hippo4j-ui/src/utils/i18n-utils.js @@ -0,0 +1,20 @@ +import Vue from 'vue' +import i18n from '@/locale' + + +/** + * @param langMap {[lang]: any} object + * @param [defaultText] any + * @returns any + */ +export function langMatch(langMap, defaultText = undefined) { + if (Object.prototype.toString.call(langMap) !== '[object Object]') { + throw Error('The first argument to the langMatch method must be the object type') + } + const lang = i18n.locale + return Object.prototype.hasOwnProperty.call(langMap, lang) ? langMap[lang] : defaultText +} + + +Vue.prototype.$langMatch = langMatch + diff --git a/hippo4j-ui/src/views/dashboard/admin/components/PanelGroup.vue b/hippo4j-ui/src/views/dashboard/admin/components/PanelGroup.vue index c2629a0c..48cbcf51 100644 --- a/hippo4j-ui/src/views/dashboard/admin/components/PanelGroup.vue +++ b/hippo4j-ui/src/views/dashboard/admin/components/PanelGroup.vue @@ -33,7 +33,7 @@
- {{ $t('common.threadPool') }} + {{ $t('threadPool.threadPool') }}
diff --git a/hippo4j-ui/src/views/hippo4j/instance/index.vue b/hippo4j-ui/src/views/hippo4j/instance/index.vue index d830ec52..3c750ac4 100755 --- a/hippo4j-ui/src/views/hippo4j/instance/index.vue +++ b/hippo4j-ui/src/views/hippo4j/instance/index.vue @@ -3,7 +3,7 @@
- 搜索 + {{ $t('common.query') }} - 重置 + {{ $t('common.reset') }}
@@ -73,51 +73,52 @@ border :data="list" element-loading-text="Loading" - fit + :fit="true" max-height="714" highlight-current-row + header-row-name="headerRowName" > - + - + - + - + - + - + - + - + - + - + @@ -129,7 +130,7 @@ --> --> @@ -168,111 +169,111 @@ width="1000px" >