2024-05-07 10:50:40 +07:00
|
|
|
package routes
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"github.com/tigorlazuardi/redmage/pkg/log"
|
|
|
|
"github.com/tigorlazuardi/redmage/views"
|
2024-05-08 14:09:00 +07:00
|
|
|
"github.com/tigorlazuardi/redmage/views/devices/put"
|
2024-05-07 10:50:40 +07:00
|
|
|
)
|
|
|
|
|
|
|
|
func (routes *Routes) PageDevicesAdd(rw http.ResponseWriter, req *http.Request) {
|
|
|
|
ctx, span := tracer.Start(req.Context(), "*Routes.PageDevicesAdd")
|
|
|
|
defer span.End()
|
|
|
|
|
|
|
|
c := views.NewContext(routes.Config, req)
|
|
|
|
|
2024-05-08 10:10:23 +07:00
|
|
|
data := put.Data{
|
|
|
|
PageTitle: "Add Device",
|
|
|
|
PostAction: "/devices/add",
|
|
|
|
AspectRatioTolerance: put.AspectRatioToleranceData{
|
|
|
|
Value: 0.2,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
if err := put.View(c, data).Render(ctx, rw); err != nil {
|
2024-05-07 10:50:40 +07:00
|
|
|
log.New(ctx).Err(err).Error("failed to render add device page")
|
|
|
|
}
|
|
|
|
}
|