diff --git a/packages/nc-gui/components/dashboard/settings/DataSources.vue b/packages/nc-gui/components/dashboard/settings/DataSources.vue index 6debc07779..1f0c7fa080 100644 --- a/packages/nc-gui/components/dashboard/settings/DataSources.vue +++ b/packages/nc-gui/components/dashboard/settings/DataSources.vue @@ -16,7 +16,7 @@ interface Props { const props = defineProps() -const emits = defineEmits(['update:state', 'update:reload']) +const emits = defineEmits(['update:state', 'update:reload', 'awaken']) const vState = useVModel(props, 'state', emits) const vReload = useVModel(props, 'reload', emits) @@ -29,6 +29,7 @@ let activeBaseId = $ref('') let metadiffbases = $ref([]) let clientType = $ref(ClientType.MYSQL) let isReloading = $ref(false) +let forceAwakened = $ref(false) async function loadBases() { try { @@ -138,6 +139,11 @@ const moveBase = async (e: any) => { } } +const forceAwaken = () => { + forceAwakened = !forceAwakened + emits('awaken', forceAwakened) +} + onMounted(async () => { if (sources.length === 0) { await loadBases() @@ -155,6 +161,18 @@ watch( }, ) +watch( + () => sources.length, + (l) => { + if (l > 1 && !forceAwakened) { + emits('awaken', false) + } else { + emits('awaken', true) + } + }, + { immediate: true }, +) + watch( vState, (newState) => { @@ -175,6 +193,11 @@ watch( clientType = ClientType.MSSQL vState.value = DataSourcesSubTab.New break + case DataSourcesSubTab.New: + if (sources.length > 1 && !forceAwakened) { + vState.value = '' + } + break } }, { immediate: true }, @@ -189,7 +212,7 @@ watch(
Name
Actions
-
Show / Hide
+
Show / Hide
@@ -269,7 +292,7 @@ watch(