Update AppImage

This commit is contained in:
MacRimi
2025-11-13 17:56:42 +01:00
parent c1d1121ed1
commit 8064e107f4
3 changed files with 15 additions and 105 deletions

View File

@@ -14,7 +14,7 @@ import { Settings } from "./settings"
import { OnboardingCarousel } from "./onboarding-carousel" import { OnboardingCarousel } from "./onboarding-carousel"
import { HealthStatusModal } from "./health-status-modal" import { HealthStatusModal } from "./health-status-modal"
import { ReleaseNotesModal, useVersionCheck } from "./release-notes-modal" import { ReleaseNotesModal, useVersionCheck } from "./release-notes-modal"
import { getApiUrl } from "../lib/api-config" import { getApiUrl, fetchApi } from "../lib/api-config"
import { import {
RefreshCw, RefreshCw,
AlertTriangle, AlertTriangle,
@@ -80,22 +80,8 @@ export function ProxmoxDashboard() {
const { showReleaseNotes, setShowReleaseNotes } = useVersionCheck() const { showReleaseNotes, setShowReleaseNotes } = useVersionCheck()
const fetchSystemData = useCallback(async () => { const fetchSystemData = useCallback(async () => {
const apiUrl = getApiUrl("/api/system-info")
try { try {
const response = await fetch(apiUrl, { const data: FlaskSystemInfo = await fetchApi("/api/system-info")
method: "GET",
headers: {
"Content-Type": "application/json",
},
cache: "no-store",
})
if (!response.ok) {
throw new Error(`Server responded with status: ${response.status}`)
}
const data: FlaskSystemInfo = await response.json()
const uptimeValue = const uptimeValue =
data.uptime && typeof data.uptime === "string" && data.uptime.trim() !== "" ? data.uptime : "N/A" data.uptime && typeof data.uptime === "string" && data.uptime.trim() !== "" ? data.uptime : "N/A"

View File

@@ -6,7 +6,7 @@ import { HardDrive, Database, AlertTriangle, CheckCircle2, XCircle, Square, Ther
import { Badge } from "@/components/ui/badge" import { Badge } from "@/components/ui/badge"
import { Progress } from "@/components/ui/progress" import { Progress } from "@/components/ui/progress"
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "@/components/ui/dialog" import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from "@/components/ui/dialog"
import { getApiUrl } from "../lib/api-config" import { fetchApi } from "../lib/api-config"
interface DiskInfo { interface DiskInfo {
name: string name: string
@@ -94,14 +94,11 @@ export function StorageOverview() {
const fetchStorageData = async () => { const fetchStorageData = async () => {
try { try {
const [storageResponse, proxmoxResponse] = await Promise.all([ const [data, proxmoxData] = await Promise.all([
fetch(getApiUrl("/api/storage")), fetchApi<StorageData>("/api/storage"),
fetch(getApiUrl("/api/proxmox-storage")), fetchApi<ProxmoxStorageData>("/api/proxmox-storage"),
]) ])
const data = await storageResponse.json()
const proxmoxData = await proxmoxResponse.json()
setStorageData(data) setStorageData(data)
setProxmoxStorage(proxmoxData) setProxmoxStorage(proxmoxData)
} catch (error) { } catch (error) {

View File

@@ -8,7 +8,7 @@ import { Cpu, MemoryStick, Thermometer, Server, Zap, AlertCircle, HardDrive, Net
import { NodeMetricsCharts } from "./node-metrics-charts" import { NodeMetricsCharts } from "./node-metrics-charts"
import { NetworkTrafficChart } from "./network-traffic-chart" import { NetworkTrafficChart } from "./network-traffic-chart"
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "./ui/select" import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "./ui/select"
import { getApiUrl } from "../lib/api-config" import { fetchApi } from "../lib/api-config"
interface SystemData { interface SystemData {
cpu_usage: number cpu_usage: number
@@ -98,21 +98,7 @@ interface ProxmoxStorageData {
const fetchSystemData = async (): Promise<SystemData | null> => { const fetchSystemData = async (): Promise<SystemData | null> => {
try { try {
const apiUrl = getApiUrl("/api/system") const data = await fetchApi<SystemData>("/api/system")
const response = await fetch(apiUrl, {
method: "GET",
headers: {
"Content-Type": "application/json",
},
cache: "no-store",
})
if (!response.ok) {
throw new Error(`Flask server responded with status: ${response.status}`)
}
const data = await response.json()
return data return data
} catch (error) { } catch (error) {
console.error("[v0] Failed to fetch system data:", error) console.error("[v0] Failed to fetch system data:", error)
@@ -122,21 +108,7 @@ const fetchSystemData = async (): Promise<SystemData | null> => {
const fetchVMData = async (): Promise<VMData[]> => { const fetchVMData = async (): Promise<VMData[]> => {
try { try {
const apiUrl = getApiUrl("/api/vms") const data = await fetchApi<any>("/api/vms")
const response = await fetch(apiUrl, {
method: "GET",
headers: {
"Content-Type": "application/json",
},
cache: "no-store",
})
if (!response.ok) {
throw new Error(`Flask server responded with status: ${response.status}`)
}
const data = await response.json()
return Array.isArray(data) ? data : data.vms || [] return Array.isArray(data) ? data : data.vms || []
} catch (error) { } catch (error) {
console.error("[v0] Failed to fetch VM data:", error) console.error("[v0] Failed to fetch VM data:", error)
@@ -146,75 +118,30 @@ const fetchVMData = async (): Promise<VMData[]> => {
const fetchStorageData = async (): Promise<StorageData | null> => { const fetchStorageData = async (): Promise<StorageData | null> => {
try { try {
const apiUrl = getApiUrl("/api/storage/summary") const data = await fetchApi<StorageData>("/api/storage/summary")
const response = await fetch(apiUrl, {
method: "GET",
headers: {
"Content-Type": "application/json",
},
cache: "no-store",
})
if (!response.ok) {
console.log("[v0] Storage API not available (this is normal if not configured)")
return null
}
const data = await response.json()
return data return data
} catch (error) { } catch (error) {
console.log("[v0] Storage data unavailable:", error instanceof Error ? error.message : "Unknown error") console.log("[v0] Storage API not available (this is normal if not configured)")
return null return null
} }
} }
const fetchNetworkData = async (): Promise<NetworkData | null> => { const fetchNetworkData = async (): Promise<NetworkData | null> => {
try { try {
const apiUrl = getApiUrl("/api/network/summary") const data = await fetchApi<NetworkData>("/api/network/summary")
const response = await fetch(apiUrl, {
method: "GET",
headers: {
"Content-Type": "application/json",
},
cache: "no-store",
})
if (!response.ok) {
console.log("[v0] Network API not available (this is normal if not configured)")
return null
}
const data = await response.json()
return data return data
} catch (error) { } catch (error) {
console.log("[v0] Network data unavailable:", error instanceof Error ? error.message : "Unknown error") console.log("[v0] Network API not available (this is normal if not configured)")
return null return null
} }
} }
const fetchProxmoxStorageData = async (): Promise<ProxmoxStorageData | null> => { const fetchProxmoxStorageData = async (): Promise<ProxmoxStorageData | null> => {
try { try {
const apiUrl = getApiUrl("/api/proxmox-storage") const data = await fetchApi<ProxmoxStorageData>("/api/proxmox-storage")
const response = await fetch(apiUrl, {
method: "GET",
headers: {
"Content-Type": "application/json",
},
cache: "no-store",
})
if (!response.ok) {
console.log("[v0] Proxmox storage API not available")
return null
}
const data = await response.json()
return data return data
} catch (error) { } catch (error) {
console.log("[v0] Proxmox storage data unavailable:", error instanceof Error ? error.message : "Unknown error") console.log("[v0] Proxmox storage API not available")
return null return null
} }
} }