From b78db8412670dd2a318d23980a8006d35f1eb90a Mon Sep 17 00:00:00 2001 From: kami <13612100484@163.com> Date: Fri, 2 Feb 2024 21:18:06 +0800 Subject: [PATCH 1/3] fix: spelling mistake, ename backand.yml to backend.yml --- .github/workflows/{backand.yml => backend.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{backand.yml => backend.yml} (100%) diff --git a/.github/workflows/backand.yml b/.github/workflows/backend.yml similarity index 100% rename from .github/workflows/backand.yml rename to .github/workflows/backend.yml From 795a868f695c16e1ee144220beaa35050eb2e44e Mon Sep 17 00:00:00 2001 From: kami <13612100484@163.com> Date: Fri, 2 Feb 2024 21:22:51 +0800 Subject: [PATCH 2/3] feat: add frontend.yml --- .github/workflows/frontend.yml | 60 ++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/frontend.yml diff --git a/.github/workflows/frontend.yml b/.github/workflows/frontend.yml new file mode 100644 index 000000000..1db1a67e4 --- /dev/null +++ b/.github/workflows/frontend.yml @@ -0,0 +1,60 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +name: Frontend + +on: + push: + branches: + - dev + paths: + - '.github/workflows/frontend.yml' + - 'datavines-ui/**' + pull_request: + paths: + - '.github/workflows/frontend.yml' + - 'datavines-ui/**' + +defaults: + run: + working-directory: datavines-ui + +concurrency: + group: frontend-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + build: + name: Build + runs-on: ${{ matrix.os }} + timeout-minutes: 20 + strategy: + matrix: + os: [ ubuntu-latest, macos-latest ] + steps: + - uses: actions/checkout@v2 + with: + submodules: true + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: 16 + - name: Compile and Build + run: | + npm install + npm fund + npm run build:prod From f1a86d7bd344e618e11f820a0f00f611833af6ef Mon Sep 17 00:00:00 2001 From: kami Date: Fri, 2 Feb 2024 23:02:57 +0800 Subject: [PATCH 3/3] fix `Could not initialize class oshi.hardware.platform.mac.MacCentralProcessor` exception. --- .../main/java/io/datavines/common/utils/OSUtils.java | 11 +++++++---- pom.xml | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/datavines-common/src/main/java/io/datavines/common/utils/OSUtils.java b/datavines-common/src/main/java/io/datavines/common/utils/OSUtils.java index 2fc702e1a..db4a57797 100644 --- a/datavines-common/src/main/java/io/datavines/common/utils/OSUtils.java +++ b/datavines-common/src/main/java/io/datavines/common/utils/OSUtils.java @@ -66,7 +66,7 @@ private OSUtils() {} */ public static double memoryUsage() { GlobalMemory memory = hal.getMemory(); - double memoryUsage = (memory.getTotal() - memory.getAvailable() - memory.getSwapUsed()) * 0.1 / memory.getTotal() * 10; + double memoryUsage = (memory.getTotal() - memory.getAvailable() - memory.getVirtualMemory().getSwapUsed()) * 0.1 / memory.getTotal() * 10; DecimalFormat df = new DecimalFormat(TWO_DECIMAL); df.setRoundingMode(RoundingMode.HALF_UP); @@ -88,7 +88,7 @@ public static double availablePhysicalMemorySize() { availablePhysicalMemorySize = freeMemory /1024.0/1024/1024; } else { GlobalMemory memory = hal.getMemory(); - availablePhysicalMemorySize = (memory.getAvailable() + memory.getSwapUsed()) /1024.0/1024/1024; + availablePhysicalMemorySize = (memory.getAvailable() + memory.getVirtualMemory().getSwapUsed()) /1024.0/1024/1024; } DecimalFormat df = new DecimalFormat(TWO_DECIMAL); @@ -124,7 +124,10 @@ public static double loadAverage() { OperatingSystemMXBean operatingSystemMXBean = ManagementFactory.getOperatingSystemMXBean(); loadAverage = operatingSystemMXBean.getSystemLoadAverage(); } else { - loadAverage = hal.getProcessor().getSystemLoadAverage(); + // 0: setCpuLoadAvg 1 min + // 1: setCpuLoadAvg 5 min + // 2: setCpuLoadAvg 15 min + loadAverage = hal.getProcessor().getSystemLoadAverage(3)[2]; } DecimalFormat df = new DecimalFormat(TWO_DECIMAL); @@ -140,7 +143,7 @@ public static double loadAverage() { */ public static double cpuUsage() { CentralProcessor processor = hal.getProcessor(); - double cpuUsage = processor.getSystemCpuLoad(); + double cpuUsage = processor.getSystemLoadAverage(3)[2]; DecimalFormat df = new DecimalFormat(TWO_DECIMAL); df.setRoundingMode(RoundingMode.HALF_UP); diff --git a/pom.xml b/pom.xml index 973de1d70..8433abd5c 100644 --- a/pom.xml +++ b/pom.xml @@ -50,7 +50,7 @@ 1.7.5 1.7.5 2.12.5 - 3.5.0 + 5.5.1 4.1 20.0 1.8