refactor: drop two unmaintained dependencies, rename the byte size helpers (#39083)

This commit is contained in:
silverwind
2026-08-27 17:31:20 +02:00
committed by GitHub
parent 3b6ce586a7
commit 66c672d0b7
33 changed files with 197 additions and 180 deletions
+3 -3
View File
@@ -2,8 +2,8 @@
<div class="admin-setting-content">
<h4 class="ui top attached header">
{{ctx.Locale.Tr "admin.packages.package_manage_panel"}} ({{ctx.Locale.Tr "admin.total" .TotalCount}},
{{ctx.Locale.Tr "admin.packages.total_size" (FileSize .TotalBlobSize)}},
{{ctx.Locale.Tr "admin.packages.unreferenced_size" (FileSize .TotalUnreferencedBlobSize)}})
{{ctx.Locale.Tr "admin.packages.total_size" (FormatByteSize .TotalBlobSize)}},
{{ctx.Locale.Tr "admin.packages.unreferenced_size" (FormatByteSize .TotalUnreferencedBlobSize)}})
<div class="ui right">
<form method="post" action="{{AppSubUrl}}/-/admin/packages/cleanup">
<button class="ui primary tiny button">{{ctx.Locale.Tr "admin.packages.cleanup"}}</button>
@@ -69,7 +69,7 @@
<a href="{{.Repository.Link}}">{{.Repository.Name}}</a>
{{end}}
</td>
<td>{{FileSize .CalculateBlobSize}}</td>
<td>{{FormatByteSize .CalculateBlobSize}}</td>
<td>{{DateUtils.AbsoluteShort .Version.CreatedUnix}}</td>
<td>
<a class="tw-text-red show-modal" href data-modal="#admin-package-delete-modal"
+2 -2
View File
@@ -80,8 +80,8 @@
<td>{{.NumStars}}</td>
<td>{{.NumForks}}</td>
<td>{{.NumIssues}}</td>
<td>{{FileSize .GitSize}}</td>
<td>{{FileSize .LFSSize}}</td>
<td>{{FormatByteSize .GitSize}}</td>
<td>{{FormatByteSize .LFSSize}}</td>
<td>{{DateUtils.AbsoluteShort .UpdatedUnix}}</td>
<td>{{DateUtils.AbsoluteShort .CreatedUnix}}</td>
<td>
+1 -1
View File
@@ -43,7 +43,7 @@
{{range .Release.Attachments}}
<li>
<a target="_blank" href="{{.DownloadURL}}">
<strong>{{.Name}} ({{.Size | FileSize}})</strong>
<strong>{{.Name}} ({{.Size | FormatByteSize}})</strong>
</a>
</li>
{{end}}
+1 -1
View File
@@ -55,7 +55,7 @@
</a>
</td>
<td>{{.Platform}}</td>
<td>{{FileSize .Size}}</td>
<td>{{FormatByteSize .Size}}</td>
</tr>
{{end}}
{{end}}
@@ -26,7 +26,7 @@
</td>
<td><a href="{{.VersionWebLink}}">{{.Version.Version}}</a></td>
<td><a href="{{.Creator.HomeLink}}">{{.Creator.Name}}</a></td>
<td>{{FileSize .CalculateBlobSize}}</td>
<td>{{FormatByteSize .CalculateBlobSize}}</td>
<td>{{DateUtils.AbsoluteShort .Version.CreatedUnix}}</td>
</tr>
{{else}}
+2 -2
View File
@@ -73,7 +73,7 @@
{{template "package/metadata/terraform" .}}
{{template "package/metadata/vagrant" .}}
{{if not (and (eq .PackageDescriptor.Package.Type "container") .PackageDescriptor.Metadata.Manifests)}}
<div class="item">{{svg "octicon-database"}} {{FileSize .PackageDescriptor.CalculateBlobSize}}</div>
<div class="item">{{svg "octicon-database"}} {{FormatByteSize .PackageDescriptor.CalculateBlobSize}}</div>
{{end}}
</div>
{{if not (eq .PackageDescriptor.Package.Type "container")}}
@@ -83,7 +83,7 @@
{{range .PackageDescriptor.Files}}
<div class="item">
<a href="{{$packageVersionLink}}/files/{{.File.ID}}">{{.File.Name}}</a>
<span class="tw-text-xs tw-whitespace-nowrap">{{FileSize .Blob.Size}}</span>
<span class="tw-text-xs tw-whitespace-nowrap">{{FormatByteSize .Blob.Size}}</span>
</div>
{{end}}
</div>
+2 -2
View File
@@ -34,7 +34,7 @@
{{ctx.Locale.Tr "repo.diff.file_image_height"}}: <span class="text bounds-info-height"></span>
&nbsp;|&nbsp;
</span>
{{ctx.Locale.Tr "repo.diff.file_byte_size"}}: <span class="text">{{FileSize .file.LeftBlobSize}}</span>
{{ctx.Locale.Tr "repo.diff.file_byte_size"}}: <span class="text">{{FormatByteSize .file.LeftBlobSize}}</span>
</p>
</span>
{{end}}
@@ -49,7 +49,7 @@
{{ctx.Locale.Tr "repo.diff.file_image_height"}}: <span class="text bounds-info-height"></span>
&nbsp;|&nbsp;
</span>
{{ctx.Locale.Tr "repo.diff.file_byte_size"}}: <span class="text">{{FileSize .file.RightBlobSize}}</span>
{{ctx.Locale.Tr "repo.diff.file_byte_size"}}: <span class="text">{{FormatByteSize .file.RightBlobSize}}</span>
</p>
</span>
{{end}}
+1 -1
View File
@@ -11,7 +11,7 @@
{{end}}
{{if ne .FileSize nil}}
<div class="file-info-entry">
<span class="file-info-size">{{FileSize .FileSize}}</span>{{if .IsLFSFile}}<span class="ui label">LFS</span>{{end}}
<span class="file-info-size">{{FormatByteSize .FileSize}}</span>{{if .IsLFSFile}}<span class="ui label">LFS</span>{{end}}
</div>
{{end}}
{{if .LFSLock}}
+1 -1
View File
@@ -65,7 +65,7 @@
</a>
{{end}}
<div class="flex-text-block muted" {{if not (eq .Repository.Size 0)}}data-tooltip-content="{{.Repository.SizeDetailsString}}"{{end}}>
{{$fileSizeFormatted := FileSize .Repository.Size}}{{/* the formatted string is always "{val} {unit}" */}}
{{$fileSizeFormatted := FormatByteSize .Repository.Size}}{{/* the formatted string is always "{val} {unit}" */}}
{{$fileSizeFields := StringUtils.Split $fileSizeFormatted " "}}
{{svg "octicon-database"}} <b>{{ctx.Locale.PrettyNumber (index $fileSizeFields 0)}}</b> {{index $fileSizeFields 1}}
</div>
@@ -19,7 +19,7 @@
</a>
</div>
<div class="flex-text-block tw-p-2">
<span class="ui tw-text-text-light">{{.Size | FileSize}}</span>
<span class="ui tw-text-text-light">{{.Size | FormatByteSize}}</span>
</div>
</div>
{{end -}}
+1 -1
View File
@@ -84,7 +84,7 @@
<strong class="flex-text-inline">{{svg "octicon-package" 16 "download-icon"}}<span class="gt-ellipsis">{{$att.Name}}</span></strong>
</a>
<div class="attachment-right-info flex-text-inline">
<span class="tw-pl-5">{{$att.Size | FileSize}}</span>
<span class="tw-pl-5">{{$att.Size | FormatByteSize}}</span>
<span class="flex-text-inline" data-tooltip-content="{{ctx.Locale.Tr "repo.release.download_count" (ctx.Locale.PrettyNumber $att.DownloadCount)}}">
{{svg "octicon-info"}}
</span>
+1 -1
View File
@@ -82,7 +82,7 @@
<div class="flex-text-block tw-flex-1">
<input name="attachment-edit-{{.UUID}}" class="tw-max-w-[48em]" required value="{{.Name}}">
<input name="attachment-del-{{.UUID}}" type="hidden" value="false">
<span class="tw-text-text-light tw-flex-shrink-0">{{.Size | FileSize}}</span>
<span class="tw-text-text-light tw-flex-shrink-0">{{.Size | FormatByteSize}}</span>
<span data-tooltip-content="{{ctx.Locale.Tr "repo.release.download_count" (ctx.Locale.PrettyNumber .DownloadCount)}}">
{{svg "octicon-info"}}
</span>
+1 -1
View File
@@ -16,7 +16,7 @@
{{ShortSha .Oid}}
</a>
</td>
<td>{{FileSize .Size}}</td>
<td>{{FormatByteSize .Size}}</td>
<td>{{DateUtils.TimeSince .CreatedUnix}}</td>
<td class="tw-text-right">
<a class="ui primary button" href="{{$.Link}}/find?oid={{.Oid}}&size={{.Size}}">{{ctx.Locale.Tr "repo.settings.lfs_findcommits"}}</a>
+1 -1
View File
@@ -13,7 +13,7 @@
</div>
<div class="inline field">
<label>{{ctx.Locale.Tr "repo.repo_size"}}</label>
<span {{if not (eq .Repository.Size 0)}} data-tooltip-content="{{.Repository.SizeDetailsString}}"{{end}}>{{FileSize .Repository.Size}}</span>
<span {{if not (eq .Repository.Size 0)}} data-tooltip-content="{{.Repository.SizeDetailsString}}"{{end}}>{{FormatByteSize .Repository.Size}}</span>
</div>
<div class="inline field">
<label>{{ctx.Locale.Tr "repo.template"}}</label>
+2 -2
View File
@@ -24,7 +24,7 @@
<span class="icon">{{svg "octicon-repo"}}</span>
{{end}}
<a class="muted name" href="{{$repo.Link}}">{{$repo.OwnerName}}/{{$repo.Name}}</a>
<span class="tw-text-text-light-3" {{if not (eq $repo.Size 0)}} data-tooltip-content="{{$repo.SizeDetailsString}}"{{end}}>{{FileSize $repo.Size}}</span>
<span class="tw-text-text-light-3" {{if not (eq $repo.Size 0)}} data-tooltip-content="{{$repo.SizeDetailsString}}"{{end}}>{{FormatByteSize $repo.Size}}</span>
{{if $repo.IsFork}}
{{ctx.Locale.Tr "repo.forked_from"}}
<span><a href="{{$repo.BaseRepo.Link}}">{{$repo.BaseRepo.OwnerName}}/{{$repo.BaseRepo.Name}}</a></span>
@@ -95,7 +95,7 @@
{{svg "octicon-repo"}}
{{end}}
<a class="name" href="{{.Link}}">{{.OwnerName}}/{{.Name}}</a>
<span>{{FileSize .Size}}</span>
<span>{{FormatByteSize .Size}}</span>
{{if .IsFork}}
{{ctx.Locale.Tr "repo.forked_from"}}
<span><a href="{{.BaseRepo.Link}}">{{.BaseRepo.OwnerName}}/{{.BaseRepo.Name}}</a></span>