grafana / grafana-plugin-examples

189 stars 53 forks source link

Chore: update create-plugin tooling for app-with-extensions #287

Closed mckn closed 6 months ago

mckn commented 6 months ago

Description

This PR updated the create-plugin tooling to latest version which includes the plugin meta extractor functionality that will extract information about the plugin during build time.

With this changes in place the plugin.json outputed in the dist folder will be altered to include generated information as follows:

{
    "$schema": "https://raw.githubusercontent.com/grafana/grafana/master/docs/sources/developers/plugins/plugin.schema.json",
    "type": "app",
    "name": "Extensions App",
    "id": "myorg-extensions-app",
    "preload": true,
    "info": {
        "keywords": [
            "app"
        ],
        "description": "Example on how to extend grafana ui from a plugin",
        "author": {
            "name": "Myorg"
        },
        "logos": {
            "small": "img/logo.svg",
            "large": "img/logo.svg"
        },
        "screenshots": [],
        "version": "1.0.0",
        "updated": "2024-05-08"
    },
    "includes": [
        {
            "type": "page",
            "name": "Default",
            "path": "/a/myorg-extensions-app",
            "role": "Admin",
            "addToNav": true,
            "defaultNav": true
        }
    ],
    "dependencies": {
        "grafanaDependency": ">=10.3.1",
        "plugins": []
    },
    "generated": {
        "extensions": [
            {
                "extensionPointId": "grafana/dashboard/panel/menu",
                "title": "Open from time series or pie charts (path)",
                "description": "This link will only be visible on time series and pie charts",
                "type": "link"
            },
            {
                "extensionPointId": "grafana/dashboard/panel/menu",
                "title": "Open from time series or pie charts (onClick)",
                "description": "This link will only be visible on time series and pie charts",
                "type": "link"
            }
        ]
    }
}

Left to do in follow up PRs:

Remove the "preload": true from plugin.json. This can't be done until we have merged the updated logic for how to load plugins with extensions in Grafana core.