mirror of
https://github.com/wahyd4/badger.git
synced 2026-08-08 21:05:55 +10:00
Update logic of handling no label prometheus query result, and update nuxt version
This commit is contained in:
+1
-1
@@ -1,4 +1,4 @@
|
||||
FROM golang:1.14-alpine AS build
|
||||
FROM golang:1.17-alpine AS build
|
||||
|
||||
RUN apk add --no-cache git openssh
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
module github.com/wahyd4/badger
|
||||
|
||||
go 1.14
|
||||
go 1.17
|
||||
|
||||
require (
|
||||
github.com/ajstarks/svgo v0.0.0-20200320125537-f189e35d30ca
|
||||
|
||||
@@ -293,6 +293,10 @@ func (handler *BadgesHandler) generateSVG(c *gin.Context, colorScheme ColorSchem
|
||||
|
||||
if len(label) <= 10 {
|
||||
labelContainerWidth = 74
|
||||
} else if len(label) >= 20 && len(label) < 25 {
|
||||
labelContainerWidth = 150
|
||||
} else if len(label) >= 25 {
|
||||
labelContainerWidth = 174
|
||||
}
|
||||
|
||||
if metricValue > 10000 && metricValue < 1000000 {
|
||||
@@ -515,6 +519,10 @@ func (handler *BadgesHandler) queryPrometheus(badge *models.Badge, options *mode
|
||||
Time: v.Timestamp.Time(),
|
||||
}
|
||||
}
|
||||
// handle label is empty, then use badge label from database
|
||||
if len(metric.Label) == 0 {
|
||||
metric.Label = badge.Label
|
||||
}
|
||||
handler.DB.Save(&models.ViewRecord{ULID: badge.ULID})
|
||||
return &metric, nil
|
||||
}
|
||||
|
||||
Generated
+23012
-95
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -11,7 +11,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@nuxt/typescript-runtime": "^1.0.0",
|
||||
"@nuxtjs/auth-next": "5.0.0-1611574754.9020f2a",
|
||||
"@nuxtjs/auth-next": "5.0.0-1643791578.532b3d6",
|
||||
"@nuxtjs/axios": "^5.12.5",
|
||||
"@nuxtjs/pwa": "^3.0.0-beta.20",
|
||||
"bootstrap": "^4.6.0",
|
||||
|
||||
Reference in New Issue
Block a user