mirror of
https://github.com/TeaOSLab/EdgeAPI.git
synced 2025-12-08 18:51:54 +08:00
统计创建浏览器、系统时限制名称长度
This commit is contained in:
@@ -23,10 +23,16 @@ func (this *NodeClusterMetricItemService) EnableNodeClusterMetricItem(ctx contex
|
||||
}
|
||||
|
||||
var tx = this.NullTx()
|
||||
err = models.SharedNodeClusterMetricItemDAO.EnableClusterItem(tx, req.NodeClusterId, req.MetricItemId)
|
||||
exists, err := models.SharedNodeClusterMetricItemDAO.ExistsClusterItem(tx, req.NodeClusterId, req.MetricItemId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !exists {
|
||||
err = models.SharedNodeClusterMetricItemDAO.EnableClusterItem(tx, req.NodeClusterId, req.MetricItemId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
return this.Success()
|
||||
}
|
||||
|
||||
@@ -53,7 +59,7 @@ func (this *NodeClusterMetricItemService) FindAllNodeClusterMetricItems(ctx cont
|
||||
}
|
||||
|
||||
var tx = this.NullTx()
|
||||
clusterItems, err := models.SharedNodeClusterMetricItemDAO.FindAllClusterItems(tx, req.NodeClusterId)
|
||||
clusterItems, err := models.SharedNodeClusterMetricItemDAO.FindAllClusterItems(tx, req.NodeClusterId, req.Category)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -79,3 +85,18 @@ func (this *NodeClusterMetricItemService) FindAllNodeClusterMetricItems(ctx cont
|
||||
}
|
||||
return &pb.FindAllNodeClusterMetricItemsResponse{MetricItems: pbItems}, nil
|
||||
}
|
||||
|
||||
// ExistsNodeClusterMetricItem 检查是否已添加某个指标
|
||||
func (this *NodeClusterMetricItemService) ExistsNodeClusterMetricItem(ctx context.Context, req *pb.ExistsNodeClusterMetricItemRequest) (*pb.RPCExists, error) {
|
||||
_, err := this.ValidateAdmin(ctx, 0)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var tx = this.NullTx()
|
||||
b, err := models.SharedNodeClusterMetricItemDAO.ExistsClusterItem(tx, req.NodeClusterId, req.MetricItemId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return this.Exists(b)
|
||||
}
|
||||
|
||||
@@ -7,12 +7,12 @@ import (
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
)
|
||||
|
||||
// 操作系统统计
|
||||
// ServerClientBrowserMonthlyStatService 操作系统统计
|
||||
type ServerClientBrowserMonthlyStatService struct {
|
||||
BaseService
|
||||
}
|
||||
|
||||
// 查找前N个操作系统
|
||||
// FindTopServerClientBrowserMonthlyStats 查找前N个操作系统
|
||||
func (this *ServerClientBrowserMonthlyStatService) FindTopServerClientBrowserMonthlyStats(ctx context.Context, req *pb.FindTopServerClientBrowserMonthlyStatsRequest) (*pb.FindTopServerClientBrowserMonthlyStatsResponse, error) {
|
||||
_, userId, err := this.ValidateAdminAndUser(ctx, 0, 0)
|
||||
if err != nil {
|
||||
|
||||
@@ -7,12 +7,12 @@ import (
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
)
|
||||
|
||||
// 操作系统统计
|
||||
// ServerClientSystemMonthlyStatService 操作系统统计
|
||||
type ServerClientSystemMonthlyStatService struct {
|
||||
BaseService
|
||||
}
|
||||
|
||||
// 查找前N个操作系统
|
||||
// FindTopServerClientSystemMonthlyStats 查找前N个操作系统
|
||||
func (this *ServerClientSystemMonthlyStatService) FindTopServerClientSystemMonthlyStats(ctx context.Context, req *pb.FindTopServerClientSystemMonthlyStatsRequest) (*pb.FindTopServerClientSystemMonthlyStatsResponse, error) {
|
||||
_, userId, err := this.ValidateAdminAndUser(ctx, 0, 0)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user