mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
add support for screenshots in plugins.
Allow plugin creators to include screenshots of their plugin in action. Primarily for use in Grafana.net info pages.
This commit is contained in:
parent
9653f43466
commit
f953033ba7
@ -24,6 +24,9 @@ func (fp *FrontendPluginBase) initFrontendPlugin() {
|
|||||||
|
|
||||||
fp.Info.Logos.Small = evalRelativePluginUrlPath(fp.Info.Logos.Small, fp.Id)
|
fp.Info.Logos.Small = evalRelativePluginUrlPath(fp.Info.Logos.Small, fp.Id)
|
||||||
fp.Info.Logos.Large = evalRelativePluginUrlPath(fp.Info.Logos.Large, fp.Id)
|
fp.Info.Logos.Large = evalRelativePluginUrlPath(fp.Info.Logos.Large, fp.Id)
|
||||||
|
for i := -0; i < len(fp.Info.Screenshots); i++ {
|
||||||
|
fp.Info.Screenshots[i].Path = evalRelativePluginUrlPath(fp.Info.Screenshots[i].Path, fp.Id)
|
||||||
|
}
|
||||||
fp.handleModuleDefaults()
|
fp.handleModuleDefaults()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,12 +19,13 @@ type PluginBase struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type PluginInfo struct {
|
type PluginInfo struct {
|
||||||
Author PluginInfoLink `json:"author"`
|
Author PluginInfoLink `json:"author"`
|
||||||
Description string `json:"description"`
|
Description string `json:"description"`
|
||||||
Links []PluginInfoLink `json:"links"`
|
Links []PluginInfoLink `json:"links"`
|
||||||
Logos PluginLogos `json:"logos"`
|
Logos PluginLogos `json:"logos"`
|
||||||
Version string `json:"version"`
|
Screenshots []PluginScreenshots `json:"screenshots"`
|
||||||
Updated string `json:"updated"`
|
Version string `json:"version"`
|
||||||
|
Updated string `json:"updated"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type PluginInfoLink struct {
|
type PluginInfoLink struct {
|
||||||
@ -37,6 +38,11 @@ type PluginLogos struct {
|
|||||||
Large string `json:"large"`
|
Large string `json:"large"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type PluginScreenshots struct {
|
||||||
|
Path string `json:"path"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
}
|
||||||
|
|
||||||
type PluginStaticRoute struct {
|
type PluginStaticRoute struct {
|
||||||
Directory string
|
Directory string
|
||||||
PluginId string
|
PluginId string
|
||||||
|
@ -34,6 +34,7 @@ func TestPluginScans(t *testing.T) {
|
|||||||
So(err, ShouldBeNil)
|
So(err, ShouldBeNil)
|
||||||
So(len(Apps), ShouldBeGreaterThan, 0)
|
So(len(Apps), ShouldBeGreaterThan, 0)
|
||||||
So(Apps["app-example"].Info.Logos.Large, ShouldEqual, "public/plugins/app-example/img/logo_large.png")
|
So(Apps["app-example"].Info.Logos.Large, ShouldEqual, "public/plugins/app-example/img/logo_large.png")
|
||||||
|
So(Apps["app-example"].Info.Screenshots[1].Path, ShouldEqual, "public/plugins/app-example/img/screenshot2.png")
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,10 @@
|
|||||||
"small": "img/logo_small.png",
|
"small": "img/logo_small.png",
|
||||||
"large": "img/logo_large.png"
|
"large": "img/logo_large.png"
|
||||||
},
|
},
|
||||||
|
"screenshots": [
|
||||||
|
{"name": "img1", "path": "img/screenshot1.png"},
|
||||||
|
{"name": "img2", "path": "img/screenshot2.png"}
|
||||||
|
],
|
||||||
"links": [
|
"links": [
|
||||||
{"name": "Project site", "url": "http://project.com"},
|
{"name": "Project site", "url": "http://project.com"},
|
||||||
{"name": "License & Terms", "url": "http://license.com"}
|
{"name": "License & Terms", "url": "http://license.com"}
|
||||||
|
Loading…
Reference in New Issue
Block a user