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:
@@ -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}`,
|
||||
};
|
||||
},
|
||||
}),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user