Display images in table plugin

hi,

I understand that the table plugin is not able to show images in the cells.

Since I really need to display images I was wondering if I can make a quick hack to implement this option.

I am thinking in modifying the “link” option in the table so instead of creating HTML code as

<a href="url">value</a>

creates code as

<img src="value">

I understand that this is not a general solution but it will solve my problem.

Before I look to the code I would appreciate if somebody with better knowledge of grafana code would tell me if this hack is easy to implement or it just does not make sense.

Any tip will be welcomed, Thank

This is what I end doing.

  1. install grafana-datatable plugin
  2. edit file DatatableRenderer.ts
  3. modify line

return '<a href="' + v + '" target="_blank">' + v + '</a>';

and insert the html code you need.

You may use the variable “style.url” (URL from the form)
and “v” cell value

  1. recompile plugin

rm yarn.lock
yarn install
yarn build

  1. reboot grafana-server

And you are done

Hope this helps to other people


Depndencies:

I needed to install yarn, nvm and the last stable version of openjs. Becareful, the last version does not work use the last STABLE version, which may be installed with the command

nvm install lts/* --reinstall-packages-from=node