Skip to content

Commit

Permalink
consoles: Also wait for address when connecting to VNC
Browse files Browse the repository at this point in the history
If the inactive XML config contains a port but not a address, we would
try to connect too early, before the address was actually filled in.
  • Loading branch information
mvollmer committed Jan 17, 2025
1 parent f7ba003 commit 5a4dc36
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/components/vm/consoles/vnc.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class Vnc extends React.Component {
}

const { consoleDetail } = props;
if (!consoleDetail || consoleDetail.port == -1) {
if (!consoleDetail || consoleDetail.port == -1 || !consoleDetail.address) {
logDebug('Vnc component: console detail not yet provided');
return;
}
Expand Down
8 changes: 2 additions & 6 deletions src/components/vm/consoles/vncBody.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,10 @@ export const VncRow = ({ idPrefix, onValueChanged, dialogValues, validationError
export function validateDialogValues(values) {
const res = { };

console.log("port", JSON.stringify(values.vncPort), values.vncPort.match("^[0-9]+$"));

if (values.vncPort == "")
; // fine
else if (!values.vncPort.match("^[0-9]+$"))
res.vncPort = _("Port must be a positive number.")
else if (Number(values.vncPort) < 5900)
res.vncPort = _("Port must be 5900 or larger.")
else if (!values.vncPort.match("^[0-9]+$") || Number(values.vncPort) < 5900)
res.vncPort = _("Port must be 5900 or larger.");

return Object.keys(res).length > 0 ? res : null;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/vm/consoles/vncEdit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export class EditVNCModal extends React.Component {
<VncRow
idPrefix={idPrefix}
dialogValues={this.state}
validationErrors={this.state.validationErrors}a
validationErrors={this.state.validationErrors}
onValueChanged={this.onValueChanged} />
</Form>
);
Expand Down

0 comments on commit 5a4dc36

Please sign in to comment.