mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-28 06:05:24 +00:00
feat: finish the host-metrics plugin, move host status into core (B16)
This commit is contained in:
1 parent
14eb558b85
commit
0a3f05d99d
308 files changed
+53073
-8985
No files matched your search
@@ -44,7 +44,7 @@ import {
|
||||
ConnectionScreen,
|
||||
} from "@termix/plugin-sdk/ui";
|
||||
import { ConnectionLogPanel } from "@/components/connection/ConnectionLogPanel.tsx";
|
||||
import { useConnectionRetry } from "@termix/plugin-sdk/frontend";
|
||||
import { invokeAction, useConnectionRetry } from "@termix/plugin-sdk/frontend";
|
||||
import { copyToClipboard } from "@/lib/clipboard.ts";
|
||||
import {
|
||||
listSSHFiles,
|
||||
@@ -78,12 +78,11 @@ import {
|
||||
} from "./api/file-manager-data-api";
|
||||
import {
|
||||
logActivity,
|
||||
getServerMetricsById,
|
||||
transferToHost,
|
||||
addTransferRecent,
|
||||
type TransferMethodPreference,
|
||||
type DiskFilesystem,
|
||||
} from "@/main-axios.ts";
|
||||
import type { DiskFilesystem, HostDiskInfo } from "./disk-info";
|
||||
import {
|
||||
getAdaptiveResourceBudget,
|
||||
markAdaptiveResourceUsed,
|
||||
@@ -3262,19 +3261,17 @@ function FileManagerContent({
|
||||
useEffect(() => {
|
||||
if (currentHost?.id) {
|
||||
loadPinnedFiles();
|
||||
getServerMetricsById(currentHost.id)
|
||||
.then((metrics) => {
|
||||
if (
|
||||
metrics?.disk?.percent != null &&
|
||||
metrics.disk.usedHuman &&
|
||||
metrics.disk.totalHuman
|
||||
) {
|
||||
// Undefined while the host-metrics plugin is off: no disk bar then.
|
||||
invokeAction("host-metrics.disk", currentHost.id)
|
||||
.then((result) => {
|
||||
const disk = result as HostDiskInfo | null | undefined;
|
||||
if (disk?.percent != null && disk.usedHuman && disk.totalHuman) {
|
||||
setDiskInfo({
|
||||
usedHuman: metrics.disk.usedHuman,
|
||||
totalHuman: metrics.disk.totalHuman,
|
||||
percent: metrics.disk.percent,
|
||||
mount: metrics.disk.mount ?? null,
|
||||
filesystems: metrics.disk.filesystems ?? [],
|
||||
usedHuman: disk.usedHuman,
|
||||
totalHuman: disk.totalHuman,
|
||||
percent: disk.percent,
|
||||
mount: disk.mount ?? null,
|
||||
filesystems: disk.filesystems ?? [],
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
@@ -27,7 +27,7 @@ import {
|
||||
removeFolderShortcut,
|
||||
} from "./api/file-manager-data-api";
|
||||
import { listSSHFiles } from "./api/ssh-file-operations-api";
|
||||
import { type DiskFilesystem } from "@/main-axios.ts";
|
||||
import type { DiskFilesystem } from "./disk-info";
|
||||
import { toast } from "sonner";
|
||||
import FolderTree from "@/components/folder.tsx";
|
||||
import {
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
/** One mounted filesystem, as the host-metrics plugin reports it. */
|
||||
export interface DiskFilesystem {
|
||||
filesystem: string;
|
||||
type: string;
|
||||
mount: string;
|
||||
percent: number | null;
|
||||
usedHuman: string | null;
|
||||
totalHuman: string | null;
|
||||
availableHuman: string | null;
|
||||
usedBytes: number | null;
|
||||
totalBytes: number | null;
|
||||
availableBytes: number | null;
|
||||
label?: string;
|
||||
}
|
||||
|
||||
export interface HostDiskInfo {
|
||||
percent: number | null;
|
||||
usedHuman: string | null;
|
||||
totalHuman: string | null;
|
||||
mount: string | null;
|
||||
filesystems?: DiskFilesystem[];
|
||||
}
|
||||
Reference in new issue
Block a user