mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2026-01-06 04:26:57 +00:00
MINOR: Tableau proxy url for sourceurl (#21799)
This commit is contained in:
parent
db2081cf4a
commit
88a0219b35
@ -16,6 +16,7 @@ source:
|
||||
hostPort: http://localhost
|
||||
siteName: site_name
|
||||
paginationLimit: 10
|
||||
proxyURL: http://proxyTableuHost
|
||||
sourceConfig:
|
||||
config:
|
||||
type: DashboardMetadata
|
||||
|
||||
@ -299,8 +299,9 @@ class TableauSource(DashboardServiceSource):
|
||||
topology. And they are cleared after processing each Dashboard because of the 'clear_cache' option.
|
||||
"""
|
||||
try:
|
||||
base_url = self.get_base_url()
|
||||
dashboard_url = (
|
||||
f"{clean_uri(str(self.config.serviceConnection.root.config.hostPort))}"
|
||||
f"{clean_uri(str(base_url))}"
|
||||
f"/#{urlparse(dashboard_details.webpageUrl).fragment}/views"
|
||||
)
|
||||
dashboard_request = CreateDashboardRequest(
|
||||
@ -731,8 +732,9 @@ class TableauSource(DashboardServiceSource):
|
||||
)
|
||||
workbook_chart_name = ChartUrl(chart.contentUrl)
|
||||
|
||||
base_url = self.get_base_url()
|
||||
chart_url = (
|
||||
f"{clean_uri(self.service_connection.hostPort)}/"
|
||||
f"{clean_uri(str(base_url))}"
|
||||
f"#{site_url}"
|
||||
f"views/{workbook_chart_name.workbook_name}"
|
||||
f"/{workbook_chart_name.chart_url_name}"
|
||||
@ -1084,3 +1086,11 @@ class TableauSource(DashboardServiceSource):
|
||||
stackTrace=traceback.format_exc(),
|
||||
)
|
||||
)
|
||||
|
||||
def get_base_url(self) -> str:
|
||||
"""
|
||||
Get the proxy url for the tableau server
|
||||
"""
|
||||
if self.config.serviceConnection.root.config.proxyURL:
|
||||
return str(self.config.serviceConnection.root.config.proxyURL)
|
||||
return str(self.config.serviceConnection.root.config.hostPort)
|
||||
|
||||
@ -456,3 +456,16 @@ class TableauUnitTest(TestCase):
|
||||
):
|
||||
dashboards = list(self.tableau.get_dashboard())
|
||||
self.assertEqual(len(dashboards), 0)
|
||||
|
||||
def test_generate_dashboard_url(self):
|
||||
"""
|
||||
Test that the dashboard url is generated correctly with proxyURL
|
||||
"""
|
||||
self.tableau.config.serviceConnection.root.config.proxyURL = (
|
||||
"http://mockTableauServer.com"
|
||||
)
|
||||
result = list(self.tableau.yield_dashboard(MOCK_DASHBOARD))
|
||||
self.assertEqual(
|
||||
result[0].right.sourceUrl.root,
|
||||
"http://mockTableauServer.com/#/site/hidarsite/workbooks/897790/views",
|
||||
)
|
||||
|
||||
@ -58,6 +58,14 @@
|
||||
"type": "string",
|
||||
"default": null
|
||||
},
|
||||
"proxyURL": {
|
||||
"expose": true,
|
||||
"title": "Proxy URL",
|
||||
"description": "Proxy URL for the tableau server. If not provided, the hostPort will be used. This is used to generate the dashboard & Chart URL.",
|
||||
"type": "string",
|
||||
"format": "uri",
|
||||
"default": null
|
||||
},
|
||||
"verifySSL": {
|
||||
"$ref": "../../../../security/ssl/verifySSLConfig.json#/definitions/verifySSL",
|
||||
"default": "no-ssl"
|
||||
|
||||
@ -46,6 +46,11 @@ export interface TableauConnection {
|
||||
* Regex to exclude or include projects that matches the pattern.
|
||||
*/
|
||||
projectFilterPattern?: FilterPattern;
|
||||
/**
|
||||
* Proxy URL for the tableau server. If not provided, the hostPort will be used. This is
|
||||
* used to generate the dashboard & Chart URL.
|
||||
*/
|
||||
proxyURL?: string;
|
||||
/**
|
||||
* Tableau Site Name.
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user