@@ -2,6 +2,10 @@ package registry
2
2
3
3
import (
4
4
"fmt"
5
+ "strings"
6
+ "sync"
7
+ "time"
8
+
5
9
"github.com/gofrs/uuid"
6
10
"github.com/layer5io/meshkit/database"
7
11
models "github.com/layer5io/meshkit/models/meshmodel/core/v1beta1"
@@ -14,9 +18,6 @@ import (
14
18
"golang.org/x/text/cases"
15
19
"golang.org/x/text/language"
16
20
"gorm.io/gorm/clause"
17
- "strings"
18
- "sync"
19
- "time"
20
21
)
21
22
22
23
// MeshModelRegistrantData struct defines the body of the POST request that is sent to the capability
@@ -174,11 +175,11 @@ func (rm *RegistryManager) GetRegistrant(e entity.Entity) connection.Connection
174
175
// to be removed
175
176
func (rm * RegistryManager ) GetRegistrants (f * models.HostFilter ) ([]models.MeshModelHostsWithEntitySummary , int64 , error ) {
176
177
var result []models.MesheryHostSummaryDB
177
- var totalcount int64
178
+ var totalConnectionsCount int64
178
179
db := rm .db
179
180
180
181
query := db .Table ("connections c" ).
181
- Count (& totalcount ).
182
+ Count (& totalConnectionsCount ).
182
183
Select ("c.*, " +
183
184
"COUNT(CASE WHEN r.type = 'component' THEN 1 END) AS components, " +
184
185
"COUNT(CASE WHEN r.type = 'model' THEN 1 END) AS models," +
@@ -213,8 +214,14 @@ func (rm *RegistryManager) GetRegistrants(f *models.HostFilter) ([]models.MeshMo
213
214
}
214
215
215
216
var response []models.MeshModelHostsWithEntitySummary
216
-
217
+ nonRegistantCount := int64 ( 0 )
217
218
for _ , r := range result {
219
+
220
+ if r .Models == 0 {
221
+ nonRegistantCount ++
222
+ continue
223
+ }
224
+
218
225
res := models.MeshModelHostsWithEntitySummary {
219
226
Connection : r .Connection ,
220
227
Summary : models.EntitySummary {
@@ -226,7 +233,9 @@ func (rm *RegistryManager) GetRegistrants(f *models.HostFilter) ([]models.MeshMo
226
233
response = append (response , res )
227
234
}
228
235
229
- return response , totalcount , nil
236
+ registrantCount := (totalConnectionsCount - nonRegistantCount )
237
+
238
+ return response , registrantCount , nil
230
239
}
231
240
232
241
func (rm * RegistryManager ) GetEntities (f entity.Filter ) ([]entity.Entity , int64 , int , error ) {
0 commit comments