mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +01:00
🎨 Improve disk usage display https://github.com/siyuan-note/siyuan/issues/11121
This commit is contained in:
parent
ffb44137f2
commit
d9351213da
11 changed files with 21 additions and 21 deletions
|
|
@ -88,7 +88,7 @@ func Icons() (icons []*Icon) {
|
|||
icon.Stars = repo.Stars
|
||||
icon.OpenIssues = repo.OpenIssues
|
||||
icon.Size = repo.Size
|
||||
icon.HSize = humanize.Bytes(uint64(icon.Size))
|
||||
icon.HSize = humanize.BytesCustomCeil(uint64(icon.Size), 2)
|
||||
icon.HUpdated = formatUpdated(icon.Updated)
|
||||
pkg := bazaarIndex[strings.Split(repoURL, "@")[0]]
|
||||
if nil != pkg {
|
||||
|
|
@ -158,7 +158,7 @@ func InstalledIcons() (ret []*Icon) {
|
|||
icon.HInstallDate = info.ModTime().Format("2006-01-02")
|
||||
installSize, _ := util.SizeOfDirectory(installPath)
|
||||
icon.InstallSize = installSize
|
||||
icon.HInstallSize = humanize.Bytes(uint64(installSize))
|
||||
icon.HInstallSize = humanize.BytesCustomCeil(uint64(installSize), 2)
|
||||
readmeFilename := getPreferredReadme(icon.Readme)
|
||||
readme, readErr := os.ReadFile(filepath.Join(installPath, readmeFilename))
|
||||
if nil != readErr {
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ func Plugins(frontend string) (plugins []*Plugin) {
|
|||
plugin.Stars = repo.Stars
|
||||
plugin.OpenIssues = repo.OpenIssues
|
||||
plugin.Size = repo.Size
|
||||
plugin.HSize = humanize.Bytes(uint64(plugin.Size))
|
||||
plugin.HSize = humanize.BytesCustomCeil(uint64(plugin.Size), 2)
|
||||
plugin.HUpdated = formatUpdated(plugin.Updated)
|
||||
pkg := bazaarIndex[strings.Split(repoURL, "@")[0]]
|
||||
if nil != pkg {
|
||||
|
|
@ -196,7 +196,7 @@ func InstalledPlugins(frontend string, checkUpdate bool) (ret []*Plugin) {
|
|||
plugin.HInstallDate = info.ModTime().Format("2006-01-02")
|
||||
installSize, _ := util.SizeOfDirectory(installPath)
|
||||
plugin.InstallSize = installSize
|
||||
plugin.HInstallSize = humanize.Bytes(uint64(installSize))
|
||||
plugin.HInstallSize = humanize.BytesCustomCeil(uint64(installSize), 2)
|
||||
readmeFilename := getPreferredReadme(plugin.Readme)
|
||||
readme, readErr := os.ReadFile(filepath.Join(installPath, readmeFilename))
|
||||
if nil != readErr {
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ func Templates() (templates []*Template) {
|
|||
template.Stars = repo.Stars
|
||||
template.OpenIssues = repo.OpenIssues
|
||||
template.Size = repo.Size
|
||||
template.HSize = humanize.Bytes(uint64(template.Size))
|
||||
template.HSize = humanize.BytesCustomCeil(uint64(template.Size), 2)
|
||||
template.HUpdated = formatUpdated(template.Updated)
|
||||
pkg := bazaarIndex[strings.Split(repoURL, "@")[0]]
|
||||
if nil != pkg {
|
||||
|
|
@ -159,7 +159,7 @@ func InstalledTemplates() (ret []*Template) {
|
|||
template.HInstallDate = info.ModTime().Format("2006-01-02")
|
||||
installSize, _ := util.SizeOfDirectory(installPath)
|
||||
template.InstallSize = installSize
|
||||
template.HInstallSize = humanize.Bytes(uint64(installSize))
|
||||
template.HInstallSize = humanize.BytesCustomCeil(uint64(installSize), 2)
|
||||
readmeFilename := getPreferredReadme(template.Readme)
|
||||
readme, readErr := os.ReadFile(filepath.Join(installPath, readmeFilename))
|
||||
if nil != readErr {
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ func Themes() (ret []*Theme) {
|
|||
theme.Stars = repo.Stars
|
||||
theme.OpenIssues = repo.OpenIssues
|
||||
theme.Size = repo.Size
|
||||
theme.HSize = humanize.Bytes(uint64(theme.Size))
|
||||
theme.HSize = humanize.BytesCustomCeil(uint64(theme.Size), 2)
|
||||
theme.HUpdated = formatUpdated(theme.Updated)
|
||||
pkg := bazaarIndex[strings.Split(repoURL, "@")[0]]
|
||||
if nil != pkg {
|
||||
|
|
@ -160,7 +160,7 @@ func InstalledThemes() (ret []*Theme) {
|
|||
theme.HInstallDate = info.ModTime().Format("2006-01-02")
|
||||
installSize, _ := util.SizeOfDirectory(installPath)
|
||||
theme.InstallSize = installSize
|
||||
theme.HInstallSize = humanize.Bytes(uint64(installSize))
|
||||
theme.HInstallSize = humanize.BytesCustomCeil(uint64(installSize), 2)
|
||||
readmeFilename := getPreferredReadme(theme.Readme)
|
||||
readme, readErr := os.ReadFile(filepath.Join(installPath, readmeFilename))
|
||||
if nil != readErr {
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ func Widgets() (widgets []*Widget) {
|
|||
widget.Stars = repo.Stars
|
||||
widget.OpenIssues = repo.OpenIssues
|
||||
widget.Size = repo.Size
|
||||
widget.HSize = humanize.Bytes(uint64(widget.Size))
|
||||
widget.HSize = humanize.BytesCustomCeil(uint64(widget.Size), 2)
|
||||
widget.HUpdated = formatUpdated(widget.Updated)
|
||||
pkg := bazaarIndex[strings.Split(repoURL, "@")[0]]
|
||||
if nil != pkg {
|
||||
|
|
@ -157,7 +157,7 @@ func InstalledWidgets() (ret []*Widget) {
|
|||
widget.HInstallDate = info.ModTime().Format("2006-01-02")
|
||||
installSize, _ := util.SizeOfDirectory(installPath)
|
||||
widget.InstallSize = installSize
|
||||
widget.HInstallSize = humanize.Bytes(uint64(installSize))
|
||||
widget.HInstallSize = humanize.BytesCustomCeil(uint64(installSize), 2)
|
||||
readmeFilename := getPreferredReadme(widget.Readme)
|
||||
readme, readErr := os.ReadFile(filepath.Join(installPath, readmeFilename))
|
||||
if nil != readErr {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue