mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* Add unlicensed property to plugins * Disable selecting unlicensed plugin * Add customizable plugin market place url * License: workaround enabled only in enterprise * linter * Move licensing info to front end * Update pkg/services/licensing/oss.go Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com> * Update pkg/services/licensing/oss.go Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com> * Update pkg/setting/setting.go Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com> * Update pkg/setting/setting.go Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com> * Update pkg/api/frontendsettings.go Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com> * Update sample.ini * Update docs * Update packages/grafana-runtime/src/config.ts Co-authored-by: Torkel Ödegaard <torkel@grafana.org> * Update public/app/features/datasources/state/buildCategories.ts Co-authored-by: Torkel Ödegaard <torkel@grafana.org> * Update pkg/api/frontendsettings.go Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com> * Update pkg/setting/setting.go Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com> * Fix spelling Co-authored-by: Leonard Gram <leo@xlson.com> Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com> Co-authored-by: Torkel Ödegaard <torkel@grafana.org>
67 lines
1.4 KiB
Go
67 lines
1.4 KiB
Go
package licensing
|
|
|
|
import (
|
|
"github.com/grafana/grafana/pkg/api/dtos"
|
|
"github.com/grafana/grafana/pkg/models"
|
|
"github.com/grafana/grafana/pkg/services/hooks"
|
|
"github.com/grafana/grafana/pkg/setting"
|
|
)
|
|
|
|
const (
|
|
openSource = "Open Source"
|
|
)
|
|
|
|
type OSSLicensingService struct {
|
|
Cfg *setting.Cfg `inject:""`
|
|
HooksService *hooks.HooksService `inject:""`
|
|
}
|
|
|
|
func (*OSSLicensingService) HasLicense() bool {
|
|
return false
|
|
}
|
|
|
|
func (*OSSLicensingService) Expiry() int64 {
|
|
return 0
|
|
}
|
|
|
|
func (*OSSLicensingService) Edition() string {
|
|
return openSource
|
|
}
|
|
|
|
func (*OSSLicensingService) StateInfo() string {
|
|
return ""
|
|
}
|
|
|
|
func (l *OSSLicensingService) LicenseURL(user *models.SignedInUser) string {
|
|
if user.IsGrafanaAdmin {
|
|
return l.Cfg.AppSubUrl + "/admin/upgrading"
|
|
}
|
|
|
|
return "https://grafana.com/products/enterprise/?utm_source=grafana_footer"
|
|
}
|
|
|
|
func (l *OSSLicensingService) Init() error {
|
|
l.HooksService.AddIndexDataHook(func(indexData *dtos.IndexViewData, req *models.ReqContext) {
|
|
for _, node := range indexData.NavTree {
|
|
if node.Id == "admin" {
|
|
node.Children = append(node.Children, &dtos.NavLink{
|
|
Text: "Upgrade",
|
|
Id: "upgrading",
|
|
Url: l.LicenseURL(req.SignedInUser),
|
|
Icon: "unlock",
|
|
})
|
|
}
|
|
}
|
|
})
|
|
|
|
return nil
|
|
}
|
|
|
|
func (*OSSLicensingService) HasValidLicense() bool {
|
|
return false
|
|
}
|
|
|
|
func (*OSSLicensingService) TokenRaw() string {
|
|
return ""
|
|
}
|