mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-24 09:01:00 -10:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
31b076dd32 |
No files matched your search
+26
-62
@@ -28,9 +28,7 @@ jobs:
|
||||
# shared runners to others. Pushes, the merge queue and manual runs always run everything.
|
||||
changes:
|
||||
name: Changes
|
||||
# Self-hosted runners (scripts/selfhost-runner) only for trusted events, and only while the
|
||||
# SELFHOSTED_RUNNERS repository variable is 'true': runs-on cannot fall back when none is online.
|
||||
runs-on: ${{ vars.SELFHOSTED_RUNNERS == 'true' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && fromJSON('["self-hosted", "openidea-selfhosted"]') || 'ubuntu-latest' }}
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
permissions:
|
||||
pull-requests: read
|
||||
@@ -110,10 +108,10 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [macos-latest, ubuntu-latest, windows-latest]
|
||||
os: [macos-latest, ubuntu-22.04, windows-latest]
|
||||
# Self-hosted runners (scripts/selfhost-runner) only for trusted events, and only while the
|
||||
# SELFHOSTED_RUNNERS repository variable is 'true': runs-on cannot fall back when none is online.
|
||||
runs-on: ${{ matrix.os == 'ubuntu-latest' && vars.SELFHOSTED_RUNNERS == 'true' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && fromJSON('["self-hosted", "openidea-selfhosted"]') || matrix.os }}
|
||||
runs-on: ${{ matrix.os == 'ubuntu-22.04' && vars.SELFHOSTED_RUNNERS == 'true' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && fromJSON('["self-hosted", "openidea-selfhosted"]') || matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: pnpm/action-setup@v5
|
||||
@@ -146,8 +144,8 @@ jobs:
|
||||
- name: Linux deps
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
pkgs=(libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev libxdo-dev libssl-dev patchelf)
|
||||
dpkg -s "${pkgs[@]}" >/dev/null 2>&1 || { sudo apt-get update && sudo apt-get install -y "${pkgs[@]}"; }
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev libxdo-dev libssl-dev patchelf
|
||||
# tauri-build checks that frontendDist exists.
|
||||
- run: pnpm install --frozen-lockfile && mkdir -p dist
|
||||
shell: bash
|
||||
@@ -158,8 +156,7 @@ jobs:
|
||||
- run: git config --global core.autocrlf false
|
||||
- run: cargo nextest run --workspace --no-fail-fast
|
||||
- name: Remote backend with Docker Compose
|
||||
# Self-hosted runner containers do not mount /var/run/docker.sock (scripts/selfhost-runner/README.md).
|
||||
if: runner.os == 'Linux' && runner.environment != 'self-hosted'
|
||||
if: runner.os == 'Linux'
|
||||
run: |
|
||||
docker pull busybox:latest
|
||||
cargo nextest run -p ide-host --test remote_daemon --run-ignored only \
|
||||
@@ -178,7 +175,7 @@ jobs:
|
||||
name: Rust checks
|
||||
needs: [changes, rust]
|
||||
if: always()
|
||||
runs-on: ${{ vars.SELFHOSTED_RUNNERS == 'true' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && fromJSON('["self-hosted", "openidea-selfhosted"]') || 'ubuntu-latest' }}
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- env:
|
||||
@@ -195,27 +192,16 @@ jobs:
|
||||
needs: changes
|
||||
if: needs.changes.outputs.server == 'true'
|
||||
timeout-minutes: 40
|
||||
runs-on: ${{ vars.SELFHOSTED_RUNNERS == 'true' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && fromJSON('["self-hosted", "openidea-selfhosted"]') || 'ubuntu-latest' }}
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with: { targets: x86_64-unknown-linux-musl }
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
if: runner.environment != 'self-hosted'
|
||||
with: { key: server-musl }
|
||||
- name: Persistent Cargo target dir
|
||||
if: runner.environment == 'self-hosted'
|
||||
shell: bash
|
||||
run: |
|
||||
echo "CARGO_INCREMENTAL=1" >> "$GITHUB_ENV"
|
||||
size=$(du -sm "$CARGO_TARGET_DIR" 2>/dev/null | cut -f1 || true)
|
||||
if [ "${size:-0}" -gt 40000 ]; then
|
||||
echo "$CARGO_TARGET_DIR is ${size} MB; clearing it"
|
||||
rm -rf "$CARGO_TARGET_DIR"
|
||||
fi
|
||||
- run: dpkg -s musl-tools >/dev/null 2>&1 || { sudo apt-get update && sudo apt-get install -y musl-tools; }
|
||||
- run: sudo apt-get update && sudo apt-get install -y musl-tools
|
||||
- run: cargo build --locked -p ide-host --bin openidea-server --target x86_64-unknown-linux-musl
|
||||
- run: '"${CARGO_TARGET_DIR:-target}/x86_64-unknown-linux-musl/debug/openidea-server" --version'
|
||||
- run: target/x86_64-unknown-linux-musl/debug/openidea-server --version
|
||||
|
||||
# The plugin SDK, the official plugins and the test fixtures build in their
|
||||
# own workspaces (the root excludes them), so the jobs above don't see them.
|
||||
@@ -224,31 +210,18 @@ jobs:
|
||||
needs: changes
|
||||
if: needs.changes.outputs.plugins == 'true'
|
||||
timeout-minutes: 30
|
||||
runs-on: ${{ vars.SELFHOSTED_RUNNERS == 'true' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && fromJSON('["self-hosted", "openidea-selfhosted"]') || 'ubuntu-latest' }}
|
||||
runs-on: ubuntu-22.04
|
||||
env:
|
||||
CARGO_TARGET_DIR: ${{ github.workspace }}/target-plugins
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with: { targets: wasm32-wasip2, components: "clippy, rustfmt" }
|
||||
- if: runner.environment != 'self-hosted'
|
||||
shell: bash
|
||||
run: echo "CARGO_TARGET_DIR=$GITHUB_WORKSPACE/target-plugins" >> "$GITHUB_ENV"
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
if: runner.environment != 'self-hosted'
|
||||
with:
|
||||
key: plugins
|
||||
cache-directories: target-plugins
|
||||
save-if: ${{ github.ref == 'refs/heads/main' }}
|
||||
- name: Persistent Cargo target dir
|
||||
if: runner.environment == 'self-hosted'
|
||||
shell: bash
|
||||
run: |
|
||||
echo "CARGO_INCREMENTAL=1" >> "$GITHUB_ENV"
|
||||
size=$(du -sm "$CARGO_TARGET_DIR" 2>/dev/null | cut -f1 || true)
|
||||
if [ "${size:-0}" -gt 40000 ]; then
|
||||
echo "$CARGO_TARGET_DIR is ${size} MB; clearing it"
|
||||
rm -rf "$CARGO_TARGET_DIR"
|
||||
fi
|
||||
echo "CARGO_TARGET_DIR=$CARGO_TARGET_DIR/plugins" >> "$GITHUB_ENV"
|
||||
- name: Format, lint (host and wasm) and test each crate
|
||||
shell: bash
|
||||
run: |
|
||||
@@ -265,7 +238,7 @@ jobs:
|
||||
- uses: pnpm/action-setup@v5
|
||||
with: { version: 11 }
|
||||
- uses: actions/setup-node@v5
|
||||
with: { node-version: 22, package-manager-cache: false }
|
||||
with: { node-version: 22 }
|
||||
# Plugin web pages (`web-src/`, their own pnpm projects): typecheck and test.
|
||||
- name: Web pages typecheck and test
|
||||
shell: bash
|
||||
@@ -289,7 +262,7 @@ jobs:
|
||||
needs: changes
|
||||
if: needs.changes.outputs.deny == 'true'
|
||||
timeout-minutes: 15
|
||||
runs-on: ${{ vars.SELFHOSTED_RUNNERS == 'true' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && fromJSON('["self-hosted", "openidea-selfhosted"]') || 'ubuntu-latest' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
@@ -301,19 +274,13 @@ jobs:
|
||||
needs: changes
|
||||
if: needs.changes.outputs.frontend == 'true'
|
||||
timeout-minutes: 30
|
||||
runs-on: ${{ vars.SELFHOSTED_RUNNERS == 'true' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && fromJSON('["self-hosted", "openidea-selfhosted"]') || 'ubuntu-latest' }}
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
# scripts/smoke-paths.test.ts runs `cargo metadata`, which is not preinstalled in the runner container.
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
if: runner.environment == 'self-hosted'
|
||||
- uses: pnpm/action-setup@v5
|
||||
with: { version: 11 }
|
||||
- uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version: 22
|
||||
cache: ${{ runner.environment != 'self-hosted' && 'pnpm' || '' }}
|
||||
package-manager-cache: ${{ runner.environment != 'self-hosted' }}
|
||||
with: { node-version: 22, cache: pnpm }
|
||||
- run: pnpm install --frozen-lockfile
|
||||
- run: pnpm typecheck
|
||||
- run: pnpm lint
|
||||
@@ -328,16 +295,13 @@ jobs:
|
||||
needs: changes
|
||||
if: needs.changes.outputs.catalog == 'true'
|
||||
timeout-minutes: 15
|
||||
runs-on: ${{ vars.SELFHOSTED_RUNNERS == 'true' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && fromJSON('["self-hosted", "openidea-selfhosted"]') || 'ubuntu-latest' }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: pnpm/action-setup@v5
|
||||
with: { version: 11 }
|
||||
- uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version: 22
|
||||
cache: ${{ runner.environment != 'self-hosted' && 'pnpm' || '' }}
|
||||
package-manager-cache: ${{ runner.environment != 'self-hosted' }}
|
||||
with: { node-version: 22, cache: pnpm }
|
||||
- run: pnpm install --frozen-lockfile
|
||||
- run: pnpm vitest run src/platform/locales/textCatalog.test.ts
|
||||
|
||||
@@ -345,24 +309,24 @@ jobs:
|
||||
name: E2E (${{ matrix.shard }}/4)
|
||||
needs: changes
|
||||
if: needs.changes.outputs.e2e == 'true'
|
||||
timeout-minutes: 45
|
||||
runs-on: ${{ vars.SELFHOSTED_RUNNERS == 'true' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && fromJSON('["self-hosted", "openidea-selfhosted"]') || 'ubuntu-latest' }}
|
||||
timeout-minutes: 30
|
||||
runs-on: ubuntu-24.04
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
shard: [1, 2, 3, 4]
|
||||
# Browsers and their system libraries are preinstalled; keep the tag in step with @playwright/test.
|
||||
container: mcr.microsoft.com/playwright:v1.64.1-noble
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: pnpm/action-setup@v5
|
||||
with: { version: 11 }
|
||||
- uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version: 22
|
||||
cache: ${{ runner.environment != 'self-hosted' && 'pnpm' || '' }}
|
||||
package-manager-cache: ${{ runner.environment != 'self-hosted' }}
|
||||
with: { node-version: 22, cache: pnpm }
|
||||
- run: pnpm install --frozen-lockfile
|
||||
- run: pnpm exec playwright install --with-deps chromium
|
||||
- run: pnpm e2e --shard=${{ matrix.shard }}/4
|
||||
env:
|
||||
HOME: /root
|
||||
- uses: actions/upload-artifact@v6
|
||||
if: failure()
|
||||
with:
|
||||
|
||||
@@ -57,9 +57,6 @@ on:
|
||||
paths: *paths
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: language-smoke-${{ github.ref }}
|
||||
# A new push supersedes a PR's run; on main every merge runs to the end (and saves the cache).
|
||||
@@ -68,6 +65,8 @@ concurrency:
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
CARGO_INCREMENTAL: 0
|
||||
# Line tables keep test backtraces readable and the binaries the build job hands on small.
|
||||
CARGO_PROFILE_DEV_DEBUG: line-tables-only
|
||||
|
||||
jobs:
|
||||
# The languages a pull request can affect: a change to one language's fixture, definition or
|
||||
@@ -75,9 +74,7 @@ jobs:
|
||||
# run none; anything else runs them all. Pushes and manual runs always run them all.
|
||||
changes:
|
||||
name: Changes
|
||||
# Self-hosted runners (scripts/selfhost-runner) only for trusted events, and only while the
|
||||
# SELFHOSTED_RUNNERS repository variable is 'true': runs-on cannot fall back when none is online.
|
||||
runs-on: ${{ vars.SELFHOSTED_RUNNERS == 'true' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && fromJSON('["self-hosted", "openidea-selfhosted"]') || 'ubuntu-latest' }}
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
permissions:
|
||||
pull-requests: read
|
||||
@@ -142,32 +139,17 @@ jobs:
|
||||
name: Build
|
||||
needs: changes
|
||||
if: needs.changes.outputs.languages != '[]'
|
||||
# Self-hosted runners (scripts/selfhost-runner) only for trusted events, and only while the
|
||||
# SELFHOSTED_RUNNERS repository variable is 'true': runs-on cannot fall back when none is online.
|
||||
runs-on: ${{ vars.SELFHOSTED_RUNNERS == 'true' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && fromJSON('["self-hosted", "openidea-selfhosted"]') || 'ubuntu-latest' }}
|
||||
# The tests find the fixtures through the checkout path compiled into them (CARGO_MANIFEST_DIR),
|
||||
# which is the same on every GitHub-hosted runner.
|
||||
runs-on: ubuntu-22.04
|
||||
timeout-minutes: 30
|
||||
env:
|
||||
# Line tables keep test backtraces readable and the binaries handed on small without
|
||||
# stripping local-variable debuginfo from fixtures debugged in the smoke job (CodeLLDB).
|
||||
CARGO_PROFILE_DEV_DEBUG: line-tables-only
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
if: runner.environment != 'self-hosted'
|
||||
with:
|
||||
shared-key: language-smoke
|
||||
save-if: ${{ github.ref == 'refs/heads/main' }}
|
||||
- name: Persistent Cargo target dir
|
||||
if: runner.environment == 'self-hosted'
|
||||
shell: bash
|
||||
run: |
|
||||
echo "CARGO_INCREMENTAL=1" >> "$GITHUB_ENV"
|
||||
size=$(du -sm "$CARGO_TARGET_DIR" 2>/dev/null | cut -f1 || true)
|
||||
if [ "${size:-0}" -gt 40000 ]; then
|
||||
echo "$CARGO_TARGET_DIR is ${size} MB; clearing it"
|
||||
rm -rf "$CARGO_TARGET_DIR"
|
||||
fi
|
||||
- run: |
|
||||
set -euo pipefail
|
||||
mkdir -p smoke-bin
|
||||
@@ -175,7 +157,7 @@ jobs:
|
||||
| jq -r 'select(.reason == "compiler-artifact" and .executable != null and .target.kind == ["test"]) | "\(.target.name) \(.executable)"' \
|
||||
| while read -r name exe; do cp "$exe" "smoke-bin/$name"; done
|
||||
cargo build --locked -p ide-host --bin openidea-server
|
||||
cp "${CARGO_TARGET_DIR:-target}/debug/openidea-server" smoke-bin/
|
||||
cp target/debug/openidea-server smoke-bin/
|
||||
ls -l smoke-bin
|
||||
test -x smoke-bin/language_smoke && test -x smoke-bin/project_smoke
|
||||
# A tar keeps the executable bits, which artifacts drop.
|
||||
@@ -190,16 +172,11 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
language: ${{ fromJSON(needs.changes.outputs.languages) }}
|
||||
# Self-hosted runners (scripts/selfhost-runner) only for trusted events, and only while the
|
||||
# SELFHOSTED_RUNNERS repository variable is 'true': runs-on cannot fall back when none is online.
|
||||
runs-on: ${{ vars.SELFHOSTED_RUNNERS == 'true' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) && fromJSON('["self-hosted", "openidea-selfhosted"]') || 'ubuntu-latest' }}
|
||||
# C/C++ debug with GDB, whose DAP interpreter needs 14+: 22.04 ships 12.1, 24.04 ships 15.
|
||||
runs-on: ${{ (matrix.language == 'c' || matrix.language == 'cpp') && 'ubuntu-24.04' || 'ubuntu-22.04' }}
|
||||
timeout-minutes: 40
|
||||
# Self-hosted runner slots have distinct checkout paths (/persist/slot-<N>/work/...); override
|
||||
# the compiled-in CARGO_MANIFEST_DIR so binaries from the Build job find this slot's fixtures.
|
||||
env:
|
||||
CARGO_MANIFEST_DIR: ${{ github.workspace }}/crates/ide-host
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v4
|
||||
# Tool versions, shared with the evals (pnpm eval).
|
||||
- run: grep -E '^[A-Z0-9_]+=' .github/tool-versions.env >> "$GITHUB_ENV"
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
@@ -210,32 +187,18 @@ jobs:
|
||||
tar -xf smoke-bin.tar && rm smoke-bin.tar
|
||||
mkdir -p target/debug && mv smoke-bin/openidea-server target/debug/
|
||||
|
||||
- uses: pnpm/action-setup@v5
|
||||
- uses: pnpm/action-setup@v4
|
||||
with: { version: 11 }
|
||||
- uses: actions/setup-node@v5
|
||||
with:
|
||||
node-version: 22
|
||||
cache: ${{ runner.environment != 'self-hosted' && 'pnpm' || '' }}
|
||||
package-manager-cache: ${{ runner.environment != 'self-hosted' }}
|
||||
- uses: actions/setup-node@v4
|
||||
with: { node-version: 22, cache: pnpm }
|
||||
- if: matrix.language == 'typescript'
|
||||
run: npm install --global "@vtsls/language-server@$VTSLS" "typescript@$TYPESCRIPT"
|
||||
|
||||
# The smoke checks C/C++ with clangd and debugs c-app with GDB's own DAP interpreter (GDB 14+).
|
||||
# The smoke builds the c-app fixture and debugs it with GDB's own DAP interpreter.
|
||||
- if: matrix.language == 'c' || matrix.language == 'cpp'
|
||||
shell: bash
|
||||
run: |
|
||||
pkgs=()
|
||||
command -v clangd >/dev/null || pkgs+=(clangd)
|
||||
command -v gdb >/dev/null || pkgs+=(gdb)
|
||||
if [ "${#pkgs[@]}" -gt 0 ]; then
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y "${pkgs[@]}"
|
||||
fi
|
||||
major=$(gdb --version | head -n1 | grep -Eo '[0-9]+\.[0-9]+' | head -n1 | cut -d. -f1)
|
||||
if [ "${major:-0}" -lt 14 ]; then
|
||||
echo "::error::GDB 14+ is required for its DAP interpreter; recreate the runner from scripts/selfhost-runner (Ubuntu 24.04)."
|
||||
exit 1
|
||||
fi
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y gdb
|
||||
|
||||
- if: matrix.language == 'python'
|
||||
uses: actions/setup-python@v5
|
||||
@@ -254,7 +217,6 @@ jobs:
|
||||
with: { distribution: temurin, java-version: "${{ env.JAVA }}" }
|
||||
- if: matrix.language == 'java'
|
||||
run: |
|
||||
command -v mvn >/dev/null || { sudo apt-get update && sudo apt-get install -y maven; }
|
||||
mkdir -p "$RUNNER_TEMP/jdtls"
|
||||
curl -fsSL "https://download.eclipse.org/jdtls/milestones/${JDTLS%-*}/jdt-language-server-$JDTLS.tar.gz" \
|
||||
| tar xz -C "$RUNNER_TEMP/jdtls"
|
||||
|
||||
Generated
+48
-48
@@ -4144,7 +4144,7 @@ checksum = "3d3067d79b975e8844ca9eb072e16b31c3c1c36928edf9c6789548c524d0d954"
|
||||
|
||||
[[package]]
|
||||
name = "ide-agent"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"blake3",
|
||||
@@ -4172,7 +4172,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-analysis"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"ast-grep-core",
|
||||
"ide-core",
|
||||
@@ -4184,7 +4184,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-android"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"serde",
|
||||
@@ -4194,7 +4194,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-build"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"blake3",
|
||||
"chardetng",
|
||||
@@ -4212,7 +4212,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-cli"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"dirs 6.0.0",
|
||||
"serde",
|
||||
@@ -4226,7 +4226,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-clipboard"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"gtk",
|
||||
"objc2 0.6.5",
|
||||
@@ -4237,7 +4237,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-command"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"heck 0.5.0",
|
||||
"proc-macro2",
|
||||
@@ -4248,7 +4248,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-core"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"dunce",
|
||||
@@ -4266,7 +4266,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-coverage"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"ide-run",
|
||||
@@ -4279,7 +4279,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-dap"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"futures",
|
||||
@@ -4308,7 +4308,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-db"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"bb8",
|
||||
@@ -4345,7 +4345,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-docker"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"serde",
|
||||
@@ -4358,7 +4358,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-drag-out"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"gtk",
|
||||
"objc2 0.6.5",
|
||||
@@ -4372,7 +4372,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-extension"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"blake3",
|
||||
@@ -4392,7 +4392,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-flutter"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"ide-android",
|
||||
"ide-core",
|
||||
@@ -4403,7 +4403,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-fonts"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"objc2-core-foundation",
|
||||
"objc2-core-text",
|
||||
@@ -4415,7 +4415,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-github"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"ide-vcs",
|
||||
@@ -4428,7 +4428,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-heap"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"criterion",
|
||||
"ide-core",
|
||||
@@ -4447,7 +4447,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-host"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"blake3",
|
||||
@@ -4522,7 +4522,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-http"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"hyper-util",
|
||||
"ide-core",
|
||||
@@ -4541,7 +4541,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-index"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"blake3",
|
||||
"criterion",
|
||||
@@ -4564,7 +4564,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-jdwp"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"ide-jvm-inspect",
|
||||
"proptest",
|
||||
@@ -4576,7 +4576,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-jsonrpc"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"encoding_rs",
|
||||
"ide-core",
|
||||
@@ -4592,7 +4592,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-jvm-attach"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"tempfile",
|
||||
@@ -4601,7 +4601,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-jvm-inspect"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"futures",
|
||||
"serde",
|
||||
@@ -4612,7 +4612,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-language"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"blake3",
|
||||
"criterion",
|
||||
@@ -4671,7 +4671,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-lsp"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"criterion",
|
||||
"dunce",
|
||||
@@ -4700,7 +4700,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-mcp"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"bytes",
|
||||
"dunce",
|
||||
@@ -4719,7 +4719,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-notebook"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"ide-vfs",
|
||||
@@ -4740,7 +4740,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-plugin"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"blake3",
|
||||
"dunce",
|
||||
@@ -4762,7 +4762,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-profiler"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"ide-jvm-attach",
|
||||
@@ -4776,7 +4776,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-remote"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"dunce",
|
||||
"futures",
|
||||
@@ -4796,7 +4796,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-run"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"dunce",
|
||||
"encoding_rs",
|
||||
@@ -4820,7 +4820,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-scaffold"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"ide-tools",
|
||||
@@ -4836,7 +4836,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-sdk"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"dirs 6.0.0",
|
||||
@@ -4862,7 +4862,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-search"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"criterion",
|
||||
"encoding_rs",
|
||||
@@ -4883,7 +4883,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-spell"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"parking_lot",
|
||||
@@ -4896,7 +4896,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-ssh"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"dirs 6.0.0",
|
||||
"flate2",
|
||||
@@ -4921,7 +4921,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-streams"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"ide-language",
|
||||
@@ -4934,7 +4934,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-syntax"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"ide-language",
|
||||
@@ -4949,7 +4949,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-terminal"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"ide-core",
|
||||
"libc",
|
||||
@@ -4963,7 +4963,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-text"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"criterion",
|
||||
"ide-core",
|
||||
@@ -4976,7 +4976,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-tools"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"flate2",
|
||||
"hex",
|
||||
@@ -4997,7 +4997,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-vcs"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"blake3",
|
||||
"dunce",
|
||||
@@ -5019,7 +5019,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-vfs"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"chardetng",
|
||||
"dunce",
|
||||
@@ -5046,7 +5046,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-web"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"dirs 6.0.0",
|
||||
"ide-core",
|
||||
@@ -5062,7 +5062,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ide-workspace"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"blake3",
|
||||
"dunce",
|
||||
@@ -6691,7 +6691,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "openidea"
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
dependencies = [
|
||||
"base64 0.22.1",
|
||||
"blake3",
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ members = ["crates/*", "src-tauri"]
|
||||
exclude = ["sdk", "plugins"]
|
||||
|
||||
[workspace.package]
|
||||
version = "0.1.51"
|
||||
version = "0.1.50"
|
||||
edition = "2024"
|
||||
rust-version = "1.96"
|
||||
license = "Apache-2.0"
|
||||
|
||||
@@ -4245,24 +4245,11 @@ fn file_uri(path: &Path) -> String {
|
||||
out
|
||||
}
|
||||
|
||||
/// The title of a task: the first line of the prompt that says something. Text inside a code
|
||||
/// fence (```` ```text ````) is pasted material, so a line outside the fences wins; a prompt
|
||||
/// that is all one pasted block still names its task from inside it.
|
||||
/// The title of a task: the first line of the prompt that says something. A pasted Markdown
|
||||
/// block opens with a code fence (```` ```text ````), which names no task.
|
||||
fn title_of(prompt: &AgentPrompt) -> String {
|
||||
let is_fence = |l: &str| l.starts_with("```") || l.starts_with("~~~");
|
||||
let (mut outside, mut inside, mut fenced) = (None, None, false);
|
||||
for l in prompt.text.lines().map(str::trim) {
|
||||
if is_fence(l) {
|
||||
fenced = !fenced;
|
||||
} else if !l.is_empty() {
|
||||
let slot = if fenced { &mut inside } else { &mut outside };
|
||||
slot.get_or_insert(l);
|
||||
if outside.is_some() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
let line = outside.or(inside);
|
||||
let line = prompt.text.lines().map(str::trim).find(|l| !l.is_empty() && !is_fence(l));
|
||||
let line = match line {
|
||||
Some(l) => l.to_owned(),
|
||||
None => prompt.files.first().map(|f| file_name(&f.0)).unwrap_or_else(|| "Image".into()),
|
||||
|
||||
@@ -1736,9 +1736,6 @@ fn prompts_become_acp_content_blocks() {
|
||||
assert_eq!(title_of(&AgentPrompt { files: p.files.clone(), ..AgentPrompt::default() }), "my file.rs");
|
||||
let pasted = AgentPrompt { text: "```text\n\n ## Fix the tab title\n```".into(), ..AgentPrompt::default() };
|
||||
assert_eq!(title_of(&pasted), "## Fix the tab title");
|
||||
let fenced_first =
|
||||
AgentPrompt { text: "```txt\nlog line\n```\nWhy does this fail?".into(), ..AgentPrompt::default() };
|
||||
assert_eq!(title_of(&fenced_first), "Why does this fail?");
|
||||
assert!(clean(text(" ")).is_none());
|
||||
}
|
||||
|
||||
|
||||
@@ -557,53 +557,6 @@ fn map_layers(layers: Vec<ApiLayer>, now: i64) -> Vec<DockerImageLayer> {
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Per-volume disk usage (`GET /system/df?type=volume`).
|
||||
pub(crate) fn volume_sizes(ep: &DockerEndpoint, timeout: Duration) -> Option<IdeResult<BTreeMap<String, String>>> {
|
||||
let addr = address(ep)?;
|
||||
Some((|| {
|
||||
let body = check(request(&addr, "GET", "/system/df?type=volume", timeout)?)?;
|
||||
map_volume_sizes(&body)
|
||||
})())
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Default)]
|
||||
#[serde(rename_all = "PascalCase", default)]
|
||||
struct ApiDiskUsage {
|
||||
volumes: Option<Vec<ApiVolumeUsage>>,
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Default)]
|
||||
#[serde(rename_all = "PascalCase", default)]
|
||||
struct ApiVolumeUsage {
|
||||
name: String,
|
||||
usage_data: Option<ApiVolumeUsageData>,
|
||||
}
|
||||
|
||||
const fn unknown_volume_size() -> i64 {
|
||||
-1
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Default)]
|
||||
#[serde(rename_all = "PascalCase", default)]
|
||||
struct ApiVolumeUsageData {
|
||||
#[serde(default = "unknown_volume_size")]
|
||||
size: i64,
|
||||
}
|
||||
|
||||
fn map_volume_sizes(body: &str) -> IdeResult<BTreeMap<String, String>> {
|
||||
let parsed = serde_json::from_str::<ApiDiskUsage>(body)
|
||||
.map_err(|e| IdeError::internal(format!("the Docker daemon's disk usage is not JSON: {e}")))?;
|
||||
Ok(parsed
|
||||
.volumes
|
||||
.unwrap_or_default()
|
||||
.into_iter()
|
||||
.filter_map(|v| {
|
||||
let size = v.usage_data?.size;
|
||||
(!v.name.is_empty() && size >= 0).then(|| (v.name, human_size(size)))
|
||||
})
|
||||
.collect())
|
||||
}
|
||||
|
||||
fn unix_now() -> i64 {
|
||||
std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).map(|d| d.as_secs() as i64).unwrap_or(0)
|
||||
}
|
||||
@@ -1205,15 +1158,6 @@ mod tests {
|
||||
(top.titles, top.processes),
|
||||
(vec!["PID".to_owned(), "CMD".to_owned()], vec![vec!["1".to_owned(), "sh".to_owned()]])
|
||||
);
|
||||
let sizes = map_volume_sizes(
|
||||
r#"{"Volumes":[{"Name":"shop_pgdata","UsageData":{"RefCount":1,"Size":145442}},{"Name":"empty","UsageData":{"RefCount":0,"Size":0}},{"Name":"remote","UsageData":{"RefCount":1,"Size":-1}},{"Name":"missing","UsageData":null}]}"#,
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(sizes.get("shop_pgdata").map(String::as_str), Some("145.442kB"));
|
||||
assert_eq!(sizes.get("empty").map(String::as_str), Some("0B"));
|
||||
assert!(!sizes.contains_key("remote"));
|
||||
assert!(!sizes.contains_key("missing"));
|
||||
assert!(map_volume_sizes(r#"{"Volumes":null}"#).unwrap().is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -315,17 +315,6 @@ pub fn container_stats(ep: &DockerEndpoint, id: &str) -> IdeResult<DockerContain
|
||||
parse_container_stats(&out).ok_or_else(|| IdeError::not_found("no container stats returned"))
|
||||
}
|
||||
|
||||
/// Per-volume disk usage (`docker system df -v --format '{{json .Volumes}}'`).
|
||||
pub fn volume_sizes(ep: &DockerEndpoint) -> IdeResult<std::collections::BTreeMap<String, String>> {
|
||||
if docker_executable().is_none()
|
||||
&& let Some(sizes) = engine::volume_sizes(ep, QUICK)
|
||||
{
|
||||
return sizes;
|
||||
}
|
||||
let out = run(ep, &["system", "df", "-v", "--format", "{{json .Volumes}}"], QUICK)?;
|
||||
Ok(parse_volume_sizes(&out))
|
||||
}
|
||||
|
||||
/// How long log lines collect before they are handed on together.
|
||||
const LOG_BATCH: Duration = Duration::from_millis(30);
|
||||
|
||||
|
||||
@@ -473,33 +473,6 @@ pub fn parse_container_stats(text: &str) -> Option<DockerContainerStats> {
|
||||
})
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Default)]
|
||||
#[serde(rename_all = "PascalCase", default)]
|
||||
struct RawVolumeUsage {
|
||||
name: String,
|
||||
size: String,
|
||||
}
|
||||
|
||||
/// `docker system df -v --format '{{json .Volumes}}'` volume name → human size.
|
||||
pub fn parse_volume_sizes(text: &str) -> BTreeMap<String, String> {
|
||||
let trimmed = text.trim();
|
||||
let items: Vec<RawVolumeUsage> = if trimmed.is_empty() || trimmed == "null" {
|
||||
Vec::new()
|
||||
} else if let Ok(parsed) = serde_json::from_str::<Option<Vec<RawVolumeUsage>>>(trimmed) {
|
||||
parsed.unwrap_or_default()
|
||||
} else {
|
||||
lines::<RawVolumeUsage>(text).collect()
|
||||
};
|
||||
items
|
||||
.into_iter()
|
||||
.filter(|v| {
|
||||
let size = v.size.trim();
|
||||
!v.name.is_empty() && !size.is_empty() && !size.eq_ignore_ascii_case("n/a")
|
||||
})
|
||||
.map(|v| (v.name, v.size.trim().to_owned()))
|
||||
.collect()
|
||||
}
|
||||
|
||||
#[derive(Deserialize, Default)]
|
||||
#[serde(default)]
|
||||
struct RawVersion {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
use ide_docker::{
|
||||
PS_FORMAT, parse_container_stats, parse_container_top, parse_containers, parse_image_history, parse_images,
|
||||
parse_networks, parse_volume_sizes, parse_volumes,
|
||||
parse_networks, parse_volumes,
|
||||
};
|
||||
|
||||
const PS: &str = include_str!("fixtures/ps.jsonl");
|
||||
@@ -113,12 +113,4 @@ fn image_history_top_and_stats() {
|
||||
assert_eq!(stats.net_io, "12kB / 8kB");
|
||||
assert_eq!(stats.block_io, "1.2MB / 0B");
|
||||
assert_eq!(stats.pids, "14");
|
||||
|
||||
let df_volumes = r#"[{"Availability":"N/A","Driver":"local","Links":"4","Mountpoint":"/var/lib/docker/volumes/selfhost_runner-persist/_data","Name":"selfhost_runner-persist","Scope":"local","Size":"145.4kB"},{"Name":"unused_anon","Size":"0B"},{"Name":"remote_nfs","Size":"N/A"}]"#;
|
||||
let volume_sizes = parse_volume_sizes(df_volumes);
|
||||
assert_eq!(volume_sizes.get("selfhost_runner-persist").map(String::as_str), Some("145.4kB"));
|
||||
assert_eq!(volume_sizes.get("unused_anon").map(String::as_str), Some("0B"));
|
||||
assert!(!volume_sizes.contains_key("remote_nfs"));
|
||||
assert!(parse_volume_sizes("null\n").is_empty());
|
||||
assert!(parse_volume_sizes("").is_empty());
|
||||
}
|
||||
@@ -128,9 +128,7 @@ struct Smoke {
|
||||
}
|
||||
|
||||
fn fixture_dir(name: &str) -> PathBuf {
|
||||
let manifest_dir =
|
||||
std::env::var_os("CARGO_MANIFEST_DIR").map_or_else(|| PathBuf::from(env!("CARGO_MANIFEST_DIR")), PathBuf::from);
|
||||
manifest_dir.join("../../fixtures").join(name)
|
||||
Path::new(env!("CARGO_MANIFEST_DIR")).join("../../fixtures").join(name)
|
||||
}
|
||||
|
||||
fn copy_dir(from: &Path, to: &Path) {
|
||||
|
||||
@@ -53,9 +53,7 @@ fn copy_dir(from: &Path, to: &Path) {
|
||||
async fn open(fixture: &str) -> Opened {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
let root = dunce::canonicalize(tmp.path()).unwrap().join(fixture);
|
||||
let manifest_dir =
|
||||
std::env::var_os("CARGO_MANIFEST_DIR").map_or_else(|| PathBuf::from(env!("CARGO_MANIFEST_DIR")), PathBuf::from);
|
||||
copy_dir(&manifest_dir.join("../../fixtures").join(fixture), &root);
|
||||
copy_dir(&Path::new(env!("CARGO_MANIFEST_DIR")).join("../../fixtures").join(fixture), &root);
|
||||
let app = tmp.path().join("app");
|
||||
let host = Arc::new(Host::new(common::host_config(&app)));
|
||||
host.trust.decide(&root, true, false).unwrap();
|
||||
|
||||
@@ -1328,15 +1328,10 @@ impl Repo {
|
||||
/// Reference names and peeled commit ids, including tags and detached HEAD.
|
||||
pub fn log_refs(&self) -> IdeResult<std::collections::BTreeMap<String, String>> {
|
||||
let repo = self.gix()?;
|
||||
let (decorations, _) = self.ref_decorations(&repo)?;
|
||||
let mut refs = std::collections::BTreeMap::new();
|
||||
for (id, names) in decorations.iter() {
|
||||
let id = id.to_string();
|
||||
for name in names {
|
||||
refs.insert(name.clone(), id.clone());
|
||||
}
|
||||
}
|
||||
Ok(refs)
|
||||
Ok(history::decorations(&repo)?
|
||||
.into_iter()
|
||||
.flat_map(|(id, names)| names.into_iter().map(move |name| (name, id.to_string())))
|
||||
.collect())
|
||||
}
|
||||
pub fn log_users(&self) -> IdeResult<Vec<String>> {
|
||||
let _scope = self.execution_scope();
|
||||
@@ -1493,8 +1488,7 @@ impl Repo {
|
||||
/// Local and remote branches; the current branch first, then most recent first.
|
||||
pub fn branches(&self) -> IdeResult<Vec<Branch>> {
|
||||
let _scope = self.execution_scope();
|
||||
let repo = self.gix()?;
|
||||
self.cached_branches(&repo)
|
||||
refs::branches(self)
|
||||
}
|
||||
/// Stash entries, newest (`stash@{0}`) first.
|
||||
pub fn stashes(&self) -> IdeResult<Vec<Stash>> {
|
||||
|
||||
@@ -4,11 +4,9 @@
|
||||
//! even for a one-row page. A page now stats `HEAD`, `packed-refs` and the directories under
|
||||
//! `refs/` instead: git replaces a loose ref by renaming a lock file over it, which changes
|
||||
//! the modification time of the ref's directory, and rewrites `packed-refs` the same way.
|
||||
//! Branch lists reuse the same snapshot because their ref walk and ahead/behind work are
|
||||
//! otherwise repeated for every VCS view refresh.
|
||||
|
||||
use crate::Repo;
|
||||
use crate::repo::absolute;
|
||||
use crate::{Branch, Repo};
|
||||
use gix::ObjectId;
|
||||
use ide_core::IdeResult;
|
||||
use std::collections::HashMap;
|
||||
@@ -26,7 +24,6 @@ pub(crate) type Decorations = Arc<HashMap<ObjectId, Vec<String>>>;
|
||||
#[derive(Default)]
|
||||
pub(crate) struct RefDecorations {
|
||||
snapshot: Option<Snapshot>,
|
||||
branches: Option<BranchSnapshot>,
|
||||
/// Changes when the decorations do, so cached views of them can be keyed by it.
|
||||
generation: u64,
|
||||
}
|
||||
@@ -37,37 +34,11 @@ struct Snapshot {
|
||||
reusable: bool,
|
||||
}
|
||||
|
||||
struct BranchSnapshot {
|
||||
branches: Vec<Branch>,
|
||||
generation: u64,
|
||||
/// The exact ref stamp also catches a checkout of another branch at the same commit.
|
||||
references: Vec<(PathBuf, Stat)>,
|
||||
trusted: bool,
|
||||
configuration: Vec<(PathBuf, Stat)>,
|
||||
reusable: bool,
|
||||
}
|
||||
|
||||
fn stat(path: &Path) -> Stat {
|
||||
let metadata = std::fs::metadata(path).ok()?;
|
||||
Some((metadata.modified().ok()?, metadata.len()))
|
||||
}
|
||||
|
||||
fn reusable(stamp: &[(PathBuf, Stat)], taken: SystemTime) -> bool {
|
||||
stamp.iter().all(|(_, stat)| stat.is_none_or(|(modified, _)| modified + RACY_WINDOW <= taken))
|
||||
}
|
||||
|
||||
fn configuration_stamp(git_dir: &Path, common_dir: &Path) -> Vec<(PathBuf, Stat)> {
|
||||
[
|
||||
common_dir.join("config"),
|
||||
git_dir.join("config.worktree"),
|
||||
common_dir.join("config.worktree"),
|
||||
common_dir.join("shallow"),
|
||||
]
|
||||
.into_iter()
|
||||
.map(|path| (path.clone(), stat(&path)))
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// `HEAD`, `packed-refs` and every directory under `refs/`.
|
||||
fn stamp(git_dir: &Path, common_dir: &Path) -> Vec<(PathBuf, Stat)> {
|
||||
let mut paths = vec![git_dir.join("HEAD"), common_dir.join("packed-refs")];
|
||||
@@ -93,7 +64,7 @@ impl RefDecorations {
|
||||
let taken = SystemTime::now();
|
||||
let stamp = stamp(git_dir, common_dir);
|
||||
let map = crate::history::decorations(repo)?;
|
||||
let reusable = reusable(&stamp, taken);
|
||||
let reusable = stamp.iter().all(|(_, stat)| stat.is_none_or(|(modified, _)| modified + RACY_WINDOW <= taken));
|
||||
let unchanged = self.snapshot.as_ref().is_some_and(|old| *old.map == map);
|
||||
let map = match &self.snapshot {
|
||||
Some(old) if unchanged => old.map.clone(),
|
||||
@@ -105,45 +76,6 @@ impl RefDecorations {
|
||||
self.snapshot = Some(Snapshot { map: map.clone(), stamp, reusable });
|
||||
Ok((map, self.generation))
|
||||
}
|
||||
|
||||
fn branches(
|
||||
&mut self,
|
||||
repo: &gix::Repository,
|
||||
git_dir: &Path,
|
||||
common_dir: &Path,
|
||||
trusted: bool,
|
||||
) -> IdeResult<Vec<Branch>> {
|
||||
let (_, generation) = self.get(repo, git_dir, common_dir)?;
|
||||
let references = self
|
||||
.snapshot
|
||||
.as_ref()
|
||||
.ok_or_else(|| ide_core::IdeError::internal("reference cache did not populate a snapshot"))?
|
||||
.stamp
|
||||
.clone();
|
||||
let taken = SystemTime::now();
|
||||
let configuration = configuration_stamp(git_dir, common_dir);
|
||||
if let Some(snapshot) = &self.branches
|
||||
&& snapshot.reusable
|
||||
&& snapshot.generation == generation
|
||||
&& snapshot.references == references
|
||||
&& snapshot.trusted == trusted
|
||||
&& snapshot.configuration == configuration
|
||||
{
|
||||
return Ok(snapshot.branches.clone());
|
||||
}
|
||||
let branches = crate::refs::branches(repo)?;
|
||||
let reusable =
|
||||
self.snapshot.as_ref().is_some_and(|snapshot| snapshot.reusable) && reusable(&configuration, taken);
|
||||
self.branches = Some(BranchSnapshot {
|
||||
branches: branches.clone(),
|
||||
generation,
|
||||
references,
|
||||
trusted,
|
||||
configuration,
|
||||
reusable,
|
||||
});
|
||||
Ok(branches)
|
||||
}
|
||||
}
|
||||
|
||||
impl Repo {
|
||||
@@ -152,17 +84,6 @@ impl Repo {
|
||||
let common_dir = absolute(repo.common_dir())?;
|
||||
self.ref_decorations.lock().unwrap_or_else(|p| p.into_inner()).get(repo, &self.git_dir, &common_dir)
|
||||
}
|
||||
|
||||
pub(crate) fn cached_branches(&self, repo: &gix::Repository) -> IdeResult<Vec<Branch>> {
|
||||
let common_dir = absolute(repo.common_dir())?;
|
||||
let trusted = self.execution_allowed.load(std::sync::atomic::Ordering::Acquire);
|
||||
self.ref_decorations.lock().unwrap_or_else(|p| p.into_inner()).branches(
|
||||
repo,
|
||||
&self.git_dir,
|
||||
&common_dir,
|
||||
trusted,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
@@ -191,18 +112,11 @@ mod tests {
|
||||
git(dir, &["rev-parse", "HEAD"])
|
||||
}
|
||||
|
||||
/// Sets the modification time of every metadata path used by the ref and branch caches.
|
||||
/// Sets the modification time of `HEAD`, `packed-refs` and every directory under `refs/`.
|
||||
fn set_ref_times(repo: &Repo, time: SystemTime) {
|
||||
let [git, common] = repo.metadata_dirs().unwrap();
|
||||
let mut paths = vec![
|
||||
git.join("HEAD"),
|
||||
common.join("packed-refs"),
|
||||
common.join("config"),
|
||||
git.join("config.worktree"),
|
||||
common.join("config.worktree"),
|
||||
common.join("shallow"),
|
||||
];
|
||||
let mut pending = vec![common.join("refs")];
|
||||
let git = repo.git_dir.clone();
|
||||
let mut paths = vec![git.join("HEAD"), git.join("packed-refs")];
|
||||
let mut pending = vec![git.join("refs")];
|
||||
while let Some(dir) = pending.pop() {
|
||||
pending.extend(std::fs::read_dir(&dir).unwrap().flatten().filter(|e| e.path().is_dir()).map(|e| e.path()));
|
||||
paths.push(dir);
|
||||
@@ -261,68 +175,6 @@ mod tests {
|
||||
assert_eq!(decorations_scans(), after_first, "a warm page listed the refs again");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn warm_log_refs_do_not_list_the_refs() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
let dir = tmp.path();
|
||||
git(dir, &["init", "-q"]);
|
||||
commit(dir, "first");
|
||||
for i in 0..20 {
|
||||
git(dir, &["branch", &format!("b{i}")]);
|
||||
}
|
||||
let repo = Repo::discover(dir).unwrap().unwrap();
|
||||
settle(&repo);
|
||||
let after_first = decorations_scans();
|
||||
for _ in 0..5 {
|
||||
assert!(repo.log_refs().unwrap().contains_key("main"));
|
||||
}
|
||||
assert_eq!(decorations_scans(), after_first, "warm log refs listed the refs again");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn warm_branch_lists_reuse_the_ref_walk() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
let dir = tmp.path();
|
||||
git(dir, &["init", "-q"]);
|
||||
let first = commit(dir, "first");
|
||||
git(dir, &["remote", "add", "origin", "."]);
|
||||
git(dir, &["update-ref", "refs/remotes/origin/main", &first]);
|
||||
let repo = Repo::discover(dir).unwrap().unwrap();
|
||||
repo.set_execution_allowed(true);
|
||||
set_ref_times(&repo, SystemTime::now() - Duration::from_secs(3600));
|
||||
let scans = crate::refs::branch_scans();
|
||||
assert!(repo.branches().unwrap().iter().any(|branch| branch.name == "origin/main"));
|
||||
let after_first = crate::refs::branch_scans();
|
||||
assert!(after_first > scans);
|
||||
for _ in 0..5 {
|
||||
repo.branches().unwrap();
|
||||
}
|
||||
assert_eq!(crate::refs::branch_scans(), after_first, "warm branch list walked the refs again");
|
||||
|
||||
git(dir, &["branch", "side"]);
|
||||
assert!(repo.branches().unwrap().iter().any(|branch| branch.name == "side"));
|
||||
assert!(crate::refs::branch_scans() > after_first, "branch creation did not invalidate the cache");
|
||||
|
||||
git(dir, &["checkout", "-q", "side"]);
|
||||
let at_side = repo.branches().unwrap();
|
||||
assert!(at_side.iter().any(|branch| branch.name == "side" && branch.current));
|
||||
assert!(!at_side.iter().any(|branch| branch.name == "main" && branch.current));
|
||||
|
||||
let scans = crate::refs::branch_scans();
|
||||
git(dir, &["config", "branch.main.remote", "origin"]);
|
||||
git(dir, &["config", "branch.main.merge", "refs/heads/main"]);
|
||||
let main = repo.branches().unwrap().into_iter().find(|branch| branch.name == "main").unwrap();
|
||||
assert_eq!(main.upstream.as_deref(), Some("origin/main"));
|
||||
assert!(crate::refs::branch_scans() > scans, "config change did not invalidate the cache");
|
||||
|
||||
repo.set_execution_allowed(false);
|
||||
let restricted = repo.branches().unwrap().into_iter().find(|branch| branch.name == "main").unwrap();
|
||||
assert_eq!(restricted.upstream, None);
|
||||
repo.set_execution_allowed(true);
|
||||
let trusted = repo.branches().unwrap().into_iter().find(|branch| branch.name == "main").unwrap();
|
||||
assert_eq!(trusted.upstream.as_deref(), Some("origin/main"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fresh_ref_timestamps_are_not_trusted() {
|
||||
let tmp = tempfile::tempdir().unwrap();
|
||||
|
||||
@@ -137,17 +137,8 @@ fn commit_time_ms(repo: &gix::Repository, id: gix::ObjectId) -> f64 {
|
||||
repo.find_commit(id).ok().and_then(|c| c.time().ok()).map(|t| t.seconds as f64 * 1000.0).unwrap_or(0.0)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
thread_local!(static BRANCH_SCANS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) });
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) fn branch_scans() -> usize {
|
||||
BRANCH_SCANS.get()
|
||||
}
|
||||
|
||||
pub(crate) fn branches(repo: &gix::Repository) -> IdeResult<Vec<Branch>> {
|
||||
#[cfg(test)]
|
||||
BRANCH_SCANS.set(BRANCH_SCANS.get() + 1);
|
||||
pub(crate) fn branches(r: &Repo) -> IdeResult<Vec<Branch>> {
|
||||
let repo = r.gix()?;
|
||||
let head_name = repo.head_name().map_err(gx)?;
|
||||
let platform = repo.references().map_err(gx)?;
|
||||
let remotes = repo.remote_names();
|
||||
@@ -170,20 +161,20 @@ pub(crate) fn branches(repo: &gix::Repository) -> IdeResult<Vec<Branch>> {
|
||||
ahead: 0,
|
||||
behind: 0,
|
||||
outgoing: None,
|
||||
last_commit_ms: commit_time_ms(repo, id),
|
||||
last_commit_ms: commit_time_ms(&repo, id),
|
||||
commit: id.to_string(),
|
||||
};
|
||||
let mut counted_upstream = None;
|
||||
if let Some((up, up_id)) = upstream_of(repo, full.as_ref()) {
|
||||
if let Some((up, up_id)) = upstream_of(&repo, full.as_ref()) {
|
||||
branch.upstream = Some(up);
|
||||
branch.tracked_tip = configured_upstream(repo, full.as_ref())
|
||||
branch.tracked_tip = configured_upstream(&repo, full.as_ref())
|
||||
.map(|tracking| TrackedTip { tracking, commit: up_id.to_string() });
|
||||
let (a, b) = ahead_behind(repo, id, up_id)?;
|
||||
let (a, b) = ahead_behind(&repo, id, up_id)?;
|
||||
branch.ahead = a;
|
||||
branch.behind = b;
|
||||
counted_upstream = Some((up_id, a));
|
||||
}
|
||||
branch.outgoing = crate::push_preview::outgoing_commits(repo, &remotes, full.as_ref(), id, counted_upstream);
|
||||
branch.outgoing = crate::push_preview::outgoing_commits(&repo, &remotes, full.as_ref(), id, counted_upstream);
|
||||
out.push(branch);
|
||||
}
|
||||
for reference in platform.remote_branches().map_err(gx)? {
|
||||
@@ -203,7 +194,7 @@ pub(crate) fn branches(repo: &gix::Repository) -> IdeResult<Vec<Branch>> {
|
||||
ahead: 0,
|
||||
behind: 0,
|
||||
outgoing: None,
|
||||
last_commit_ms: commit_time_ms(repo, id),
|
||||
last_commit_ms: commit_time_ms(&repo, id),
|
||||
commit: id.to_string(),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -80,12 +80,12 @@ See [Unit and E2E tests](/en/contribute/testing/unit-e2e) for details.
|
||||
|
||||
`.github/workflows/ci.yml` first classifies the changed files, so a docs-only or frontend-only PR skips the jobs it can't affect:
|
||||
|
||||
- **Rust** on macOS, Ubuntu and Windows: `cargo fmt --check` (Linux), clippy with `-D warnings`, `cargo nextest run --workspace`, and a check that `src/bindings.ts` is up to date.
|
||||
- **Rust** on macOS, Ubuntu 22.04 and Windows: `cargo fmt --check` (Linux), clippy with `-D warnings`, `cargo nextest run --workspace`, and a check that `src/bindings.ts` is up to date.
|
||||
- **Remote server**: a static Linux (musl) build of `openidea-server`.
|
||||
- **Plugins**: format, clippy (host and `wasm32-wasip2`) and tests of the SDK, the official plugins and the test fixtures; plugin web pages typechecked and tested; `plugins/build.sh --check`.
|
||||
- **Cargo deny**: `cargo deny check` (licences, advisories, sources).
|
||||
- **Frontend**: typecheck, lint, format check, knip, tests, build.
|
||||
- **E2E**: `pnpm e2e` in Chromium.
|
||||
- **E2E**: `pnpm e2e` in the Playwright container.
|
||||
|
||||
`.github/workflows/language-smoke.yml` runs the [language smoke tests](/en/contribute/testing/smoke) when crates, `languages/`, `fixtures/`, the run/debugger features, `src/platform/` or `smoke/` change.
|
||||
|
||||
|
||||
@@ -69,10 +69,10 @@ Long operations (pull, prune, Compose) show progress at the top with a **Cancel*
|
||||
|
||||
Selecting an item shows tabs in the detail pane:
|
||||
|
||||
- **Compose project**: **Dashboard** (project overview, services with live resource usage, named volumes created by the project with live disk usage).
|
||||
- **Container**: **Dashboard** (overview, live resource usage, port bindings that open in the browser, mounts with live volume disk usage, networks, environment variables, labels), **Log** (last 1,000 lines, following while the container runs, with **Timestamps**), **Processes** (`docker top`) and **Inspect** (the raw JSON).
|
||||
- **Compose project**: **Dashboard** (project overview, services with live resource usage, named volumes created by the project).
|
||||
- **Container**: **Dashboard** (overview, live resource usage, port bindings that open in the browser, mounts, networks, environment variables, labels), **Log** (last 1,000 lines, following while the container runs, with **Timestamps**), **Processes** (`docker top`) and **Inspect** (the raw JSON).
|
||||
- **Image**: **Dashboard** (tags, containers using it, environment, labels), **Layers** and **Inspect**.
|
||||
- **Volume** and **network**: **Dashboard** (including live volume disk usage) and **Inspect**.
|
||||
- **Volume** and **network**: **Dashboard** and **Inspect**.
|
||||
|
||||
**Open Log in Editor** opens the log in an editor tab with **Timestamps**, **Soft-wrap**, **Find in Logs** and **Clear**.
|
||||
|
||||
|
||||
@@ -76,12 +76,12 @@ description: "issue 如何分流、PR 需要包含什么、验证说明如何检
|
||||
|
||||
`.github/workflows/ci.yml` 先按改动的文件分类,只改文档或只改前端的 PR 会跳过与之无关的任务:
|
||||
|
||||
- **Rust**:在 macOS、Ubuntu、Windows 上运行 `cargo fmt --check`(仅 Linux)、带 `-D warnings` 的 clippy、`cargo nextest run --workspace`,并检查 `src/bindings.ts` 是否最新。
|
||||
- **Rust**:在 macOS、Ubuntu 22.04、Windows 上运行 `cargo fmt --check`(仅 Linux)、带 `-D warnings` 的 clippy、`cargo nextest run --workspace`,并检查 `src/bindings.ts` 是否最新。
|
||||
- **Remote server**:`openidea-server` 的静态 Linux(musl)构建。
|
||||
- **Plugins**:SDK、官方插件和测试夹具的格式、clippy(宿主与 `wasm32-wasip2`)和测试;插件 Web 页面的类型检查与测试;`plugins/build.sh --check`。
|
||||
- **Cargo deny**:`cargo deny check`(许可证、安全公告、依赖来源)。
|
||||
- **Frontend**:类型检查、lint、格式检查、knip、测试、构建。
|
||||
- **E2E**:在 Chromium 中运行 `pnpm e2e`。
|
||||
- **E2E**:在 Playwright 容器里运行 `pnpm e2e`。
|
||||
|
||||
当 crates、`languages/`、`fixtures/`、运行/调试功能、`src/platform/` 或 `smoke/` 有改动时,`.github/workflows/language-smoke.yml` 会运行[语言冒烟测试](/zh/contribute/testing/smoke)。
|
||||
|
||||
|
||||
@@ -69,10 +69,10 @@ OpenIDEA 通过 `docker` 命令行操作 Docker,所以只要能提供可用的
|
||||
|
||||
选中某项后,详情区会显示以下标签页:
|
||||
|
||||
- **Compose 项目**:**仪表盘**(项目概览、各服务的实时资源使用情况、该项目创建的命名卷及其实时磁盘占用)。
|
||||
- **容器**:**仪表盘**(概览、实时资源使用情况、可在浏览器中打开的端口绑定、挂载及数据卷实时磁盘占用、网络、环境变量、标签)、**日志**(最近 1,000 行,容器运行时持续跟随,可切换 **时间戳**)、**进程**(`docker top`)和 **检查**(原始 JSON)。
|
||||
- **Compose 项目**:**仪表盘**(项目概览、各服务的实时资源使用情况、该项目创建的命名卷)。
|
||||
- **容器**:**仪表盘**(概览、实时资源使用情况、可在浏览器中打开的端口绑定、挂载、网络、环境变量、标签)、**日志**(最近 1,000 行,容器运行时持续跟随,可切换 **时间戳**)、**进程**(`docker top`)和 **检查**(原始 JSON)。
|
||||
- **镜像**:**仪表盘**(标签、使用它的容器、环境变量、标签)、**镜像层** 和 **检查**。
|
||||
- **卷** 和 **网络**:**仪表盘**(含数据卷实时磁盘占用)和 **检查**。
|
||||
- **卷** 和 **网络**:**仪表盘** 和 **检查**。
|
||||
|
||||
**在编辑器中打开日志** 会在编辑器标签页中打开日志,提供 **时间戳**、**软换行**、**在日志中查找** 和 **清除**。
|
||||
|
||||
|
||||
@@ -787,128 +787,3 @@ test("Docker Compose dashboard keeps its action row pinned when scrolling", asyn
|
||||
expect(afterDown.y).toBe(beforeDown.y);
|
||||
expect(afterBanner.y).toBeLessThan(beforeBanner.y - 100);
|
||||
});
|
||||
|
||||
test("Docker volume, Compose, and container dashboards show volume disk usage", async ({ workbench: page }) => {
|
||||
await stubDesktop(page);
|
||||
await page.evaluate(async () => {
|
||||
(window as unknown as { __volSize: string }).__volSize = "145.4kB";
|
||||
const inspectJson = JSON.stringify([
|
||||
{
|
||||
Created: "2026-11-23T02:37:25Z",
|
||||
State: { Status: "running", Pid: 2048, StartedAt: "2026-11-23T02:37:26Z" },
|
||||
HostConfig: { RestartPolicy: { Name: "unless-stopped", MaximumRetryCount: 0 } },
|
||||
Config: { Entrypoint: [], Cmd: ["./bin/Runner.Listener", "run"], Env: [], Labels: {} },
|
||||
Mounts: [
|
||||
{
|
||||
Type: "volume",
|
||||
Name: "selfhost_runner-persist",
|
||||
Source: "/var/lib/docker/volumes/selfhost_runner-persist/_data",
|
||||
Destination: "/persist",
|
||||
Mode: "rw",
|
||||
RW: true,
|
||||
},
|
||||
],
|
||||
NetworkSettings: { Ports: {}, Networks: {} },
|
||||
},
|
||||
]);
|
||||
const snapshot = {
|
||||
availability: { kind: "ready", clientVersion: "28.0.1", serverVersion: "28.0.1", context: "desktop-linux" },
|
||||
executable: "/usr/bin/docker",
|
||||
containers: [
|
||||
{
|
||||
id: "runner-1",
|
||||
name: "selfhost-github-runner-1",
|
||||
image: "myoung34/github-runner:latest",
|
||||
command: "./bin/Runner.Listener run",
|
||||
state: "running",
|
||||
status: "Up 24 hours",
|
||||
ports: "",
|
||||
createdAt: "2026-11-23T02:37:25Z",
|
||||
composeProject: "selfhost",
|
||||
composeService: "github-runner-1",
|
||||
composeWorkingDir: "/work/selfhost",
|
||||
composeFiles: ["/work/selfhost/docker-compose.yml"],
|
||||
mounts: ["selfhost_runner-persist"],
|
||||
networks: ["selfhost_default"],
|
||||
},
|
||||
],
|
||||
images: [],
|
||||
volumes: [
|
||||
{
|
||||
name: "selfhost_runner-persist",
|
||||
driver: "local",
|
||||
mountpoint: "/var/lib/docker/volumes/selfhost_runner-persist/_data",
|
||||
composeProject: "selfhost",
|
||||
scope: "local",
|
||||
labels: {
|
||||
"com.docker.compose.project": "selfhost",
|
||||
"com.docker.compose.volume": "runner-persist",
|
||||
},
|
||||
},
|
||||
],
|
||||
networks: [
|
||||
{ id: "net-1", name: "selfhost_default", driver: "bridge", scope: "local", composeProject: "selfhost" },
|
||||
],
|
||||
errors: [],
|
||||
};
|
||||
|
||||
window.__ipc.handlers.docker_settings = () => ({
|
||||
connections: [{ id: "default", name: "Docker", endpoint: { kind: "default" } }],
|
||||
registries: [],
|
||||
});
|
||||
window.__ipc.handlers.docker_snapshot = () => snapshot;
|
||||
window.__ipc.handlers.docker_events = () => new Promise(() => {});
|
||||
window.__ipc.handlers.docker_inspect = () => inspectJson;
|
||||
window.__ipc.handlers.docker_container_stats = () => ({
|
||||
cpuPerc: "0.02%",
|
||||
memUsage: "96MiB / 114GiB",
|
||||
memPerc: "0.08%",
|
||||
netIo: "1.1MB / 3.8MB",
|
||||
blockIo: "512kB / 201kB",
|
||||
pids: "16",
|
||||
});
|
||||
window.__ipc.handlers.docker_volume_sizes = () => ({
|
||||
"selfhost_runner-persist": (window as unknown as { __volSize: string }).__volSize,
|
||||
});
|
||||
|
||||
const storeMod = "/src/features/services/store.ts";
|
||||
const treeMod = "/src/features/services/tree.ts";
|
||||
const { useServices } = await import(/* @vite-ignore */ storeMod);
|
||||
const { useServicesTree } = await import(/* @vite-ignore */ treeMod);
|
||||
useServices.setState({
|
||||
settings: { connections: [{ id: "default", name: "Docker", endpoint: { kind: "default" } }], registries: [] },
|
||||
conns: { default: { snapshot, loading: false, error: null } },
|
||||
detailTab: "dashboard",
|
||||
});
|
||||
useServicesTree.setState({
|
||||
expanded: new Set(["docker:default"]),
|
||||
selectedKey: "docker:default:compose:selfhost",
|
||||
selectedKeys: new Set(["docker:default:compose:selfhost"]),
|
||||
});
|
||||
});
|
||||
|
||||
await page.keyboard.press("Meta+8");
|
||||
const services = page.getByRole("region", { name: "Services", exact: true });
|
||||
const detail = services.locator("[data-panel][id=services-detail]");
|
||||
|
||||
// 1. Compose dashboard shows volume disk usage on the chip and the banner.
|
||||
const volumeChip = detail.getByRole("button", { name: /selfhost_runner-persist/ });
|
||||
await expect(volumeChip).toContainText("runner-persist · local · 145.4kB");
|
||||
await expect(detail).toContainText("Disk usage: 145.4kB");
|
||||
|
||||
// 2. Opening the volume samples again; the dashboard shows the current size.
|
||||
await page.evaluate(() => {
|
||||
(window as unknown as { __volSize: string }).__volSize = "210.8kB";
|
||||
});
|
||||
await volumeChip.click();
|
||||
await expect(detail.getByText("Volume Overview")).toBeVisible();
|
||||
await expect(detail).toContainText("210.8kB");
|
||||
|
||||
// 3. The container dashboard shows the size beside the volume mount.
|
||||
await page.evaluate(() => {
|
||||
(window as unknown as { __volSize: string }).__volSize = "380.2kB";
|
||||
});
|
||||
await detail.getByRole("button", { name: /selfhost-github-runner-1/ }).click();
|
||||
await expect(detail.getByText("Volume & Bind Mounts")).toBeVisible();
|
||||
await expect(detail).toContainText("380.2kB");
|
||||
});
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
"name": "openidea",
|
||||
"private": true,
|
||||
"description": "An open-source IDE inspired by IntelliJ IDEA",
|
||||
"version": "0.1.51",
|
||||
"version": "0.1.50",
|
||||
"license": "Apache-2.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
Runs _N_ persistent, isolated GitHub Actions runners via Docker Compose on a single Docker named volume (`runner-persist`) without requiring repository admin Personal Access Tokens.
|
||||
|
||||
In `.github/workflows/ci.yml` and `.github/workflows/language-smoke.yml`, every Linux job routes to `["self-hosted", "openidea-selfhosted"]` on trusted events (`push`, `merge_group`, `workflow_dispatch`, and same-repo pull requests) while the `SELFHOSTED_RUNNERS` repository variable is `true`. Fork pull requests, and every run while the variable is unset, fall back to `ubuntu-latest`. Workflows triggered on `pull_request_target` with write-scoped `GITHUB_TOKEN` permissions (`pr-check.yml`, `cancel-on-close.yml`) stay on `ubuntu-latest`.
|
||||
In `.github/workflows/ci.yml`, the Linux leg of `Rust (${{ matrix.os }})` routes to `["self-hosted", "openidea-selfhosted"]` on trusted events (`push`, `merge_group`, `workflow_dispatch`, and same-repo pull requests) while the `SELFHOSTED_RUNNERS` repository variable is `true`. Fork pull requests, and every run while the variable is unset, use GitHub-hosted runners.
|
||||
|
||||
> **Availability requirement:** GitHub Actions `runs-on` cannot fall back to GitHub-hosted runners when no matching self-hosted runner is online; jobs stay queued until one connects. Set `SELFHOSTED_RUNNERS=true` (**Settings → Secrets and variables → Actions → Variables**) only once the runners are up, and delete it before taking the host down.
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
services:
|
||||
github-runner:
|
||||
image: myoung34/github-runner:2.338.2-ubuntu-noble@sha256:23e3a4a1da30de5b462ad0ae13d901288e803a688075c3b9b5bb79b7148c07fa
|
||||
image: myoung34/github-runner:2.338.2-ubuntu-jammy@sha256:9944eb7fe15cff8f31ce6389a1cd39f5fb32627f56bdfa8a21fb27e56e99fa1a
|
||||
restart: unless-stopped
|
||||
deploy:
|
||||
replicas: ${RUNNER_COUNT:-4}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package openidea:[email protected]5.0;
|
||||
package openidea:[email protected]4.0;
|
||||
|
||||
/// The commit being prepared in the window the current command or event came
|
||||
/// from (the Commit tool window, or the Commit dialog while it is open): the
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package openidea:[email protected]5.0;
|
||||
package openidea:[email protected]4.0;
|
||||
|
||||
/// Plugin-owned project data sources. Requires database.sources and project trust.
|
||||
/// Runs on the Database subsystem's host, including on remote project servers.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package openidea:[email protected]5.0;
|
||||
package openidea:[email protected]4.0;
|
||||
|
||||
/// Editor and project-tree decorations (API 1.4). Requires project.read. An editor set
|
||||
/// follows its file: the file's own project, or the nearest one when it is outside them all.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package openidea:[email protected]5.0;
|
||||
package openidea:[email protected]4.0;
|
||||
|
||||
/// What the pane beside the Services tree shows for a plugin's node.
|
||||
interface detail-types {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package openidea:[email protected]5.0;
|
||||
package openidea:[email protected]4.0;
|
||||
|
||||
/// Optional export (world `plugin-diagnostics`): problems in the current,
|
||||
/// possibly unsaved document, for the languages declared with the
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package openidea:[email protected]5.0;
|
||||
package openidea:[email protected]4.0;
|
||||
|
||||
/// HTTP endpoints found in a project (`[[contributes.endpoints]]`).
|
||||
interface endpoints-provider {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package openidea:[email protected]5.0;
|
||||
package openidea:[email protected]4.0;
|
||||
|
||||
/// Workbench events, delivered in batches to `event-handler.handle`.
|
||||
interface events {
|
||||
@@ -35,13 +35,9 @@ interface events {
|
||||
/// API 1.5 also delivers `extensions-changed` (JSON array of the extension
|
||||
/// points this plugin declares whose contributions changed) through `other`,
|
||||
/// to the declaring plugin only and without a capability.
|
||||
/// API 1.15 also delivers `caret-moved` (JSON {path, line, col, settled},
|
||||
/// 0-based UTF-16 positions, when the caret moves in the focused editor;
|
||||
/// `settled` is true for the final position once the caret rests, so costly
|
||||
/// work waits for it; it requires `events`) through `other`.
|
||||
/// Kinds: `file-opened`, `file-saved`, `document-changed` (versioned UTF-16
|
||||
/// replacements from explicit path subscriptions), `websocket-ready`
|
||||
/// (a host-owned connection has messages to drain), `caret-moved`, `files-changed` (batched disk changes
|
||||
/// (a host-owned connection has messages to drain), `files-changed` (batched disk changes
|
||||
/// as `other`, with created/modified/removed path lists in JSON), `editor-focused` (the focused editor
|
||||
/// changed), `vcs-changed` (a repository's state changed: commit,
|
||||
/// checkout, fetch…), `action-performed` (an IDE action ran) and
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package openidea:[email protected]5.0;
|
||||
package openidea:[email protected]4.0;
|
||||
|
||||
interface lifecycle {
|
||||
use types.{context, error};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package openidea:[email protected]5.0;
|
||||
package openidea:[email protected]4.0;
|
||||
|
||||
/// What other plugins contributed to the extension points this plugin declares
|
||||
/// (`[[extension-points]]` in `plugin.toml`; the contributors list this plugin
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package openidea:[email protected]5.0;
|
||||
package openidea:[email protected]4.0;
|
||||
|
||||
/// Optional export (world `plugin-file-actions`): quick fixes and
|
||||
/// refactorings that create, rename or delete files, next to the text edits
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package openidea:[email protected]5.0;
|
||||
package openidea:[email protected]4.0;
|
||||
|
||||
/// Files outside the open projects: the configuration of the program a
|
||||
/// plugin integrates with, a tool installed elsewhere, a licence file.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package openidea:[email protected]5.0;
|
||||
package openidea:[email protected]4.0;
|
||||
|
||||
/// Writes to the IDE log, tagged with the plugin id.
|
||||
interface log {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package openidea:[email protected]5.0;
|
||||
package openidea:[email protected]4.0;
|
||||
|
||||
/// Optional export (world `plugin-hover-actions`): clickable actions rendered
|
||||
/// at the left edge of a line and revealed while the pointer is in the leftmost
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package openidea:[email protected]5.0;
|
||||
package openidea:[email protected]4.0;
|
||||
|
||||
/// Optional export (world `plugin-hover`): Markdown added to the hover of
|
||||
/// documents of the languages declared with the `hover` provider kind,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package openidea:[email protected]5.0;
|
||||
package openidea:[email protected]4.0;
|
||||
|
||||
/// Cross-file associations a plugin publishes for the files it declares under
|
||||
/// `[[contributes.documentIndexers]]`. The host calls `index` in cancellable
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package openidea:[email protected]5.0;
|
||||
package openidea:[email protected]4.0;
|
||||
|
||||
/// Embedded languages. The host routes plugin providers and configured language
|
||||
/// servers inside these ranges, preserving host-document UTF-16 coordinates.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package openidea:[email protected]5.0;
|
||||
package openidea:[email protected]4.0;
|
||||
|
||||
/// Optional export (world `plugin-inlay-hints`): inline hints in documents of
|
||||
/// the languages declared with the `inlay-hints` provider kind, including
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package openidea:[email protected]5.0;
|
||||
package openidea:[email protected]4.0;
|
||||
|
||||
/// Problems in files, shown in the editor and the Problems view.
|
||||
interface diagnostics {
|
||||
@@ -138,14 +138,6 @@ interface process {
|
||||
stderr: string,
|
||||
}
|
||||
|
||||
/// Options for running a program with configurable capture or streaming (API 1.15).
|
||||
record process-options {
|
||||
/// Maximum bytes captured per stream before returning an error (up to 128 MiB; default 16 MiB).
|
||||
max-output-bytes: option<u32>,
|
||||
/// In-flight buffer size per stream for streaming backpressure (default 256 KiB, max 4 MiB).
|
||||
buffer-bytes: option<u32>,
|
||||
}
|
||||
|
||||
/// What to run (API 1.3). `env` only adds variables: an existing name in
|
||||
/// the prepared child environment (including the login-shell PATH) is an
|
||||
/// error naming that key; nothing is replaced or removed. Names compare
|
||||
@@ -202,17 +194,6 @@ interface process {
|
||||
/// handle to it without waiting (API 1.3). Closing the invoking window
|
||||
/// also ends its processes.
|
||||
start: func(cmd: command, cwd: option<borrow<project>>) -> result<child, error>;
|
||||
|
||||
/// Runs `cmd` with configurable capture limits (API 1.15).
|
||||
/// Both stdout and stderr are captured losslessly up to `options.max-output-bytes`.
|
||||
/// Exceeding the limit on either stream returns an explicit error naming that stream.
|
||||
run-captured: func(cmd: command, cwd: option<borrow<project>>, stdin: option<string>, options: option<process-options>) -> result<output, error>;
|
||||
|
||||
/// Starts `cmd` with backpressure-driven lossless streaming (API 1.15).
|
||||
/// If the unread buffer reaches `buffer-bytes`, the reader pauses and the child blocks
|
||||
/// on its pipe, preventing head truncation. If total output exceeds `max-output-bytes`,
|
||||
/// polling returns an explicit error.
|
||||
start-stream: func(cmd: command, cwd: option<borrow<project>>, options: option<process-options>) -> result<child, error>;
|
||||
}
|
||||
|
||||
/// Local sockets on the project machine, including the server for remote projects.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package openidea:[email protected]5.0;
|
||||
package openidea:[email protected]4.0;
|
||||
|
||||
/// Additional language features, called only for declared API 1.4 provider kinds.
|
||||
/// Editor calls have a 50 ms soft / 500 ms hard budget; formatting has 5 seconds.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package openidea:[email protected]5.0;
|
||||
package openidea:[email protected]4.0;
|
||||
|
||||
/// Discovery of the IDE's built-in MCP server; never exposes its URL or token.
|
||||
interface mcp {
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
/// `fs` and `workspace`, and everything else goes through the imports below,
|
||||
/// gated by the capabilities granted in `plugin.toml` (a missing one returns
|
||||
/// `error::denied`).
|
||||
package openidea:[email protected]5.0;
|
||||
package openidea:[email protected]4.0;
|
||||
|
||||
world plugin {
|
||||
import log;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package openidea:[email protected]5.0;
|
||||
package openidea:[email protected]4.0;
|
||||
|
||||
/// Editor features a plugin provides for the languages it declares under
|
||||
/// `[[contributes.providers]]` (the host calls only declared kinds). They run
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package openidea:[email protected]5.0;
|
||||
package openidea:[email protected]4.0;
|
||||
|
||||
/// Project-scoped targets owned by the registering plugin (API 1.4).
|
||||
interface run-targets {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package openidea:[email protected]5.0;
|
||||
package openidea:[email protected]4.0;
|
||||
|
||||
/// Launches this plugin's configurations in the invoking window's Run tool window.
|
||||
interface run {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package openidea:[email protected]5.0;
|
||||
package openidea:[email protected]4.0;
|
||||
|
||||
/// On-demand results for `[[contributes.searchCategories]]`. Optional, API 1.13.
|
||||
interface search-provider {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package openidea:[email protected]5.0;
|
||||
package openidea:[email protected]4.0;
|
||||
|
||||
/// Optional export (world `plugin-semantic-tokens`): semantic colouring of
|
||||
/// documents of the languages declared with the `semantic-tokens` provider
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package openidea:[email protected]5.0;
|
||||
package openidea:[email protected]4.0;
|
||||
|
||||
/// Shared types. Positions are 0-based lines and UTF-16 code unit columns,
|
||||
/// as in the editor and LSP.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package openidea:[email protected]5.0;
|
||||
package openidea:[email protected]4.0;
|
||||
|
||||
/// Declarative views: tool windows declared
|
||||
/// under `[[contributes.views]]` and custom editors under
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package openidea:[email protected]5.0;
|
||||
package openidea:[email protected]4.0;
|
||||
|
||||
interface workspace {
|
||||
use types.{error, location};
|
||||
|
||||
@@ -130,18 +130,6 @@ pub async fn docker_container_stats(
|
||||
blocking(move || ide_docker::container_stats(&endpoint, &id)).await
|
||||
}
|
||||
|
||||
/// Disk usage per volume name (`docker system df -v`).
|
||||
#[desktop_command(trust = trusted)]
|
||||
#[tauri::command]
|
||||
#[specta::specta]
|
||||
pub async fn docker_volume_sizes(
|
||||
state: State<'_, AppState>,
|
||||
endpoint: DockerEndpoint,
|
||||
) -> IdeResult<std::collections::BTreeMap<String, String>> {
|
||||
let endpoint = resolve(&state, endpoint).await?;
|
||||
blocking(move || ide_docker::volume_sizes(&endpoint)).await
|
||||
}
|
||||
|
||||
/// Streams a container's log lines, in batches, until it stops or the request is cancelled.
|
||||
#[desktop_command(trust = trusted)]
|
||||
#[tauri::command]
|
||||
@@ -320,5 +308,4 @@ ide_command::desktop_domain!(
|
||||
docker_set_registry_password,
|
||||
docker_settings,
|
||||
docker_snapshot,
|
||||
docker_volume_sizes,
|
||||
);
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "OpenIDEA",
|
||||
"version": "0.1.51",
|
||||
"version": "0.1.50",
|
||||
"identifier": "ai.l0ng.openidea",
|
||||
"build": {
|
||||
"beforeDevCommand": "pnpm dev",
|
||||
|
||||
@@ -258,7 +258,6 @@ docker_save_settings always desktop bin
|
||||
docker_set_registry_password always desktop bindings async
|
||||
docker_settings always desktop bindings async
|
||||
docker_snapshot trusted desktop bindings async
|
||||
docker_volume_sizes trusted desktop bindings async
|
||||
end_process trusted desktop bindings async
|
||||
env_reload always project_host bindings async
|
||||
file_dialog_needs_gtk trusted desktop bindings async
|
||||
|
||||
@@ -637,8 +637,6 @@ export const commands = {
|
||||
dockerSettings: () => typedError<DockerSettings, IdeError>(__TAURI_INVOKE("docker_settings")),
|
||||
/** Availability plus containers, images, volumes and networks. */
|
||||
dockerSnapshot: (endpoint: DockerEndpoint) => typedError<DockerSnapshot, IdeError>(__TAURI_INVOKE("docker_snapshot", { endpoint })),
|
||||
/** Disk usage per volume name (`docker system df -v`). */
|
||||
dockerVolumeSizes: (endpoint: DockerEndpoint) => typedError<{ [key in string]: string }, IdeError>(__TAURI_INVOKE("docker_volume_sizes", { endpoint })),
|
||||
/**
|
||||
* "Clear caches": drops syntax trees and EditorConfig files of the window's
|
||||
* project, shrinks the in-memory index and compacts its on-disk cache.
|
||||
|
||||
@@ -260,10 +260,6 @@
|
||||
.dashboardActions + .sectionBanner {
|
||||
border-top: 0;
|
||||
}
|
||||
.bannerMeta {
|
||||
font-weight: 400;
|
||||
color: var(--fg-secondary);
|
||||
}
|
||||
.propList {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -521,7 +517,7 @@ button.entityChip:not(:disabled):hover {
|
||||
}
|
||||
.dataRow {
|
||||
display: grid;
|
||||
grid-template-columns: 72px minmax(120px, 1fr) minmax(120px, 1.2fr) 88px 56px;
|
||||
grid-template-columns: 72px minmax(120px, 1fr) minmax(140px, 1.3fr) 56px;
|
||||
gap: var(--space-2);
|
||||
align-items: center;
|
||||
padding: 4px 12px;
|
||||
|
||||
@@ -113,20 +113,6 @@ export function bytesToUnits(bytes: number, precision = 1): string {
|
||||
return `${val.toFixed(precision)} ${units[idx]!}`;
|
||||
}
|
||||
|
||||
export function bytesToDecimalUnits(bytes: number): string {
|
||||
if (!Number.isFinite(bytes) || bytes <= 0) return "0B";
|
||||
const units = ["B", "kB", "MB", "GB", "TB", "PB"];
|
||||
let idx = 0;
|
||||
let val = bytes;
|
||||
while (val >= 1000 && idx < units.length - 1) {
|
||||
val /= 1000;
|
||||
idx++;
|
||||
}
|
||||
if (idx === 0) return `${Math.round(val)}B`;
|
||||
const text = val.toFixed(3).replace(/\.?0+$/, "");
|
||||
return `${text}${units[idx]!}`;
|
||||
}
|
||||
|
||||
export function parsePercent(raw: string | undefined | null): number {
|
||||
if (!raw) return 0;
|
||||
const n = Number.parseFloat(raw.replace(/%/g, "").trim());
|
||||
@@ -830,11 +816,9 @@ function ContainerLinkChip({ conn, container }: { conn: string; container: Docke
|
||||
);
|
||||
}
|
||||
|
||||
function VolumeLinkChip({ conn, volume, size }: { conn: string; volume: DockerVolume; size?: string }) {
|
||||
function VolumeLinkChip({ conn, volume }: { conn: string; volume: DockerVolume }) {
|
||||
const composeVol = volume.labels?.["com.docker.compose.volume"];
|
||||
const meta = [composeVol && composeVol !== volume.name ? composeVol : null, volume.driver, size]
|
||||
.filter(Boolean)
|
||||
.join(" · ");
|
||||
const meta = composeVol && composeVol !== volume.name ? `${composeVol} · ${volume.driver}` : volume.driver;
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
@@ -857,9 +841,6 @@ const STATS_CONCURRENCY = 6;
|
||||
/** Default `top` refresh delay (3s) between live `docker stats --no-stream` samples. */
|
||||
export const CONTAINER_STATS_POLL_MS = 3000;
|
||||
|
||||
/** Between `docker system df -v` samples, which make the daemon measure every volume. */
|
||||
export const VOLUME_SIZES_POLL_MS = 30_000;
|
||||
|
||||
async function fetchContainerStatsMap(
|
||||
conn: string,
|
||||
ids: readonly string[],
|
||||
@@ -951,88 +932,6 @@ function useLiveContainerStats(
|
||||
};
|
||||
}
|
||||
|
||||
function useLiveVolumeSizes(
|
||||
conn: string,
|
||||
scopeKey: string,
|
||||
enabled = true,
|
||||
): {
|
||||
byName: Record<string, string>;
|
||||
loading: boolean;
|
||||
} {
|
||||
const shown = useToolWindowShown();
|
||||
const fullScope = `${conn}\0${scopeKey}`;
|
||||
const [sizeState, setSizeState] = useState<{
|
||||
conn: string;
|
||||
byName: Record<string, string>;
|
||||
settledScope: string;
|
||||
}>({ conn: "", byName: {}, settledScope: "" });
|
||||
|
||||
useEffect(() => {
|
||||
if (!enabled || !scopeKey || !shown || !isTauri()) return;
|
||||
let alive = true;
|
||||
let timer: ReturnType<typeof setTimeout> | undefined;
|
||||
let inFlight = false;
|
||||
|
||||
const clearTimer = () => {
|
||||
if (timer !== undefined) {
|
||||
clearTimeout(timer);
|
||||
timer = undefined;
|
||||
}
|
||||
};
|
||||
|
||||
const isDocumentHidden = () => document.visibilityState === "hidden";
|
||||
|
||||
const sample = async () => {
|
||||
clearTimer();
|
||||
if (!alive || inFlight || isDocumentHidden()) return;
|
||||
inFlight = true;
|
||||
try {
|
||||
const raw = await call(commands.dockerVolumeSizes(endpointOf(conn)));
|
||||
if (alive) {
|
||||
const byName: Record<string, string> = {};
|
||||
for (const [k, v] of Object.entries(raw)) {
|
||||
if (v) byName[k] = v;
|
||||
}
|
||||
setSizeState({ conn, byName, settledScope: fullScope });
|
||||
}
|
||||
} catch {
|
||||
if (alive) {
|
||||
setSizeState((prev) => ({
|
||||
conn,
|
||||
byName: prev.conn === conn ? prev.byName : {},
|
||||
settledScope: fullScope,
|
||||
}));
|
||||
}
|
||||
} finally {
|
||||
inFlight = false;
|
||||
if (alive && !isDocumentHidden()) {
|
||||
timer = setTimeout(() => void sample(), VOLUME_SIZES_POLL_MS);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const onVisibility = () => {
|
||||
if (isDocumentHidden()) clearTimer();
|
||||
else void sample();
|
||||
};
|
||||
|
||||
document.addEventListener("visibilitychange", onVisibility);
|
||||
if (!isDocumentHidden()) void sample();
|
||||
|
||||
return () => {
|
||||
alive = false;
|
||||
clearTimer();
|
||||
document.removeEventListener("visibilitychange", onVisibility);
|
||||
};
|
||||
}, [conn, scopeKey, enabled, shown, fullScope]);
|
||||
|
||||
const active = Boolean(enabled && scopeKey) && shown && isTauri();
|
||||
return {
|
||||
byName: sizeState.conn === conn ? sizeState.byName : {},
|
||||
loading: active && sizeState.settledScope !== fullScope,
|
||||
};
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Container Dashboard & Processes View
|
||||
|
||||
@@ -1080,18 +979,6 @@ export function ContainerDashboard({
|
||||
const { byId: statsById, loading: statsLoading } = useLiveContainerStats(conn, running ? container.id : "");
|
||||
const stats = running ? (statsById[container.id] ?? null) : null;
|
||||
|
||||
const mountedVolumesKey = useMemo(() => {
|
||||
const names = inspect?.mounts.length
|
||||
? inspect.mounts.filter((m) => m.type === "volume" && m.name).map((m) => m.name!)
|
||||
: (container.mounts ?? []).filter((m) => snapshot.volumes.some((v) => v.name === m));
|
||||
return [...new Set(names)].sort().join("\0");
|
||||
}, [inspect, container.mounts, snapshot.volumes]);
|
||||
const { byName: volumeSizes, loading: volumeSizesLoading } = useLiveVolumeSizes(
|
||||
conn,
|
||||
mountedVolumesKey,
|
||||
Boolean(mountedVolumesKey),
|
||||
);
|
||||
|
||||
const cpuPct = stats ? parsePercent(stats.cpuPerc) : 0;
|
||||
const memPair = stats ? parseUsagePair(stats.memUsage) : null;
|
||||
const labels = inspect?.labels.length ? inspect.labels : Object.entries(container.labels ?? {});
|
||||
@@ -1334,17 +1221,12 @@ export function ContainerDashboard({
|
||||
<span>
|
||||
<T>Destination</T>
|
||||
</span>
|
||||
<span>
|
||||
<T>Size</T>
|
||||
</span>
|
||||
<span>
|
||||
<T>Mode</T>
|
||||
</span>
|
||||
</div>
|
||||
{inspect.mounts.map((m) => {
|
||||
const volumeName = m.type === "volume" ? m.name : undefined;
|
||||
const volumeObj = volumeName ? snapshot.volumes.find((v) => v.name === volumeName) : undefined;
|
||||
const mountSize = volumeName ? volumeSizes[volumeName] : undefined;
|
||||
const volumeObj = m.name ? snapshot.volumes.find((v) => v.name === m.name) : undefined;
|
||||
return (
|
||||
<div key={`${m.destination}:${m.type}:${m.source}`} className={styles.dataRow}>
|
||||
<span className={styles.badgeMuted}>{m.type}</span>
|
||||
@@ -1369,14 +1251,6 @@ export function ContainerDashboard({
|
||||
<span className={styles.mono} title={m.destination}>
|
||||
{m.destination}
|
||||
</span>
|
||||
<span className={clsx(styles.mono, styles.nowrapCell)}>
|
||||
{mountSize ??
|
||||
(volumeName && volumeSizesLoading ? (
|
||||
<Spinner size={12} />
|
||||
) : (
|
||||
<span className={styles.mutedMeta}>—</span>
|
||||
))}
|
||||
</span>
|
||||
<span className={styles.mono}>{m.rw ? m.mode || "rw" : "ro"}</span>
|
||||
</div>
|
||||
);
|
||||
@@ -1386,13 +1260,24 @@ export function ContainerDashboard({
|
||||
<div className={styles.chipGroup}>
|
||||
{container.mounts.map((m) => {
|
||||
const volumeObj = snapshot.volumes.find((v) => v.name === m);
|
||||
const mountSize = volumeSizes[m];
|
||||
return volumeObj ? (
|
||||
<VolumeLinkChip key={m} conn={conn} volume={volumeObj} size={mountSize} />
|
||||
<button
|
||||
key={m}
|
||||
type="button"
|
||||
className={styles.entityChip}
|
||||
onClick={() => {
|
||||
selectServicesTreeKey(
|
||||
treeKey(conn, { kind: "volume", key: `volume:${volumeObj.name}`, volume: volumeObj }),
|
||||
);
|
||||
showDetail("dashboard");
|
||||
}}
|
||||
>
|
||||
<Icon name="docker-volumes" size={14} />
|
||||
<span className={styles.mono}>{m}</span>
|
||||
</button>
|
||||
) : (
|
||||
<span key={m} className={styles.entityChip}>
|
||||
<span className={styles.mono}>{m}</span>
|
||||
{mountSize && <span className={styles.chipMeta}>{mountSize}</span>}
|
||||
</span>
|
||||
);
|
||||
})}
|
||||
@@ -1784,8 +1669,6 @@ export function VolumeDashboard({
|
||||
const target: DockerTarget = { conn, node: { kind: "volume", key: `volume:${volume.name}`, volume } };
|
||||
const usingContainers = useMemo(() => containersUsingVolume(snapshot, volume), [snapshot, volume]);
|
||||
const labels = Object.entries(volume.labels ?? {}).sort((a, b) => a[0].localeCompare(b[0]));
|
||||
const { byName: volumeSizes, loading: volumeSizesLoading } = useLiveVolumeSizes(conn, volume.name);
|
||||
const diskUsage = volumeSizes[volume.name];
|
||||
|
||||
return (
|
||||
<div className={styles.dashboard} tabIndex={0} onKeyDown={copySelectionOnKeyDown}>
|
||||
@@ -1805,17 +1688,6 @@ export function VolumeDashboard({
|
||||
<PropRow label={<T>Name</T>}>
|
||||
<span className={styles.mono}>{volume.name}</span>
|
||||
</PropRow>
|
||||
<PropRow label={<T>Disk usage</T>}>
|
||||
{diskUsage ? (
|
||||
<span className={styles.mono}>{diskUsage}</span>
|
||||
) : volumeSizesLoading ? (
|
||||
<span className={styles.mutedMeta}>
|
||||
<T>Loading…</T>
|
||||
</span>
|
||||
) : (
|
||||
<span className={styles.mutedMeta}>—</span>
|
||||
)}
|
||||
</PropRow>
|
||||
<PropRow label={<T>Driver</T>}>
|
||||
<span className={styles.mono}>{volume.driver}</span>
|
||||
</PropRow>
|
||||
@@ -2003,21 +1875,6 @@ export function ComposeProjectDashboard({
|
||||
const first = containers[0];
|
||||
const runningCount = containers.filter(isRunning).length;
|
||||
const namedVolumes = useMemo(() => volumesInComposeProject(snapshot, project), [snapshot, project]);
|
||||
const namedVolumesKey = useMemo(
|
||||
() =>
|
||||
namedVolumes
|
||||
.map((v) => v.name)
|
||||
.sort()
|
||||
.join("\0"),
|
||||
[namedVolumes],
|
||||
);
|
||||
const { byName: volumeSizes } = useLiveVolumeSizes(conn, namedVolumesKey, namedVolumes.length > 0);
|
||||
const totalVolumeSize = useMemo(() => {
|
||||
const sizes = namedVolumes.map((v) => volumeSizes[v.name]).filter((s): s is string => Boolean(s));
|
||||
if (sizes.length === 0) return null;
|
||||
if (sizes.length === 1) return sizes[0]!;
|
||||
return bytesToDecimalUnits(sizes.reduce((sum, s) => sum + unitsToBytes(s), 0));
|
||||
}, [namedVolumes, volumeSizes]);
|
||||
|
||||
const runningIdsKey = useMemo(
|
||||
() =>
|
||||
@@ -2172,23 +2029,13 @@ export function ComposeProjectDashboard({
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<SectionBanner
|
||||
action={
|
||||
totalVolumeSize ? (
|
||||
<span className={styles.bannerMeta}>
|
||||
<T>Disk usage</T>
|
||||
{": "}
|
||||
<span className={styles.mono}>{totalVolumeSize}</span>
|
||||
</span>
|
||||
) : undefined
|
||||
}
|
||||
>
|
||||
<SectionBanner>
|
||||
<T>Volumes</T>
|
||||
</SectionBanner>
|
||||
{namedVolumes.length > 0 ? (
|
||||
<div className={styles.chipGroup}>
|
||||
{namedVolumes.map((v) => (
|
||||
<VolumeLinkChip key={v.name} conn={conn} volume={v} size={volumeSizes[v.name]} />
|
||||
<VolumeLinkChip key={v.name} conn={conn} volume={v} />
|
||||
))}
|
||||
</div>
|
||||
) : (
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import { act, cleanup, render, screen } from "@testing-library/react";
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import type { DockerContainer, DockerContainerStats, DockerSnapshot, DockerVolume } from "@/platform/ipc";
|
||||
import type { DockerContainer, DockerContainerStats, DockerSnapshot } from "@/platform/ipc";
|
||||
import { ToolWindowShownProvider } from "@/workbench/contributions";
|
||||
|
||||
const backend = vi.hoisted(() => ({
|
||||
stats: vi.fn(),
|
||||
volumeSizes: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock("@/platform/ipc", async (original) => {
|
||||
@@ -16,21 +15,13 @@ vi.mock("@/platform/ipc", async (original) => {
|
||||
commands: {
|
||||
...actual.commands,
|
||||
dockerContainerStats: backend.stats,
|
||||
dockerVolumeSizes: backend.volumeSizes,
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
import {
|
||||
bytesToDecimalUnits,
|
||||
ComposeProjectDashboard,
|
||||
CONTAINER_STATS_POLL_MS,
|
||||
ContainerDashboard,
|
||||
VOLUME_SIZES_POLL_MS,
|
||||
VolumeDashboard,
|
||||
} from "./dashboard";
|
||||
import { ComposeProjectDashboard, CONTAINER_STATS_POLL_MS, ContainerDashboard } from "./dashboard";
|
||||
|
||||
const ok = <T,>(data: T) => ({ status: "ok" as const, data });
|
||||
const ok = (data: DockerContainerStats) => ({ status: "ok" as const, data });
|
||||
|
||||
function makeStats(cpuPerc: string): DockerContainerStats {
|
||||
return {
|
||||
@@ -82,8 +73,6 @@ const snapshot: DockerSnapshot = {
|
||||
beforeEach(() => {
|
||||
vi.useFakeTimers();
|
||||
backend.stats.mockReset();
|
||||
backend.volumeSizes.mockReset();
|
||||
backend.volumeSizes.mockResolvedValue(ok({}));
|
||||
vi.spyOn(document, "visibilityState", "get").mockReturnValue("visible");
|
||||
});
|
||||
|
||||
@@ -162,7 +151,7 @@ describe("live container stats polling", () => {
|
||||
});
|
||||
|
||||
it("auto-refreshes ContainerDashboard without overlapping slow stats calls", async () => {
|
||||
let resolvePending: ((v: ReturnType<typeof ok<DockerContainerStats>>) => void) | undefined;
|
||||
let resolvePending: ((v: ReturnType<typeof ok>) => void) | undefined;
|
||||
backend.stats
|
||||
.mockImplementationOnce(
|
||||
() =>
|
||||
@@ -175,8 +164,6 @@ describe("live container stats polling", () => {
|
||||
render(<ContainerDashboard conn="default" container={runningContainer} snapshot={snapshot} inspectText={null} />);
|
||||
|
||||
expect(backend.stats).toHaveBeenCalledTimes(1);
|
||||
// Container without volume mounts does not poll dockerVolumeSizes.
|
||||
expect(backend.volumeSizes).not.toHaveBeenCalled();
|
||||
// Slow first sample (4.5s > 3s): no overlapping second call starts while in flight.
|
||||
await act(async () => {
|
||||
await vi.advanceTimersByTimeAsync(4500);
|
||||
@@ -197,200 +184,3 @@ describe("live container stats polling", () => {
|
||||
expect(screen.getByText("22.50%")).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
describe("live volume disk usage polling", () => {
|
||||
const pgVolume: DockerVolume = {
|
||||
name: "shop_pgdata",
|
||||
driver: "local",
|
||||
mountpoint: "/var/lib/docker/volumes/shop_pgdata/_data",
|
||||
composeProject: "shop",
|
||||
scope: "local",
|
||||
labels: {
|
||||
"com.docker.compose.project": "shop",
|
||||
"com.docker.compose.volume": "pgdata",
|
||||
},
|
||||
};
|
||||
|
||||
const cacheVolume: DockerVolume = {
|
||||
name: "shop_redis",
|
||||
driver: "local",
|
||||
mountpoint: "/var/lib/docker/volumes/shop_redis/_data",
|
||||
composeProject: "shop",
|
||||
scope: "local",
|
||||
labels: {
|
||||
"com.docker.compose.project": "shop",
|
||||
"com.docker.compose.volume": "redis",
|
||||
},
|
||||
};
|
||||
|
||||
const snapshotWithVolumes: DockerSnapshot = {
|
||||
...snapshot,
|
||||
volumes: [pgVolume, cacheVolume],
|
||||
};
|
||||
|
||||
it("formats decimal byte totals like Docker CLI output", () => {
|
||||
expect(bytesToDecimalUnits(0)).toBe("0B");
|
||||
expect(bytesToDecimalUnits(512)).toBe("512B");
|
||||
expect(bytesToDecimalUnits(145_400)).toBe("145.4kB");
|
||||
expect(bytesToDecimalUnits(1_500_000_000)).toBe("1.5GB");
|
||||
});
|
||||
|
||||
it("auto-refreshes VolumeDashboard disk usage every 30s while visible and pauses when hidden", async () => {
|
||||
let sample = 0;
|
||||
backend.volumeSizes.mockImplementation(async () => {
|
||||
sample += 1;
|
||||
return ok({ shop_pgdata: `${sample * 100}kB` });
|
||||
});
|
||||
|
||||
const { rerender } = render(
|
||||
<ToolWindowShownProvider value={true}>
|
||||
<VolumeDashboard conn="default" volume={pgVolume} snapshot={snapshotWithVolumes} />
|
||||
</ToolWindowShownProvider>,
|
||||
);
|
||||
|
||||
await act(async () => {
|
||||
await Promise.resolve();
|
||||
});
|
||||
expect(backend.volumeSizes).toHaveBeenCalledTimes(1);
|
||||
expect(backend.volumeSizes).toHaveBeenLastCalledWith({ kind: "default" });
|
||||
expect(screen.getByText("100kB")).toBeInTheDocument();
|
||||
|
||||
await act(async () => {
|
||||
await vi.advanceTimersByTimeAsync(VOLUME_SIZES_POLL_MS);
|
||||
});
|
||||
expect(backend.volumeSizes).toHaveBeenCalledTimes(2);
|
||||
expect(screen.getByText("200kB")).toBeInTheDocument();
|
||||
|
||||
// Pauses while hidden and resumes when visible again.
|
||||
vi.spyOn(document, "visibilityState", "get").mockReturnValue("hidden");
|
||||
act(() => {
|
||||
document.dispatchEvent(new Event("visibilitychange"));
|
||||
});
|
||||
await act(async () => {
|
||||
await vi.advanceTimersByTimeAsync(VOLUME_SIZES_POLL_MS * 3);
|
||||
});
|
||||
expect(backend.volumeSizes).toHaveBeenCalledTimes(2);
|
||||
|
||||
vi.spyOn(document, "visibilityState", "get").mockReturnValue("visible");
|
||||
await act(async () => {
|
||||
document.dispatchEvent(new Event("visibilitychange"));
|
||||
await Promise.resolve();
|
||||
});
|
||||
expect(backend.volumeSizes).toHaveBeenCalledTimes(3);
|
||||
expect(screen.getByText("300kB")).toBeInTheDocument();
|
||||
|
||||
// Stops polling when the Services tool window is closed.
|
||||
rerender(
|
||||
<ToolWindowShownProvider value={false}>
|
||||
<VolumeDashboard conn="default" volume={pgVolume} snapshot={snapshotWithVolumes} />
|
||||
</ToolWindowShownProvider>,
|
||||
);
|
||||
await act(async () => {
|
||||
await vi.advanceTimersByTimeAsync(VOLUME_SIZES_POLL_MS * 3);
|
||||
});
|
||||
expect(backend.volumeSizes).toHaveBeenCalledTimes(3);
|
||||
});
|
||||
|
||||
it("refreshes ComposeProjectDashboard per-volume chips and summed banner disk usage every 30s", async () => {
|
||||
backend.stats.mockResolvedValue(ok(makeStats("1.00%")));
|
||||
backend.volumeSizes
|
||||
.mockResolvedValueOnce(ok({ shop_pgdata: "1.2GB", shop_redis: "300MB" }))
|
||||
.mockResolvedValueOnce(ok({ shop_pgdata: "1.5GB", shop_redis: "500MB" }));
|
||||
|
||||
render(
|
||||
<ToolWindowShownProvider value={true}>
|
||||
<ComposeProjectDashboard
|
||||
conn="default"
|
||||
project="shop"
|
||||
containers={[runningContainer, stoppedContainer]}
|
||||
snapshot={snapshotWithVolumes}
|
||||
/>
|
||||
</ToolWindowShownProvider>,
|
||||
);
|
||||
|
||||
await act(async () => {
|
||||
await Promise.resolve();
|
||||
});
|
||||
expect(backend.volumeSizes).toHaveBeenCalledTimes(1);
|
||||
expect(screen.getByText("pgdata · local · 1.2GB")).toBeInTheDocument();
|
||||
expect(screen.getByText("redis · local · 300MB")).toBeInTheDocument();
|
||||
expect(screen.getByText("1.5GB")).toBeInTheDocument();
|
||||
|
||||
await act(async () => {
|
||||
await vi.advanceTimersByTimeAsync(VOLUME_SIZES_POLL_MS);
|
||||
});
|
||||
expect(backend.volumeSizes).toHaveBeenCalledTimes(2);
|
||||
expect(screen.getByText("pgdata · local · 1.5GB")).toBeInTheDocument();
|
||||
expect(screen.getByText("redis · local · 500MB")).toBeInTheDocument();
|
||||
expect(screen.getByText("2GB")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("refreshes ContainerDashboard mounted volume sizes every 30s without overlapping slow calls", async () => {
|
||||
backend.stats.mockResolvedValue(ok(makeStats("1.00%")));
|
||||
let resolveSlow: ((v: ReturnType<typeof ok<Record<string, string>>>) => void) | undefined;
|
||||
backend.volumeSizes
|
||||
.mockImplementationOnce(
|
||||
() =>
|
||||
new Promise((resolve) => {
|
||||
resolveSlow = resolve;
|
||||
}),
|
||||
)
|
||||
.mockResolvedValueOnce(ok({ shop_pgdata: "256.8kB" }));
|
||||
|
||||
const inspectJson = JSON.stringify([
|
||||
{
|
||||
Created: "2026-04-20T05:00:00Z",
|
||||
State: { Status: "running", Pid: 100, StartedAt: "2026-04-20T05:00:01Z" },
|
||||
HostConfig: { RestartPolicy: { Name: "no", MaximumRetryCount: 0 } },
|
||||
Config: { Entrypoint: [], Cmd: ["postgres"], Env: [], Labels: {} },
|
||||
Mounts: [
|
||||
{
|
||||
Type: "volume",
|
||||
Name: "shop_pgdata",
|
||||
Source: "/var/lib/docker/volumes/shop_pgdata/_data",
|
||||
Destination: "/var/lib/postgresql/data",
|
||||
Mode: "z",
|
||||
RW: true,
|
||||
},
|
||||
{
|
||||
Type: "bind",
|
||||
Source: "/work/shop/init.sql",
|
||||
Destination: "/docker-entrypoint-initdb.d/init.sql",
|
||||
Mode: "ro",
|
||||
RW: false,
|
||||
},
|
||||
],
|
||||
NetworkSettings: { Ports: {}, Networks: {} },
|
||||
},
|
||||
]);
|
||||
|
||||
render(
|
||||
<ToolWindowShownProvider value={true}>
|
||||
<ContainerDashboard
|
||||
conn="default"
|
||||
container={{ ...runningContainer, mounts: ["shop_pgdata"] }}
|
||||
snapshot={snapshotWithVolumes}
|
||||
inspectText={inspectJson}
|
||||
/>
|
||||
</ToolWindowShownProvider>,
|
||||
);
|
||||
|
||||
expect(backend.volumeSizes).toHaveBeenCalledTimes(1);
|
||||
await act(async () => {
|
||||
await vi.advanceTimersByTimeAsync(VOLUME_SIZES_POLL_MS * 1.5);
|
||||
});
|
||||
expect(backend.volumeSizes).toHaveBeenCalledTimes(1);
|
||||
|
||||
await act(async () => {
|
||||
resolveSlow!(ok({ shop_pgdata: "145.4kB" }));
|
||||
await Promise.resolve();
|
||||
});
|
||||
expect(screen.getByText("145.4kB")).toBeInTheDocument();
|
||||
|
||||
await act(async () => {
|
||||
await vi.advanceTimersByTimeAsync(VOLUME_SIZES_POLL_MS);
|
||||
});
|
||||
expect(backend.volumeSizes).toHaveBeenCalledTimes(2);
|
||||
expect(screen.getByText("256.8kB")).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
@@ -1678,7 +1678,6 @@
|
||||
"No image layers": "No image layers",
|
||||
"Instruction": "Instruction",
|
||||
"Volume Overview": "Volume Overview",
|
||||
"Disk usage": "Disk usage",
|
||||
"Mountpoint": "Mountpoint",
|
||||
"Containers Using Volume": "Containers Using Volume",
|
||||
"No containers are using this volume": "No containers are using this volume",
|
||||
|
||||
@@ -7588,7 +7588,6 @@
|
||||
"No image layers": "無映像層",
|
||||
"Instruction": "指令",
|
||||
"Volume Overview": "資料磁碟區概覽",
|
||||
"Disk usage": "磁碟用量",
|
||||
"Mountpoint": "掛載點",
|
||||
"Containers Using Volume": "使用此資料磁碟區的容器",
|
||||
"No containers are using this volume": "沒有容器正在使用此資料磁碟區",
|
||||
|
||||
@@ -8123,7 +8123,6 @@
|
||||
"No image layers": "无镜像层",
|
||||
"Instruction": "指令",
|
||||
"Volume Overview": "数据卷概览",
|
||||
"Disk usage": "磁盘占用",
|
||||
"Mountpoint": "挂载点",
|
||||
"Containers Using Volume": "使用此数据卷的容器",
|
||||
"No containers are using this volume": "没有容器正在使用此数据卷",
|
||||
|
||||
Reference in new issue
Block a user