diff --git a/console/src/components/Services/Data/Schema/AddDataSource.tsx b/console/src/components/Services/Data/Schema/AddDataSource.tsx index 7d6c06b4dc0..73b302bab45 100644 --- a/console/src/components/Services/Data/Schema/AddDataSource.tsx +++ b/console/src/components/Services/Data/Schema/AddDataSource.tsx @@ -6,30 +6,6 @@ import DropdownButton from '../../../Common/DropdownButton/DropdownButton'; import CollapsibleToggle from '../../../Common/CollapsibleToggle/CollapsibleToggle'; import { DataSource } from '../../../../metadata/types'; -// const customSelectBoxStyles = { -// control: { -// height: '34px', -// minHeight: '34px !important', -// }, -// container: { -// width: '156px', -// height: '34px', -// minHeight: '34px !important', -// }, -// dropdownIndicator: { -// padding: '5px', -// }, -// placeholder: { -// top: '50%', -// fontSize: '12px', -// }, -// singleValue: { -// fontSize: '12px', -// top: '44%', -// color: '#555555', -// }, -// }; - type AddDataSourceProps = { onSubmit(data: DataSource, successCallback: () => void): void; }; @@ -49,9 +25,11 @@ const AddDataSource = ({ onSubmit }: AddDataSourceProps) => { { name: databaseName.trim(), driver: 'postgres', - fromEnv: urlType === 'from-env', connection_pool_settings: retryConf, - url: databaseUrl.trim(), + url: + urlType === 'from-env' + ? { from_env: databaseUrl.trim() } + : databaseUrl.trim(), }, () => { setDatabaseUrl(''); @@ -66,19 +44,6 @@ const AddDataSource = ({ onSubmit }: AddDataSourceProps) => { const expandedContent = () => (
- {/* - - setDatabaseType(typeof opt === 'string' ? opt : opt.value) - } - value={databaseType || ''} - bsClass="modify_select" - styleOverrides={customSelectBoxStyles} - filterOption="prefix" - placeholder="database type" - /> - */} = ({ retries: data.connection_pool_settings.retries, }), }, - dbUrl: typeof data.url === 'string' ? data.url : data.url.from_env, + dbUrl: data.url, }, }, successCallback diff --git a/console/src/metadata/actions.ts b/console/src/metadata/actions.ts index 60fedd7346c..c46720a660d 100644 --- a/console/src/metadata/actions.ts +++ b/console/src/metadata/actions.ts @@ -97,7 +97,7 @@ export interface AddDataSourceRequest { driver: Driver; payload: { name: string; - dbUrl: string; + dbUrl: string | { from_env: string }; connection_pool_settings: { max_connections?: number; idle_timeout?: number; // in seconds diff --git a/console/src/metadata/selector.ts b/console/src/metadata/selector.ts index 077e4461cc7..d7d7bc3c49a 100644 --- a/console/src/metadata/selector.ts +++ b/console/src/metadata/selector.ts @@ -338,10 +338,7 @@ export const getDataSources = createSelector(getMetadata, metadata => { metadata?.sources.forEach(source => { sources.push({ name: source.name, - url: - source.configuration?.connection_info?.database_url || - 'HASURA_GRAPHQL_DATABASE_URL', - fromEnv: false, + url: source.configuration?.connection_info?.database_url || '', connection_pool_settings: source.configuration?.connection_info ?.pool_settings || { retries: 1, diff --git a/console/src/metadata/sourcesUtils.ts b/console/src/metadata/sourcesUtils.ts index 666f57796b2..ab7d6ce3e77 100644 --- a/console/src/metadata/sourcesUtils.ts +++ b/console/src/metadata/sourcesUtils.ts @@ -4,7 +4,7 @@ export const addSource = ( driver: Driver, payload: { name: string; - dbUrl: string; + dbUrl: string | { from_env: string }; connection_pool_settings?: { max_connections?: number; idle_timeout?: number; diff --git a/console/src/metadata/types.ts b/console/src/metadata/types.ts index 291a17e44a6..2d5b0a896ee 100644 --- a/console/src/metadata/types.ts +++ b/console/src/metadata/types.ts @@ -4,7 +4,6 @@ import { PermissionsType } from '../components/Services/RemoteSchema/Permissions export type DataSource = { name: string; url: string | { from_env: string }; - fromEnv: boolean; driver: Driver; connection_pool_settings?: { max_connections?: number; @@ -856,7 +855,7 @@ export interface MetadataDataSource { kind?: 'postgres' | 'mysql'; configuration?: { connection_info?: { - database_url?: string; + database_url: string | { from_env: string }; pool_settings?: { max_connections: number; idle_timeout: number;