fix: 解决应用安装有远程同名数据库报错的问题 (#1861)
This commit is contained in:
@@ -130,7 +130,7 @@ func createLink(ctx context.Context, app model.App, appInstall *model.AppInstall
|
|||||||
var resourceId uint
|
var resourceId uint
|
||||||
if dbConfig.DbName != "" && dbConfig.DbUser != "" && dbConfig.Password != "" {
|
if dbConfig.DbName != "" && dbConfig.DbUser != "" && dbConfig.Password != "" {
|
||||||
iMysqlRepo := repo.NewIMysqlRepo()
|
iMysqlRepo := repo.NewIMysqlRepo()
|
||||||
oldMysqlDb, _ := iMysqlRepo.Get(commonRepo.WithByName(dbConfig.DbName))
|
oldMysqlDb, _ := iMysqlRepo.Get(commonRepo.WithByName(dbConfig.DbName), iMysqlRepo.WithByFrom(constant.ResourceLocal))
|
||||||
resourceId = oldMysqlDb.ID
|
resourceId = oldMysqlDb.ID
|
||||||
if oldMysqlDb.ID > 0 {
|
if oldMysqlDb.ID > 0 {
|
||||||
if oldMysqlDb.Username != dbConfig.DbUser || oldMysqlDb.Password != dbConfig.Password {
|
if oldMysqlDb.Username != dbConfig.DbUser || oldMysqlDb.Password != dbConfig.Password {
|
||||||
|
@@ -80,7 +80,7 @@
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { reactive, ref } from 'vue';
|
import { reactive, ref } from 'vue';
|
||||||
import { checkFileType, computeSize } from '@/utils/util';
|
import { computeSize } from '@/utils/util';
|
||||||
import { useDeleteData } from '@/hooks/use-delete-data';
|
import { useDeleteData } from '@/hooks/use-delete-data';
|
||||||
import { handleRecoverByUpload } from '@/api/modules/setting';
|
import { handleRecoverByUpload } from '@/api/modules/setting';
|
||||||
import i18n from '@/lang';
|
import i18n from '@/lang';
|
||||||
@@ -184,9 +184,7 @@ const beforeAvatarUpload = (rawFile) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const fileOnChange = (_uploadFile: UploadFile, uploadFiles: UploadFiles) => {
|
const fileOnChange = (_uploadFile: UploadFile, uploadFiles: UploadFiles) => {
|
||||||
if (checkFileType(_uploadFile, uploadFiles)) {
|
|
||||||
uploaderFiles.value = uploadFiles;
|
uploaderFiles.value = uploadFiles;
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleClose = () => {
|
const handleClose = () => {
|
||||||
|
@@ -1,6 +1,4 @@
|
|||||||
import i18n from '@/lang';
|
import i18n from '@/lang';
|
||||||
import { UploadFile, UploadFiles } from 'element-plus';
|
|
||||||
import { MsgWarning } from './message';
|
|
||||||
|
|
||||||
export function deepCopy<T>(obj: any): T {
|
export function deepCopy<T>(obj: any): T {
|
||||||
let newObj: any;
|
let newObj: any;
|
||||||
@@ -307,15 +305,3 @@ export function downloadWithContent(content: string, fileName: string) {
|
|||||||
const event = new MouseEvent('click');
|
const event = new MouseEvent('click');
|
||||||
a.dispatchEvent(event);
|
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;
|
|
||||||
}
|
|
||||||
|
@@ -48,7 +48,6 @@ import { ChunkUploadFileData, UploadFileData } from '@/api/modules/files';
|
|||||||
import i18n from '@/lang';
|
import i18n from '@/lang';
|
||||||
import DrawerHeader from '@/components/drawer-header/index.vue';
|
import DrawerHeader from '@/components/drawer-header/index.vue';
|
||||||
import { MsgSuccess } from '@/utils/message';
|
import { MsgSuccess } from '@/utils/message';
|
||||||
import { checkFileType } from '@/utils/util';
|
|
||||||
|
|
||||||
interface UploadFileProps {
|
interface UploadFileProps {
|
||||||
path: string;
|
path: string;
|
||||||
@@ -71,9 +70,7 @@ const handleClose = () => {
|
|||||||
const uploaderFiles = ref<UploadFiles>([]);
|
const uploaderFiles = ref<UploadFiles>([]);
|
||||||
|
|
||||||
const fileOnChange = (_uploadFile: UploadFile, uploadFiles: UploadFiles) => {
|
const fileOnChange = (_uploadFile: UploadFile, uploadFiles: UploadFiles) => {
|
||||||
if (checkFileType(_uploadFile, uploadFiles)) {
|
|
||||||
uploaderFiles.value = uploadFiles;
|
uploaderFiles.value = uploadFiles;
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleExceed: UploadProps['onExceed'] = (files) => {
|
const handleExceed: UploadProps['onExceed'] = (files) => {
|
||||||
|
@@ -565,7 +565,6 @@ const submit = async (formEl: FormInstance | undefined) => {
|
|||||||
} else {
|
} else {
|
||||||
if (website.value.type === 'proxy') {
|
if (website.value.type === 'proxy') {
|
||||||
website.value.proxy = website.value.proxyProtocol + website.value.proxyAddress;
|
website.value.proxy = website.value.proxyProtocol + website.value.proxyAddress;
|
||||||
console.log(website.value.proxy);
|
|
||||||
}
|
}
|
||||||
CreateWebsite(website.value)
|
CreateWebsite(website.value)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
Reference in New Issue
Block a user