2020-01-15 07:50:44 -06:00
|
|
|
package licensing
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/grafana/grafana/pkg/api/dtos"
|
2020-01-27 02:24:44 -06:00
|
|
|
"github.com/grafana/grafana/pkg/models"
|
2020-01-15 07:50:44 -06:00
|
|
|
"github.com/grafana/grafana/pkg/services/hooks"
|
|
|
|
"github.com/grafana/grafana/pkg/setting"
|
|
|
|
)
|
|
|
|
|
2020-11-05 04:55:40 -06:00
|
|
|
const (
|
|
|
|
openSource = "Open Source"
|
|
|
|
)
|
|
|
|
|
2020-01-15 07:50:44 -06:00
|
|
|
type OSSLicensingService struct {
|
2021-08-25 08:11:22 -05:00
|
|
|
Cfg *setting.Cfg
|
|
|
|
HooksService *hooks.HooksService
|
2020-01-15 07:50:44 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
func (*OSSLicensingService) HasLicense() bool {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
func (*OSSLicensingService) Expiry() int64 {
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
2020-01-27 02:24:44 -06:00
|
|
|
func (*OSSLicensingService) Edition() string {
|
2020-11-05 04:55:40 -06:00
|
|
|
return openSource
|
2020-01-27 02:24:44 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
func (*OSSLicensingService) StateInfo() string {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
2021-02-01 03:13:09 -06:00
|
|
|
func (*OSSLicensingService) ContentDeliveryPrefix() string {
|
|
|
|
return "grafana-oss"
|
|
|
|
}
|
|
|
|
|
2021-10-05 08:54:26 -05:00
|
|
|
func (l *OSSLicensingService) LicenseURL(showAdminLicensingPage bool) string {
|
|
|
|
if showAdminLicensingPage {
|
2020-11-13 02:52:38 -06:00
|
|
|
return l.Cfg.AppSubURL + "/admin/upgrading"
|
2020-01-27 02:24:44 -06:00
|
|
|
}
|
|
|
|
|
2021-08-25 03:43:43 -05:00
|
|
|
return "https://grafana.com/oss/grafana?utm_source=grafana_footer"
|
2020-01-27 02:24:44 -06:00
|
|
|
}
|
|
|
|
|
2021-08-25 08:11:22 -05:00
|
|
|
func (*OSSLicensingService) HasValidLicense() bool {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
func ProvideService(cfg *setting.Cfg, hooksService *hooks.HooksService) *OSSLicensingService {
|
|
|
|
l := &OSSLicensingService{
|
|
|
|
Cfg: cfg,
|
|
|
|
HooksService: hooksService,
|
|
|
|
}
|
2020-01-27 02:24:44 -06:00
|
|
|
l.HooksService.AddIndexDataHook(func(indexData *dtos.IndexViewData, req *models.ReqContext) {
|
2020-01-15 07:50:44 -06:00
|
|
|
for _, node := range indexData.NavTree {
|
|
|
|
if node.Id == "admin" {
|
|
|
|
node.Children = append(node.Children, &dtos.NavLink{
|
2021-08-24 11:13:48 -05:00
|
|
|
Text: "Stats and license",
|
2020-01-15 07:50:44 -06:00
|
|
|
Id: "upgrading",
|
2021-10-05 08:54:26 -05:00
|
|
|
Url: l.LicenseURL(req.IsGrafanaAdmin),
|
@grafana/ui: Create Icon component and replace part of the icons (#23402)
* Part1: Unicons implementation (#23197)
* Create a new Icon component
* Update icons in main sidebar
* Update icons in Useful links and in react components on main site
* Update icons in Useful links and in main top navigation
* Adjust sizing
* Update panel navigation and timepicker
* Update icons in Panel menu
* NewPanelEditor: Fixed so that test alert rule works in new edit mode (#23179)
* Update icons in add panel widget
* Resolve merge conflict
* Fix part of the test errors and type errors
* Fix storybook errors
* Update getAvailableIcons import in storybook knobs
* Fix import path
* Fix SyntaxError: Cannot use import statement outside a module in test environment error
* Remove dynamic imports
* Remove types as using @ts-ignore
* Update snapshot test
* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax
* Remove color prop from icon, remove color implemetation in mono icons
* Update navbar styling
* Move toPascalCase to utils/string
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
* Resolve type errors resulted from merge
* Part2: Unicons implementation (#23266)
* Create a new Icon component
* Update icons in main sidebar
* Update icons in Useful links and in react components on main site
* Update icons in Useful links and in main top navigation
* Adjust sizing
* Update panel navigation and timepicker
* Update icons in Panel menu
* Update icons in add panel widget
* Resolve merge conflict
* Fix part of the test errors and type errors
* Fix storybook errors
* Update getAvailableIcons import in storybook knobs
* Fix import path
* Fix SyntaxError: Cannot use import statement outside a module in test environment error
* Remove dynamic imports
* Remove types as using @ts-ignore
* Update snapshot test
* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax
* Implment icons in Tabs
* Implement icons in search items and empty list
* Update buttons
* Update button-related snapshot tests
* Update icons in modals and page headers
* Create anfular wrapper and update all icons on search screen
* Update sizing, remove colors, update snapshot tests
* Remove color prop from icon, remove color implemetation in mono icons
* Remove color props from monochrome icons
* Complete update of icons for search screen
* Update icons for infor tooltips, playlist, permissions
* Support temporarly font awesome icons used in enterprise grafana
* Part1: Unicons implementation (#23197)
* Create a new Icon component
* Update icons in main sidebar
* Update icons in Useful links and in react components on main site
* Update icons in Useful links and in main top navigation
* Adjust sizing
* Update panel navigation and timepicker
* Update icons in Panel menu
* NewPanelEditor: Fixed so that test alert rule works in new edit mode (#23179)
* Update icons in add panel widget
* Resolve merge conflict
* Fix part of the test errors and type errors
* Fix storybook errors
* Update getAvailableIcons import in storybook knobs
* Fix import path
* Fix SyntaxError: Cannot use import statement outside a module in test environment error
* Remove dynamic imports
* Remove types as using @ts-ignore
* Update snapshot test
* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax
* Remove color prop from icon, remove color implemetation in mono icons
* Update navbar styling
* Move toPascalCase to utils/string
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
* Icons update
* Add optional chaining to for isFontAwesome variable
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
* Part3: Unicons implementation (#23356)
* Create a new Icon component
* Update icons in main sidebar
* Update icons in Useful links and in react components on main site
* Update icons in Useful links and in main top navigation
* Adjust sizing
* Update panel navigation and timepicker
* Update icons in Panel menu
* Update icons in add panel widget
* Resolve merge conflict
* Fix part of the test errors and type errors
* Fix storybook errors
* Update getAvailableIcons import in storybook knobs
* Fix import path
* Fix SyntaxError: Cannot use import statement outside a module in test environment error
* Remove dynamic imports
* Remove types as using @ts-ignore
* Update snapshot test
* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax
* Implment icons in Tabs
* Implement icons in search items and empty list
* Update buttons
* Update button-related snapshot tests
* Update icons in modals and page headers
* Create anfular wrapper and update all icons on search screen
* Update sizing, remove colors, update snapshot tests
* Remove color prop from icon, remove color implemetation in mono icons
* Remove color props from monochrome icons
* Complete update of icons for search screen
* Update icons for infor tooltips, playlist, permissions
* Support temporarly font awesome icons used in enterprise grafana
* Part1: Unicons implementation (#23197)
* Create a new Icon component
* Update icons in main sidebar
* Update icons in Useful links and in react components on main site
* Update icons in Useful links and in main top navigation
* Adjust sizing
* Update panel navigation and timepicker
* Update icons in Panel menu
* NewPanelEditor: Fixed so that test alert rule works in new edit mode (#23179)
* Update icons in add panel widget
* Resolve merge conflict
* Fix part of the test errors and type errors
* Fix storybook errors
* Update getAvailableIcons import in storybook knobs
* Fix import path
* Fix SyntaxError: Cannot use import statement outside a module in test environment error
* Remove dynamic imports
* Remove types as using @ts-ignore
* Update snapshot test
* Add @iconscout/react-unicons to the shouldExclude list as it is blundled with es2015 syntax
* Remove color prop from icon, remove color implemetation in mono icons
* Update navbar styling
* Move toPascalCase to utils/string
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
* Update icons in Explore
* Update icons in alerting
* Update + and x buttons
* Update icons in configurations and settings
* Update close icons
* Update icons in rich history
* Update alert messages
* Add optional chaining to for isFontAwesome variable
* Remove icon mock, set up jest.config
* Fix navbar plus icon
* Fir enable-bacground to enableBackgournd
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
* Merge remote branch origin master to icons-unicons
* Revert "Merge remote branch origin master to icons-unicons"
This reverts commit 3f25d50a39a940883fefe73ce51219139c1ed37f.
* Size-up dashnav icons
* Fix alerting icons, panel headers, update tests
* Fix typecheck error
* Adjustments - add panel icon, spacing
* Set TerserPlugin sourceMap to false to prevent running out of memory when publishing storybook
Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
2020-04-08 07:33:31 -05:00
|
|
|
Icon: "unlock",
|
2020-01-15 07:50:44 -06:00
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
2021-08-25 08:11:22 -05:00
|
|
|
return l
|
2020-01-15 07:50:44 -06:00
|
|
|
}
|