mirror of
https://github.com/fankes/beszel.git
synced 2025-10-19 09:49:28 +08:00
update makefile and other tiny refactoring
- remove goccy/json dep - add explicit types in gpu.go
This commit is contained in:
@@ -56,7 +56,7 @@ dev-hub: export ENV=dev
|
|||||||
dev-hub:
|
dev-hub:
|
||||||
mkdir -p ./site/dist && touch ./site/dist/index.html
|
mkdir -p ./site/dist && touch ./site/dist/index.html
|
||||||
@if command -v entr >/dev/null 2>&1; then \
|
@if command -v entr >/dev/null 2>&1; then \
|
||||||
find ./cmd/hub/*.go ./internal/{alerts,hub,records,users}/*.go | entr -r -s "cd ./cmd/hub && go run . serve --http 0.0.0.0:8090"; \
|
find ./cmd/hub ./internal/{alerts,hub,records,users} -name "*.go" | entr -r -s "cd ./cmd/hub && go run . serve"; \
|
||||||
else \
|
else \
|
||||||
cd ./cmd/hub && go run . serve --http 0.0.0.0:8090; \
|
cd ./cmd/hub && go run . serve --http 0.0.0.0:8090; \
|
||||||
fi
|
fi
|
||||||
|
@@ -1,3 +1,6 @@
|
|||||||
|
//go:build testing
|
||||||
|
// +build testing
|
||||||
|
|
||||||
package agent
|
package agent
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@@ -18,24 +18,24 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
// Commands
|
// Commands
|
||||||
nvidiaSmiCmd = "nvidia-smi"
|
nvidiaSmiCmd string = "nvidia-smi"
|
||||||
rocmSmiCmd = "rocm-smi"
|
rocmSmiCmd string = "rocm-smi"
|
||||||
tegraStatsCmd = "tegrastats"
|
tegraStatsCmd string = "tegrastats"
|
||||||
|
|
||||||
// Polling intervals
|
// Polling intervals
|
||||||
nvidiaSmiInterval = "4" // in seconds
|
nvidiaSmiInterval string = "4" // in seconds
|
||||||
tegraStatsInterval = "3700" // in milliseconds
|
tegraStatsInterval string = "3700" // in milliseconds
|
||||||
rocmSmiInterval = 4300 * time.Millisecond
|
rocmSmiInterval time.Duration = 4300 * time.Millisecond
|
||||||
|
|
||||||
// Command retry and timeout constants
|
// Command retry and timeout constants
|
||||||
retryWaitTime = 5 * time.Second
|
retryWaitTime time.Duration = 5 * time.Second
|
||||||
maxFailureRetries = 5
|
maxFailureRetries int = 5
|
||||||
|
|
||||||
cmdBufferSize = 10 * 1024
|
cmdBufferSize uint16 = 10 * 1024
|
||||||
|
|
||||||
// Unit Conversions
|
// Unit Conversions
|
||||||
mebibytesInAMegabyte = 1.024 // nvidia-smi reports memory in MiB
|
mebibytesInAMegabyte float64 = 1.024 // nvidia-smi reports memory in MiB
|
||||||
milliwattsInAWatt = 1000.0 // tegrastats reports power in mW
|
milliwattsInAWatt float64 = 1000.0 // tegrastats reports power in mW
|
||||||
)
|
)
|
||||||
|
|
||||||
// GPUManager manages data collection for GPUs (either Nvidia or AMD)
|
// GPUManager manages data collection for GPUs (either Nvidia or AMD)
|
||||||
|
@@ -2,11 +2,11 @@ package alerts
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"beszel/internal/entities/system"
|
"beszel/internal/entities/system"
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/goccy/go-json"
|
|
||||||
"github.com/pocketbase/dbx"
|
"github.com/pocketbase/dbx"
|
||||||
"github.com/pocketbase/pocketbase/core"
|
"github.com/pocketbase/pocketbase/core"
|
||||||
"github.com/pocketbase/pocketbase/tools/types"
|
"github.com/pocketbase/pocketbase/tools/types"
|
||||||
|
@@ -11,7 +11,7 @@ const routes = {
|
|||||||
* The base path of the application.
|
* The base path of the application.
|
||||||
* This is used to prepend the base path to all routes.
|
* This is used to prepend the base path to all routes.
|
||||||
*/
|
*/
|
||||||
export const basePath = globalThis.BESZEL.BASE_PATH || ""
|
export const basePath = BESZEL?.BASE_PATH || ""
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepends the base path to the given path.
|
* Prepends the base path to the given path.
|
||||||
@@ -41,5 +41,12 @@ function onClick(e: React.MouseEvent<HTMLAnchorElement, MouseEvent>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const Link = (props: React.AnchorHTMLAttributes<HTMLAnchorElement>) => {
|
export const Link = (props: React.AnchorHTMLAttributes<HTMLAnchorElement>) => {
|
||||||
return <a onClick={onClick} {...props}></a>
|
let clickFn = onClick
|
||||||
|
if (props.onClick) {
|
||||||
|
clickFn = (e) => {
|
||||||
|
onClick(e)
|
||||||
|
props.onClick?.(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return <a {...props} onClick={clickFn}></a>
|
||||||
}
|
}
|
||||||
|
@@ -293,7 +293,7 @@ export default function SystemsTable() {
|
|||||||
"bg-yellow-500"
|
"bg-yellow-500"
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<span>{info.getValue() as string}</span>
|
<span className="truncate max-w-14">{info.getValue() as string}</span>
|
||||||
</span>
|
</span>
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user