From f95b3be328b552fb4b552c7fe3024dd6fa464769 Mon Sep 17 00:00:00 2001 From: cuigh Date: Mon, 25 Jun 2018 18:38:34 +0800 Subject: [PATCH] Fix #15 --- controller/service.go | 2 +- dao/bolt/chart.go | 12 ++++++------ views/service/stats.jet | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/controller/service.go b/controller/service.go index e15dfa0..fe8a6d5 100644 --- a/controller/service.go +++ b/controller/service.go @@ -338,6 +338,6 @@ func serviceStats(ctx web.Context) error { period := cast.ToDuration(ctx.Q("time"), time.Hour) refresh := cast.ToBool(ctx.Q("refresh"), true) m := newModel(ctx).Set("Service", service).Set("Tasks", tasks).Set("Time", period.String()). - Set("Refresh", refresh).Set("Charts", charts) + Set("Refresh", refresh).Set("Prometheus", setting.Metrics.Prometheus).Set("Charts", charts) return ctx.Render("service/stats", m) } diff --git a/dao/bolt/chart.go b/dao/bolt/chart.go index 75faa08..6c84852 100644 --- a/dao/bolt/chart.go +++ b/dao/bolt/chart.go @@ -53,19 +53,19 @@ func (d *Dao) ChartDelete(name string) (err error) { } func (d *Dao) DashboardGet(name, key string) (dashboard *model.ChartDashboard, err error) { - dashboard = &model.ChartDashboard{ + cd := &model.ChartDashboard{ Name: name, Key: key, } var v Value - v, err = d.get("dashboard", dashboard.ID()) - if err == nil { - if v != nil { - err = v.Unmarshal(dashboard) + v, err = d.get("dashboard", cd.ID()) + if v != nil { + if err = v.Unmarshal(cd); err == nil { + return cd, nil } } - return + return nil, err } func (d *Dao) DashboardUpdate(dashboard *model.ChartDashboard) (err error) { diff --git a/views/service/stats.jet b/views/service/stats.jet index 98e37db..d1b26a0 100644 --- a/views/service/stats.jet +++ b/views/service/stats.jet @@ -47,7 +47,7 @@
- {{ if .Charts }} + {{ if .Prometheus }}