Skip to content

Commit

Permalink
Show disk usage of current working directory
Browse files Browse the repository at this point in the history
  • Loading branch information
bclswl0827 committed Feb 13, 2024
1 parent 61b34eb commit 07ab91a
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 27 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

Starting from v2.2.5, all notable changes to this project will be documented in this file.

## v2.8.1

- Show disk usage of current working directory

## v2.8.0

- Allow setting rate limitation for API endpoints
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2.8.0
v2.8.1
31 changes: 15 additions & 16 deletions app/v1/station/disk.go
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
package station

import "github.com/shirou/gopsutil/disk"
import (
"os"

"github.com/shirou/gopsutil/disk"
)

func getDisk() diskModel {
partitions, err := disk.Partitions(false)
cwd, err := os.Getwd()
if err != nil {
panic(err)
}

disks := make([]diskModel, 0)
for _, partition := range partitions {
usage, err := disk.Usage(partition.Mountpoint)
if err != nil {
panic(err)
}

disks = append(disks, diskModel{
Total: usage.Total,
Free: usage.Free,
Used: usage.Used,
Percent: usage.UsedPercent,
})
usage, err := disk.Usage(cwd)
if err != nil {
panic(err)
}

return disks[0]
return diskModel{
Total: usage.Total,
Free: usage.Free,
Used: usage.Used,
Percent: usage.UsedPercent,
}
}
4 changes: 2 additions & 2 deletions frontend/dist/asset-manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"files": {
"main.css": "/static/css/main.40ace055.css",
"main.js": "/static/js/main.f3306104.js",
"main.js": "/static/js/main.71322421.js",
"static/css/290.525e2941.chunk.css": "/static/css/290.525e2941.chunk.css",
"static/js/290.4f498365.chunk.js": "/static/js/290.4f498365.chunk.js",
"static/js/735.26a45829.chunk.js": "/static/js/735.26a45829.chunk.js",
Expand Down Expand Up @@ -48,6 +48,6 @@
},
"entrypoints": [
"static/css/main.40ace055.css",
"static/js/main.f3306104.js"
"static/js/main.71322421.js"
]
}
2 changes: 1 addition & 1 deletion frontend/dist/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no"/><link rel="icon" href="/favicon.ico"/><link rel="manifest" href="/manifest.json"/><script defer="defer" src="/static/js/main.f3306104.js"></script><link href="/static/css/main.40ace055.css" rel="stylesheet"></head><body><div id="root"></div></body></html>
<!doctype html><html><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no"/><link rel="icon" href="/favicon.ico"/><link rel="manifest" href="/manifest.json"/><script defer="defer" src="/static/js/main.71322421.js"></script><link href="/static/css/main.40ace055.css" rel="stylesheet"></head><body><div id="root"></div></body></html>

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions frontend/src/.env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
REACT_APP_VERSION=v2.8.0
REACT_APP_RELEASE=6237433a-20240209214911
REACT_APP_VERSION=v2.8.1
REACT_APP_RELEASE=61b34ebe-20240213154524
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ require (
github.com/swaggo/files v1.0.1
github.com/swaggo/swag v1.16.2
github.com/wille/osutil v0.0.0-20230417145339-416c15a22a77
golang.org/x/time v0.5.0
gorm.io/driver/mysql v1.5.2
gorm.io/driver/postgres v1.5.4
gorm.io/driver/sqlserver v1.5.2
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,6 @@ golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
Expand Down

0 comments on commit 07ab91a

Please sign in to comment.