diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2023-01-18 23:52:04 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-18 09:52:04 -0600 |
commit | f59ce777728cf84ccdf711491772104a0fc0dd6e (patch) | |
tree | b77b85f70a9b53decf87db3b7414736fd49b0234 /routers | |
parent | 7ddc11def7e524df194cd67a93cf83cf733b1b79 (diff) | |
download | gitea-f59ce777728cf84ccdf711491772104a0fc0dd6e.tar.gz gitea-f59ce777728cf84ccdf711491772104a0fc0dd6e.zip |
Display unreferenced packages total size in package admin panel (#22498)
Diffstat (limited to 'routers')
-rw-r--r-- | routers/web/admin/packages.go | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/routers/web/admin/packages.go b/routers/web/admin/packages.go index 7c6d1ed840..88fb47ca01 100644 --- a/routers/web/admin/packages.go +++ b/routers/web/admin/packages.go @@ -51,12 +51,18 @@ func Packages(ctx *context.Context) { return } - totalBlobSize, err := packages_model.GetTotalBlobSize() + totalBlobSize, err := packages_model.GetTotalBlobSize(ctx) if err != nil { ctx.ServerError("GetTotalBlobSize", err) return } + totalUnreferencedBlobSize, err := packages_model.GetTotalUnreferencedBlobSize(ctx) + if err != nil { + ctx.ServerError("CalculateBlobSize", err) + return + } + ctx.Data["Title"] = ctx.Tr("packages.title") ctx.Data["PageIsAdmin"] = true ctx.Data["PageIsAdminPackages"] = true @@ -65,8 +71,9 @@ func Packages(ctx *context.Context) { ctx.Data["AvailableTypes"] = packages_model.TypeList ctx.Data["SortType"] = sort ctx.Data["PackageDescriptors"] = pds - ctx.Data["Total"] = total - ctx.Data["TotalBlobSize"] = totalBlobSize + ctx.Data["TotalCount"] = total + ctx.Data["TotalBlobSize"] = totalBlobSize - totalUnreferencedBlobSize + ctx.Data["TotalUnreferencedBlobSize"] = totalUnreferencedBlobSize pager := context.NewPagination(int(total), setting.UI.PackagesPagingNum, page, 5) pager.AddParamString("q", query) |