Skip to content

add support for links #20

Open
Open
@ItsVeryWindy

Description

@ItsVeryWindy

Is your feature request related to a problem? Please describe.
I was trying to figure out why the context menu wasn't being displayed, then I came across this issue #17. Doing some more digging I then came across this other issue grafana/grafana#33358. So I thought great, I'd probably want to return some links anyway, lets see if I add some links if it fixes it. But from what I can see links don't appear to be supported by this plugin.

Describe the solution you'd like
I'm not too particular on the implementation, but it will most likely have to be part of the payload returned by the endpoint. At least for my purposes, I'm only interested in being able to add "external" links.

Additional context
These can be seen and mentioned on the page for the visualisation https://grafana.com/docs/grafana/latest/visualizations/node-graph/, but I didn't have much luck finding documentation on implementing them.

This I believe describes the interface for links. The more interesting properties are url, title, targetBlank, which are hopefully self explanatory.
https://grafana.com/docs/grafana/latest/packages_api/data/datalink/#datalink-interface

Links can be added as an array as part of the config, around this part of the code.

outputField.config.color = { fixedColor: field['color'], mode: FieldColorModeId.Fixed };

eg.

outputField.config.links = [{
url: 'http://example.com',
title: 'Example'
}];

I did play around with it a bit hard coding stuff in there, and I was able to get the context menu and links to display.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions