Dalvany / dalvany-image-panel

Image panel for Grafana
MIT License
16 stars 3 forks source link

Open link in the same tab #62

Closed megamaster4 closed 2 years ago

megamaster4 commented 2 years ago

Hi,

Would it be possible to open a link in the same tab, instead of opening a new tab?

I saw that the following code decides to open the link in a new tab:

<div className={'div-container'} style={{ width: w, overflow: 'hidden' }}>
      <ConditionalWrapper
        condition={link !== undefined}
        wrapper={(children) => (
          <a href={link.link} target={'_blank'} rel={'noreferrer noopener'} style={{ height: '100%' }}>
            {children}
          </a>
        )}

Changing target={'_blank'} to target={'_self'} would achieve my goal for opening the link in the same tab, but I can imagine that you don't want to change it in this way.

Is there a possibility to create an extra radio button to make this a changable feature?

Many thanks in advance!

Dalvany commented 2 years ago

I'll do that : a switch in configuration to open in new tab, it will be enabled by default so that current behavior doesn't change. When enabled target will be _blank and when disabled it will be _self.

Dalvany commented 2 years ago

@megamaster4 , could you test this pre-release to see if it's ok for your use ?

Please note that it requires at least grafana 8.5.0

megamaster4 commented 2 years ago

@Dalvany tested locally in grafana 9.1.1 and seems to be working: image

Thank you for the quick feature & the nice plugin altogether!

Dalvany commented 2 years ago

You're welcome. I'll make a proper release on grafana soon I think.