Browse Source

feat: add oracle option in treeview menu

Signed-off-by: Pranav C <pranavxc@gmail.com>
feat/oracle-support
Pranav C 2 years ago
parent
commit
28aff6bfe2
  1. 1
      packages/nc-gui/components.d.ts
  2. 20
      packages/nc-gui/components/dashboard/TreeView.vue
  3. 6
      packages/nc-gui/components/dashboard/settings/DataSources.vue
  4. 2
      packages/nc-gui/components/dashboard/settings/data-sources/CreateBase.vue
  5. 3
      packages/nocodb/src/lib/db/sql-client/lib/SqlClientFactory.ts
  6. 3
      packages/nocodb/src/lib/db/sql-client/lib/ee/SqlClientFactoryEE.ts

1
packages/nc-gui/components.d.ts vendored

@ -89,6 +89,7 @@ declare module '@vue/runtime-core' {
IcTwotoneWidthNormal: typeof import('~icons/ic/twotone-width-normal')['default'] IcTwotoneWidthNormal: typeof import('~icons/ic/twotone-width-normal')['default']
LogosGoogleGmail: typeof import('~icons/logos/google-gmail')['default'] LogosGoogleGmail: typeof import('~icons/logos/google-gmail')['default']
LogosMysqlIcon: typeof import('~icons/logos/mysql-icon')['default'] LogosMysqlIcon: typeof import('~icons/logos/mysql-icon')['default']
LogosOracle: typeof import('~icons/logos/oracle')['default']
LogosPostgresql: typeof import('~icons/logos/postgresql')['default'] LogosPostgresql: typeof import('~icons/logos/postgresql')['default']
LogosRedditIcon: typeof import('~icons/logos/reddit-icon')['default'] LogosRedditIcon: typeof import('~icons/logos/reddit-icon')['default']
LogosSnowflakeIcon: typeof import('~icons/logos/snowflake-icon')['default'] LogosSnowflakeIcon: typeof import('~icons/logos/snowflake-icon')['default']

20
packages/nc-gui/components/dashboard/TreeView.vue

@ -427,6 +427,16 @@ const setIcon = async (icon: string, table: TableType) => {
Snowflake Snowflake
</div> </div>
</a-menu-item> </a-menu-item>
<a-menu-item
v-if="appInfo.ee"
key="connect-new-source"
@click="toggleDialog(true, 'dataSources', ClientType.ORACLEDB)"
>
<div class="color-transition nc-project-menu-item group">
<LogosOracle class="group-hover:text-accent" />
Oracle
</div>
</a-menu-item>
</a-menu-item-group> </a-menu-item-group>
<a-menu-divider class="my-0" /> <a-menu-divider class="my-0" />
@ -547,6 +557,16 @@ const setIcon = async (icon: string, table: TableType) => {
Snowflake Snowflake
</div> </div>
</a-menu-item> </a-menu-item>
<a-menu-item
v-if="appInfo.ee"
key="connect-new-source"
@click="toggleDialog(true, 'dataSources', ClientType.ORACLEDB)"
>
<div class="color-transition nc-project-menu-item group">
<LogosOracle class="group-hover:text-accent" />
Oracle
</div>
</a-menu-item>
</a-menu-item-group> </a-menu-item-group>
<a-menu-divider class="my-0" /> <a-menu-divider class="my-0" />

6
packages/nc-gui/components/dashboard/settings/DataSources.vue

@ -204,6 +204,10 @@ watch(
clientType = ClientType.SNOWFLAKE clientType = ClientType.SNOWFLAKE
vState.value = DataSourcesSubTab.New vState.value = DataSourcesSubTab.New
break break
case ClientType.ORACLEDB:
clientType = ClientType.ORACLEDB
vState.value = DataSourcesSubTab.New
break
case DataSourcesSubTab.New: case DataSourcesSubTab.New:
if (sources.length > 1 && !forceAwakened) { if (sources.length > 1 && !forceAwakened) {
vState.value = '' vState.value = ''
@ -245,7 +249,7 @@ watch(
@click="baseAction(sources[0].id, DataSourcesSubTab.Metadata)" @click="baseAction(sources[0].id, DataSourcesSubTab.Metadata)"
> >
<div class="flex items-center gap-2 text-gray-600 font-light"> <div class="flex items-center gap-2 text-gray-600 font-light">
<a-tooltip v-if="metadiffbases.includes(sources[0].id as string)"> <a-tooltip v-if="metadiffbases.includes(sources[0].id)">
<template #title>Out of sync</template> <template #title>Out of sync</template>
<MdiDatabaseAlert class="text-lg group-hover:text-accent text-primary" /> <MdiDatabaseAlert class="text-lg group-hover:text-accent text-primary" />
</a-tooltip> </a-tooltip>

2
packages/nc-gui/components/dashboard/settings/data-sources/CreateBase.vue

@ -73,7 +73,7 @@ const customFormState = ref<ProjectCreateForm>({
const clientTypes = computed(() => { const clientTypes = computed(() => {
return _clientTypes.filter((type) => { return _clientTypes.filter((type) => {
return appInfo.value?.ee || type.value !== ClientType.SNOWFLAKE return appInfo.value?.ee || ![ClientType.SNOWFLAKE, ClientType.ORACLEDB].includes(type.value)
}) })
}) })

3
packages/nocodb/src/lib/db/sql-client/lib/SqlClientFactory.ts

@ -2,7 +2,6 @@ import Noco from '../../../Noco';
import SqlClientFactoryEE from './ee/SqlClientFactoryEE'; import SqlClientFactoryEE from './ee/SqlClientFactoryEE';
import MySqlClient from './mysql/MysqlClient'; import MySqlClient from './mysql/MysqlClient';
import MssqlClient from './mssql/MssqlClient'; import MssqlClient from './mssql/MssqlClient';
import OracleClient from './oracle/OracleClient';
import SqliteClient from './sqlite/SqliteClient'; import SqliteClient from './sqlite/SqliteClient';
import PgClient from './pg/PgClient'; import PgClient from './pg/PgClient';
import YugabyteClient from './pg/YugabyteClient'; import YugabyteClient from './pg/YugabyteClient';
@ -30,8 +29,6 @@ export class SqlClientFactory {
return new SqliteClient(connectionConfig); return new SqliteClient(connectionConfig);
} else if (connectionConfig.client === 'mssql') { } else if (connectionConfig.client === 'mssql') {
return new MssqlClient(connectionConfig); return new MssqlClient(connectionConfig);
} else if (connectionConfig.client === 'oracledb') {
return new OracleClient(connectionConfig);
} else if (connectionConfig.client === 'pg') { } else if (connectionConfig.client === 'pg') {
if (connectionConfig.meta.dbtype === 'yugabyte') if (connectionConfig.meta.dbtype === 'yugabyte')
return new YugabyteClient(connectionConfig); return new YugabyteClient(connectionConfig);

3
packages/nocodb/src/lib/db/sql-client/lib/ee/SqlClientFactoryEE.ts

@ -1,3 +1,4 @@
import OracleClient from '../oracle/OracleClient'
import { SqlClientFactory } from '../SqlClientFactory'; import { SqlClientFactory } from '../SqlClientFactory';
import SfClient from '../snowflake/SnowflakeClient'; import SfClient from '../snowflake/SnowflakeClient';
import { SnowflakeClient } from 'nc-help'; import { SnowflakeClient } from 'nc-help';
@ -11,6 +12,8 @@ class SqlClientFactoryEE {
if (connectionConfig.client === 'snowflake') { if (connectionConfig.client === 'snowflake') {
connectionConfig.client = SnowflakeClient; connectionConfig.client = SnowflakeClient;
return new SfClient(connectionConfig); return new SfClient(connectionConfig);
} else if (connectionConfig.client === 'oracledb') {
return new OracleClient(connectionConfig);
} }
return SqlClientFactory.create(connectionConfig); return SqlClientFactory.create(connectionConfig);
} }

Loading…
Cancel
Save