File tree Expand file tree Collapse file tree 3 files changed +28
-29
lines changed
x-pack/plugin/sql/connectors/tableau/connector Expand file tree Collapse file tree 3 files changed +28
-29
lines changed Original file line number Diff line number Diff line change 66 } else {
77 urlBuilder += "http://" ;
88 }
9- urlBuilder += attr [ "server" ] + ":" + attr [ "port" ] ;
9+ urlBuilder += attr [ "server" ] + ":" + attr [ "port" ] + "?" ;
1010
11- var params = [ ] ;
12- params [ "user" ] = attr [ "username" ] ;
13- params [ "password" ] = attr [ "password" ] ;
14-
15- var formattedParams = [ ] ;
16-
17- for ( var key in params ) {
18- if ( params [ key ] ) {
19- var param = encodeURIComponent ( params [ key ] ) ;
20- formattedParams . push ( connectionHelper . formatKeyValuePair ( key , param ) ) ;
21- }
22- }
23-
24- if ( formattedParams . length > 0 ) {
25- urlBuilder += "?" + formattedParams . join ( "&" )
26- }
27-
28- // logging visible in log.txt if -DLogLevel=Debug is added in Tableau command line
29- logging . log ( "ES JDBC URL before adding additional parameters: " + urlBuilder ) ;
30-
31- // TODO: wrap error-prone "free form"
32- var additionalConnectionParameters = attr [ connectionHelper . attributeWarehouse ] ;
33- if ( additionalConnectionParameters != null && additionalConnectionParameters . trim ( ) . length > 0 ) {
34- urlBuilder += ( formattedParams . length == 0 ) ? "?" : "&" ;
35- urlBuilder += additionalConnectionParameters ;
36- }
37-
38- logging . log ( "ES JDBC final URL: " + urlBuilder ) ;
3911 return [ urlBuilder ] ;
4012} )
Original file line number Diff line number Diff line change 1+ ( function propertiesbuilder ( attr ) {
2+ var props = { } ;
3+
4+ props [ "user" ] = attr [ "username" ] ;
5+ props [ "password" ] = attr [ "password" ] ;
6+
7+ var extraProps = attr [ connectionHelper . attributeWarehouse ] ;
8+ if ( extraProps != null && extraProps . trim ( ) . length > 0 ) {
9+ // allow `&` and white-space as attribue-value pair delimiters
10+ var avps = extraProps . trim ( ) . split ( / [ \s & ] / ) ;
11+ for ( var i = 0 ; i < avps . length ; i ++ ) {
12+ var tokens = avps [ i ] . split ( "=" ) ;
13+ if ( tokens . length != 2 || tokens [ 0 ] . length == 0 || tokens [ 1 ] . length == 0 ) {
14+ var errMessage = "Invalid additional settings property `" + avps [ i ] + "`: " +
15+ "not conforming to the attribute=value format."
16+ return connectionHelper . ThrowTableauException ( errMessage ) ;
17+ } else {
18+ props [ tokens [ 0 ] ] = tokens [ 1 ] ;
19+ }
20+ }
21+ }
22+
23+ return props ;
24+ } )
Original file line number Diff line number Diff line change 1717 </attribute-list >
1818 </required-attributes >
1919 </connection-normalizer >
20+ <connection-properties >
21+ <script file =' connectionProperties.js' />
22+ </connection-properties >
2023 </connection-resolver >
2124</tdr >
You can’t perform that action at this time.
0 commit comments