mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-10-24 12:32:55 +08:00
fix: need more args in CustomizedTotalCount (#15718)
Co-authored-by: Qiu Jian <qiujian@yunionyun.com>
This commit is contained in:
@@ -652,7 +652,7 @@ func ListItems(manager IModelManager, ctx context.Context, userCred mcclient.Tok
|
||||
if pagingConf == nil {
|
||||
// calculate total
|
||||
totalQ := q.CountQuery()
|
||||
totalCnt, totalJson, err = manager.CustomizedTotalCount(totalQ)
|
||||
totalCnt, totalJson, err = manager.CustomizedTotalCount(ctx, userCred, query, totalQ)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "CustomizedTotalCount")
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ type IModelManager interface {
|
||||
|
||||
CreateByInsertOrUpdate() bool
|
||||
|
||||
CustomizedTotalCount(totalQ *sqlchemy.SQuery) (int, jsonutils.JSONObject, error)
|
||||
CustomizedTotalCount(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, totalQ *sqlchemy.SQuery) (int, jsonutils.JSONObject, error)
|
||||
}
|
||||
|
||||
type IModel interface {
|
||||
|
||||
@@ -539,7 +539,7 @@ func (manager *SModelBaseManager) PerformPurgeSplitable(ctx context.Context, use
|
||||
return jsonutils.Marshal(map[string][]string{"tables": ret}), nil
|
||||
}
|
||||
|
||||
func (manager *SModelBaseManager) CustomizedTotalCount(totalQ *sqlchemy.SQuery) (int, jsonutils.JSONObject, error) {
|
||||
func (manager *SModelBaseManager) CustomizedTotalCount(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, totalQ *sqlchemy.SQuery) (int, jsonutils.JSONObject, error) {
|
||||
ret := apis.TotalCountBase{}
|
||||
err := totalQ.First(&ret)
|
||||
if err != nil {
|
||||
|
||||
@@ -6361,7 +6361,7 @@ type SGuestTotalCount struct {
|
||||
DiskCount int
|
||||
}
|
||||
|
||||
func (manager *SGuestManager) CustomizedTotalCount(totalQ *sqlchemy.SQuery) (int, jsonutils.JSONObject, error) {
|
||||
func (manager *SGuestManager) CustomizedTotalCount(ctx context.Context, userCred mcclient.TokenCredential, query jsonutils.JSONObject, totalQ *sqlchemy.SQuery) (int, jsonutils.JSONObject, error) {
|
||||
results := SGuestTotalCount{}
|
||||
|
||||
totalQ = totalQ.AppendField(sqlchemy.SUM("cpu_count", totalQ.Field("vcpu_count")))
|
||||
|
||||
Reference in New Issue
Block a user