mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-19 08:19:15 +08:00
fix: 解决慢日志开启后未刷新导致无法关闭的问题
This commit is contained in:
parent
89cb9e6693
commit
fb286d2def
@ -2,7 +2,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<el-drawer v-model="changeVisiable" :destroy-on-close="true" :close-on-click-modal="false" width="30%">
|
<el-drawer v-model="changeVisiable" :destroy-on-close="true" :close-on-click-modal="false" width="30%">
|
||||||
<template #header>
|
<template #header>
|
||||||
<DrawerHeader :header="$t('database.changePassword')" :back="handleClose" />
|
<DrawerHeader :header="title" :back="handleClose" />
|
||||||
</template>
|
</template>
|
||||||
<el-form>
|
<el-form>
|
||||||
<el-form v-loading="loading" ref="changeFormRef" :model="changeForm" label-position="top">
|
<el-form v-loading="loading" ref="changeFormRef" :model="changeForm" label-position="top">
|
||||||
@ -78,6 +78,7 @@ const loading = ref();
|
|||||||
const changeVisiable = ref(false);
|
const changeVisiable = ref(false);
|
||||||
type FormInstance = InstanceType<typeof ElForm>;
|
type FormInstance = InstanceType<typeof ElForm>;
|
||||||
const changeFormRef = ref<FormInstance>();
|
const changeFormRef = ref<FormInstance>();
|
||||||
|
const title = ref();
|
||||||
const changeForm = reactive({
|
const changeForm = reactive({
|
||||||
id: 0,
|
id: 0,
|
||||||
mysqlName: '',
|
mysqlName: '',
|
||||||
@ -101,6 +102,10 @@ interface DialogProps {
|
|||||||
value: string;
|
value: string;
|
||||||
}
|
}
|
||||||
const acceptParams = (params: DialogProps): void => {
|
const acceptParams = (params: DialogProps): void => {
|
||||||
|
title.value =
|
||||||
|
params.operation === 'password'
|
||||||
|
? i18n.global.t('database.changePassword')
|
||||||
|
: i18n.global.t('database.permission');
|
||||||
changeForm.id = params.id;
|
changeForm.id = params.id;
|
||||||
changeForm.mysqlName = params.mysqlName;
|
changeForm.mysqlName = params.mysqlName;
|
||||||
changeForm.userName = params.username;
|
changeForm.userName = params.username;
|
||||||
|
@ -17,9 +17,11 @@
|
|||||||
{{ $t('commons.button.save') }}
|
{{ $t('commons.button.save') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<div style="float: left; margin-left: 20px">
|
<div style="float: left; margin-left: 20px">
|
||||||
<el-checkbox border v-model="isWatch">{{ $t('commons.button.watch') }}</el-checkbox>
|
<el-checkbox style="margin-top: 2px" :disabled="!currentStatus" border v-model="isWatch">
|
||||||
|
{{ $t('commons.button.watch') }}
|
||||||
|
</el-checkbox>
|
||||||
</div>
|
</div>
|
||||||
<el-button style="margin-left: 20px" @click="onDownload" icon="Download">
|
<el-button :disabled="!currentStatus" style="margin-left: 20px" @click="onDownload" icon="Download">
|
||||||
{{ $t('file.download') }}
|
{{ $t('file.download') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
@ -29,7 +31,7 @@
|
|||||||
:placeholder="$t('database.noData')"
|
:placeholder="$t('database.noData')"
|
||||||
:indent-with-tab="true"
|
:indent-with-tab="true"
|
||||||
:tabSize="4"
|
:tabSize="4"
|
||||||
style="height: calc(100vh - 427px); width: 100%"
|
style="height: calc(100vh - 428px); width: 100%"
|
||||||
:lineWrapping="true"
|
:lineWrapping="true"
|
||||||
:matchBrackets="true"
|
:matchBrackets="true"
|
||||||
theme="cobalt"
|
theme="cobalt"
|
||||||
@ -77,7 +79,6 @@ const variables = reactive({
|
|||||||
slow_query_log: 'OFF',
|
slow_query_log: 'OFF',
|
||||||
long_query_time: 10,
|
long_query_time: 10,
|
||||||
});
|
});
|
||||||
const oldVariables = ref();
|
|
||||||
|
|
||||||
interface DialogProps {
|
interface DialogProps {
|
||||||
mysqlName: string;
|
mysqlName: string;
|
||||||
@ -100,7 +101,6 @@ const acceptParams = async (params: DialogProps): Promise<void> => {
|
|||||||
}
|
}
|
||||||
}, 1000 * 5);
|
}, 1000 * 5);
|
||||||
}
|
}
|
||||||
oldVariables.value = { ...variables };
|
|
||||||
};
|
};
|
||||||
const emit = defineEmits(['loading']);
|
const emit = defineEmits(['loading']);
|
||||||
|
|
||||||
@ -132,13 +132,12 @@ const changeSlowLogs = () => {
|
|||||||
|
|
||||||
const onCancle = async () => {
|
const onCancle = async () => {
|
||||||
variables.slow_query_log = currentStatus.value ? 'ON' : 'OFF';
|
variables.slow_query_log = currentStatus.value ? 'ON' : 'OFF';
|
||||||
|
detailShow.value = currentStatus.value;
|
||||||
};
|
};
|
||||||
|
|
||||||
const onSave = async () => {
|
const onSave = async () => {
|
||||||
let param = [] as Array<Database.VariablesUpdate>;
|
let param = [] as Array<Database.VariablesUpdate>;
|
||||||
if (variables.slow_query_log !== oldVariables.value.slow_query_log) {
|
param.push({ param: 'slow_query_log', value: variables.slow_query_log });
|
||||||
param.push({ param: 'slow_query_log', value: variables.slow_query_log });
|
|
||||||
}
|
|
||||||
if (variables.slow_query_log === 'ON') {
|
if (variables.slow_query_log === 'ON') {
|
||||||
param.push({ param: 'long_query_time', value: variables.long_query_time + '' });
|
param.push({ param: 'long_query_time', value: variables.long_query_time + '' });
|
||||||
param.push({ param: 'slow_query_log_file', value: '/var/lib/mysql/1Panel-slow.log' });
|
param.push({ param: 'slow_query_log_file', value: '/var/lib/mysql/1Panel-slow.log' });
|
||||||
@ -149,7 +148,6 @@ const onSave = async () => {
|
|||||||
emit('loading', false);
|
emit('loading', false);
|
||||||
currentStatus.value = variables.slow_query_log === 'ON';
|
currentStatus.value = variables.slow_query_log === 'ON';
|
||||||
detailShow.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'));
|
MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
|
@ -152,7 +152,7 @@ let mysqlVariables = reactive({
|
|||||||
});
|
});
|
||||||
const variablesRules = reactive({
|
const variablesRules = reactive({
|
||||||
key_buffer_size: [Rules.number, checkNumberRange(1, 102400)],
|
key_buffer_size: [Rules.number, checkNumberRange(1, 102400)],
|
||||||
query_cache_size: [Rules.number, checkNumberRange(1, 102400)],
|
query_cache_size: [Rules.number, checkNumberRange(0, 102400)],
|
||||||
tmp_table_size: [Rules.number, checkNumberRange(1, 102400)],
|
tmp_table_size: [Rules.number, checkNumberRange(1, 102400)],
|
||||||
innodb_buffer_pool_size: [Rules.number, checkNumberRange(1, 102400)],
|
innodb_buffer_pool_size: [Rules.number, checkNumberRange(1, 102400)],
|
||||||
innodb_log_buffer_size: [Rules.number, checkNumberRange(1, 102400)],
|
innodb_log_buffer_size: [Rules.number, checkNumberRange(1, 102400)],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user