bugfix: list builtin alerts and dashboards

This commit is contained in:
Ulric Qin 2022-04-02 12:21:03 +08:00
parent 9e8d9b44b1
commit 66bc023e51
2 changed files with 3 additions and 2 deletions

View File

@ -20,7 +20,7 @@ func alertRuleBuiltinList(c *gin.Context) {
fp = path.Join(runner.Cwd, "etc", "alerts") fp = path.Join(runner.Cwd, "etc", "alerts")
} }
files, err := file.DirsUnder(fp) files, err := file.FilesUnder(fp)
ginx.Dangerous(err) ginx.Dangerous(err)
names := make([]string, 0, len(files)) names := make([]string, 0, len(files))
@ -93,7 +93,7 @@ func dashboardBuiltinList(c *gin.Context) {
fp = path.Join(runner.Cwd, "etc", "dashboards") fp = path.Join(runner.Cwd, "etc", "dashboards")
} }
files, err := file.DirsUnder(fp) files, err := file.FilesUnder(fp)
ginx.Dangerous(err) ginx.Dangerous(err)
names := make([]string, 0, len(files)) names := make([]string, 0, len(files))

View File

@ -67,6 +67,7 @@ func user() gin.HandlerFunc {
} }
c.Set("user", user) c.Set("user", user)
c.Set("isadmin", user.IsAdmin())
c.Next() c.Next()
} }
} }