feat: 数据库从服务器获取增加提示信息 (#1817)

pull/1819/head
ssongliu 2023-08-03 14:45:27 +08:00 committed by GitHub
parent e4462c06fe
commit b0320a4ebc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 22 additions and 11 deletions

View File

@ -202,7 +202,6 @@ func handleAppRecover(install *model.AppInstall, recoverFile string, isRollback
global.LOG.Errorf("handle recover from sql.gz failed, err: %v", err) global.LOG.Errorf("handle recover from sql.gz failed, err: %v", err)
return err return err
} }
_ = NewIMysqlService().LoadFromRemote("local")
} }
if err := handleUnTar(tmpPath+"/app.tar.gz", fmt.Sprintf("%s/%s", constant.AppInstallDir, install.App.Key)); err != nil { if err := handleUnTar(tmpPath+"/app.tar.gz", fmt.Sprintf("%s/%s", constant.AppInstallDir, install.App.Key)); err != nil {
@ -224,6 +223,7 @@ func handleAppRecover(install *model.AppInstall, recoverFile string, isRollback
oldInstall.Status = constant.StatusRunning oldInstall.Status = constant.StatusRunning
oldInstall.AppId = install.AppId oldInstall.AppId = install.AppId
oldInstall.AppDetailId = install.AppDetailId oldInstall.AppDetailId = install.AppDetailId
oldInstall.App.ID = install.AppId
if err := appInstallRepo.Save(context.Background(), &oldInstall); err != nil { if err := appInstallRepo.Save(context.Background(), &oldInstall); err != nil {
global.LOG.Errorf("save db app install failed, err: %v", err) global.LOG.Errorf("save db app install failed, err: %v", err)
return err return err

View File

@ -338,6 +338,8 @@ const message = {
'This port is the exposed port of the container. You need to save the modification separately and restart the container!', 'This port is the exposed port of the container. You need to save the modification separately and restart the container!',
loadFromRemote: 'load from Server', loadFromRemote: 'load from Server',
loadFromRemoteHelper:
'This action will synchronize the database info on the server to 1Panel, do you want to continue?',
passwordHelper: 'Unable to retrieve, please modify', passwordHelper: 'Unable to retrieve, please modify',
remote: 'Remote', remote: 'Remote',
remoteDB: 'Remote DB', remoteDB: 'Remote DB',

View File

@ -333,6 +333,7 @@ const message = {
confChange: '', confChange: '',
loadFromRemote: '', loadFromRemote: '',
loadFromRemoteHelper: ' 1Panel',
passwordHelper: '', passwordHelper: '',
remote: '', remote: '',
remoteDB: '', remoteDB: '',

View File

@ -333,6 +333,7 @@ const message = {
confChange: '', confChange: '',
loadFromRemote: '', loadFromRemote: '',
loadFromRemoteHelper: ' 1Panel',
passwordHelper: '', passwordHelper: '',
remote: '', remote: '',
remoteDB: '', remoteDB: '',

View File

@ -214,6 +214,7 @@ import Backups from '@/components/backup/index.vue';
import UploadDialog from '@/components/upload/index.vue'; import UploadDialog from '@/components/upload/index.vue';
import PortJumpDialog from '@/components/port-jump/index.vue'; import PortJumpDialog from '@/components/port-jump/index.vue';
import { dateFormat } from '@/utils/util'; import { dateFormat } from '@/utils/util';
import { ElMessageBox } from 'element-plus';
import { onMounted, reactive, ref } from 'vue'; import { onMounted, reactive, ref } from 'vue';
import { import {
deleteCheckMysqlDB, deleteCheckMysqlDB,
@ -315,6 +316,11 @@ const search = async (column?: any) => {
}; };
const loadDB = async () => { const loadDB = async () => {
ElMessageBox.confirm(i18n.global.t('database.loadFromRemoteHelper'), i18n.global.t('commons.msg.infoTitle'), {
confirmButtonText: i18n.global.t('commons.button.confirm'),
cancelButtonText: i18n.global.t('commons.button.cancel'),
type: 'info',
}).then(async () => {
loading.value = true; loading.value = true;
await loadDBFromRemote(paginationConfig.from) await loadDBFromRemote(paginationConfig.from)
.then(() => { .then(() => {
@ -324,6 +330,7 @@ const loadDB = async () => {
.catch(() => { .catch(() => {
loading.value = false; loading.value = false;
}); });
});
}; };
const goRouter = async () => { const goRouter = async () => {

View File

@ -31,7 +31,7 @@
<el-input clearable v-model.trim="dialogData.rowData!.address" /> <el-input clearable v-model.trim="dialogData.rowData!.address" />
</el-form-item> </el-form-item>
<el-form-item :label="$t('commons.table.port')" prop="port"> <el-form-item :label="$t('commons.table.port')" prop="port">
<el-input clearable v-model.trim="dialogData.rowData!.port" /> <el-input clearable v-model.number="dialogData.rowData!.port" />
</el-form-item> </el-form-item>
<el-form-item :label="$t('commons.login.username')" prop="username"> <el-form-item :label="$t('commons.login.username')" prop="username">
<el-input clearable v-model.trim="dialogData.rowData!.username" /> <el-input clearable v-model.trim="dialogData.rowData!.username" />