1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-03-17 03:04:46 +08:00

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

This commit is contained in:
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,15 +316,21 @@ const search = async (column?: any) => {
}; };
const loadDB = async () => { const loadDB = async () => {
loading.value = true; ElMessageBox.confirm(i18n.global.t('database.loadFromRemoteHelper'), i18n.global.t('commons.msg.infoTitle'), {
await loadDBFromRemote(paginationConfig.from) confirmButtonText: i18n.global.t('commons.button.confirm'),
.then(() => { cancelButtonText: i18n.global.t('commons.button.cancel'),
loading.value = false; type: 'info',
search(); }).then(async () => {
}) loading.value = true;
.catch(() => { await loadDBFromRemote(paginationConfig.from)
loading.value = false; .then(() => {
}); loading.value = false;
search();
})
.catch(() => {
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" />