Explore Metrics: Duplicate subpath (#96287)

* explore metrics subpath

* optimize
This commit is contained in:
jackyin 2024-11-19 00:57:51 +08:00 committed by GitHub
parent a049183ecd
commit 9cd2598e8c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -164,11 +164,9 @@ export class MetricActionBar extends SceneObjectBase<MetricActionBarState> {
public openExploreLink = async () => {
reportExploreMetrics('selected_metric_action_clicked', { action: 'open_in_explore' });
this.getLinkToExplore().then((link) => {
// We need to ensure we prefix with the appSubUrl for environments that don't host grafana at the root.
const url = `${config.appSubUrl}${link}`;
// We use window.open instead of a Link or <a> because we want to compute the explore link when clicking,
// if we precompute it we have to keep track of a lot of dependencies
window.open(url, '_blank');
window.open(link, '_blank');
});
};