diff --git a/frontend/package-lock.json b/frontend/package-lock.json
index d4c8abafa..29346e77c 100644
--- a/frontend/package-lock.json
+++ b/frontend/package-lock.json
@@ -10643,9 +10643,9 @@
}
},
"node_modules/webpack": {
- "version": "5.75.0",
- "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.75.0.tgz",
- "integrity": "sha512-piaIaoVJlqMsPtX/+3KTTO6jfvrSYgauFVdt8cr9LTHKmcq/AMd4mhzsiP7ZF/PGRNPGA8336jldh9l2Kt2ogQ==",
+ "version": "5.76.1",
+ "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.76.1.tgz",
+ "integrity": "sha512-4+YIK4Abzv8172/SGqObnUjaIHjLEuUasz9EwQj/9xmPPkYJy2Mh03Q/lJfSD3YLzbxy5FeTq5Uw0323Oh6SJQ==",
"peer": true,
"dependencies": {
"@types/eslint-scope": "^3.7.3",
@@ -18679,9 +18679,9 @@
}
},
"webpack": {
- "version": "5.75.0",
- "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.75.0.tgz",
- "integrity": "sha512-piaIaoVJlqMsPtX/+3KTTO6jfvrSYgauFVdt8cr9LTHKmcq/AMd4mhzsiP7ZF/PGRNPGA8336jldh9l2Kt2ogQ==",
+ "version": "5.76.1",
+ "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.76.1.tgz",
+ "integrity": "sha512-4+YIK4Abzv8172/SGqObnUjaIHjLEuUasz9EwQj/9xmPPkYJy2Mh03Q/lJfSD3YLzbxy5FeTq5Uw0323Oh6SJQ==",
"peer": true,
"requires": {
"@types/eslint-scope": "^3.7.3",
diff --git a/frontend/src/components/container-log/index.vue b/frontend/src/components/container-log/index.vue
index 693333357..7eb5c3289 100644
--- a/frontend/src/components/container-log/index.vue
+++ b/frontend/src/components/container-log/index.vue
@@ -77,7 +77,7 @@ const timeOptions = ref([
const searchLogs = async () => {
const res = await logContainer(logSearch);
- logInfo.value = res.data;
+ logInfo.value = res.data || '';
nextTick(() => {
const state = view.value.state;
view.value.dispatch({
diff --git a/frontend/src/views/container/container/log/index.vue b/frontend/src/views/container/container/log/index.vue
index 19c283f91..f223a77e3 100644
--- a/frontend/src/views/container/container/log/index.vue
+++ b/frontend/src/views/container/container/log/index.vue
@@ -96,7 +96,7 @@ const handleClose = async () => {
const searchLogs = async () => {
const res = await logContainer(logSearch);
- logInfo.value = res.data;
+ logInfo.value = res.data || '';
nextTick(() => {
const state = view.value.state;
view.value.dispatch({
diff --git a/frontend/src/views/database/mysql/setting/slow-log/index.vue b/frontend/src/views/database/mysql/setting/slow-log/index.vue
index 0fefd6394..850b789f8 100644
--- a/frontend/src/views/database/mysql/setting/slow-log/index.vue
+++ b/frontend/src/views/database/mysql/setting/slow-log/index.vue
@@ -13,7 +13,7 @@
-
+
{{ $t('commons.button.save') }}
@@ -56,7 +56,7 @@ import { updateMysqlVariables } from '@/api/modules/database';
import { dateFormatForName } from '@/utils/util';
import i18n from '@/lang';
import { loadBaseDir } from '@/api/modules/setting';
-import { MsgError, MsgSuccess } from '@/utils/message';
+import { MsgError, MsgInfo, MsgSuccess } from '@/utils/message';
const extensions = [javascript(), oneDark];
const slowLogs = ref();
@@ -65,7 +65,7 @@ const handleReady = (payload) => {
view.value = payload.view;
};
const detailShow = ref();
-const isOnEdit = ref();
+const currentStatus = ref();
const confirmDialogRef = ref();
@@ -88,17 +88,18 @@ const acceptParams = async (params: DialogProps): Promise => {
variables.slow_query_log = params.variables.slow_query_log;
variables.long_query_time = Number(params.variables.long_query_time);
- const pathRes = await loadBaseDir();
- let path = `${pathRes.data}/apps/mysql/${mysqlName.value}/data/1Panel-slow.log`;
if (variables.slow_query_log === 'ON') {
+ currentStatus.value = true;
detailShow.value = true;
+ const pathRes = await loadBaseDir();
+ let path = `${pathRes.data}/apps/mysql/${mysqlName.value}/data/1Panel-slow.log`;
loadMysqlSlowlogs(path);
+ timer = setInterval(() => {
+ if (variables.slow_query_log === 'ON' && isWatch.value) {
+ loadMysqlSlowlogs(path);
+ }
+ }, 1000 * 5);
}
- timer = setInterval(() => {
- if (variables.slow_query_log === 'ON' && isWatch.value) {
- loadMysqlSlowlogs(path);
- }
- }, 1000 * 5);
oldVariables.value = { ...variables };
};
const emit = defineEmits(['loading']);
@@ -106,11 +107,6 @@ const emit = defineEmits(['loading']);
const handleSlowLogs = async () => {
if (variables.slow_query_log === 'ON') {
detailShow.value = true;
- isOnEdit.value = true;
- return;
- }
- if (isOnEdit.value) {
- detailShow.value = false;
return;
}
let params = {
@@ -121,7 +117,7 @@ const handleSlowLogs = async () => {
confirmDialogRef.value!.acceptParams(params);
};
-const openSlowLogs = () => {
+const changeSlowLogs = () => {
if (!(variables.long_query_time > 0 && variables.long_query_time <= 600)) {
MsgError(i18n.global.t('database.thresholdRangeHelper'));
return;
@@ -135,7 +131,7 @@ const openSlowLogs = () => {
};
const onCancle = async () => {
- variables.slow_query_log = variables.slow_query_log === 'ON' ? 'OFF' : 'ON';
+ variables.slow_query_log = currentStatus.value ? 'ON' : 'OFF';
};
const onSave = async () => {
@@ -151,10 +147,9 @@ const onSave = async () => {
await updateMysqlVariables(param)
.then(() => {
emit('loading', false);
- isOnEdit.value = false;
- if (variables.slow_query_log !== 'ON') {
- detailShow.value = false;
- }
+ currentStatus.value = variables.slow_query_log === 'ON';
+ detailShow.value = variables.slow_query_log === 'ON';
+ oldVariables.value.slow_query_log = variables.slow_query_log;
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
})
.catch(() => {
@@ -163,6 +158,10 @@ const onSave = async () => {
};
const onDownload = async () => {
+ if (!slowLogs.value) {
+ MsgInfo(i18n.global.t('database.noData'));
+ return;
+ }
const downloadUrl = window.URL.createObjectURL(new Blob([slowLogs.value]));
const a = document.createElement('a');
a.style.display = 'none';
@@ -174,7 +173,7 @@ const onDownload = async () => {
const loadMysqlSlowlogs = async (path: string) => {
const res = await LoadFile({ path: path });
- slowLogs.value = res.data;
+ slowLogs.value = res.data || '';
nextTick(() => {
const state = view.value.state;
view.value.dispatch({
diff --git a/frontend/src/views/host/terminal/host/operate/index.vue b/frontend/src/views/host/terminal/host/operate/index.vue
index 1338d479e..a010cc8d7 100644
--- a/frontend/src/views/host/terminal/host/operate/index.vue
+++ b/frontend/src/views/host/terminal/host/operate/index.vue
@@ -79,7 +79,7 @@ import type { ElForm } from 'element-plus';
import { Rules } from '@/global/form-rules';
import { addHost, editHost, testByInfo, GetGroupList } from '@/api/modules/host';
import i18n from '@/lang';
-import { MsgSuccess } from '@/utils/message';
+import { MsgError, MsgSuccess } from '@/utils/message';
const loading = ref();
@@ -165,7 +165,7 @@ const submitAddHost = (formEl: FormInstance | undefined, ops: string) => {
if (res.data) {
MsgSuccess(i18n.global.t('terminal.connTestOk'));
} else {
- MsgSuccess(i18n.global.t('terminal.connTestFailed'));
+ MsgError(i18n.global.t('terminal.connTestFailed'));
}
});
}