refactor: overwrite port if already defined and warn in front - #2367
Open
frankiejol wants to merge 3 commits into
Open
frankiejol wants to merge 3 commits into
frankiejol wants to merge 3 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The port behavior may break existing tests, and the warning markup is malformed.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Refactors display creation to overwrite conflicting exported ports and warn users in the frontend.
Changes:
- Adds an exported-port warning to the display form.
- Overwrites conflicting ports for non-built-in displays.
- Adds RDP port overwrite coverage.
File summaries
| File | Summary |
|---|---|
templates/main/manage_machine_new_display.html.ep |
Adds the port warning UI; the opening <div> is malformed. |
t/vm/23_display.t |
Adds regression coverage for RDP port replacement. |
lib/Ravada/Domain.pm |
Removes conflicting exports, potentially breaking existing x2go conflict expectations. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+6660
to
+6662
| if ( $exposed ) { | ||
| $self->remove_expose($data->{port}); | ||
| } |
issue #2366
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Port replacement must preserve existing exposures and referencing displays, and the new warning messages need localization entries.
Get a fresh assessment by requesting another Copilot review.
Review details
Suppressed comments (2)
lib/Ravada/Domain.pm:6662
- Deleting the
domain_portsrow here can invalidate an existing non-builtin display that references it throughdomain_displays.id_domain_port. For example, adding a display with an explicitly collidingdata.portremoves the row but leaves the old display; when the active machine is refreshed,display_infodereferences the missing port as{is_active}(Domain.pm:1385-1387), causing the display state path to fail. Reuse/update the existing port row, or detach and rebind every referencing display before deleting it.
if ( $exposed ) {
$self->remove_expose($data->{port});
}
templates/main/manage_machine_new_display.html.ep:15
- These new
l()message IDs are not present inlib/Ravada/I18N/messages.potor the locale catalogs, unlike the surrounding existing template strings. Unknown IDs fall back to the source English text, so this warning will not be localized for non-English users; add the IDs through the project's catalog extraction/update step and provide the locale entries.
<%=l 'There are already ports exported.' %>
<%=l 'They may be overwritten on creating some displays.' %>
- Files reviewed: 5/5 changed files
- Comments generated: 1
- Review effort level: Lite
Comment on lines
+6660
to
+6662
| if ( $exposed ) { | ||
| $self->remove_expose($data->{port}); | ||
| } |
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.
Overwrite the exported port if required for Displays
issue #2366