Bläddra i källkod

feat(cli): download all plugin dependencies

bergquist 9 år sedan
förälder
incheckning
3c966caa23

+ 3 - 3
pkg/cmd/grafana-cli/commands/install_command.go

@@ -14,6 +14,7 @@ import (
 	"strings"
 
 	"github.com/fatih/color"
+	"github.com/grafana/grafana-cli/pkg/log"
 	"github.com/grafana/grafana/pkg/cmd/grafana-cli/logger"
 	m "github.com/grafana/grafana/pkg/cmd/grafana-cli/models"
 	s "github.com/grafana/grafana/pkg/cmd/grafana-cli/services"
@@ -90,13 +91,12 @@ func InstallPlugin(pluginName, version string, c CommandLine) error {
 
 	logger.Infof("%s Installed %s successfully \n", color.GreenString("✔"), plugin.Id)
 
-	/* Enable once we need support for downloading depedencies
 	res, _ := s.ReadPlugin(pluginFolder, pluginName)
-	for _, v := range res.Dependency.Plugins {
+	for _, v := range res.Dependencies.Plugins {
 		InstallPlugin(v.Id, version, c)
 		log.Infof("Installed dependency: %v ✔\n", v.Id)
 	}
-	*/
+
 	return err
 }
 

+ 3 - 3
pkg/cmd/grafana-cli/models/model.go

@@ -9,11 +9,11 @@ type InstalledPlugin struct {
 	Name string `json:"name"`
 	Type string `json:"type"`
 
-	Info       PluginInfo `json:"info"`
-	Dependency Dependency `json:"dependencies"`
+	Info         PluginInfo   `json:"info"`
+	Dependencies Dependencies `json:"dependencies"`
 }
 
-type Dependency struct {
+type Dependencies struct {
 	GrafanaVersion string   `json:"grafanaVersion"`
 	Plugins        []Plugin `json:"plugins"`
 }