Browse Source

chore(gui-v2): narrow down types

pull/3306/head
braks 2 years ago committed by mertmit
parent
commit
4dc8959203
  1. 32
      packages/nc-gui-v2/utils/projectCreateUtils.ts

32
packages/nc-gui-v2/utils/projectCreateUtils.ts

@ -69,35 +69,45 @@ export const clientTypes = [
] ]
const homeDir = '' const homeDir = ''
const sampleConnectionData: Record<ClientType | string, ProjectCreateForm['dataSource']['connection']> = {
type ConnectionClientType =
| Exclude<ClientType, ClientType.SQLITE>
| 'tidb'
| 'yugabyte'
| 'citusdb'
| 'cockroachdb'
| 'oracledb'
| 'greenplum'
const sampleConnectionData: { [key in ConnectionClientType]: DefaultConnection } & { [ClientType.SQLITE]: SQLiteConnection } = {
[ClientType.PG]: { [ClientType.PG]: {
host: defaultHost, host: defaultHost,
port: '5432', port: '5432',
user: 'postgres', user: 'postgres',
password: 'password', password: 'password',
database: '_test', database: '_test',
} as DefaultConnection, },
[ClientType.MYSQL]: { [ClientType.MYSQL]: {
host: defaultHost, host: defaultHost,
port: '3306', port: '3306',
user: 'root', user: 'root',
password: 'password', password: 'password',
database: '_test', database: '_test',
} as DefaultConnection, },
[ClientType.VITESS]: { [ClientType.VITESS]: {
host: defaultHost, host: defaultHost,
port: '15306', port: '15306',
user: 'root', user: 'root',
password: 'password', password: 'password',
database: '_test', database: '_test',
} as DefaultConnection, },
[ClientType.MSSQL]: { [ClientType.MSSQL]: {
host: defaultHost, host: defaultHost,
port: 1433, port: 1433,
user: 'sa', user: 'sa',
password: 'Password123.', password: 'Password123.',
database: '_test', database: '_test',
} as DefaultConnection, },
[ClientType.SQLITE]: { [ClientType.SQLITE]: {
client: ClientType.SQLITE, client: ClientType.SQLITE,
database: homeDir, database: homeDir,
@ -112,42 +122,42 @@ const sampleConnectionData: Record<ClientType | string, ProjectCreateForm['dataS
user: 'root', user: 'root',
password: '', password: '',
database: '_test', database: '_test',
} as DefaultConnection, },
yugabyte: { yugabyte: {
host: defaultHost, host: defaultHost,
port: '5432', port: '5432',
user: 'postgres', user: 'postgres',
password: '', password: '',
database: '_test', database: '_test',
} as DefaultConnection, },
citusdb: { citusdb: {
host: defaultHost, host: defaultHost,
port: '5432', port: '5432',
user: 'postgres', user: 'postgres',
password: '', password: '',
database: '_test', database: '_test',
} as DefaultConnection, },
cockroachdb: { cockroachdb: {
host: defaultHost, host: defaultHost,
port: '5432', port: '5432',
user: 'postgres', user: 'postgres',
password: '', password: '',
database: '_test', database: '_test',
} as DefaultConnection, },
greenplum: { greenplum: {
host: defaultHost, host: defaultHost,
port: '5432', port: '5432',
user: 'postgres', user: 'postgres',
password: '', password: '',
database: '_test', database: '_test',
} as DefaultConnection, },
oracledb: { oracledb: {
host: defaultHost, host: defaultHost,
port: '1521', port: '1521',
user: 'system', user: 'system',
password: 'Oracle18', password: 'Oracle18',
database: '_test', database: '_test',
} as DefaultConnection, },
} }
export const getDefaultConnectionConfig = (client: ClientType): ProjectCreateForm['dataSource'] => { export const getDefaultConnectionConfig = (client: ClientType): ProjectCreateForm['dataSource'] => {

Loading…
Cancel
Save