Fix: URL-encode metric FQN in catalog modal request
When metric FQN contains spaces (e.g. 'Active2 Customers'), JavaScript was creating invalid URLs with literal spaces. Now properly encoding FQN with encodeURIComponent() to convert spaces to %20 before sending to API. Flask automatically decodes the path parameter back to original FQN.
This commit is contained in:
parent
1bcd7e4080
commit
f6000cc867
1 changed files with 7 additions and 3 deletions
|
|
@ -24,9 +24,13 @@ function openMetricModal(metricPath) {
|
|||
body.innerHTML = '<div class="metric-loading"><div class="metric-loading-spinner"></div><div class="metric-loading-text">Loading metric...</div></div>';
|
||||
|
||||
// Route based on prefix: catalog:FQN uses /api/catalog/metrics, YAML paths use /api/metrics
|
||||
const url = metricPath.startsWith('catalog:')
|
||||
? `/api/catalog/metrics/${metricPath.slice(8)}` // Remove 'catalog:' prefix
|
||||
: `/api/metrics/${metricPath}`;
|
||||
let url;
|
||||
if (metricPath.startsWith('catalog:')) {
|
||||
const fqn = metricPath.slice(8); // Remove 'catalog:' prefix
|
||||
url = `/api/catalog/metrics/${encodeURIComponent(fqn)}`; // URL-encode FQN
|
||||
} else {
|
||||
url = `/api/metrics/${metricPath}`;
|
||||
}
|
||||
|
||||
// Fetch metric data
|
||||
fetch(url)
|
||||
|
|
|
|||
Loading…
Reference in a new issue