From 71e277f68b8c2ee99ea1943d917a276c7f6b7f2b Mon Sep 17 00:00:00 2001 From: chenwenchang <479999519@qq.com> Date: Wed, 30 Oct 2024 10:30:42 +0800 Subject: [PATCH] =?UTF-8?q?fix(frontend):=20webconsole=20use=E8=AF=AD?= =?UTF-8?q?=E5=8F=A5=E6=AD=A3=E5=88=99=E6=A0=A1=E9=AA=8C=20#7488=20#=20Rev?= =?UTF-8?q?iewed,=20transaction=20id:=2022282?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/webconsole/components/console-panel/Index.vue | 2 +- .../components/console-panel/components/RenderMysqlMessage.vue | 2 +- .../components/console-panel/components/RenderRedisMessage.vue | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dbm-ui/frontend/src/views/db-manage/common/webconsole/components/console-panel/Index.vue b/dbm-ui/frontend/src/views/db-manage/common/webconsole/components/console-panel/Index.vue index cc62b02746..96c9c59a79 100644 --- a/dbm-ui/frontend/src/views/db-manage/common/webconsole/components/console-panel/Index.vue +++ b/dbm-ui/frontend/src/views/db-manage/common/webconsole/components/console-panel/Index.vue @@ -187,6 +187,7 @@ } // 校验语句 + cmd = cmd.substring(inputPlaceholder.length); if (consoleConfig.value.validate) { const validateResult = consoleConfig.value.validate(cmd); if (validateResult) { @@ -202,7 +203,6 @@ // 开始请求 try { loading.value = true; - cmd = cmd.substring(inputPlaceholder.length); if (typeof props.raw === 'boolean') { baseParams = { ...baseParams, diff --git a/dbm-ui/frontend/src/views/db-manage/common/webconsole/components/console-panel/components/RenderMysqlMessage.vue b/dbm-ui/frontend/src/views/db-manage/common/webconsole/components/console-panel/components/RenderMysqlMessage.vue index 8319555f2d..054cbf1128 100644 --- a/dbm-ui/frontend/src/views/db-manage/common/webconsole/components/console-panel/components/RenderMysqlMessage.vue +++ b/dbm-ui/frontend/src/views/db-manage/common/webconsole/components/console-panel/components/RenderMysqlMessage.vue @@ -32,7 +32,7 @@ } export const validate = (cmd: string) => { - if (cmd.includes('use')) { + if (/^\s*use\s+.*$/.test(cmd)) { return t('暂不支持 use 语句,请使用 db.table 指定 database'); } return ''; diff --git a/dbm-ui/frontend/src/views/db-manage/common/webconsole/components/console-panel/components/RenderRedisMessage.vue b/dbm-ui/frontend/src/views/db-manage/common/webconsole/components/console-panel/components/RenderRedisMessage.vue index 25e0514099..42c1970da3 100644 --- a/dbm-ui/frontend/src/views/db-manage/common/webconsole/components/console-panel/components/RenderRedisMessage.vue +++ b/dbm-ui/frontend/src/views/db-manage/common/webconsole/components/console-panel/components/RenderRedisMessage.vue @@ -37,7 +37,7 @@ queryResult: string; commandInputs: string[]; }) => { - if (/select/i.test(cmd) && queryResult === 'OK') { + if (/^\s*select\s+.*$/.test(cmd) && queryResult === 'OK') { const newDbIndex = Number(cmd.substring('select '.length)); setDbIndexByClusterId(clusterId, newDbIndex); const newCommandInputs = commandInputs.map((item) => item.replace(/\[(\d+)\]/, `[${newDbIndex}]`));