I’m currently working on creating a new element in canvas panel such as circle. After saving the file in Grafana Installation directory “C:\Program Files\GrafanaLabs\grafana\public\app\features\canvas\elements” & imported the function in registry.ts. After saving the files, restarting the service & rebooting the system I cannot see any change in elements dropdown in grafana canvas panel.
Just to be sure, i removed a existing file “droneTop.tsx” from system & also removed the path from “registry.ts” & then restarted the service & rebooted the system but there is still no update in elements dropdown in grafana canvas panel.
Can anyone provide me suggestion on why I’m facing this issue & How to create a new element in canvas panel?
@rsm You need to rebuild Grafana to remove or add advanced elements as we demonstrated in the tutorial. Updating internal files won’t make a difference:
In grafana, while a rectangle is created as an element as rectangle.tsx. The function which exported is “droneFrontItem()” in registry.ts but they imported the function “rectangleItem()” from same file where “rectangleItem()” doesn’t exist.
How the rectangle element is working perfectly if the function which doesn’t even exist is being imported registry.ts?
I followed the blog post Pizzeria observability on Grafana Canvas panel | Volkov Labs and it worked fine for me. My custom element types may be used in the canvas as the default element types. Setting the options works as expected. All this is done locally by running the frontend with ‘yarn start’.
Now I want to incorporate my changes in an official grafana docker image. For this I created a git patch, copied and applied it in Dockerfile. Starting and logging into the container results, that the patch is applied under the ‘public’ folder as expected.
Navigating to ‘localhost:3000’ and logging in as admin/admin also works. But other than for my local installtion, I don’t see my custom element types.
The attempt to build the frontend with ‘yarn start’ (as done locally) would fail, because the complete sources, including the ‘package.json’ file, are not available. Only the stuff below the ‘public’ folder is provided by the pulled grafana base image.