fix: 解决数据库切换版本不正确的问题 (#7111)

pull/7114/head
ssongliu 2 weeks ago committed by GitHub
parent f1afc0f4d9
commit ee0e17a496
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -47,6 +47,7 @@ var (
ErrXpackNotFound = "ErrXpackNotFound" ErrXpackNotFound = "ErrXpackNotFound"
ErrXpackNotActive = "ErrXpackNotActive" ErrXpackNotActive = "ErrXpackNotActive"
ErrXpackLost = "ErrXpackLost" ErrXpackLost = "ErrXpackLost"
ErrXpackTimeout = "ErrXpackTimeout"
ErrXpackOutOfDate = "ErrXpackOutOfDate" ErrXpackOutOfDate = "ErrXpackOutOfDate"
) )

@ -159,8 +159,8 @@ const isDB = () => {
return key.value === 'mysql' || key.value === 'mariadb' || key.value === 'postgresql'; return key.value === 'mysql' || key.value === 'mariadb' || key.value === 'postgresql';
}; };
const onCheck = async () => { const onCheck = async (key: any, name: any) => {
await CheckAppInstalled(key.value, name.value) await CheckAppInstalled(key, name)
.then((res) => { .then((res) => {
data.value = res.data; data.value = res.data;
em('isExist', res.data); em('isExist', res.data);
@ -206,7 +206,7 @@ const onOperate = async (operation: string) => {
.then(() => { .then(() => {
em('update:loading', false); em('update:loading', false);
MsgSuccess(i18n.global.t('commons.msg.operationSuccess')); MsgSuccess(i18n.global.t('commons.msg.operationSuccess'));
onCheck(); onCheck(key.value, name.value);
em('after'); em('after');
}) })
.catch(() => { .catch(() => {
@ -234,7 +234,7 @@ const getTitle = (key: string) => {
onMounted(() => { onMounted(() => {
key.value = props.appKey; key.value = props.appKey;
name.value = props.appName; name.value = props.appName;
onCheck(); onCheck(key.value, name.value);
}); });
defineExpose({ defineExpose({

@ -388,15 +388,13 @@ const onSetting = async () => {
}; };
const changeDatabase = async () => { const changeDatabase = async () => {
if (currentDB.value.from === 'local') {
appStatusRef.value.onCheck();
}
for (const item of dbOptionsLocal.value) { for (const item of dbOptionsLocal.value) {
if (item.database == currentDBName.value) { if (item.database == currentDBName.value) {
currentDB.value = item; currentDB.value = item;
appKey.value = item.type; appKey.value = item.type;
appName.value = item.database; appName.value = item.database;
search(); search();
appStatusRef.value?.onCheck(appKey.value, appName.value);
return; return;
} }
} }

@ -351,15 +351,13 @@ const onSetting = async () => {
}; };
const changeDatabase = async () => { const changeDatabase = async () => {
if (currentDB.value.from === 'local') {
appStatusRef.value.onCheck();
}
for (const item of dbOptionsLocal.value) { for (const item of dbOptionsLocal.value) {
if (item.database == currentDBName.value) { if (item.database == currentDBName.value) {
currentDB.value = item; currentDB.value = item;
appKey.value = item.type; appKey.value = item.type;
appName.value = item.database; appName.value = item.database;
search(); search();
appStatusRef.value?.onCheck(appKey.value, appName.value);
return; return;
} }
} }

@ -223,14 +223,12 @@ const goRouter = async (target: string) => {
}; };
const changeDatabase = async () => { const changeDatabase = async () => {
if (currentDB.value.from === 'local') {
appStatusRef.value.onCheck();
}
for (const item of dbOptionsLocal.value) { for (const item of dbOptionsLocal.value) {
if (item.database == currentDBName.value) { if (item.database == currentDBName.value) {
currentDB.value = item; currentDB.value = item;
appKey.value = item.type; appKey.value = item.type;
appName.value = item.database; appName.value = item.database;
appStatusRef.value?.onCheck(appKey.value, appName.value);
reOpenTerminal(); reOpenTerminal();
return; return;
} }

Loading…
Cancel
Save