diff --git a/src-tauri/capabilities/main.json b/src-tauri/capabilities/main.json index 9974310b..ab06fc10 100644 --- a/src-tauri/capabilities/main.json +++ b/src-tauri/capabilities/main.json @@ -9,6 +9,11 @@ "store:allow-get", "store:allow-set", "store:allow-save", + "store:default", + "store:allow-create-store", + "store:allow-clear", + "store:allow-delete", + "store:allow-entries", "os:default", "os:allow-arch", "os:allow-hostname", diff --git a/src-tauri/gen/schemas/capabilities.json b/src-tauri/gen/schemas/capabilities.json index 6d9af2fb..2791b955 100644 --- a/src-tauri/gen/schemas/capabilities.json +++ b/src-tauri/gen/schemas/capabilities.json @@ -1 +1 @@ -{"main":{"identifier":"main","description":"permissions for pachtop","local":true,"windows":["main"],"permissions":["store:allow-get","store:allow-set","store:allow-save","os:default","os:allow-arch","os:allow-hostname","os:allow-exe-extension","os:allow-family","os:allow-os-type","os:allow-platform","os:allow-version","core:window:allow-start-dragging","autostart:allow-enable","autostart:allow-disable","autostart:allow-is-enabled","updater:allow-check","updater:default","log:allow-log","log:default","shell:allow-spawn","core:menu:allow-new","core:menu:allow-popup","core:window:allow-close","core:window:allow-center","core:window:allow-minimize","core:window:allow-maximize","core:window:allow-set-size","core:window:allow-set-focus","core:window:allow-is-maximized","core:window:allow-start-dragging","core:window:allow-toggle-maximize","decorum:allow-show-snap-overlay",{"identifier":"shell:allow-execute","allow":[{"args":true,"cmd":"powershell","name":"powershell"}]},"fs:read-all","fs:read-files","fs:read-meta"]},"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","local":true,"windows":["main"],"permissions":["core:path:default","core:event:default","core:window:default","core:app:default","core:resources:default","core:menu:default","core:tray:default"]}} \ No newline at end of file +{"main":{"identifier":"main","description":"permissions for pachtop","local":true,"windows":["main"],"permissions":["store:allow-get","store:allow-set","store:allow-save","store:default","store:allow-create-store","store:allow-clear","store:allow-delete","store:allow-entries","os:default","os:allow-arch","os:allow-hostname","os:allow-exe-extension","os:allow-family","os:allow-os-type","os:allow-platform","os:allow-version","core:window:allow-start-dragging","autostart:allow-enable","autostart:allow-disable","autostart:allow-is-enabled","updater:allow-check","updater:default","log:allow-log","log:default","shell:allow-spawn","core:menu:allow-new","core:menu:allow-popup","core:window:allow-close","core:window:allow-center","core:window:allow-minimize","core:window:allow-maximize","core:window:allow-set-size","core:window:allow-set-focus","core:window:allow-is-maximized","core:window:allow-start-dragging","core:window:allow-toggle-maximize","decorum:allow-show-snap-overlay",{"identifier":"shell:allow-execute","allow":[{"args":true,"cmd":"powershell","name":"powershell"}]},"fs:read-all","fs:read-files","fs:read-meta"]},"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","local":true,"windows":["main"],"permissions":["core:path:default","core:event:default","core:window:default","core:app:default","core:resources:default","core:menu:default","core:tray:default"]}} \ No newline at end of file diff --git a/src/components/area-chart.tsx b/src/components/area-chart.tsx index 3f256fd3..6eecaf0e 100644 --- a/src/components/area-chart.tsx +++ b/src/components/area-chart.tsx @@ -1,11 +1,11 @@ -import HighchartsReact from "highcharts-react-official"; -import * as Highcharts from "highcharts/highstock"; -import HighchartsBoost from "highcharts/modules/boost"; -import { Dispatch, SetStateAction, useEffect, useRef, useState } from "react"; +import HighchartsReact from 'highcharts-react-official'; +import * as Highcharts from 'highcharts/highstock'; +import HighchartsBoost from 'highcharts/modules/boost'; +import { Dispatch, SetStateAction, useEffect, useRef, useState } from 'react'; -import useSettings from "@/hooks/useSettings"; -import { useMantineTheme } from "@mantine/core"; -import { useViewportSize } from "@mantine/hooks"; +import useSettings from '@/hooks/useSettings'; +import { useMantineTheme } from '@mantine/core'; +import { useViewportSize } from '@mantine/hooks'; HighchartsBoost(Highcharts); @@ -101,7 +101,7 @@ export const useAreaChartState = ( title: { text: null, }, - + startOnTick: true, endOnTick: true, gridLineColor: other.charts.area.default.gridLineColor, @@ -191,6 +191,9 @@ export const useAreaChartState = ( alignTicks: false, backgroundColor: "transparent", animation: settings.isPerformanceModeEnabled ? false : true, + zooming: { + mouseWheel: true, + }, }, }); diff --git a/src/features/metrics/pages/dashboard.page.tsx b/src/features/metrics/pages/dashboard.page.tsx index f2029413..2f93e0e4 100644 --- a/src/features/metrics/pages/dashboard.page.tsx +++ b/src/features/metrics/pages/dashboard.page.tsx @@ -1,45 +1,48 @@ -import { useShallow } from "zustand/react/shallow"; +import { useShallow } from 'zustand/react/shallow'; -import PageWrapper from "@/components/page-wrapper"; -import SystemInformationWidget from "@/components/system-information-widget"; -import CpusBarChart from "@/features/metrics/components/cpus/cpus.bar-charts"; -import DiskAreaChart from "@/features/metrics/components/disks/disk.area-chart"; -import DiskStatsRing from "@/features/metrics/components/disks/disk.stats-ring"; -import GlobalCpuAreaChart from "@/features/metrics/components/global-cpu/global-cpu.area-chart"; -import GlobalCpuStatsRing from "@/features/metrics/components/global-cpu/global-cpu.stats-ring"; -import MemoryAreaChart from "@/features/metrics/components/memory/memory.area-chart"; -import MemoryStatsRing from "@/features/metrics/components/memory/memory.stats-ring"; -import NetworksReceivedAreaChart from "@/features/metrics/components/networks/networks-received.area-chart"; -import NetworksTransmittedAreaChart from "@/features/metrics/components/networks/networks-transmitted.area-chart"; -import SwapAreaChart from "@/features/metrics/components/swap/swap.area-chart"; -import SwapStatsRing from "@/features/metrics/components/swap/swap.stats-ring"; -import useDisksSelectors from "@/features/metrics/stores/disk.store"; -import useSystemStoreSelectors from "@/features/metrics/stores/system.store"; -import useRandomGreeting from "@/hooks/useRandomGreeting"; -import { Grid } from "@mantine/core"; +import PageWrapper from '@/components/page-wrapper'; +import SystemInformationWidget from '@/components/system-information-widget'; +import CpusBarChart from '@/features/metrics/components/cpus/cpus.bar-charts'; +import DiskAreaChart from '@/features/metrics/components/disks/disk.area-chart'; +import DiskStatsRing from '@/features/metrics/components/disks/disk.stats-ring'; +import GlobalCpuAreaChart from '@/features/metrics/components/global-cpu/global-cpu.area-chart'; +import GlobalCpuStatsRing from '@/features/metrics/components/global-cpu/global-cpu.stats-ring'; +import MemoryAreaChart from '@/features/metrics/components/memory/memory.area-chart'; +import MemoryStatsRing from '@/features/metrics/components/memory/memory.stats-ring'; +import NetworksReceivedAreaChart from '@/features/metrics/components/networks/networks-received.area-chart'; +import NetworksTransmittedAreaChart from '@/features/metrics/components/networks/networks-transmitted.area-chart'; +import SwapAreaChart from '@/features/metrics/components/swap/swap.area-chart'; +import SwapStatsRing from '@/features/metrics/components/swap/swap.stats-ring'; +import useDisksSelectors from '@/features/metrics/stores/disk.store'; +import useSystemStoreSelectors from '@/features/metrics/stores/system.store'; +import useRandomGreeting from '@/hooks/useRandomGreeting'; +import { Divider, Grid, Text } from '@mantine/core'; -const StatsRings = () => { - return ( - <> - - - - - - - - - - - - - - ); -}; +// const StatsRings = () => { +// return ( +// <> +// +// +// +// +// +// +// +// +// +// +// +// +// +// ); +// }; const MemorySection = () => { return ( <> + + + @@ -54,8 +57,7 @@ const CpuSection = () => { - {/* */} - + ); @@ -88,6 +90,28 @@ const DiskSection = () => { ); }; +interface DashboardSectionsDividerProps { + label: string; +} +const DashboardSectionsDivider = ({ label }: DashboardSectionsDividerProps) => { + return ( + <> + + + + {label} + + + } + /> + + + ); +}; + const DashboardPage = () => { const hostname = useSystemStoreSelectors(useShallow((state) => state.info.hostname)); const greeting = useRandomGreeting(hostname); @@ -97,10 +121,12 @@ const DashboardPage = () => { - {/* */} + + + diff --git a/src/lib/store.ts b/src/lib/store.ts index efa84c66..1efe88e8 100644 --- a/src/lib/store.ts +++ b/src/lib/store.ts @@ -1,8 +1,9 @@ -import { Store } from "tauri-plugin-store"; +import { Store } from 'tauri-plugin-store'; -import logger from "@/lib/logger"; -import { appDataDir } from "@tauri-apps/api/path"; -import { platform } from "@tauri-apps/plugin-os"; +import logger from '@/lib/logger'; +import { appDataDir } from '@tauri-apps/api/path'; + +const { platform } = window.__TAURI__.os; // Generic function to create get/set operations const createStoreItem = (store: Store, key: string, defaultValue: T) => ({