mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Remove Macaron ParamsInt64 function from code base (#43810)
* draft commit * change all calls * Compilation errors
This commit is contained in:
@@ -1,13 +1,21 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strconv"
|
||||
|
||||
"github.com/grafana/grafana/pkg/api/response"
|
||||
"github.com/grafana/grafana/pkg/bus"
|
||||
"github.com/grafana/grafana/pkg/models"
|
||||
"github.com/grafana/grafana/pkg/web"
|
||||
)
|
||||
|
||||
func StarDashboard(c *models.ReqContext) response.Response {
|
||||
cmd := models.StarDashboardCommand{UserId: c.UserId, DashboardId: c.ParamsInt64(":id")}
|
||||
id, err := strconv.ParseInt(web.Params(c.Req)[":id"], 10, 64)
|
||||
if err != nil {
|
||||
return response.Error(http.StatusBadRequest, "id is invalid", err)
|
||||
}
|
||||
cmd := models.StarDashboardCommand{UserId: c.UserId, DashboardId: id}
|
||||
|
||||
if cmd.DashboardId <= 0 {
|
||||
return response.Error(400, "Missing dashboard id", nil)
|
||||
@@ -21,7 +29,11 @@ func StarDashboard(c *models.ReqContext) response.Response {
|
||||
}
|
||||
|
||||
func UnstarDashboard(c *models.ReqContext) response.Response {
|
||||
cmd := models.UnstarDashboardCommand{UserId: c.UserId, DashboardId: c.ParamsInt64(":id")}
|
||||
id, err := strconv.ParseInt(web.Params(c.Req)[":id"], 10, 64)
|
||||
if err != nil {
|
||||
return response.Error(http.StatusBadRequest, "id is invalid", err)
|
||||
}
|
||||
cmd := models.UnstarDashboardCommand{UserId: c.UserId, DashboardId: id}
|
||||
|
||||
if cmd.DashboardId <= 0 {
|
||||
return response.Error(400, "Missing dashboard id", nil)
|
||||
|
||||
Reference in New Issue
Block a user