feat: 优化数据库切换效果 (#6757)

Refs #6755
aliyun
ssongliu 1 month ago committed by ssongliu
parent a6ab6d6aba
commit fcce6fec44

@ -107,7 +107,7 @@
<script lang="ts" setup> <script lang="ts" setup>
import { CheckAppInstalled, InstalledOp } from '@/api/modules/app'; import { CheckAppInstalled, InstalledOp } from '@/api/modules/app';
import router from '@/routers'; import router from '@/routers';
import { onMounted, reactive, ref, watch } from 'vue'; import { onMounted, reactive, ref } from 'vue';
import Status from '@/components/status/index.vue'; import Status from '@/components/status/index.vue';
import { ElMessageBox } from 'element-plus'; import { ElMessageBox } from 'element-plus';
import i18n from '@/lang'; import i18n from '@/lang';
@ -125,21 +125,6 @@ const props = defineProps({
}, },
}); });
watch(
() => props.appKey,
(val) => {
key.value = val;
onCheck();
},
);
watch(
() => props.appName,
(val) => {
name.value = val;
onCheck();
},
);
let key = ref(''); let key = ref('');
let name = ref(''); let name = ref('');
@ -250,4 +235,8 @@ onMounted(() => {
name.value = props.appName; name.value = props.appName;
onCheck(); onCheck();
}); });
defineExpose({
onCheck,
});
</script> </script>

@ -21,6 +21,7 @@
v-model:mask-show="maskShow" v-model:mask-show="maskShow"
@setting="onSetting" @setting="onSetting"
@is-exist="checkExist" @is-exist="checkExist"
ref="appStatusRef"
></AppStatus> ></AppStatus>
</template> </template>
@ -327,6 +328,8 @@ const dashboardName = ref();
const dashboardKey = ref(); const dashboardKey = ref();
const dashboardVisible = ref(false); const dashboardVisible = ref(false);
const appStatusRef = ref();
const dialogPortJumpRef = ref(); const dialogPortJumpRef = ref();
const data = ref(); const data = ref();
@ -384,6 +387,7 @@ const onSetting = async () => {
}; };
const changeDatabase = async () => { const changeDatabase = async () => {
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;

@ -19,6 +19,7 @@
v-model:mask-show="maskShow" v-model:mask-show="maskShow"
@setting="onSetting" @setting="onSetting"
@is-exist="checkExist" @is-exist="checkExist"
ref="appStatusRef"
></AppStatus> ></AppStatus>
</template> </template>
@ -305,6 +306,7 @@ const postgresqlContainer = ref();
const postgresqlStatus = ref(); const postgresqlStatus = ref();
const postgresqlVersion = ref(); const postgresqlVersion = ref();
const appStatusRef = ref();
const dialogRef = ref(); const dialogRef = ref();
const onOpenDialog = async () => { const onOpenDialog = async () => {
let params = { let params = {
@ -348,6 +350,7 @@ const onSetting = async () => {
}; };
const changeDatabase = async () => { const changeDatabase = async () => {
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;

@ -19,6 +19,7 @@
@before="onBefore" @before="onBefore"
@after="onAfter" @after="onAfter"
@setting="onSetting" @setting="onSetting"
ref="appStatusRef"
></AppStatus> ></AppStatus>
</template> </template>
<template #search v-if="!isOnSetting && currentDB"> <template #search v-if="!isOnSetting && currentDB">
@ -164,6 +165,7 @@ const redisIsExist = ref(false);
const redisStatus = ref(); const redisStatus = ref();
const terminalShow = ref(false); const terminalShow = ref(false);
const appStatusRef = ref();
const commandVisible = ref(false); const commandVisible = ref(false);
const redisCliExist = ref(); const redisCliExist = ref();
@ -220,6 +222,7 @@ const goRouter = async (target: string) => {
}; };
const changeDatabase = async () => { const changeDatabase = async () => {
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;

Loading…
Cancel
Save