(ctx context.Context)
| 1301 | } |
| 1302 | |
| 1303 | func (m *imlMonitorConfig) GetMonitorCluster(ctx context.Context) ([]*monitor_dto.MonitorCluster, error) { |
| 1304 | clusters, err := m.clusterService.ListByClusters(ctx) |
| 1305 | if err != nil { |
| 1306 | return nil, err |
| 1307 | } |
| 1308 | clusterIds := utils.SliceToSlice(clusters, func(i *cluster.Cluster) string { |
| 1309 | return i.Uuid |
| 1310 | }) |
| 1311 | monitorMap, err := m.monitorService.MapByCluster(ctx, clusterIds...) |
| 1312 | if err != nil { |
| 1313 | return nil, err |
| 1314 | } |
| 1315 | |
| 1316 | monitorClusters := make([]*monitor_dto.MonitorCluster, 0, len(clusters)) |
| 1317 | for _, c := range clusters { |
| 1318 | mc := &monitor_dto.MonitorCluster{ |
| 1319 | Id: c.Uuid, |
| 1320 | Name: c.Name, |
| 1321 | } |
| 1322 | _, ok := monitorMap[c.Uuid] |
| 1323 | if ok { |
| 1324 | mc.Enable = true |
| 1325 | } |
| 1326 | monitorClusters = append(monitorClusters, mc) |
| 1327 | } |
| 1328 | return monitorClusters, nil |
| 1329 | } |
nothing calls this directly
no test coverage detected