Skip to content

Beta: Add CPU & Memory Load to advanced view mode; Use integrated Ace editor if available; Right click to access context menu#74

Open
mstrhakr wants to merge 55 commits intomainfrom
dev
Open

Beta: Add CPU & Memory Load to advanced view mode; Use integrated Ace editor if available; Right click to access context menu#74
mstrhakr wants to merge 55 commits intomainfrom
dev

Conversation

@mstrhakr
Copy link
Copy Markdown
Owner

What changed
Refactored Ace Editor integration to improve error handling and prevent crashes when Ace fails to load. Enhanced UI with context menus for stacks and containers, and added CPU and memory load displays to the advanced view. Updated CodeQL workflow to skip certain commits.

Related issues
Closes #72

Checklist

  • I have added/updated tests where applicable
  • I have updated documentation (docs/, README, or plugin docs)
  • Linted/formatted the code
  • Verified on Unraid or CI

Testing notes
Test the context menus by right-clicking on stacks and containers in the dashboard. Verify Ace Editor functionality and error handling by simulating a failure to load Ace.

Notes
No migration steps required. Ensure compatibility with existing setups by checking Ace Editor dependencies.

mstrhakr added 30 commits March 28, 2026 10:14
… Ace is missing

When Ace fails to load, initEditorModal() returns early leaving
editorModal.editors[type] undefined. loadEditorFiles(), saveTab(),
and the post-save validation callback all accessed these without
guards, causing TypeError crashes.

Add null checks on every unguarded editorModal.editors[type] access
in loadEditorFiles, saveTab, and the save-success validation callback.
Remove stale AceVersion parameter declaration, documentation, and
print statement that were missed during the Ace removal.
The settings page doesn't include compose_manager_main.php, so the
JS aceBasePath variable was undefined. The typeof fallback defaulted
to /webGui/javascript/ace which is correct on 7.0.0+ but wrong on
6.x where ace lives in the plugin directory.

Use the same PHP file_exists() detection to resolve the correct
path server-side and emit it directly into the JS.
Ace modes try to load worker scripts (worker-yaml.js, worker-sh.js)
via the module loader. Since we only bundle a minimal subset of Ace
files, these would 404 and throw loader errors. Disable workers via
session.setUseWorker(false) — we already validate YAML client-side
via js-yaml so workers are redundant.
Only disable certificate checking when no system CA bundle exists.
Previously wget --no-check-certificate was used unconditionally,
which could allow MITM substitution of the downloaded JS assets.
Check unzip and cp exit codes and verify ace.js exists after install.
Previously a failed extraction would silently print success, leaving
users with missing editor files and no diagnostic output.
Help text said Default: 2.40.3 but actual default is 5.0.2.
When Ace fails to load, opening the editor modal would show an empty
non-functional UI. Instead, prevent the modal from opening entirely
and show a swal error prompting the user to reload or check the
plugin installation.
- Add missing 'var loadMap = {}' declaration
- Fix cpuRaw used before declaration (moved above cpuNorm)
- Remove duplicate cpuNorm/loadMap assignments and orphan braces
- Add parts.length >= 3 guard to skip malformed rows
- Use Math.max(composeCpuCount, 1) to prevent division by zero
The .ct-col-icon class is defined in CSS but never used in any HTML
output. Container detail tables have no icon column.
Stopped stacks and containers will never receive docker stats data,
so showing '0%' / '0B' is misleading. Show '-' instead and hide the
usage bar and memory span for non-running entries.
Copilot AI review requested due to automatic review settings March 30, 2026 01:49
@mstrhakr mstrhakr self-assigned this Mar 30, 2026
@mstrhakr mstrhakr changed the title Beta: Add CPU & Memory Load to advanced view mode; Use integrated Ace editor if available Beta: Add CPU & Memory Load to advanced view mode; Use integrated Ace editor if available; Right click to access context menu Mar 30, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the Compose Manager UI by adding real-time CPU & memory load metrics to the advanced view (leveraging Unraid’s dockerload Nchan channel), and refactors Ace Editor integration to prefer Dynamix’s bundled Ace (Unraid 7+) with a safer fallback for older versions.

Changes:

  • Add advanced-view “CPU & Memory load” columns for stacks and container detail rows, populated via a dockerload WebSocket subscriber with stack-level aggregation.
  • Refactor Ace Editor loading to use Dynamix’s bundled Ace when present, with install-time download for older Unraid versions and additional runtime guards when Ace is unavailable.
  • Update packaging/build/deploy and CI workflows to reflect the new Ace delivery approach and improve release tagging/CodeQL behavior.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated no comments.

Show a summary per file
File Description
versions.env Removes ACE_VERSION from version environment inputs.
tests/unit/ComposeManagerMainSourceTest.php Adds source-level tests for CPU/memory load logic markers in compose_manager_main.php.
tests/unit/ComposeListHtmlTest.php Extends source-level HTML structure tests for new load column + updated colspans/data attributes.
source/pkg_build.sh Stops bundling Ace into the package during build.
source/compose.manager/styles/comboButton.css Adds column width for the new container “load” column.
source/compose.manager/php/util.php Adds $skipDocker option to StackInfo::allFromRoot() for faster rendering paths.
source/compose.manager/php/compose_manager_main.php Implements CPU/mem parsing, Nchan dockerload subscription, aggregation, UI column changes, and Ace basePath handling + guards.
source/compose.manager/php/compose_list.php Adds data-ctids for stack rows, new load column markup, and updates colspans to 10.
source/compose.manager/compose.manager.settings.page Uses dynamic Ace path detection when extracting/displaying Ace version.
source/compose.manager/compose.manager.page Adds Nchan=...docker_load to enable dockerload subscription support.
source/compose.manager/compose.manager.dashboard.page Adds right-click handlers to open stack/container context menus from dashboard rows.
source/compose.manager/Compose.page Adds Nchan=...docker_load for the header menu entry page.
deploy.ps1 Enhances deploy script to support deploying to multiple remote hosts.
compose.manager.plg Adds install-time Ace download for pre-Unraid-7 setups and skips download when Dynamix provides Ace.
build_in_docker.sh Removes ACE_VERSION passthrough to container builds.
build.ps1 Removes Ace download/version parameterization from the build process.
.github/workflows/tag-release.yml Tightens stable tag detection regex to avoid beta tags and handle optional letter suffixes.
.github/workflows/codeql.yml Adds a custom CodeQL workflow that skips [skip ci]/release bot commits and runs JS/TS analysis.
.github/workflows/build.yml Removes ACE_VERSION environment injection from the package build step.
Comments suppressed due to low confidence (1)

compose.manager.plg:92

  • The install script falls back to wget --no-check-certificate when a system CA bundle is missing, which disables TLS verification and allows MITM tampering with the downloaded Ace JavaScript. Consider failing the download with a clear warning (and leaving the editor without highlighting), or bundling/ensuring a trusted CA bundle instead of disabling verification.
    [ -e "$pkg" ] && removepkg "$(basename "$pkg")" 2>/dev/null || true
done

#Create projects folder if it doesnt exist
mkdir -p &pluginLOC;/projects

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add CPU + MEM display to advanced view mode.

2 participants