refactor: use configure() for dynamic datasource extension URLs

- Replace onClick handler with configure() function for dynamic path generation
- Use context to build monitoring tool URL with datasource UID
- Follows extension system design patterns for declarative configuration
- Removes manual window.open() in favor of automatic path handling
This commit is contained in:
Miguel Palau Zarza
2025-07-29 14:32:15 -06:00
parent 30ad257f6d
commit 5a6d90ae1b
@@ -26,10 +26,11 @@ export function getDataSourceExtensionConfigs(): PluginExtensionAddedLinkConfig[
if (context?.dataSource?.type !== 'prometheus') {
return undefined;
}
return {};
},
onClick: (_, { context }) => {
window.open(`https://monitoring-tool.com/datasource/${context!.dataSource.uid}`, '_blank');
// Return dynamic path with context
return {
path: `https://monitoring-tool.com/datasource/${context.dataSource.uid}`,
};
},
}),