From e98777ee3f9aa28a12e8bf3c44fdb7ffab545b2f Mon Sep 17 00:00:00 2001 From: Kinplemelon Date: Thu, 26 Dec 2024 11:43:03 +0800 Subject: [PATCH 1/6] fix(buttons): wrong text --- src/components/Buttons/SearchButton.vue | 4 ++-- src/components/global-components.ts | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/Buttons/SearchButton.vue b/src/components/Buttons/SearchButton.vue index e3ec63d8a..2208132c1 100644 --- a/src/components/Buttons/SearchButton.vue +++ b/src/components/Buttons/SearchButton.vue @@ -1,6 +1,6 @@ @@ -13,5 +13,5 @@ defineProps<{ noText?: boolean }>() -const { t } = useI18nTl('Base') +const { tl } = useI18nTl('Base') diff --git a/src/components/global-components.ts b/src/components/global-components.ts index 83153c5d2..c49b33a7c 100644 --- a/src/components/global-components.ts +++ b/src/components/global-components.ts @@ -1,5 +1,5 @@ import CustomInputPassword from './CustomInputPassword.vue' -import { CreateButton, TableButton, RefreshButton, SearchButton } from './Buttons' +import { CreateButton, TableButton, RefreshButton, SearchButton, ResetButton } from './Buttons' import type { App } from 'vue' export default { @@ -9,5 +9,6 @@ export default { app.component('TableButton', TableButton) app.component('RefreshButton', RefreshButton) app.component('SearchButton', SearchButton) + app.component('ResetButton', ResetButton) }, } From e647e918fbb050d12457e57d1ca2fdfcf9f72f0a Mon Sep 17 00:00:00 2001 From: Kinplemelon Date: Thu, 26 Dec 2024 14:20:14 +0800 Subject: [PATCH 2/6] refactor(buttons): add ShowMoreButton component --- src/components/Buttons/ShowMoreButton.vue | 36 +++++++++++++++++++ src/components/Buttons/index.ts | 1 + src/components/global-components.ts | 10 +++++- src/style/normalize.scss | 1 + src/views/Clients/Clients.vue | 15 ++------ .../Rule/components/RuleFilterForm.vue | 14 +------- src/views/Subscriptions/Subscriptions.vue | 14 +------- 7 files changed, 51 insertions(+), 40 deletions(-) create mode 100644 src/components/Buttons/ShowMoreButton.vue diff --git a/src/components/Buttons/ShowMoreButton.vue b/src/components/Buttons/ShowMoreButton.vue new file mode 100644 index 000000000..8112636a4 --- /dev/null +++ b/src/components/Buttons/ShowMoreButton.vue @@ -0,0 +1,36 @@ + + + diff --git a/src/components/Buttons/index.ts b/src/components/Buttons/index.ts index 6edce5559..fb78192a6 100644 --- a/src/components/Buttons/index.ts +++ b/src/components/Buttons/index.ts @@ -3,3 +3,4 @@ export { default as SearchButton } from './SearchButton.vue' export { default as TableButton } from './TableButton.vue' export { default as RefreshButton } from './RefreshButton.vue' export { default as ResetButton } from './ResetButton.vue' +export { default as ShowMoreButton } from './ShowMoreButton.vue' diff --git a/src/components/global-components.ts b/src/components/global-components.ts index c49b33a7c..8793ab858 100644 --- a/src/components/global-components.ts +++ b/src/components/global-components.ts @@ -1,5 +1,12 @@ import CustomInputPassword from './CustomInputPassword.vue' -import { CreateButton, TableButton, RefreshButton, SearchButton, ResetButton } from './Buttons' +import { + CreateButton, + TableButton, + RefreshButton, + SearchButton, + ResetButton, + ShowMoreButton, +} from './Buttons' import type { App } from 'vue' export default { @@ -10,5 +17,6 @@ export default { app.component('RefreshButton', RefreshButton) app.component('SearchButton', SearchButton) app.component('ResetButton', ResetButton) + app.component('ShowMoreButton', ShowMoreButton) }, } diff --git a/src/style/normalize.scss b/src/style/normalize.scss index 804e96cae..927d34294 100644 --- a/src/style/normalize.scss +++ b/src/style/normalize.scss @@ -251,6 +251,7 @@ & + .el-dropdown { margin-left: 0; margin-right: 12px; + vertical-align: middle; } } } diff --git a/src/views/Clients/Clients.vue b/src/views/Clients/Clients.vue index 80a8d79d6..6ba4a969c 100644 --- a/src/views/Clients/Clients.vue +++ b/src/views/Clients/Clients.vue @@ -72,18 +72,7 @@ - - - - + @@ -183,7 +172,7 @@ import { useCursorPagination } from '@/hooks/usePagination' import usePaginationRemember from '@/hooks/usePaginationRemember' import { Client } from '@/types/client' import { CheckStatus } from '@/types/enum' -import { ArrowDown, ArrowUp, Delete } from '@element-plus/icons-vue' +import { Delete } from '@element-plus/icons-vue' import { isEmptyObj } from '@emqx/shared-ui-utils' import { ElMessage, ElMessageBox } from 'element-plus' import { computed } from 'vue' diff --git a/src/views/RuleEngine/Rule/components/RuleFilterForm.vue b/src/views/RuleEngine/Rule/components/RuleFilterForm.vue index 9abef917c..46d20c844 100644 --- a/src/views/RuleEngine/Rule/components/RuleFilterForm.vue +++ b/src/views/RuleEngine/Rule/components/RuleFilterForm.vue @@ -111,18 +111,7 @@ - - - - + @@ -135,7 +124,6 @@ import useSourceList from '@/hooks/Rule/action/useSourceList' import useBridgeTypeValue from '@/hooks/Rule/bridge/useBridgeTypeValue' import useI18nTl from '@/hooks/useI18nTl' import { FilterParamsForQueryRules } from '@/types/rule' -import { ArrowDown, ArrowUp } from '@element-plus/icons-vue' import { omit } from 'lodash' import type { Ref } from 'vue' import { computed, defineEmits, defineProps, ref } from 'vue' diff --git a/src/views/Subscriptions/Subscriptions.vue b/src/views/Subscriptions/Subscriptions.vue index c4455910c..09b5e397d 100644 --- a/src/views/Subscriptions/Subscriptions.vue +++ b/src/views/Subscriptions/Subscriptions.vue @@ -61,18 +61,7 @@ - - - - + @@ -129,7 +118,6 @@ import InfoTooltip from '@/components/InfoTooltip.vue' import useMQTTVersion5NewConfig from '@/hooks/useMQTTVersion5NewConfig' import usePaginationWithHasNext from '@/hooks/usePaginationWithHasNext' import useClusterNodes from '@/hooks/useClusterNodes' -import { ArrowDown, ArrowUp } from '@element-plus/icons-vue' import CommonPagination from '../../components/commonPagination.vue' import 'element-plus/theme-chalk/display.css' From a16509b81d3583bcec98e9432accda102a170d7f Mon Sep 17 00:00:00 2001 From: Kinplemelon Date: Thu, 26 Dec 2024 16:00:51 +0800 Subject: [PATCH 3/6] refactor(rule): order of buttons at the bottom of detail page --- src/views/RuleEngine/components/RuleForm.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/views/RuleEngine/components/RuleForm.vue b/src/views/RuleEngine/components/RuleForm.vue index 1ca404c8d..c2053f643 100644 --- a/src/views/RuleEngine/components/RuleForm.vue +++ b/src/views/RuleEngine/components/RuleForm.vue @@ -79,6 +79,9 @@ {{ savedAfterDataChange ? tl('backToRuleList') : $t('Base.cancel') }} + + {{ tl('saveAsCopy') }} + {{ isEdit ? $t('Base.update') : $t('Base.save') }} - - {{ tl('saveAsCopy') }} - From 28d456e2cb15b755a911dc5cae5e95d403345ed5 Mon Sep 17 00:00:00 2001 From: Kinplemelon Date: Fri, 27 Dec 2024 16:09:14 +0800 Subject: [PATCH 4/6] style(tables): unify components of some tables --- src/components/ArrayEditorTable.vue | 8 ++-- src/components/ObjectArrayEditor.vue | 8 ++-- src/views/Auth/components/AuthzManager.vue | 39 ++++++++++--------- .../Dashboard/components/NodesGraphCard.vue | 4 +- src/views/Diagnose/LogTrace/LogTrace.vue | 12 +----- .../Gateway/components/topicEditList.vue | 8 ++-- 6 files changed, 37 insertions(+), 42 deletions(-) diff --git a/src/components/ArrayEditorTable.vue b/src/components/ArrayEditorTable.vue index fbf8398fe..fb214309c 100644 --- a/src/components/ArrayEditorTable.vue +++ b/src/components/ArrayEditorTable.vue @@ -7,14 +7,14 @@ diff --git a/src/components/ObjectArrayEditor.vue b/src/components/ObjectArrayEditor.vue index 1e453d044..7acc3a6e7 100644 --- a/src/components/ObjectArrayEditor.vue +++ b/src/components/ObjectArrayEditor.vue @@ -34,14 +34,14 @@ diff --git a/src/views/Auth/components/AuthzManager.vue b/src/views/Auth/components/AuthzManager.vue index c82ec165f..d836ff30b 100644 --- a/src/views/Auth/components/AuthzManager.vue +++ b/src/views/Auth/components/AuthzManager.vue @@ -211,28 +211,30 @@ @@ -661,12 +663,13 @@ export default defineComponent({ } .form-table { .cell { - .btn.disabled { - cursor: not-allowed; - color: var(--color-text-placeholder); - } - .btn + .btn { - margin-left: 8px; + .el-button { + padding: 0; + margin-right: 0; + border: none; + & + .el-button { + margin-left: 8px; + } } } } diff --git a/src/views/Dashboard/components/NodesGraphCard.vue b/src/views/Dashboard/components/NodesGraphCard.vue index aaf34253b..ba0c508df 100644 --- a/src/views/Dashboard/components/NodesGraphCard.vue +++ b/src/views/Dashboard/components/NodesGraphCard.vue @@ -12,9 +12,9 @@
{{ tl('nodeData') }}
- + {{ tl('viewNodes') }} - +
diff --git a/src/views/Diagnose/LogTrace/LogTrace.vue b/src/views/Diagnose/LogTrace/LogTrace.vue index fb27699e6..adad1a642 100644 --- a/src/views/Diagnose/LogTrace/LogTrace.vue +++ b/src/views/Diagnose/LogTrace/LogTrace.vue @@ -10,17 +10,9 @@ diff --git a/src/views/Gateway/components/topicEditList.vue b/src/views/Gateway/components/topicEditList.vue index 62c00ba49..4561916f1 100644 --- a/src/views/Gateway/components/topicEditList.vue +++ b/src/views/Gateway/components/topicEditList.vue @@ -23,14 +23,14 @@ From a77036f91f8b8ac4fd0cb1128a75f80933f48d94 Mon Sep 17 00:00:00 2001 From: Kinplemelon Date: Fri, 27 Dec 2024 17:20:38 +0800 Subject: [PATCH 5/6] refactor(buttons): centre-aligned --- src/components/Buttons/CreateButton.vue | 12 ++++++++---- src/components/Buttons/RefreshButton.vue | 5 +++-- src/components/Buttons/SearchButton.vue | 5 +++-- src/views/Auth/components/AuthnManager.vue | 2 +- src/views/Auth/components/AuthzManager.vue | 4 +++- 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/src/components/Buttons/CreateButton.vue b/src/components/Buttons/CreateButton.vue index 1aac8eb2f..7549e2208 100644 --- a/src/components/Buttons/CreateButton.vue +++ b/src/components/Buttons/CreateButton.vue @@ -1,8 +1,7 @@ @@ -10,6 +9,11 @@ diff --git a/src/components/Buttons/RefreshButton.vue b/src/components/Buttons/RefreshButton.vue index dda6e8b2a..c2566d07e 100644 --- a/src/components/Buttons/RefreshButton.vue +++ b/src/components/Buttons/RefreshButton.vue @@ -1,6 +1,7 @@
- + + +
Date: Thu, 2 Jan 2025 16:55:02 +0800 Subject: [PATCH 6/6] feat(config): expose force shutdown config --- src/i18n/General.js | 24 +++ src/i18n/components.js | 4 + src/router/index.ts | 5 + src/types/config.d.ts | 9 +- .../Config/BasicConfig/ForceShutdown.vue | 155 ++++++++++++++++++ 5 files changed, 190 insertions(+), 7 deletions(-) create mode 100644 src/views/Config/BasicConfig/ForceShutdown.vue diff --git a/src/i18n/General.js b/src/i18n/General.js index fad7f1912..b02d48624 100644 --- a/src/i18n/General.js +++ b/src/i18n/General.js @@ -259,4 +259,28 @@ export default { zh: '持久会话中消息保留时长,超期的消息不会发送到订阅者。', en: 'The duration of message retention in a persistent session, messages that expire are not delivered to subscribers.', }, + enableForceShutdown: { + zh: '启用强制关闭', + en: 'Enable Force Shutdown', + }, + enableForceShutdownDesc: { + zh: '启用 force_shutdown(强制关闭)功能,当进程堆内存或邮箱大小超过设定值时强制关闭进程', + en: 'Enable force_shutdown feature. Process will be forcibly shutdown when heap memory or mailbox size exceeds the set value', + }, + maxHeapSize: { + zh: '最大堆内存', + en: 'Max Heap Size', + }, + maxHeapSizeDesc: { + zh: '进程的最大堆内存大小。如果启用了强制关闭功能,超过此限制的进程将自动退出或被强制终止。进程消息队列(邮箱)中的消息也是堆的一部分。进程关闭可分为以下两种情况:\n- 进程在运行时主动检查当前堆大小,发现超出限制后主动退出\n- 底层调度系统在为进程执行垃圾回收后检查当前堆大小,发现超出限制后强制终止进程\n\n注意:上述两种情况产生的错误日志会有所不同。前者生成的日志类似于 ...errorContext: connection_shutdown, reason: #{max => 2097152, reason => proc_heap_too_large, value => 2787348}..,后者生成的日志类似于 ...Context: maximum heap size reached...。', + en: 'The maximum heap size of the process. If the force_shutdown is enabled, processes that exceed this limit will automatically exit or be forcibly killed. Messages in the process message queue (mailbox) are also part of the heap. The shutdown of a process can be divided into the following two situations:\n- The process actively checks the current heap size during its own operation, and actively exits after finding that it exceeds the limit.\n- The underlying scheduling system checks the current heap size after performing garbage collection for the process, and forcibly kills the process after finding that it exceeds the limit.\n\nNote: The Error logs generated by the above two will be different. The log generated by the former is similar to ...errorContext: connection_shutdown, reason: #{max => 2097152, reason => proc_heap_too_large, value => 2787348}.., and the log generated by the latter is similar to ...Context: maximum heap size reached....', + }, + maxMailboxSize: { + zh: '最大邮箱大小', + en: 'Max Mailbox Size', + }, + maxMailboxSizeDesc: { + zh: 'EMQX 为每个客户端连接创建至少一个轻量级进程。每个进程都有自己的消息队列(邮箱)来保存来自其他进程(如 MQTT 消息)的消息,以便进程可以随时从消息队列(邮箱)中读取消息。如果系统繁忙或进程因繁忙的套接字而挂起,消息队列可能会积累大量消息。为避免过度使用内存,当进程的消息队列长度超过此值时,EMQX 将强制关闭该进程。', + en: 'EMQX creates at least one lightweight process for each client connection. Each process has its own message queue (aka mailbox) to hold messages from other processes (e.g. MQTT messages) so that the process can read messages from the message queue (mailbox) at any time. If the system is busy or the process hangs due to a busy socket (see high_watermark), the message queue can accumulate many messages. To avoid excessive memory usage, EMQX will force a process to shut down when the length of its message queue exceeds max_mailbox_size.', + }, } diff --git a/src/i18n/components.js b/src/i18n/components.js index 4e1974c5c..fc1fcc794 100644 --- a/src/i18n/components.js +++ b/src/i18n/components.js @@ -287,6 +287,10 @@ export default { zh: '会话持久化', en: 'Durable Sessions', }, + 'mqtt-force-shutdown': { + zh: '强制关闭', + en: 'Force Shutdown', + }, /* For Quick Panel Start */ 'rule-create': { zh: '创建规则', diff --git a/src/router/index.ts b/src/router/index.ts index 3c4656b73..1d4c95cab 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -504,6 +504,11 @@ export const routes: Array = [ name: 'mqtt-system-topic', component: () => import('@/views/Config/BasicConfig/SystemTopics.vue'), }, + { + path: 'force-shutdown', + name: 'mqtt-force-shutdown', + component: () => import('@/views/Config/BasicConfig/ForceShutdown.vue'), + }, ], }, // log config diff --git a/src/types/config.d.ts b/src/types/config.d.ts index 70f320fbf..e1ad17f7d 100644 --- a/src/types/config.d.ts +++ b/src/types/config.d.ts @@ -1,4 +1,5 @@ import { ComponentPublicInstance } from 'vue' +import { EmqxForceShutdown } from './schemas/configs.schemas' export interface SubTabComponent extends ComponentPublicInstance { index: number @@ -189,7 +190,7 @@ export interface Zone { mqtt: Mqtt stats: Stats flapping_detect: FlappingDetect - force_shutdown: ForceShutdown + force_shutdown: EmqxForceShutdown conn_congestion: ConnCongestion force_gc: ForceGc overload_protection: OverloadProtection @@ -238,12 +239,6 @@ export interface FlappingDetect { ban_time: string } -export interface ForceShutdown { - enable: boolean - max_message_queue_len: number - max_heap_size: string -} - export interface ConnCongestion { enable_alarm: boolean min_alarm_sustain_duration: string diff --git a/src/views/Config/BasicConfig/ForceShutdown.vue b/src/views/Config/BasicConfig/ForceShutdown.vue new file mode 100644 index 000000000..4bb8db673 --- /dev/null +++ b/src/views/Config/BasicConfig/ForceShutdown.vue @@ -0,0 +1,155 @@ + + + + +