Commit ac6800a8 by Torkel Ödegaard

Merge branch 'master' of github.com:grafana/grafana

parents 39fdfb79 4c073e1c
...@@ -91,7 +91,14 @@ func InstallPlugin(pluginName, version string, c CommandLine) error { ...@@ -91,7 +91,14 @@ func InstallPlugin(pluginName, version string, c CommandLine) error {
} }
logger.Infof("%s Installed %s successfully \n", color.GreenString("✔"), pluginName) logger.Infof("%s Installed %s successfully \n", color.GreenString("✔"), pluginName)
return nil
res, _ := s.ReadPlugin(pluginFolder, pluginName)
for _, v := range res.Dependencies.Plugins {
InstallPlugin(v.Id, "", c)
logger.Infof("Installed dependency: %v ✔\n", v.Id)
}
return err
} }
func SelectVersion(plugin m.Plugin, version string) (m.Version, error) { func SelectVersion(plugin m.Plugin, version string) (m.Version, error) {
......
...@@ -14,7 +14,8 @@ type InstalledPlugin struct { ...@@ -14,7 +14,8 @@ type InstalledPlugin struct {
} }
type Dependencies struct { type Dependencies struct {
GrafanaVersion string `json:"grafanaVersion"` GrafanaVersion string `json:"grafanaVersion"`
Plugins []Plugin `json:"plugins"`
} }
type PluginInfo struct { type PluginInfo struct {
......
...@@ -59,6 +59,10 @@ func (pb *PluginBase) registerPlugin(pluginDir string) error { ...@@ -59,6 +59,10 @@ func (pb *PluginBase) registerPlugin(pluginDir string) error {
plog.Info("Registering plugin", "name", pb.Name) plog.Info("Registering plugin", "name", pb.Name)
} }
if len(pb.Dependencies.Plugins) == 0 {
pb.Dependencies.Plugins = []PluginDependencyItem{}
}
if pb.Dependencies.GrafanaVersion == "" { if pb.Dependencies.GrafanaVersion == "" {
pb.Dependencies.GrafanaVersion = "*" pb.Dependencies.GrafanaVersion = "*"
} }
...@@ -75,7 +79,8 @@ func (pb *PluginBase) registerPlugin(pluginDir string) error { ...@@ -75,7 +79,8 @@ func (pb *PluginBase) registerPlugin(pluginDir string) error {
} }
type PluginDependencies struct { type PluginDependencies struct {
GrafanaVersion string `json:"grafanaVersion"` GrafanaVersion string `json:"grafanaVersion"`
Plugins []PluginDependencyItem `json:"plugins"`
} }
type PluginInclude struct { type PluginInclude struct {
...@@ -91,6 +96,13 @@ type PluginInclude struct { ...@@ -91,6 +96,13 @@ type PluginInclude struct {
Id string `json:"-"` Id string `json:"-"`
} }
type PluginDependencyItem struct {
Type string `json:"type"`
Id string `json:"id"`
Name string `json:"name"`
Version string `json:"version"`
}
type PluginInfo struct { type PluginInfo struct {
Author PluginInfoLink `json:"author"` Author PluginInfoLink `json:"author"`
Description string `json:"description"` Description string `json:"description"`
......
...@@ -429,6 +429,9 @@ export class DashboardMigrator { ...@@ -429,6 +429,9 @@ export class DashboardMigrator {
for (let panel of row.panels) { for (let panel of row.panels) {
panel.span = panel.span || DEFAULT_PANEL_SPAN; panel.span = panel.span || DEFAULT_PANEL_SPAN;
if (panel.minSpan) {
panel.minSpan = Math.min(GRID_COLUMN_COUNT, GRID_COLUMN_COUNT / 12 * panel.minSpan);
}
const panelWidth = Math.floor(panel.span) * widthFactor; const panelWidth = Math.floor(panel.span) * widthFactor;
const panelHeight = panel.height ? getGridHeight(panel.height) : rowGridHeight; const panelHeight = panel.height ? getGridHeight(panel.height) : rowGridHeight;
......
...@@ -363,6 +363,14 @@ describe('DashboardModel', function() { ...@@ -363,6 +363,14 @@ describe('DashboardModel', function() {
expect(dashboard.panels[0].repeat).toBe('server'); expect(dashboard.panels[0].repeat).toBe('server');
expect(dashboard.panels.length).toBe(2); expect(dashboard.panels.length).toBe(2);
}); });
it('minSpan should be twice', function() {
model.rows = [createRow({ height: 8 }, [[6]])];
model.rows[0].panels[0] = { minSpan: 12 };
let dashboard = new DashboardModel(model);
expect(dashboard.panels[0].minSpan).toBe(24);
});
}); });
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment