1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- package dashboard
- import (
- "kpt-pasture/http/middleware"
- "net/http"
- operationPb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/operation"
- pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
- "gitee.com/xuyiping_admin/pkg/valid"
- "gitee.com/xuyiping_admin/pkg/apierr"
- "gitee.com/xuyiping_admin/pkg/ginutil"
- "github.com/gin-gonic/gin"
- )
- func Bar(c *gin.Context) {
- res, err := middleware.Dependency(c).StoreEventHub.OpsService.Bar(c)
- if err != nil {
- apierr.ClassifiedAbort(c, err)
- return
- }
- ginutil.JSONResp(c, res)
- }
- func NeckRingWarning(c *gin.Context) {
- res, err := middleware.Dependency(c).StoreEventHub.OpsService.NeckRingWarning(c)
- if err != nil {
- apierr.ClassifiedAbort(c, err)
- return
- }
- ginutil.JSONResp(c, res)
- }
- func FocusIndicators(c *gin.Context) {
- dimension := c.Param("dimension")
- if err := valid.Validate(dimension, valid.Required); err != nil {
- apierr.AbortBadRequest(c, http.StatusBadRequest, err)
- return
- }
- res, err := middleware.Dependency(c).StoreEventHub.OpsService.FocusIndicatorsList(c, dimension)
- if err != nil {
- apierr.ClassifiedAbort(c, err)
- return
- }
- ginutil.JSONResp(c, res)
- }
- func FocusIndicatorsSet(c *gin.Context) {
- var req pasturePb.IndexFocusIndicatorsSetRequest
- if err := ginutil.BindProto(c, &req); err != nil {
- apierr.AbortBadRequest(c, http.StatusBadRequest, err)
- return
- }
- if err := middleware.Dependency(c).StoreEventHub.OpsService.FocusIndicatorsSet(c, &req); err != nil {
- apierr.ClassifiedAbort(c, err)
- return
- }
- ginutil.JSONResp(c, &operationPb.CommonOK{
- Code: http.StatusOK,
- Msg: "ok",
- Data: &operationPb.Success{Success: true},
- })
- }
- func DataWarningSet(c *gin.Context) {
- var req pasturePb.IndexDataWarningSetRequest
- if err := ginutil.BindProto(c, &req); err != nil {
- apierr.AbortBadRequest(c, http.StatusBadRequest, err)
- return
- }
- if err := middleware.Dependency(c).StoreEventHub.OpsService.DataWarningSet(c, &req); err != nil {
- apierr.ClassifiedAbort(c, err)
- return
- }
- ginutil.JSONResp(c, &operationPb.CommonOK{
- Code: http.StatusOK,
- Msg: "ok",
- Data: &operationPb.Success{Success: true},
- })
- }
- func DataWarningList(c *gin.Context) {
- res, err := middleware.Dependency(c).StoreEventHub.OpsService.DataWarningList(c)
- if err != nil {
- apierr.ClassifiedAbort(c, err)
- return
- }
- ginutil.JSONResp(c, res)
- }
|