Skip to content

Commit

Permalink
shuffles more connection config to single file
Browse files Browse the repository at this point in the history
  • Loading branch information
nickzelei committed Jul 24, 2024
1 parent ff1d4bc commit 1ef85dc
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import NextLink from 'next/link';

import { formatDateTime } from '@/util/util';
import { PlainMessage, Timestamp } from '@bufbuild/protobuf';
import { Connection, ConnectionConfig } from '@neosync/sdk';
import { Connection } from '@neosync/sdk';
import { getCategory } from '../../util';
import { DataTableColumnHeader } from './data-table-column-header';
import { DataTableRowActions } from './data-table-row-actions';

Expand Down Expand Up @@ -126,27 +127,3 @@ export function getColumns(
},
];
}

function getCategory(cc?: PlainMessage<ConnectionConfig>): string {
if (!cc) {
return '-';
}
switch (cc.config.case) {
case 'pgConfig':
return 'Postgres';
case 'mysqlConfig':
return 'MySQL';
case 'awsS3Config':
return 'AWS S3';
case 'openaiConfig':
return 'OpenAI';
case 'localDirConfig':
return 'Local Dir';
case 'mongoConfig':
return 'MongoDB';
case 'gcpCloudstorageConfig':
return 'GCP Cloud Storage';
default:
return '-';
}
}
28 changes: 28 additions & 0 deletions frontend/apps/web/app/(mgmt)/[account]/connections/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
PostgresFormValues,
SshTunnelFormValues,
} from '@/yup-validations/connections';
import { PlainMessage } from '@bufbuild/protobuf';
import {
AwsS3ConnectionConfig,
AwsS3Credentials,
Expand Down Expand Up @@ -70,6 +71,33 @@ export function getConnectionType(
}
}

// Used for the connections data table
export function getCategory(cc?: PlainMessage<ConnectionConfig>): string {
if (!cc) {
return '-';
}
switch (cc.config.case) {
case 'pgConfig':
return 'Postgres';
case 'mysqlConfig':
return 'MySQL';
case 'awsS3Config':
return 'AWS S3';
case 'openaiConfig':
return 'OpenAI';
case 'localDirConfig':
return 'Local Dir';
case 'mongoConfig':
return 'MongoDB';
case 'gcpCloudstorageConfig':
return 'GCP Cloud Storage';
case 'dynamodbConfig':
return 'DynamoDB';
default:
return '-';
}
}

export function buildConnectionConfigDynamoDB(
values: DynamoDbFormValues
): ConnectionConfig {
Expand Down

0 comments on commit 1ef85dc

Please sign in to comment.