Skip to content

Commit d9f6339

Browse files
committed
consoles: Also wait for address when connecting to VNC
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.
1 parent ab688be commit d9f6339

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

src/components/vm/consoles/vnc.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class Vnc extends React.Component {
6969
}
7070

7171
const { consoleDetail } = props;
72-
if (!consoleDetail || consoleDetail.port == -1) {
72+
if (!consoleDetail || consoleDetail.port == -1 || !consoleDetail.address) {
7373
logDebug('Vnc component: console detail not yet provided');
7474
return;
7575
}

src/components/vm/consoles/vncBody.jsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,10 @@ export const VncRow = ({ idPrefix, onValueChanged, dialogValues, validationError
8484
export function validateDialogValues(values) {
8585
const res = { };
8686

87-
console.log("port", JSON.stringify(values.vncPort), values.vncPort.match("^[0-9]+$"));
88-
8987
if (values.vncPort == "")
9088
; // fine
91-
else if (!values.vncPort.match("^[0-9]+$"))
92-
res.vncPort = _("Port must be a positive number.")
93-
else if (Number(values.vncPort) < 5900)
94-
res.vncPort = _("Port must be 5900 or larger.")
89+
else if (!values.vncPort.match("^[0-9]+$") || Number(values.vncPort) < 5900)
90+
res.vncPort = _("Port must be 5900 or larger.");
9591

9692
return Object.keys(res).length > 0 ? res : null;
9793
}

src/components/vm/consoles/vncEdit.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export class EditVNCModal extends React.Component {
9696
<VncRow
9797
idPrefix={idPrefix}
9898
dialogValues={this.state}
99-
validationErrors={this.state.validationErrors}a
99+
validationErrors={this.state.validationErrors}
100100
onValueChanged={this.onValueChanged} />
101101
</Form>
102102
);

0 commit comments

Comments
 (0)