mirror of
https://github.com/Dvorinka/Containr.git
synced 2026-10-28 07:41:27 +00:00
fix: telemetry scope label, chunk split, remove stale vite artifacts
- /system/host now reports scope=host|docker-desktop-vm and the daemon OS; Projects dashboard labels cards VM.* when the daemon is a Desktop VM so memory/core numbers aren't mistaken for physical host values - manualChunks: split @xyflow/react and recharts out of the main bundle; removes the >1MB chunk warning - drop tracked vite.config.js/.d.ts build artifacts that shadowed the real vite.config.ts Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
1 parent
9f5dcc7296
commit
a91e6531f5
8 files changed
+30
-57
No files matched your search
@@ -40,6 +40,9 @@ type hostMonitoringResponse struct {
|
||||
UptimeSeconds int64 `json:"uptime_seconds"`
|
||||
DockerAvailable bool `json:"docker_available"`
|
||||
Docker map[string]any `json:"docker,omitempty"`
|
||||
// Scope names what the telemetry actually measures: the physical host for
|
||||
// native dockerd, or the Docker Desktop VM when the daemon runs in one.
|
||||
Scope string `json:"scope"`
|
||||
CollectedAt string `json:"collected_at"`
|
||||
}
|
||||
|
||||
@@ -159,6 +162,7 @@ func handleGetHostMonitoring(c *gin.Context) {
|
||||
Storage: storage,
|
||||
Load: load,
|
||||
UptimeSeconds: uptime,
|
||||
Scope: "host",
|
||||
CollectedAt: time.Now().UTC().Format(time.RFC3339),
|
||||
}
|
||||
|
||||
@@ -173,6 +177,10 @@ func handleGetHostMonitoring(c *gin.Context) {
|
||||
"images": info.Images,
|
||||
"driver": info.Driver,
|
||||
"server": info.ServerVersion,
|
||||
"os": info.OperatingSystem,
|
||||
}
|
||||
if strings.Contains(strings.ToLower(info.OperatingSystem), "docker desktop") {
|
||||
response.Scope = "docker-desktop-vm"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,6 +181,7 @@ export function ProjectsPage() {
|
||||
const totalServices = projects.reduce((sum, p) => sum + p.stats.service_count, 0);
|
||||
const runningServices = projects.reduce((sum, p) => sum + p.stats.running_services, 0);
|
||||
const host = hostQuery.data;
|
||||
const hostLabel = host?.scope === 'docker-desktop-vm' ? 'VM' : 'HOST';
|
||||
const cpuPct = isDemoMode ? 14 : host && host.cpu.cores > 0
|
||||
? Math.min(100, Math.round((host.load.load1m / host.cpu.cores) * 100))
|
||||
: null;
|
||||
@@ -243,7 +244,7 @@ export function ProjectsPage() {
|
||||
{/* Host stat row */}
|
||||
<div className="mb-7 grid grid-cols-2 gap-3 lg:grid-cols-4">
|
||||
<div className="v-stat">
|
||||
<div className="v-k"><span>HOST.CPU</span><span className="v-live" /></div>
|
||||
<div className="v-k"><span>{hostLabel}.CPU</span><span className="v-live" /></div>
|
||||
<div className="v-v">{cpuPct ?? '—'}<span>%</span></div>
|
||||
{isDemoMode ? (
|
||||
<div className="v-spark">
|
||||
@@ -259,13 +260,13 @@ export function ProjectsPage() {
|
||||
</div>
|
||||
</div>
|
||||
<div className="v-stat">
|
||||
<div className="v-k"><span>HOST.MEM</span><span className="v-live" /></div>
|
||||
<div className="v-k"><span>{hostLabel}.MEM</span><span className="v-live" /></div>
|
||||
<div className="v-v">{memPct ?? '—'}<span>%</span></div>
|
||||
<div className="v-meter"><i className={memPct !== null && memPct > 85 ? 'r' : 'y'} style={{ width: `${memPct ?? 0}%` }} /></div>
|
||||
<div className="v-d">{isDemoMode ? '9.8G / 13G' : host ? `${fmtGB(host.memory.used)} / ${fmtGB(host.memory.total)}` : 'no telemetry'}</div>
|
||||
</div>
|
||||
<div className="v-stat">
|
||||
<div className="v-k"><span>HOST.DISK</span><span className="v-live" /></div>
|
||||
<div className="v-k"><span>{hostLabel}.DISK</span><span className="v-live" /></div>
|
||||
<div className="v-v">{diskPct ?? '—'}<span>%</span></div>
|
||||
<div className="v-meter"><i className="r" style={{ width: `${diskPct ?? 0}%` }} /></div>
|
||||
<div className="v-d">{isDemoMode ? '338G of 465G · high' : host ? `${fmtGB(host.storage.used)} of ${fmtGB(host.storage.total)}` : 'no telemetry'}</div>
|
||||
|
||||
@@ -8299,7 +8299,13 @@ export interface components {
|
||||
images?: number;
|
||||
driver?: string;
|
||||
server?: string;
|
||||
os?: string;
|
||||
};
|
||||
/**
|
||||
* @description What the telemetry measures — `host` for a native daemon, `docker-desktop-vm` when Docker runs inside a Desktop VM.
|
||||
* @enum {string}
|
||||
*/
|
||||
scope?: "host" | "docker-desktop-vm";
|
||||
/** Format: date-time */
|
||||
collected_at?: string;
|
||||
};
|
||||
|
||||
@@ -225,7 +225,9 @@ export type HostMonitoring = {
|
||||
images?: number;
|
||||
driver?: string;
|
||||
server?: string;
|
||||
os?: string;
|
||||
};
|
||||
scope: 'host' | 'docker-desktop-vm';
|
||||
collectedAt: string;
|
||||
};
|
||||
|
||||
@@ -888,6 +890,7 @@ function normalizeHostMonitoring(payload: RawHostMonitoring): HostMonitoring {
|
||||
uptimeSeconds: payload.uptime_seconds ?? 0,
|
||||
dockerAvailable: Boolean(payload.docker_available),
|
||||
docker: payload.docker,
|
||||
scope: payload.scope === 'docker-desktop-vm' ? 'docker-desktop-vm' : 'host',
|
||||
collectedAt: payload.collected_at ?? '',
|
||||
};
|
||||
}
|
||||
|
||||
Vendored
-2
@@ -1,2 +0,0 @@
|
||||
declare const _default: import("vite").UserConfig;
|
||||
export default _default;
|
||||
@@ -1,51 +0,0 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
import path from 'path';
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
resolve: {
|
||||
alias: {
|
||||
"@": path.resolve(__dirname, "./src"),
|
||||
},
|
||||
},
|
||||
build: {
|
||||
// Enable code splitting and optimization
|
||||
rollupOptions: {
|
||||
output: {
|
||||
manualChunks: {
|
||||
// Split vendor libraries
|
||||
vendor: ['react', 'react-dom', '@tanstack/react-query'],
|
||||
ui: ['@radix-ui/react-dialog', '@radix-ui/react-dropdown-menu', 'lucide-react'],
|
||||
utils: ['date-fns', 'clsx', 'tailwind-merge']
|
||||
},
|
||||
// Optimize chunk naming for better caching
|
||||
chunkFileNames: 'assets/js/[name]-[hash].js',
|
||||
entryFileNames: 'assets/js/[name]-[hash].js',
|
||||
assetFileNames: 'assets/[ext]/[name]-[hash].[ext]'
|
||||
}
|
||||
},
|
||||
// Enable source maps for production debugging
|
||||
sourcemap: true,
|
||||
// Optimize bundle size
|
||||
minify: 'terser',
|
||||
// Set appropriate chunk size limit for better caching
|
||||
chunkSizeWarningLimit: 1000
|
||||
},
|
||||
// Optimize dependencies during build
|
||||
optimizeDeps: {
|
||||
include: ['react', 'react-dom', '@tanstack/react-query', 'date-fns']
|
||||
},
|
||||
// Development server optimization
|
||||
server: {
|
||||
fs: {
|
||||
// Allow serving files from project root
|
||||
allow: ['..']
|
||||
}
|
||||
},
|
||||
// Preview server optimization
|
||||
preview: {
|
||||
port: 4173,
|
||||
strictPort: true
|
||||
}
|
||||
});
|
||||
@@ -30,7 +30,9 @@ export default defineConfig({
|
||||
// Split vendor libraries
|
||||
vendor: ['react', 'react-dom', '@tanstack/react-query'],
|
||||
ui: ['@radix-ui/react-dialog', '@radix-ui/react-dropdown-menu', 'lucide-react'],
|
||||
utils: ['date-fns', 'clsx', 'tailwind-merge']
|
||||
utils: ['date-fns', 'clsx', 'tailwind-merge'],
|
||||
canvas: ['@xyflow/react'],
|
||||
charts: ['recharts']
|
||||
},
|
||||
// Optimize chunk naming for better caching
|
||||
chunkFileNames: 'assets/js/[name]-[hash].js',
|
||||
|
||||
@@ -6052,6 +6052,12 @@ components:
|
||||
type: string
|
||||
server:
|
||||
type: string
|
||||
os:
|
||||
type: string
|
||||
scope:
|
||||
type: string
|
||||
description: What the telemetry measures — `host` for a native daemon, `docker-desktop-vm` when Docker runs inside a Desktop VM.
|
||||
enum: [host, docker-desktop-vm]
|
||||
collected_at:
|
||||
type: string
|
||||
format: date-time
|
||||
|
||||
Reference in new issue
Block a user