mirror of
https://github.com/glanceapp/glance.git
synced 2025-06-21 18:31:24 +02:00
Move behavior within the widget init
Otherwise we create a global getWidgetTitleURL function that sounds a little too generic and vague
This commit is contained in:
parent
55685e6854
commit
a77d0ce5c0
@ -60,19 +60,16 @@ func makeDNSWidgetTimeLabels(format string) [8]string {
|
||||
return labels
|
||||
}
|
||||
|
||||
func getWidgetTitleURL(widget *dnsStatsWidget) string {
|
||||
func (widget *dnsStatsWidget) initialize() error {
|
||||
titleURL := strings.TrimRight(widget.URL, "/")
|
||||
switch widget.Service {
|
||||
case dnsServicePihole, dnsServicePiholeV6:
|
||||
return fmt.Sprintf("%s/admin", strings.TrimRight(widget.URL, "/"))
|
||||
default:
|
||||
return widget.URL
|
||||
}
|
||||
titleURL = titleURL + "/admin"
|
||||
}
|
||||
|
||||
func (widget *dnsStatsWidget) initialize() error {
|
||||
widget.
|
||||
withTitle("DNS Stats").
|
||||
withTitleURL(getWidgetTitleURL(widget)).
|
||||
withTitleURL(titleURL).
|
||||
withCacheDuration(10 * time.Minute)
|
||||
|
||||
switch widget.Service {
|
||||
|
Loading…
x
Reference in New Issue
Block a user