Skip to content

Centralize stack management and improve status handling#90

Merged
mstrhakr merged 17 commits intodevfrom
fix/centralize-stack-status-counts
Apr 11, 2026
Merged

Centralize stack management and improve status handling#90
mstrhakr merged 17 commits intodevfrom
fix/centralize-stack-status-counts

Conversation

@mstrhakr
Copy link
Copy Markdown
Owner

This pull request centralizes and standardizes the logic for determining stack and container states in the Compose Manager, reducing code duplication and improving reliability across both PHP and JavaScript code. The main changes involve replacing scattered, ad-hoc state calculations with a single source of truth (getStackState() in PHP, and deriveStackState() in JS), and updating all relevant code paths to use these helpers for state, status icons, and counts.

Centralization and standardization of stack/container state logic:

  • All PHP logic for calculating running/stopped/partial counts and states in ComposeList.php, DashboardStacks.php, and Exec.php now uses the StackInfo::getStackState() method, replacing manual counting and state inference. [1] [2] [3] [4] [5]
  • The JavaScript logic for aggregating container states and updating UI elements (status icons, labels, counts) is now handled by a centralized deriveStackState() helper, replacing repetitive code in multiple functions.

UI and update logic improvements:

  • Update and "Update All" button logic now always derives the running state from the DOM rather than relying on possibly stale cached data, ensuring the UI accurately reflects the current stack status. [1] [2] [3]
  • When a stack is running but update data is missing, the UI now prompts the user to "check for updates" instead of offering a pull, ensuring SHA metadata is populated before updates.

Cleanup and removal of obsolete code:

  • Removed unused or redundant variables and caches related to defined service counts, as this is now handled centrally. [1] [2] [3] [4]
  • Simplified the creation and updating of stack info objects in JavaScript to rely on the new state logic, removing unnecessary parameters and fallback logic. [1] [2]

Other improvements:

  • Added a new JavaScript utility file composeStackUtils.js for helper functions.
  • Minor bug fixes and code simplification throughout the update and refresh logic.

These changes make the stack state logic more robust, easier to maintain, and ensure consistent behavior across the UI and backend.

Related to #89

Copilot AI review requested due to automatic review settings April 10, 2026 19:30

This comment was marked as resolved.

This comment was marked as resolved.

@mstrhakr mstrhakr merged commit 0cceef1 into dev Apr 11, 2026
5 checks passed
@mstrhakr mstrhakr deleted the fix/centralize-stack-status-counts branch April 11, 2026 01:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants