Added normalizedName getter#961
Open
blzzua wants to merge 1 commit into
Open
Conversation
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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://github.com/louislam/dockge/blob/master/CONTRIBUTING.md
Tick the checkbox if you understand [x]:
Description
Due to the fact that I don't know typescript, I used opencode + gemini to write the code.
Added a
normalizedNamegetter 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 thecomposeListprocessing loop. Now, it first checks if a Stack exists instackList(using the exact folder name). If not found, it checksnormalizedNameMap(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 sharedcomposeFileName, preserving the original folder-based name andisManagedByDockge: 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
Checklist
(including JSDoc for methods)
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.
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.