Skip to content

Added normalizedName getter#961

Open
blzzua wants to merge 1 commit into
louislam:masterfrom
blzzua:master
Open

Added normalizedName getter#961
blzzua wants to merge 1 commit into
louislam:masterfrom
blzzua:master

Conversation

@blzzua

@blzzua blzzua commented May 17, 2026

Copy link
Copy Markdown

⚠️⚠️⚠️ Since we do not accept all types of pull requests and do not want to waste your time. Please be sure that you have read pull request rules:
https://github.com/louislam/dockge/blob/master/CONTRIBUTING.md

Tick the checkbox if you understand [x]:

  • [x ] I have read and understand the pull request rules.

Description

Due to the fact that I don't know typescript, I used opencode + gemini to write the code.

Added a normalizedName getter to the Stack class, which removes all dots and converts the name to lowercase. This provides a consistent way to match stack folder names (which include dots) with their corresponding Docker Compose project names (which have dots removed).

Updated getStackList:
Created a mapping (normalizedNameMap) of normalized stack names to their corresponding Stack objects during the initial scan of the stacks directory. Updated the composeList processing loop. Now, it first checks if a Stack exists in stackList (using the exact folder name). If not found, it checks normalizedNameMap (using the normalized Docker name). If a match is found in either map, it updates the existing Stack instance instead of creating a new, separate one. This ensures that the original Stack (managed by Dockge, with dots in its name) is correctly associated with the Docker Compose status. This approach ensures that Docker Compose stacks and Dockge-managed stacks are merged correctly based on the shared composeFileName, preserving the original folder-based name and isManagedByDockge: true status for managed stacks.

This is a rather specialized solution. For a "correct" solution, I need to join(match) the lists of stacks from docker compose and directories using a different principle than name similarity. For example, using the full path of compose.yml.

Fixes #(issue)

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • My code follows the style guidelines of this project
  • I ran ESLint and other linters for modified files
  • I have performed a self-review of my own code and tested it
  • I have commented my code, particularly in hard-to-understand areas
    (including JSDoc for methods)
  • My changes generate no new warnings
  • My code needed automated testing. I have added them (this is optional task)

Screenshots (if any)

For me, creating a working Dockerfile that will create an image for local use turned out to be a task with increased complexity. But it works as I wanted.

image

Please do not use any external image service. Instead, just paste in or drag and drop the image here, and it will be uploaded automatically.

Added a normalizedName getter to the Stack class, which removes all dots and converts the name to lowercase. This provides a consistent way to match stack folder names (which include dots) with their corresponding Docker Compose project names (which have dots removed).
Updated getStackList:
Created a mapping (normalizedNameMap) of normalized stack names to their corresponding Stack objects during the initial scan of the stacks directory.
Updated the composeList processing loop. Now, it first checks if a Stack exists in stackList (using the exact folder name). If not found, it checks normalizedNameMap (using the normalized Docker name).
If a match is found in either map, it updates the existing Stack instance instead of creating a new, separate one. This ensures that the original Stack (managed by Dockge, with dots in its name) is correctly associated with the Docker Compose status.
This approach ensures that Docker Compose stacks and Dockge-managed stacks are merged correctly based on the shared composeFileName, preserving the original folder-based name and isManagedByDockge: true status for managed stacks.
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.

1 participant