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') {
|
if (context?.dataSource?.type !== 'prometheus') {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
return {};
|
|
||||||
},
|
// Return dynamic path with context
|
||||||
onClick: (_, { context }) => {
|
return {
|
||||||
window.open(`https://monitoring-tool.com/datasource/${context!.dataSource.uid}`, '_blank');
|
path: `https://monitoring-tool.com/datasource/${context.dataSource.uid}`,
|
||||||
|
};
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user