From f4b30da6b34e2445bf263a79f951b039c51c06e5 Mon Sep 17 00:00:00 2001 From: Gold856 <117957790+Gold856@users.noreply.github.com> Date: Mon, 2 Feb 2026 11:06:48 -0500 Subject: [PATCH] Dynamically import echarts and three.js (#2349) --- .../components/app/photon-3d-visualizer.vue | 8 +++++-- .../app/photon-calibration-visualizer.vue | 4 ++-- .../src/components/settings/DeviceCard.vue | 24 +++++++++++++++---- .../src/components/settings/MetricsChart.vue | 4 ++-- photon-client/src/lib/ThreeUtils.ts | 5 ++-- 5 files changed, 33 insertions(+), 12 deletions(-) diff --git a/photon-client/src/components/app/photon-3d-visualizer.vue b/photon-client/src/components/app/photon-3d-visualizer.vue index cc954c7f4..10cce9366 100644 --- a/photon-client/src/components/app/photon-3d-visualizer.vue +++ b/photon-client/src/components/app/photon-3d-visualizer.vue @@ -44,7 +44,7 @@ let renderer: WebGLRenderer | undefined; let controls: TrackballControls | undefined; let previousTargets: Object3D[] = []; -const drawTargets = (targets: PhotonTarget[]) => { +const drawTargets = async (targets: PhotonTarget[]) => { // Check here, since if we check in watchEffect this never gets called if (!scene || !camera || !renderer || !controls) { return; @@ -89,7 +89,11 @@ const drawTargets = (targets: PhotonTarget[]) => { if (calibrationCoeffs) { // And show camera frustum - const calibCamera = createPerspectiveCamera(calibrationCoeffs.resolution, calibrationCoeffs.cameraIntrinsics, 10); + const calibCamera = await createPerspectiveCamera( + calibrationCoeffs.resolution, + calibrationCoeffs.cameraIntrinsics, + 10 + ); const helper = new CameraHelper(calibCamera); const helperGroup = new Group(); helperGroup.add(helper); diff --git a/photon-client/src/components/app/photon-calibration-visualizer.vue b/photon-client/src/components/app/photon-calibration-visualizer.vue index e63798c6d..4dad72020 100644 --- a/photon-client/src/components/app/photon-calibration-visualizer.vue +++ b/photon-client/src/components/app/photon-calibration-visualizer.vue @@ -65,7 +65,7 @@ const createChessboard = (obs: BoardObservation, cal: CameraCalibrationResult): let previousTargets: Object3D[] = []; let baseAspect: number | undefined; -const drawCalibration = (cal: CameraCalibrationResult | null) => { +const drawCalibration = async (cal: CameraCalibrationResult | null) => { // Check here, since if we check in watchEffect this never gets called if (!cal || !scene || !camera || !renderer || !controls) { return; @@ -95,7 +95,7 @@ const drawCalibration = (cal: CameraCalibrationResult | null) => { }); // And show camera frustum - const calibCamera = createPerspectiveCamera(props.resolution, cal.cameraIntrinsics); + const calibCamera = await createPerspectiveCamera(props.resolution, cal.cameraIntrinsics); const helper = new CameraHelper(calibCamera); // Flip to +Z forward diff --git a/photon-client/src/components/settings/DeviceCard.vue b/photon-client/src/components/settings/DeviceCard.vue index 71fdc2f2e..e1bd5c22a 100644 --- a/photon-client/src/components/settings/DeviceCard.vue +++ b/photon-client/src/components/settings/DeviceCard.vue @@ -376,21 +376,33 @@ watch(metricsHistorySnapshot, () => { CPU Usage {{ Math.round(cpuUsageData.at(-1)?.value ?? 0) }}% - + + + + +
CPU Memory Usage {{ Math.round(cpuMemoryUsageData.at(-1)?.value ?? 0) }}%
- + + + + +
CPU Temperature {{ cpuTempData.at(-1)?.value == -1 ? "--- " : Math.round(cpuTempData.at(-1)?.value ?? 0) }}°C
- + + + + +
@@ -404,7 +416,11 @@ watch(metricsHistorySnapshot, () => { >{{ networkUsageData.at(-1)?.value == -1 ? "---" : networkUsageData.at(-1)?.value.toFixed(3) }} Mb/s
- + + + + +
diff --git a/photon-client/src/components/settings/MetricsChart.vue b/photon-client/src/components/settings/MetricsChart.vue index 89e73c2d6..a3c3a00b0 100644 --- a/photon-client/src/components/settings/MetricsChart.vue +++ b/photon-client/src/components/settings/MetricsChart.vue @@ -1,5 +1,4 @@