pref: 优化远程数据库删除提示信息 (#5824)

Refs #5819 #5818
pull/5833/head
ssongliu 2024-07-15 18:43:27 +08:00 committed by GitHub
parent 12c6fe6331
commit 74bd997f07
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 40 additions and 55 deletions

View File

@ -230,13 +230,17 @@ func RemoveRepeatElement(a interface{}) (ret []interface{}) {
} }
func LoadSizeUnit(value float64) string { func LoadSizeUnit(value float64) string {
if value > 1048576 { val := int64(value)
return fmt.Sprintf("%vM", value/1048576) if val%1024 != 0 {
return fmt.Sprintf("%v", val)
} }
if value > 1024 { if val > 1048576 {
return fmt.Sprintf("%vK", value/1024) return fmt.Sprintf("%vM", val/1048576)
} }
return fmt.Sprintf("%v", value) if val > 1024 {
return fmt.Sprintf("%vK", val/1024)
}
return fmt.Sprintf("%v", val)
} }
func LoadSizeUnit2F(value float64) string { func LoadSizeUnit2F(value float64) string {

View File

@ -437,6 +437,11 @@ const message = {
remote: 'Remote', remote: 'Remote',
remoteDB: 'Remote DB', remoteDB: 'Remote DB',
createRemoteDB: 'Create Remote Server', createRemoteDB: 'Create Remote Server',
unBindRemoteDB: 'Unbind remote server',
unBindForce: 'Force unbind',
unBindForceHelper: 'Ignore all errors during the unbinding process to ensure the final operation is successful',
unBindRemoteHelper:
'Unbinding the remote database will only remove the binding relationship and will not directly delete the remote database',
editRemoteDB: 'Edit Remote Server', editRemoteDB: 'Edit Remote Server',
localDB: 'Local DB', localDB: 'Local DB',
address: 'DB address', address: 'DB address',

View File

@ -424,6 +424,10 @@ const message = {
remote: '', remote: '',
remoteDB: '', remoteDB: '',
createRemoteDB: '', createRemoteDB: '',
unBindRemoteDB: '',
unBindForce: '',
unBindForceHelper: '',
unBindRemoteHelper: '',
editRemoteDB: '', editRemoteDB: '',
localDB: '', localDB: '',
address: '', address: '',

View File

@ -424,6 +424,10 @@ const message = {
remote: '', remote: '',
remoteDB: '', remoteDB: '',
createRemoteDB: '', createRemoteDB: '',
unBindRemoteDB: '',
unBindForce: '',
unBindForceHelper: '',
unBindRemoteHelper: '',
editRemoteDB: '', editRemoteDB: '',
localDB: '', localDB: '',
address: '', address: '',

View File

@ -1,15 +1,15 @@
<template> <template>
<el-dialog <el-dialog
v-model="dialogVisible" v-model="dialogVisible"
:title="$t('commons.button.delete') + ' - ' + deleteMysqlReq.database" :title="$t('database.unBindRemoteDB') + ' - ' + deleteMysqlReq.database"
width="30%" width="30%"
:close-on-click-modal="false" :close-on-click-modal="false"
> >
<el-form ref="deleteForm" v-loading="loading" @submit.prevent> <el-form ref="deleteForm" v-loading="loading" @submit.prevent>
<el-form-item> <el-form-item>
<el-checkbox v-model="deleteMysqlReq.forceDelete" :label="$t('app.forceDelete')" /> <el-checkbox v-model="deleteMysqlReq.forceDelete" :label="$t('database.unBindForce')" />
<span class="input-help"> <span class="input-help">
{{ $t('app.forceDeleteHelper') }} {{ $t('database.unBindForceHelper') }}
</span> </span>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
@ -18,25 +18,15 @@
{{ $t('database.deleteBackupHelper') }} {{ $t('database.deleteBackupHelper') }}
</span> </span>
</el-form-item> </el-form-item>
<el-form-item>
<div> <span style="font-size: 12px">{{ $t('database.unBindRemoteHelper') }}</span>
<span style="font-size: 12px">{{ $t('database.delete') }}</span>
<span style="font-size: 12px; color: red; font-weight: 500">{{ deleteMysqlReq.database }}</span>
<span style="font-size: 12px">{{ $t('database.deleteHelper') }}</span>
</div>
<el-input v-model="delMysqlInfo" :placeholder="deleteMysqlReq.database"></el-input>
</el-form-item>
</el-form> </el-form>
<template #footer> <template #footer>
<span class="dialog-footer"> <span class="dialog-footer">
<el-button @click="dialogVisible = false" :disabled="loading"> <el-button @click="dialogVisible = false" :disabled="loading">
{{ $t('commons.button.cancel') }} {{ $t('commons.button.cancel') }}
</el-button> </el-button>
<el-button <el-button type="primary" @click="submit" :disabled="loading">
type="primary"
@click="submit"
:disabled="delMysqlInfo != deleteMysqlReq.database || loading"
>
{{ $t('commons.button.confirm') }} {{ $t('commons.button.confirm') }}
</el-button> </el-button>
</span> </span>
@ -58,7 +48,6 @@ let deleteMysqlReq = ref({
}); });
let dialogVisible = ref(false); let dialogVisible = ref(false);
let loading = ref(false); let loading = ref(false);
let delMysqlInfo = ref('');
const deleteForm = ref<FormInstance>(); const deleteForm = ref<FormInstance>();
@ -70,7 +59,6 @@ interface DialogProps {
const emit = defineEmits<{ (e: 'search'): void }>(); const emit = defineEmits<{ (e: 'search'): void }>();
const acceptParams = async (prop: DialogProps) => { const acceptParams = async (prop: DialogProps) => {
delMysqlInfo.value = '';
deleteMysqlReq.value = { deleteMysqlReq.value = {
id: prop.id, id: prop.id,
database: prop.database, database: prop.database,

View File

@ -1,15 +1,15 @@
<template> <template>
<el-dialog <el-dialog
v-model="dialogVisible" v-model="dialogVisible"
:title="$t('commons.button.delete') + ' - ' + deleteReq.database" :title="$t('database.unBindRemoteDB') + ' - ' + deleteReq.database"
width="30%" width="30%"
:close-on-click-modal="false" :close-on-click-modal="false"
> >
<el-form ref="deleteForm" v-loading="loading" @submit.prevent> <el-form ref="deleteForm" v-loading="loading" @submit.prevent>
<el-form-item> <el-form-item>
<el-checkbox v-model="deleteReq.forceDelete" :label="$t('app.forceDelete')" /> <el-checkbox v-model="deleteReq.forceDelete" :label="$t('database.unBindForce')" />
<span class="input-help"> <span class="input-help">
{{ $t('app.forceDeleteHelper') }} {{ $t('database.unBindForceHelper') }}
</span> </span>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
@ -18,21 +18,15 @@
{{ $t('database.deleteBackupHelper') }} {{ $t('database.deleteBackupHelper') }}
</span> </span>
</el-form-item> </el-form-item>
<el-form-item>
<div> <span style="font-size: 12px">{{ $t('database.unBindRemoteHelper') }}</span>
<span style="font-size: 12px">{{ $t('database.delete') }}</span>
<span style="font-size: 12px; color: red; font-weight: 500">{{ deleteReq.database }}</span>
<span style="font-size: 12px">{{ $t('database.deleteHelper') }}</span>
</div>
<el-input v-model="deleteInfo" :placeholder="deleteReq.database"></el-input>
</el-form-item>
</el-form> </el-form>
<template #footer> <template #footer>
<span class="dialog-footer"> <span class="dialog-footer">
<el-button @click="dialogVisible = false" :disabled="loading"> <el-button @click="dialogVisible = false" :disabled="loading">
{{ $t('commons.button.cancel') }} {{ $t('commons.button.cancel') }}
</el-button> </el-button>
<el-button type="primary" @click="submit" :disabled="deleteInfo != deleteReq.database || loading"> <el-button type="primary" @click="submit" :disabled="loading">
{{ $t('commons.button.confirm') }} {{ $t('commons.button.confirm') }}
</el-button> </el-button>
</span> </span>
@ -54,7 +48,6 @@ let deleteReq = ref({
}); });
let dialogVisible = ref(false); let dialogVisible = ref(false);
let loading = ref(false); let loading = ref(false);
let deleteInfo = ref('');
const deleteForm = ref<FormInstance>(); const deleteForm = ref<FormInstance>();
@ -66,7 +59,6 @@ interface DialogProps {
const emit = defineEmits<{ (e: 'search'): void }>(); const emit = defineEmits<{ (e: 'search'): void }>();
const acceptParams = async (prop: DialogProps) => { const acceptParams = async (prop: DialogProps) => {
deleteInfo.value = '';
deleteReq.value = { deleteReq.value = {
id: prop.id, id: prop.id,
database: prop.database, database: prop.database,

View File

@ -1,15 +1,15 @@
<template> <template>
<el-dialog <el-dialog
v-model="dialogVisible" v-model="dialogVisible"
:title="$t('commons.button.delete') + ' - ' + deleteMysqlReq.database" :title="$t('database.unBindRemoteDB') + ' - ' + deleteMysqlReq.database"
width="30%" width="30%"
:close-on-click-modal="false" :close-on-click-modal="false"
> >
<el-form ref="deleteForm" v-loading="loading" @submit.prevent> <el-form ref="deleteForm" v-loading="loading" @submit.prevent>
<el-form-item> <el-form-item>
<el-checkbox v-model="deleteMysqlReq.forceDelete" :label="$t('app.forceDelete')" /> <el-checkbox v-model="deleteMysqlReq.forceDelete" :label="$t('database.unBindForce')" />
<span class="input-help"> <span class="input-help">
{{ $t('app.forceDeleteHelper') }} {{ $t('database.unBindForceHelper') }}
</span> </span>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
@ -18,25 +18,15 @@
{{ $t('database.deleteBackupHelper') }} {{ $t('database.deleteBackupHelper') }}
</span> </span>
</el-form-item> </el-form-item>
<el-form-item>
<div> <span style="font-size: 12px">{{ $t('database.unBindRemoteHelper') }}</span>
<span style="font-size: 12px">{{ $t('database.delete') }}</span>
<span style="font-size: 12px; color: red; font-weight: 500">{{ deleteMysqlReq.database }}</span>
<span style="font-size: 12px">{{ $t('database.deleteHelper') }}</span>
</div>
<el-input v-model="delMysqlInfo" :placeholder="deleteMysqlReq.database"></el-input>
</el-form-item>
</el-form> </el-form>
<template #footer> <template #footer>
<span class="dialog-footer"> <span class="dialog-footer">
<el-button @click="dialogVisible = false" :disabled="loading"> <el-button @click="dialogVisible = false" :disabled="loading">
{{ $t('commons.button.cancel') }} {{ $t('commons.button.cancel') }}
</el-button> </el-button>
<el-button <el-button type="primary" @click="submit" :disabled="loading">
type="primary"
@click="submit"
:disabled="delMysqlInfo != deleteMysqlReq.database || loading"
>
{{ $t('commons.button.confirm') }} {{ $t('commons.button.confirm') }}
</el-button> </el-button>
</span> </span>
@ -58,7 +48,6 @@ let deleteMysqlReq = ref({
}); });
let dialogVisible = ref(false); let dialogVisible = ref(false);
let loading = ref(false); let loading = ref(false);
let delMysqlInfo = ref('');
const deleteForm = ref<FormInstance>(); const deleteForm = ref<FormInstance>();
@ -70,7 +59,6 @@ interface DialogProps {
const emit = defineEmits<{ (e: 'search'): void }>(); const emit = defineEmits<{ (e: 'search'): void }>();
const acceptParams = async (prop: DialogProps) => { const acceptParams = async (prop: DialogProps) => {
delMysqlInfo.value = '';
deleteMysqlReq.value = { deleteMysqlReq.value = {
id: prop.id, id: prop.id,
database: prop.database, database: prop.database,