-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SQL: Refactor Tableau connector to make use of the connection propert…
…ies (#69169) * Refactor to make use of the connection propreties This refactors the way the connection URL is being built, to make use of frameworks' ability to construct the URL based on a set of connection propreties. This also ensures that the URI attributes are properly escaped. (cherry picked from commit 3c1e0a9)
- Loading branch information
Showing
3 changed files
with
28 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
x-pack/plugin/sql/connectors/tableau/connector/connectionProperties.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
(function propertiesbuilder(attr) { | ||
var props = {}; | ||
|
||
props["user"] = attr["username"]; | ||
props["password"] = attr["password"]; | ||
|
||
var extraProps = attr[connectionHelper.attributeWarehouse]; | ||
if (extraProps != null && extraProps.trim().length > 0) { | ||
// allow `&` and white-space as attribue-value pair delimiters | ||
var avps = extraProps.trim().split(/[\s&]/); | ||
for (var i = 0; i < avps.length; i++) { | ||
var tokens = avps[i].split("="); | ||
if (tokens.length != 2 || tokens[0].length == 0 || tokens[1].length == 0) { | ||
var errMessage = "Invalid additional settings property `" + avps[i] + "`: " + | ||
"not conforming to the attribute=value format." | ||
return connectionHelper.ThrowTableauException(errMessage); | ||
} else { | ||
props[tokens[0]] = tokens[1]; | ||
} | ||
} | ||
} | ||
|
||
return props; | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters