This commit includes comprehensive codebase cleanup and refactoring: ## Code Cleanup - Remove dead TypeScript code (types/monitoring.ts - 194 lines duplicate) - Remove unused Go functions (GetClusterNodes, MigratePassword, GetClusterHealthInfo) - Clean up commented-out code blocks across multiple files - Remove unused TypeScript exports (helpTextClass, private tag color helpers) - Delete obsolete test files and components ## localStorage Consolidation - Centralize all storage keys into STORAGE_KEYS constant - Update 5 files to use centralized keys: * utils/apiClient.ts (AUTH, LEGACY_TOKEN) * components/Dashboard/Dashboard.tsx (GUEST_METADATA) * components/Docker/DockerHosts.tsx (DOCKER_METADATA) * App.tsx (PLATFORMS_SEEN) * stores/updates.ts (UPDATES) - Benefits: Single source of truth, prevents typos, better maintainability ## Previous Work Committed - Docker monitoring improvements and disk metrics - Security enhancements and setup fixes - API refactoring and cleanup - Documentation updates - Build system improvements ## Testing - All frontend tests pass (29 tests) - All Go tests pass (15 packages) - Production build successful - Zero breaking changes Total: 186 files changed, 5825 insertions(+), 11602 deletions(-)
89 lines
2.2 KiB
TypeScript
89 lines
2.2 KiB
TypeScript
import { defineConfig } from 'vite';
|
|
import solid from 'vite-plugin-solid';
|
|
import path from 'path';
|
|
import { URL } from 'node:url';
|
|
|
|
const frontendDevHost = process.env.FRONTEND_DEV_HOST ?? '0.0.0.0';
|
|
const frontendDevPort = Number(
|
|
process.env.FRONTEND_DEV_PORT ?? process.env.VITE_PORT ?? process.env.PORT ?? 5173,
|
|
);
|
|
|
|
const backendProtocol = process.env.PULSE_DEV_API_PROTOCOL ?? 'http';
|
|
const backendHost = process.env.PULSE_DEV_API_HOST ?? '127.0.0.1';
|
|
const backendPort = Number(
|
|
process.env.PULSE_DEV_API_PORT ??
|
|
process.env.FRONTEND_PORT ??
|
|
process.env.PORT ??
|
|
7655,
|
|
);
|
|
|
|
const backendUrl =
|
|
process.env.PULSE_DEV_API_URL ?? `${backendProtocol}://${backendHost}:${backendPort}`;
|
|
|
|
const backendWsUrl =
|
|
process.env.PULSE_DEV_WS_URL ??
|
|
(() => {
|
|
try {
|
|
const parsed = new URL(backendUrl);
|
|
parsed.protocol = parsed.protocol === 'https:' ? 'wss:' : 'ws:';
|
|
return parsed.toString();
|
|
} catch {
|
|
return backendUrl
|
|
.replace(/^http:\/\//i, 'ws://')
|
|
.replace(/^https:\/\//i, 'wss://');
|
|
}
|
|
})();
|
|
|
|
export default defineConfig({
|
|
plugins: [solid()],
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, './src'),
|
|
},
|
|
conditions: ['import', 'browser', 'default'],
|
|
},
|
|
server: {
|
|
port: frontendDevPort,
|
|
host: frontendDevHost, // Listen on all interfaces for remote access
|
|
strictPort: true,
|
|
proxy: {
|
|
'/ws': {
|
|
target: backendWsUrl,
|
|
ws: true,
|
|
changeOrigin: true,
|
|
},
|
|
'/api': {
|
|
target: backendUrl,
|
|
changeOrigin: true,
|
|
},
|
|
'/install-docker-agent.sh': {
|
|
target: backendUrl,
|
|
changeOrigin: true,
|
|
},
|
|
'/install-container-agent.sh': {
|
|
target: backendUrl,
|
|
changeOrigin: true,
|
|
},
|
|
'/install-host-agent.sh': {
|
|
target: backendUrl,
|
|
changeOrigin: true,
|
|
},
|
|
'/install-host-agent.ps1': {
|
|
target: backendUrl,
|
|
changeOrigin: true,
|
|
},
|
|
'/download': {
|
|
target: backendUrl,
|
|
changeOrigin: true,
|
|
},
|
|
},
|
|
},
|
|
build: {
|
|
target: 'esnext',
|
|
},
|
|
test: {
|
|
environment: 'jsdom',
|
|
globals: true,
|
|
setupFiles: ['./src/test/setup.ts'],
|
|
},
|
|
});
|