diff --git a/packages/nc-gui/components.d.ts b/packages/nc-gui/components.d.ts index bb95e0722e..a2d73853c2 100644 --- a/packages/nc-gui/components.d.ts +++ b/packages/nc-gui/components.d.ts @@ -90,6 +90,7 @@ declare module '@vue/runtime-core' { LogosMysqlIcon: typeof import('~icons/logos/mysql-icon')['default'] LogosPostgresql: typeof import('~icons/logos/postgresql')['default'] LogosRedditIcon: typeof import('~icons/logos/reddit-icon')['default'] + LogosSnowflakeIcon: typeof import('~icons/logos/snowflake-icon')['default'] LogosSwagger: typeof import('~icons/logos/swagger')['default'] MaterialSymbolsAccountTreeRounded: typeof import('~icons/material-symbols/account-tree-rounded')['default'] MaterialSymbolsArrowCircleLeftRounded: typeof import('~icons/material-symbols/arrow-circle-left-rounded')['default'] @@ -142,6 +143,7 @@ declare module '@vue/runtime-core' { MdiCloseCircleOutline: typeof import('~icons/mdi/close-circle-outline')['default'] MdiCloseThick: typeof import('~icons/mdi/close-thick')['default'] MdiCodeJson: typeof import('~icons/mdi/code-json')['default'] + MdiCodeTags: typeof import('~icons/mdi/code-tags')['default'] MdiCog: typeof import('~icons/mdi/cog')['default'] MdiCommentTextOutline: typeof import('~icons/mdi/comment-text-outline')['default'] MdiContentCopy: typeof import('~icons/mdi/content-copy')['default'] @@ -226,7 +228,6 @@ declare module '@vue/runtime-core' { MdiStarOutline: typeof import('~icons/mdi/star-outline')['default'] MdiStorefrontOutline: typeof import('~icons/mdi/storefront-outline')['default'] MdiTable: typeof import('~icons/mdi/table')['default'] - MdiTableArrowRight: typeof import('~icons/mdi/table-arrow-right')['default'] MdiTableColumnPlusAfter: typeof import('~icons/mdi/table-column-plus-after')['default'] MdiTableColumnPlusBefore: typeof import('~icons/mdi/table-column-plus-before')['default'] MdiTableLarge: typeof import('~icons/mdi/table-large')['default'] diff --git a/packages/nc-gui/components/dashboard/TreeView.vue b/packages/nc-gui/components/dashboard/TreeView.vue index d8bfa0e807..796a5f66c2 100644 --- a/packages/nc-gui/components/dashboard/TreeView.vue +++ b/packages/nc-gui/components/dashboard/TreeView.vue @@ -18,6 +18,7 @@ import { ref, resolveComponent, useDialog, + useGlobal, useNuxtApp, useProject, useRoute, @@ -46,6 +47,8 @@ const route = useRoute() const [searchActive, toggleSearchActive] = useToggle() +const { appInfo } = useGlobal() + const toggleDialog = inject(ToggleDialogInj, () => {}) const keys = $ref>({}) @@ -414,7 +417,11 @@ const setIcon = async (icon: string, table: TableType) => { MSSQL - +
Snowflake @@ -530,7 +537,11 @@ const setIcon = async (icon: string, table: TableType) => { MSSQL
- +
Snowflake 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 9fe262966e..f429dd62d3 100644 --- a/packages/nc-gui/components/dashboard/settings/data-sources/CreateBase.vue +++ b/packages/nc-gui/components/dashboard/settings/data-sources/CreateBase.vue @@ -8,7 +8,7 @@ import { DefaultConnection, SQLiteConnection, SSLUsage, - clientTypes, + clientTypes as _clientTypes, computed, extractSdkResponseErrorMsg, fieldRequiredValidator, @@ -21,6 +21,7 @@ import { readFile, ref, useApi, + useGlobal, useI18n, useNuxtApp, watch, @@ -30,6 +31,8 @@ const { connectionType } = defineProps<{ connectionType: ClientType }>() const emit = defineEmits(['baseCreated']) +const { appInfo } = useGlobal() + const { project, loadProject } = useProject() const useForm = Form.useForm @@ -68,7 +71,43 @@ const customFormState = ref({ extraParameters: [], }) +const clientTypes = computed(() => { + return _clientTypes.filter((type) => { + return appInfo.value?.ee || type.value !== ClientType.SNOWFLAKE + }) +}) + const validators = computed(() => { + let clientValidations: Record = { + 'dataSource.connection.host': [fieldRequiredValidator()], + 'dataSource.connection.port': [fieldRequiredValidator()], + 'dataSource.connection.user': [fieldRequiredValidator()], + 'dataSource.connection.password': [fieldRequiredValidator()], + 'dataSource.connection.database': [fieldRequiredValidator()], + } + + switch (formState.dataSource.client) { + case ClientType.SQLITE: + clientValidations = { + 'dataSource.connection.connection.filename': [fieldRequiredValidator()], + } + break + case ClientType.SNOWFLAKE: + clientValidations = { + 'dataSource.connection.account': [fieldRequiredValidator()], + 'dataSource.connection.username': [fieldRequiredValidator()], + 'dataSource.connection.password': [fieldRequiredValidator()], + 'dataSource.connection.warehouse': [fieldRequiredValidator()], + 'dataSource.connection.database': [fieldRequiredValidator()], + 'dataSource.connection.schema': [fieldRequiredValidator()], + } + break + case ClientType.PG: + case ClientType.MSSQL: + clientValidations['dataSource.searchPath.0'] = [fieldRequiredValidator()] + break + } + return { 'title': [ { @@ -79,31 +118,7 @@ const validators = computed(() => { ], 'extraParameters': [extraParameterValidator], 'dataSource.client': [fieldRequiredValidator()], - ...(formState.dataSource.client === ClientType.SQLITE - ? { - 'dataSource.connection.connection.filename': [fieldRequiredValidator()], - } - : formState.dataSource.client === ClientType.SNOWFLAKE - ? { - 'dataSource.connection.account': [fieldRequiredValidator()], - 'dataSource.connection.username': [fieldRequiredValidator()], - 'dataSource.connection.password': [fieldRequiredValidator()], - 'dataSource.connection.warehouse': [fieldRequiredValidator()], - 'dataSource.connection.database': [fieldRequiredValidator()], - 'dataSource.connection.schema': [fieldRequiredValidator()], - } - : { - 'dataSource.connection.host': [fieldRequiredValidator()], - 'dataSource.connection.port': [fieldRequiredValidator()], - 'dataSource.connection.user': [fieldRequiredValidator()], - 'dataSource.connection.password': [fieldRequiredValidator()], - 'dataSource.connection.database': [fieldRequiredValidator()], - ...([ClientType.PG, ClientType.MSSQL].includes(formState.dataSource.client) - ? { - 'dataSource.searchPath.0': [fieldRequiredValidator()], - } - : {}), - }), + ...clientValidations, } }) diff --git a/packages/nc-gui/components/general/ViewIcon.vue b/packages/nc-gui/components/general/ViewIcon.vue index 5e6a18b9dc..5454cb7e1d 100644 --- a/packages/nc-gui/components/general/ViewIcon.vue +++ b/packages/nc-gui/components/general/ViewIcon.vue @@ -1,11 +1,13 @@