diff --git a/beszel.go b/beszel.go index d8f15ef9..3b7ff2ee 100644 --- a/beszel.go +++ b/beszel.go @@ -6,7 +6,7 @@ import "github.com/blang/semver" const ( // Version is the current version of the application. - Version = "0.15.2" + Version = "0.15.3-beta.1" // AppName is the name of the application. AppName = "beszel" ) diff --git a/internal/site/src/components/charts/area-chart.tsx b/internal/site/src/components/charts/area-chart.tsx index ef4ffdd9..94f34003 100644 --- a/internal/site/src/components/charts/area-chart.tsx +++ b/internal/site/src/components/charts/area-chart.tsx @@ -109,7 +109,7 @@ export default function AreaChartDefault({ /> ) })} - {legend && } />} + {legend && } />} diff --git a/internal/site/src/components/routes/system/cpu-sheet.tsx b/internal/site/src/components/routes/system/cpu-sheet.tsx index 6715bbcf..936d96b7 100644 --- a/internal/site/src/components/routes/system/cpu-sheet.tsx +++ b/internal/site/src/components/routes/system/cpu-sheet.tsx @@ -1,6 +1,6 @@ import { t } from "@lingui/core/macro" import { MoreHorizontalIcon } from "lucide-react" -import { memo, useMemo, useRef, useState } from "react" +import { memo, useRef, useState } from "react" import AreaChartDefault, { DataPoint } from "@/components/charts/area-chart" import ChartTimeSelect from "@/components/charts/chart-time-select" import { Button } from "@/components/ui/button" @@ -26,7 +26,7 @@ export default memo(function CpuCoresSheet({ const [cpuCoresOpen, setCpuCoresOpen] = useState(false) const hasOpened = useRef(false) - const supportsBreakdown = useMemo(() => compareSemVer(chartData.agentVersion, minAgentVersion) >= 0, [chartData.agentVersion]) + const supportsBreakdown = compareSemVer(chartData.agentVersion, minAgentVersion) >= 0 if (!supportsBreakdown) { return null @@ -44,48 +44,48 @@ export default memo(function CpuCoresSheet({ const breakdownDataPoints = [ { - label: t`Other`, - dataKey: ({ stats }: SystemStatsRecord) => { - const total = stats?.cpub?.reduce((acc, curr) => acc + curr, 0) ?? 0 - return total > 0 ? 100 - total : null - }, - color: `hsl(80, 65%, 52%)`, - opacity: 0.4, - stackId: "a" - }, - { - label: "Steal", - dataKey: ({ stats }: SystemStatsRecord) => stats?.cpub?.[3], - color: 5, - opacity: 0.4, - stackId: "a" - }, - { - label: "Idle", - dataKey: ({ stats }: SystemStatsRecord) => stats?.cpub?.[4], - color: 2, - opacity: 0.4, - stackId: "a" - }, - { - label: "IOWait", - dataKey: ({ stats }: SystemStatsRecord) => stats?.cpub?.[2], - color: 4, - opacity: 0.4, + label: "System", + dataKey: ({ stats }: SystemStatsRecord) => stats?.cpub?.[1], + color: 3, + opacity: 0.35, stackId: "a" }, { label: "User", dataKey: ({ stats }: SystemStatsRecord) => stats?.cpub?.[0], color: 1, - opacity: 0.4, + opacity: 0.35, stackId: "a" }, { - label: "System", - dataKey: ({ stats }: SystemStatsRecord) => stats?.cpub?.[1], - color: 3, - opacity: 0.4, + label: "IOWait", + dataKey: ({ stats }: SystemStatsRecord) => stats?.cpub?.[2], + color: 4, + opacity: 0.35, + stackId: "a" + }, + { + label: "Steal", + dataKey: ({ stats }: SystemStatsRecord) => stats?.cpub?.[3], + color: 5, + opacity: 0.35, + stackId: "a" + }, + { + label: "Idle", + dataKey: ({ stats }: SystemStatsRecord) => stats?.cpub?.[4], + color: 2, + opacity: 0.35, + stackId: "a" + }, + { + label: t`Other`, + dataKey: ({ stats }: SystemStatsRecord) => { + const total = stats?.cpub?.reduce((acc, curr) => acc + curr, 0) ?? 0 + return total > 0 ? 100 - total : null + }, + color: `hsl(80, 65%, 52%)`, + opacity: 0.35, stackId: "a" }, ] as DataPoint[] @@ -118,13 +118,13 @@ export default memo(function CpuCoresSheet({ className="min-h-auto" > `${toFixedFloat(val, 2)}%`} contentFormatter={({ value }) => `${decimalString(value)}%`} + reverseStackOrder={true} itemSorter={() => 1} domain={[0, 100]} /> diff --git a/internal/site/src/components/ui/chart.tsx b/internal/site/src/components/ui/chart.tsx index 8068ef65..614d6d12 100644 --- a/internal/site/src/components/ui/chart.tsx +++ b/internal/site/src/components/ui/chart.tsx @@ -257,14 +257,17 @@ const ChartLegendContent = React.forwardRef< Pick & { hideIcon?: boolean nameKey?: string + reverse?: boolean } ->(({ className, payload, verticalAlign = "bottom" }, ref) => { +>(({ className, payload, verticalAlign = "bottom", reverse = false }, ref) => { // const { config } = useChart() if (!payload?.length) { return null } + const reversedPayload = reverse ? [...payload].reverse() : payload + return (
- {payload.map((item) => { + {reversedPayload.map((item) => { // const key = `${nameKey || item.dataKey || 'value'}` // const itemConfig = getPayloadConfigFromPayload(config, item, key) diff --git a/internal/site/src/lib/i18n.ts b/internal/site/src/lib/i18n.ts index c8fcb12b..bda1a206 100644 --- a/internal/site/src/lib/i18n.ts +++ b/internal/site/src/lib/i18n.ts @@ -7,13 +7,15 @@ import { messages as enMessages } from "@/locales/en/en" import { BatteryState } from "./enums" import { $direction } from "./stores" +const rtlLanguages = new Set(["ar", "fa", "he"]) + // activates locale function activateLocale(locale: string, messages: Messages = enMessages) { i18n.load(locale, messages) i18n.activate(locale) document.documentElement.lang = locale localStorage.setItem("lang", locale) - $direction.set(locale.startsWith("ar") || locale.startsWith("fa") ? "rtl" : "ltr") + $direction.set(rtlLanguages.has(locale) ? "rtl" : "ltr") } // dynamically loads translations for the given locale diff --git a/internal/site/src/lib/languages.ts b/internal/site/src/lib/languages.ts index 28bf0026..27c92a01 100644 --- a/internal/site/src/lib/languages.ts +++ b/internal/site/src/lib/languages.ts @@ -44,6 +44,11 @@ export default [ label: "Français", e: "🇫🇷", }, + { + lang: "he", + label: "עברית", + e: "🕎", + }, { lang: "hr", label: "Hrvatski",