diff --git a/pkg/api/dashboard.go b/pkg/api/dashboard.go index cc635a108e3..c0c7cd0e4f5 100644 --- a/pkg/api/dashboard.go +++ b/pkg/api/dashboard.go @@ -58,26 +58,20 @@ func GetDashboard(c *middleware.Context) { creator = getUserLogin(dash.CreatedBy) } - // Finding total panels and queries on the dashboard - totalRows, totalPanels, totalQueries := getTotalRowsPanelsAndQueries(dash.Data) - dto := dtos.DashboardFullWithMeta{ Dashboard: dash.Data, Meta: dtos.DashboardMeta{ - IsStarred: isStarred, - Slug: slug, - Type: m.DashTypeDB, - CanStar: c.IsSignedIn, - CanSave: c.OrgRole == m.ROLE_ADMIN || c.OrgRole == m.ROLE_EDITOR, - CanEdit: canEditDashboard(c.OrgRole), - Created: dash.Created, - Updated: dash.Updated, - UpdatedBy: updater, - CreatedBy: creator, - TotalRows: totalRows, - TotalPanels: totalPanels, - TotalQueries: totalQueries, - Version: dash.Version, + IsStarred: isStarred, + Slug: slug, + Type: m.DashTypeDB, + CanStar: c.IsSignedIn, + CanSave: c.OrgRole == m.ROLE_ADMIN || c.OrgRole == m.ROLE_EDITOR, + CanEdit: canEditDashboard(c.OrgRole), + Created: dash.Created, + Updated: dash.Updated, + UpdatedBy: updater, + CreatedBy: creator, + Version: dash.Version, }, } @@ -95,26 +89,6 @@ func getUserLogin(userId int64) string { } } -func getTotalRowsPanelsAndQueries(data map[string]interface{}) (int, int, int) { - totalRows, totalPanels, totalQueries := 0, 0, 0 - if rows, rowsOk := data["rows"]; rowsOk { - totalRows = len(rows.([]interface{})) - if totalRows > 0 { - for _, rowElement := range rows.([]interface{}) { - if panels, panelsOk := rowElement.(map[string]interface{})["panels"]; panelsOk { - totalPanels += len(panels.([]interface{})) - for _, panelElement := range panels.([]interface{}) { - if targets, targetsOk := panelElement.(map[string]interface{})["targets"]; targetsOk { - totalQueries += len(targets.([]interface{})) - } - } - } - } - } - } - return totalRows, totalPanels, totalQueries -} - func DeleteDashboard(c *middleware.Context) { slug := c.Params(":slug") diff --git a/pkg/api/dtos/models.go b/pkg/api/dtos/models.go index 5fe23b4a53e..83176e836e5 100644 --- a/pkg/api/dtos/models.go +++ b/pkg/api/dtos/models.go @@ -30,23 +30,20 @@ type CurrentUser struct { } type DashboardMeta struct { - IsStarred bool `json:"isStarred,omitempty"` - IsHome bool `json:"isHome,omitempty"` - IsSnapshot bool `json:"isSnapshot,omitempty"` - Type string `json:"type,omitempty"` - CanSave bool `json:"canSave"` - CanEdit bool `json:"canEdit"` - CanStar bool `json:"canStar"` - Slug string `json:"slug"` - Expires time.Time `json:"expires"` - Created time.Time `json:"created"` - Updated time.Time `json:"updated"` - UpdatedBy string `json:"updatedBy"` - CreatedBy string `json:"createdBy"` - TotalRows int `json:"totalRows"` - TotalPanels int `json:"totalPanels"` - TotalQueries int `json:"totalQueries"` - Version int `json:"version"` + IsStarred bool `json:"isStarred,omitempty"` + IsHome bool `json:"isHome,omitempty"` + IsSnapshot bool `json:"isSnapshot,omitempty"` + Type string `json:"type,omitempty"` + CanSave bool `json:"canSave"` + CanEdit bool `json:"canEdit"` + CanStar bool `json:"canStar"` + Slug string `json:"slug"` + Expires time.Time `json:"expires"` + Created time.Time `json:"created"` + Updated time.Time `json:"updated"` + UpdatedBy string `json:"updatedBy"` + CreatedBy string `json:"createdBy"` + Version int `json:"version"` } type DashboardFullWithMeta struct { diff --git a/public/app/features/dashboard/partials/settings.html b/public/app/features/dashboard/partials/settings.html index e5b42bbdfdd..939a23a2d1e 100644 --- a/public/app/features/dashboard/partials/settings.html +++ b/public/app/features/dashboard/partials/settings.html @@ -167,40 +167,7 @@