Skip to content

Commit 241fe0c

Browse files
committed
fix: revision history, click opens new tab, card backgrounds
1 parent 2b19c9b commit 241fe0c

File tree

12 files changed

+23
-28
lines changed

12 files changed

+23
-28
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ host:
4848
port: 22
4949
username: user
5050
password: password
51+
storage:
52+
- /path/to/storage/to/monitor
5153

5254
commands:
5355
- name: "view app logs"

api/backend/configs/schema.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from typing import Optional
21
from pydantic import BaseModel
32

43

@@ -8,17 +7,18 @@ class Host(BaseModel):
87
port: int
98
username: str
109
password: str
10+
storage: list[str] | None = None
1111

1212

1313
class Arg(BaseModel):
1414
flag: str
15-
value: Optional[str] = None
15+
value: str | None = None
1616

1717

1818
class Command(BaseModel):
1919
name: str
2020
command: str
21-
args: Optional[list[Arg]] = None
21+
args: list[Arg] | None = None
2222

2323

2424
class Schema(BaseModel):

api/backend/routers/config.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ async def get_background():
3535

3636

3737
@config_router.post("/api/config/background")
38-
async def upload_background(file: UploadFile = File(...)):
38+
async def upload_background(
39+
file: UploadFile = File(...),
40+
):
3941
try:
4042
LOG.info(f"Form: {file}")
4143
config_utils.upload_background(file)

api/backend/routers/host.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
# LOCAL
1010
from api.backend.host_manager import HOST_MAP
11-
from api.backend.database.database_functions import delete_job
12-
1311
from api.backend.command_queue import COMMAND_QUEUE
1412

1513
LOG = logging.getLogger(__name__)
@@ -43,6 +41,7 @@ async def delete_single_job(id: str):
4341
@host_router.get("/api/{host_name}/stats")
4442
async def get_stats(host_name: str):
4543
host = HOST_MAP[host_name]
44+
4645
try:
4746
storage = "".join(host.runner.dispatch("storage")[0])
4847
usage = "".join(host.runner.dispatch("cpu_usage")[0])
@@ -54,6 +53,7 @@ async def get_stats(host_name: str):
5453
return JSONResponse(
5554
{
5655
"storage": storage,
56+
"storage_paths": host.storage,
5757
"usage": usage,
5858
"cores": cores,
5959
"threads": threads,
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
from api.backend.systems.command import Command
22
from api.backend.systems.arg import Arg
3+
from typing import Literal
34

45

56
class StorageMetric(Command):
67
def __init__(self) -> None:
7-
self.name = "storage"
8-
self.command = "df"
9-
self.args = [Arg(flag="-h", value=None)]
8+
self.name: str = "storage"
9+
self.command: str = "df"
10+
self.args: list[Arg] | None = [Arg(flag="-h", value=None)]
1011
super().__init__(self.name, self.command, self.args)
11-
self.type = "system"
12+
self.type: Literal["system", "docker", "user"] = "system"

api/backend/systems/host.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ def __init__(self, config_file: str) -> None:
1212
self.hostname: str = config.host.hostname
1313
self.runner: MachineRunner = MachineRunner()
1414
self.runner.read_config(config_file)
15+
self.storage: list[str] | None = config.host.storage
1516

1617
def refresh(self):
1718
LOG.info(f"Refreshing host {self.name}")

charts/dashboard/templates/dashboard-deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ metadata:
44
name: {{ .Values.app.metadata.name }}
55
spec:
66
replicas: {{ .Values.app.replicas }}
7+
revisionHistoryLimit: 1
78
selector:
89
matchLabels:
910
app: {{ .Values.app.metadata.name }}
@@ -17,7 +18,6 @@ spec:
1718
image: {{ .Values.app.frontendImage }}:{{ .Values.app.APP_VERSION }}
1819
command: ["bash", "/start.sh"]
1920
imagePullPolicy: Always
20-
revisionHistoryLimit: 1
2121
volumeMounts:
2222
- mountPath: /project/configs
2323
subPath: {{ .Values.app.metadata.name }}/configs

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ reportAny = false
4040
reportUnknownVariableType = false
4141
reportUnknownMemberType = false
4242
reportExplicitAny = false
43+
reportCallInDefaultInitializer = false
4344

4445
pythonVersion = "3.10"
4546
pythonPlatform = "Linux"

src/components/dashboard/widgets/external-integrations/sonarr-integration/sonarr-integration.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from "react";
2-
import Integration from "../../../../shared/integration/integration";
3-
import { SonarrData } from "../../../../../lib/services/external-integrations/sonarr/sonarr.types";
2+
import Integration from "@/components/shared/integration/integration";
3+
import { SonarrData } from "@/lib/services/external-integrations/sonarr/sonarr.types";
44

55
type SonarrIntegrationProps = {
66
data: SonarrData;

src/components/shared/integration/integration.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import React from "react";
22
import { Paper, Typography } from "@mui/material";
33
import classes from "./integration.module.css";
44
import Image from "next/image";
5-
import { useRouter } from "next/navigation";
65
import { clsx } from "clsx";
76

87
type IntegrationProps = {
@@ -20,11 +19,9 @@ const Integration = ({
2019
link,
2120
children,
2221
}: IntegrationProps) => {
23-
const router = useRouter();
24-
2522
const handleNavigate = () => {
2623
if (link) {
27-
router.push(link);
24+
window.open(link, "_blank");
2825
}
2926
};
3027

src/pages/api/[host_name]/stats.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,10 @@ export default async function handler(
1313
) {
1414
try {
1515
const { host_name } = req.query;
16-
const data = { paths: ["/home", "/", "/mnt/nas"] };
17-
18-
if (!data?.paths || data.paths.length === 0) {
19-
return res
20-
.status(400)
21-
.json({ message: "No paths provided in the request body" });
22-
}
23-
24-
const paths = data.paths;
2516

2617
const response = await api.get<ResponseData>(`/${host_name}/stats`);
2718
const json = await response.data;
28-
19+
const paths = json.storage_paths || [];
2920
const uptimeRegex = new RegExp(`(\\d+\\s+days,\\s+(?:\\d+:\\d+|\\d+))`);
3021

3122
if (json.uptime) {

src/styles/globals.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
--kuma-status-down: rgba(254, 2, 2, 0.497);
1717
--kuma-status-up-circle: rgba(14, 46, 6, 0.497);
1818
--kuma-status-up-down: rgba(46, 6, 6, 0.497);
19-
--paper-opaque-bg: rgba(33, 29, 29, 0.75);
19+
--paper-opaque-bg: rgba(8, 8, 8, 0.75);
2020
--paper-opaque-dark: rgba(0, 0, 0, 0.5);
2121
--paper-hover-color: rgba(61, 61, 61);
2222
--failed: rgba(254, 2, 2, 0.25);

0 commit comments

Comments
 (0)