Skip to content

Commit

Permalink
master: add connection options to driver docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mtxr committed Nov 6, 2019
1 parent 7415278 commit 49e8896
Show file tree
Hide file tree
Showing 13 changed files with 58 additions and 6 deletions.
3 changes: 1 addition & 2 deletions docs/src/components/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import styled from 'styled-components';

const OriginalEditor = components.editor;

const CodeTitleHeader = styled.div`
const CodeTitleHeader: any = styled.div`
background: ${(props: any) => props.theme.docz.colors.grayBg};
margin-top: 30px;
margin-bottom: -31px;
Expand Down Expand Up @@ -40,7 +40,6 @@ const CodeTitle = (props: any) => (
);

const Editor = (props: any) => {
console.log(props.children.props)
if (props.children && props.children.props.title) {
return (
<CodeTitle title={props.children.props.title} language={props.children.props.className.replace('language-', '')}>
Expand Down
8 changes: 8 additions & 0 deletions docs/src/components/RenderConnectionOptions.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from 'react'
import RenderSettings from './RenderSettings'

const RenderConnectionOptions = ({ exclude = [], include = [] }) => (
<RenderSettings path="['sqltools.connections'].items.properties" exclude={exclude} include={include} disableSearch title="Connecton Options"/>
)

export default RenderConnectionOptions;
10 changes: 10 additions & 0 deletions docs/src/components/RenderSettings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ interface Props {
path?: string;
disableSearch?: boolean;
title?: string;
exclude?: string[];
include?: string[];
}

class RenderSettings extends React.Component<Props> {
Expand Down Expand Up @@ -90,6 +92,14 @@ class RenderSettings extends React.Component<Props> {
render() {
const search = this.state.search.toLowerCase();
let propsList = this.state.jsonProps;
const exclude = this.props.exclude || [];
const include = this.props.include || [];

if (exclude.length > 0)
propsList = propsList.filter(prop => !exclude.includes(prop.name));
if (include.length > 0)
propsList = propsList.filter(prop => include.includes(prop.name));

if (search.trim()) {
propsList = propsList.filter(prop => prop.name.toLowerCase().includes(search));
}
Expand Down
4 changes: 4 additions & 0 deletions docs/src/pages/driver/aws-redshift.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ name: AWS Redshift
## 1. Connections

import RenderConnectionOptions from '../../components/RenderConnectionOptions.tsx'

Connection example:
```json
{
Expand Down Expand Up @@ -66,3 +68,5 @@ Using connectionURI for previous example:
"connectionTimeout": 15,
}
```

<RenderConnectionOptions exclude={['mysqlOptions', 'oracleOptions', 'socketPath','mssqlOptions', 'icons', 'domain']} />
4 changes: 4 additions & 0 deletions docs/src/pages/driver/cql.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ menu: Drivers
route: /driver/cassandra
---

import RenderConnectionOptions from '../../components/RenderConnectionOptions.tsx'

# Cassandra Start Guide

## 1. Connections
Expand Down Expand Up @@ -45,3 +47,5 @@ Cassandra driver specific options can be passed using `cqlOptions` settings.
```

You can use any options defined in https://docs.datastax.com/en/developer/nodejs-driver/4.1/api/type.ClientOptions/ in `cqlOptions`.

<RenderConnectionOptions exclude={['mysqlOptions', 'oracleOptions', 'socketPath','mssqlOptions', 'icons', 'domain', 'pgOptions']}/>
4 changes: 4 additions & 0 deletions docs/src/pages/driver/db2.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ menu: Drivers
route: /driver/db2
---

import RenderConnectionOptions from '../../components/RenderConnectionOptions.tsx'

# DB2 Start Guide

## 1. Prerequisites
Expand Down Expand Up @@ -57,3 +59,5 @@ Connection example:
"database": "MyDB"
}
```

<RenderConnectionOptions exclude={['mysqlOptions', 'oracleOptions', 'socketPath','mssqlOptions', 'icons', 'domain', 'pgOptions']}/>
6 changes: 5 additions & 1 deletion docs/src/pages/driver/mssql.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: MSSQL, SQL Server, Azure
menu: Drivers
route: /driver/mssql
---
import RenderConnectionOptions from '../../components/RenderConnectionOptions.tsx'

# Microsoft SQL Server/Azure Start Guide

Expand Down Expand Up @@ -53,4 +54,7 @@ You can use any setting defined in https://www.npmjs.com/package/mssql#configura

### v0.19.x

* Remove deprecated (v0.17.6) `sqltools.connections[].dialectOptions` in favor of `sqltools.connections[].mssqlOptions`.
* Remove deprecated (v0.17.6) `sqltools.connections[].dialectOptions` in favor of `sqltools.connections[].mssqlOptions`.


<RenderConnectionOptions exclude={['mysqlOptions', 'oracleOptions', 'socketPath','icons', 'pgOptions']}/>
3 changes: 3 additions & 0 deletions docs/src/pages/driver/mysql.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ name: MySQL
menu: Drivers
route: /driver/mysql
---
import RenderConnectionOptions from '../../components/RenderConnectionOptions.tsx'

# MySQL Start Guide

Expand Down Expand Up @@ -102,3 +103,5 @@ Example configuration:
]
}
```

<RenderConnectionOptions exclude={['oracleOptions','mssqlOptions', 'icons', 'domain', 'pgOptions']}/>
6 changes: 5 additions & 1 deletion docs/src/pages/driver/oracledb.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ menu: Drivers
route: /driver/oracle
---

import RenderConnectionOptions from '../../components/RenderConnectionOptions.tsx'

# Oracle Start Guide

## 1. Prerequisites
Expand Down Expand Up @@ -116,4 +118,6 @@ If you want to use 32bits drivers or set a different ORACLE_HOME to be used with
}
```

For more information, please, read [#281](https://github.com/mtxr/vscode-sqltools/issues/281)
For more information, please, read [#281](https://github.com/mtxr/vscode-sqltools/issues/281)

<RenderConnectionOptions exclude={['mysqlOptions', 'socketPath','mssqlOptions', 'icons', 'domain', 'pgOptions']}/>
4 changes: 4 additions & 0 deletions docs/src/pages/driver/postgresql.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ menu: Drivers
route: /driver/postgresql
---

import RenderConnectionOptions from '../../components/RenderConnectionOptions.tsx'

# PostgreSQL Start Guide

## 1. Connections
Expand Down Expand Up @@ -85,3 +87,5 @@ Using connectionURI for previous example:
"connectionTimeout": 15,
}
```

<RenderConnectionOptions exclude={['mysqlOptions', 'oracleOptions', 'socketPath','mssqlOptions', 'icons', 'domain']}/>
6 changes: 5 additions & 1 deletion docs/src/pages/driver/saphana.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ menu: Drivers
route: /driver/saphana
---

import RenderConnectionOptions from '../../components/RenderConnectionOptions.tsx'

# SAP HANA Start Guide

## 1. Prerequisites
Expand Down Expand Up @@ -52,4 +54,6 @@ ConnectionString maps from `connectString` property:
"dialect": "SAPHana",
"connectString": "<see docs>" // Example: "connectString": "HOST=myServer;PORT=30015;UID=MyUser;PWD=MyPassword"
}
```
```

<RenderConnectionOptions exclude={['mysqlOptions', 'oracleOptions', 'socketPath','mssqlOptions', 'icons', 'domain', 'pgOptions']}/>
4 changes: 4 additions & 0 deletions docs/src/pages/driver/sqlite.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ menu: Drivers
route: /driver/sqlite
---

import RenderConnectionOptions from '../../components/RenderConnectionOptions.tsx'

# SQLite Start Guide

## 1. Prerequisites
Expand Down Expand Up @@ -36,3 +38,5 @@ SQLite's connections handle files so you can use the example below as reference
"connectionTimeout": 15
}
```

<RenderConnectionOptions include={['name', 'dialect', 'database', 'connectionTimeout']}/>
2 changes: 1 addition & 1 deletion packages/extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@
}
}
},
"pqOptions": {
"pgOptions": {
"type": [
"object",
"null"
Expand Down

0 comments on commit 49e8896

Please sign in to comment.