fix: 解决应用安装有远程同名数据库报错的问题 (#1861)

This commit is contained in:
zhengkunwang
2023-08-07 11:50:11 +08:00
committed by GitHub
parent 8c2d3e432d
commit c9ea6f6c8d
5 changed files with 4 additions and 24 deletions

View File

@@ -130,7 +130,7 @@ func createLink(ctx context.Context, app model.App, appInstall *model.AppInstall
var resourceId uint
if dbConfig.DbName != "" && dbConfig.DbUser != "" && dbConfig.Password != "" {
iMysqlRepo := repo.NewIMysqlRepo()
oldMysqlDb, _ := iMysqlRepo.Get(commonRepo.WithByName(dbConfig.DbName))
oldMysqlDb, _ := iMysqlRepo.Get(commonRepo.WithByName(dbConfig.DbName), iMysqlRepo.WithByFrom(constant.ResourceLocal))
resourceId = oldMysqlDb.ID
if oldMysqlDb.ID > 0 {
if oldMysqlDb.Username != dbConfig.DbUser || oldMysqlDb.Password != dbConfig.Password {

View File

@@ -80,7 +80,7 @@
<script lang="ts" setup>
import { reactive, ref } from 'vue';
import { checkFileType, computeSize } from '@/utils/util';
import { computeSize } from '@/utils/util';
import { useDeleteData } from '@/hooks/use-delete-data';
import { handleRecoverByUpload } from '@/api/modules/setting';
import i18n from '@/lang';
@@ -184,9 +184,7 @@ const beforeAvatarUpload = (rawFile) => {
};
const fileOnChange = (_uploadFile: UploadFile, uploadFiles: UploadFiles) => {
if (checkFileType(_uploadFile, uploadFiles)) {
uploaderFiles.value = uploadFiles;
}
};
const handleClose = () => {

View File

@@ -1,6 +1,4 @@
import i18n from '@/lang';
import { UploadFile, UploadFiles } from 'element-plus';
import { MsgWarning } from './message';
export function deepCopy<T>(obj: any): T {
let newObj: any;
@@ -307,15 +305,3 @@ export function downloadWithContent(content: string, fileName: string) {
const event = new MouseEvent('click');
a.dispatchEvent(event);
}
export function checkFileType(_uploadFile: UploadFile, uploadFiles: UploadFiles): boolean {
if (_uploadFile.raw?.type == '') {
const index = uploadFiles.findIndex((file) => file.name === _uploadFile.name && file.raw?.type === '');
if (index !== -1) {
uploadFiles.splice(index, 1);
}
MsgWarning(i18n.global.t('file.unsupportType'));
return false;
}
return true;
}

View File

@@ -48,7 +48,6 @@ import { ChunkUploadFileData, UploadFileData } from '@/api/modules/files';
import i18n from '@/lang';
import DrawerHeader from '@/components/drawer-header/index.vue';
import { MsgSuccess } from '@/utils/message';
import { checkFileType } from '@/utils/util';
interface UploadFileProps {
path: string;
@@ -71,9 +70,7 @@ const handleClose = () => {
const uploaderFiles = ref<UploadFiles>([]);
const fileOnChange = (_uploadFile: UploadFile, uploadFiles: UploadFiles) => {
if (checkFileType(_uploadFile, uploadFiles)) {
uploaderFiles.value = uploadFiles;
}
};
const handleExceed: UploadProps['onExceed'] = (files) => {

View File

@@ -565,7 +565,6 @@ const submit = async (formEl: FormInstance | undefined) => {
} else {
if (website.value.type === 'proxy') {
website.value.proxy = website.value.proxyProtocol + website.value.proxyAddress;
console.log(website.value.proxy);
}
CreateWebsite(website.value)
.then(() => {