mirror of
https://github.com/grafana/grafana.git
synced 2024-11-30 04:34:23 -06:00
586272e5f0
* First attempt at creating new navbar_preferences table in db * Apply to every nav item instead of just home * user essentials mob! 🔱 * user essentials mob! 🔱 * user essentials mob! 🔱 * user essentials mob! 🔱 * user essentials mob! 🔱 * user essentials mob! 🔱 * user essentials mob! 🔱 * user essentials mob! 🔱 * user essentials mob! 🔱 * user essentials mob! 🔱 * user essentials mob! 🔱 * user essentials mob! 🔱 * user essentials mob! 🔱 * user essentials mob! 🔱 * user essentials mob! 🔱 * user essentials mob! 🔱 * user essentials mob! 🔱 * user essentials mob! 🔱 * user essentials mob! 🔱 * user essentials mob! 🔱 * user essentials mob! 🔱 * user essentials mob! 🔱 * user essentials mob! 🔱 * user essentials mob! 🔱 * user essentials mob! 🔱 * user essentials mob! 🔱 * user essentials mob! 🔱 * user essentials mob! 🔱 * Chore: introduce initTestDB options for features * fix unit tests * Add another unit test and some logic for detecting if a preference already exists * tidy up * Only override IsFeatureToggleEnabled if it's defined * Extract setNavPreferences out into it's own function, initialise features correctly * Make the linter happy * Use new structure * user essentials mob! 🔱 * user essentials mob! 🔱 * Split NavbarPreferences from Preferences * user essentials mob! 🔱 * user essentials mob! 🔱 * Fix lint error * Start adding tests * Change internal db structure to be a generic json object * GetJsonData -> GetPreferencesJsonData * Stop using simplejson + add some more unit tests * Update pkg/api/preferences.go Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com> * Updates following review comments * user essentials mob! 🔱 * user essentials mob! 🔱 * user essentials mob! 🔱 * user essentials mob! 🔱 * Change patch to upsert, add a unit test * remove commented out code * introduce patch user/org preferences methods * Return Navbar preferences in the get call * Fix integration test by instantiating JsonData * Address review comments * Rename HideFromNavbar -> Hide * add swagger:model comment * Add patch to the preferences documentation * Add openapi annotations * Add a short description * user essentials mob! 🔱 * user essentials mob! 🔱 * user essentials mob! 🔱 * user essentials mob! 🔱 * Update unit tests * remove unneeded url * remove outdated comment * Update integration tests * update generated swagger Co-authored-by: Alexandra Vargas <alexa1866@gmail.com> Co-authored-by: Hugo Häggmark <hugo.haggmark@gmail.com> Co-authored-by: Marcus Efraimsson <marcus.efraimsson@gmail.com>
80 lines
2.4 KiB
Go
80 lines
2.4 KiB
Go
package dtos
|
|
|
|
import (
|
|
"github.com/grafana/grafana/pkg/setting"
|
|
|
|
"html/template"
|
|
)
|
|
|
|
type IndexViewData struct {
|
|
User *CurrentUser
|
|
Settings map[string]interface{}
|
|
AppUrl string
|
|
AppSubUrl string
|
|
GoogleAnalyticsId string
|
|
GoogleTagManagerId string
|
|
NavTree []*NavLink
|
|
BuildVersion string
|
|
BuildCommit string
|
|
Theme string
|
|
NewGrafanaVersionExists bool
|
|
NewGrafanaVersion string
|
|
AppName string
|
|
AppNameBodyClass string
|
|
FavIcon template.URL
|
|
AppleTouchIcon template.URL
|
|
AppTitle string
|
|
Sentry *setting.Sentry
|
|
ContentDeliveryURL string
|
|
LoadingLogo template.URL
|
|
// Nonce is a cryptographic identifier for use with Content Security Policy.
|
|
Nonce string
|
|
}
|
|
|
|
const (
|
|
// These weights may be used by an extension to reliably place
|
|
// itself in relation to a particular item in the menu. The weights
|
|
// are negative to ensure that the default items are placed above
|
|
// any items with default weight.
|
|
|
|
WeightSavedItems = (iota - 20) * 100
|
|
WeightHome
|
|
WeightCreate
|
|
WeightDashboard
|
|
WeightExplore
|
|
WeightAlerting
|
|
WeightPlugin
|
|
WeightConfig
|
|
WeightAdmin
|
|
WeightProfile
|
|
WeightHelp
|
|
)
|
|
|
|
const (
|
|
NavSectionCore string = "core"
|
|
NavSectionPlugin string = "plugin"
|
|
NavSectionConfig string = "config"
|
|
)
|
|
|
|
type NavLink struct {
|
|
Id string `json:"id,omitempty"`
|
|
Text string `json:"text,omitempty"`
|
|
Description string `json:"description,omitempty"`
|
|
Section string `json:"section,omitempty"`
|
|
SubTitle string `json:"subTitle,omitempty"`
|
|
Icon string `json:"icon,omitempty"`
|
|
Img string `json:"img,omitempty"`
|
|
Url string `json:"url,omitempty"`
|
|
Target string `json:"target,omitempty"`
|
|
SortWeight int64 `json:"sortWeight,omitempty"`
|
|
Divider bool `json:"divider,omitempty"`
|
|
HideFromMenu bool `json:"hideFromMenu,omitempty"`
|
|
HideFromTabs bool `json:"hideFromTabs,omitempty"`
|
|
Children []*NavLink `json:"children,omitempty"`
|
|
HighlightText string `json:"highlightText,omitempty"`
|
|
HighlightID string `json:"highlightId,omitempty"`
|
|
}
|
|
|
|
// NavIDCfg is the id for org configuration navigation node
|
|
const NavIDCfg = "cfg"
|