From 1f2bb6a3d857655d77ea091022f71d22baac3581 Mon Sep 17 00:00:00 2001 From: Muhammed Mustafa Date: Mon, 2 Oct 2023 11:43:00 +0000 Subject: [PATCH 01/52] fix: Added Create Data Source btn --- .../assets/nc-icons/add-data-source.svg | 6 +++ .../dashboard/settings/DataSources.vue | 18 ++++++--- .../settings/data-sources/CreateBase.vue | 6 ++- .../nc-gui/components/project/AllTables.vue | 35 +++++++++++++++- packages/nc-gui/components/project/View.vue | 40 +++++++++++++------ packages/nc-gui/lang/en.json | 3 ++ packages/nc-gui/store/config.ts | 3 ++ packages/nc-gui/utils/iconUtils.ts | 2 + 8 files changed, 93 insertions(+), 20 deletions(-) create mode 100644 packages/nc-gui/assets/nc-icons/add-data-source.svg diff --git a/packages/nc-gui/assets/nc-icons/add-data-source.svg b/packages/nc-gui/assets/nc-icons/add-data-source.svg new file mode 100644 index 0000000000..6ea287bc88 --- /dev/null +++ b/packages/nc-gui/assets/nc-icons/add-data-source.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/packages/nc-gui/components/dashboard/settings/DataSources.vue b/packages/nc-gui/components/dashboard/settings/DataSources.vue index 1628edb602..c4fb2b08cf 100644 --- a/packages/nc-gui/components/dashboard/settings/DataSources.vue +++ b/packages/nc-gui/components/dashboard/settings/DataSources.vue @@ -25,6 +25,8 @@ const { loadProject } = useProjects() const projectStore = useProject() const { project } = storeToRefs(projectStore) +const { projectPageTab } = storeToRefs(useConfigStore()) + const { refreshCommandPalette } = useCommandPalette() const sources = ref([]) @@ -140,11 +142,17 @@ const forceAwaken = () => { emits('awaken', forceAwakened.value) } -onMounted(async () => { - if (sources.value.length === 0) { - loadBases() - } -}) +watch( + projectPageTab, + () => { + if (projectPageTab.value === 'data-source') { + loadBases() + } + }, + { + immediate: true, + }, +) watch( () => props.reload, diff --git a/packages/nc-gui/components/dashboard/settings/data-sources/CreateBase.vue b/packages/nc-gui/components/dashboard/settings/data-sources/CreateBase.vue index 7b38e81944..eb7c74868b 100644 --- a/packages/nc-gui/components/dashboard/settings/data-sources/CreateBase.vue +++ b/packages/nc-gui/components/dashboard/settings/data-sources/CreateBase.vue @@ -27,10 +27,12 @@ import { watch, } from '#imports' -const { connectionType } = defineProps<{ connectionType: ClientType }>() +const props = defineProps<{ connectionType?: ClientType }>() const emit = defineEmits(['baseCreated', 'close']) +const connectionType = computed(() => props.connectionType ?? ClientType.MYSQL) + const projectStore = useProject() const { loadProject } = useProjects() const { project } = storeToRefs(projectStore) @@ -391,7 +393,7 @@ onMounted(async () => { }) watch( - () => connectionType, + connectionType, (v) => { formState.value.dataSource.client = v onClientChange() diff --git a/packages/nc-gui/components/project/AllTables.vue b/packages/nc-gui/components/project/AllTables.vue index 09da149053..29593dc176 100644 --- a/packages/nc-gui/components/project/AllTables.vue +++ b/packages/nc-gui/components/project/AllTables.vue @@ -1,11 +1,16 @@