use i18n error when import rules and dashboards
This commit is contained in:
parent
dd8e1f2d71
commit
4e3f9914f1
|
@ -6,6 +6,7 @@ import (
|
|||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/toolkits/pkg/ginx"
|
||||
"github.com/toolkits/pkg/i18n"
|
||||
|
||||
"github.com/didi/nightingale/v5/src/models"
|
||||
)
|
||||
|
@ -46,7 +47,7 @@ func alertRuleAdd(c *gin.Context) {
|
|||
lst[i].FE2DB()
|
||||
|
||||
if err := lst[i].Add(); err != nil {
|
||||
reterr[lst[i].Name] = err.Error()
|
||||
reterr[lst[i].Name] = i18n.Sprintf(c.GetHeader("X-Language"), err.Error())
|
||||
} else {
|
||||
reterr[lst[i].Name] = ""
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import (
|
|||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/toolkits/pkg/ginx"
|
||||
"github.com/toolkits/pkg/i18n"
|
||||
|
||||
"github.com/didi/nightingale/v5/src/models"
|
||||
)
|
||||
|
@ -186,7 +187,7 @@ func dashboardImport(c *gin.Context) {
|
|||
|
||||
err := dash.Add()
|
||||
if err != nil {
|
||||
ret[dash.Name] = err.Error()
|
||||
ret[dash.Name] = i18n.Sprintf(c.GetHeader("X-Language"), err.Error())
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue