shell: Only show superuser indicator when a machine is connected

Showing it for a disconnected machine does 'work' in the sense that
the SuperuserIndicator stays invisible, but it wouldn't try to
reconnect once the machine changes its state from "failed" to
"connected".

By only rendering the SuperuserIndicator for connected machines, we
make sure that the indicator correctly follows the connectedness state
of the machine.

Closes #14444
This commit is contained in:
Marius Vollmer 2020-08-04 19:09:11 +03:00 committed by GitHub
parent eb1fc2028c
commit 158eef4dc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 4 deletions

View File

@ -416,10 +416,15 @@ function MachinesIndex(index_options, machines, loader, mdialogs) {
}
function update_superuser(machine, state, compiled) {
ReactDOM.render(React.createElement(SuperuserIndicator, { host: machine.connection_string }),
document.getElementById('super-user-indicator'));
ReactDOM.render(React.createElement(SuperuserIndicator, { host: machine.connection_string }),
document.getElementById('super-user-indicator-mobile'));
if (machine.state == "connected") {
ReactDOM.render(React.createElement(SuperuserIndicator, { host: machine.connection_string }),
document.getElementById('super-user-indicator'));
ReactDOM.render(React.createElement(SuperuserIndicator, { host: machine.connection_string }),
document.getElementById('super-user-indicator-mobile'));
} else {
ReactDOM.unmountComponentAtNode(document.getElementById('super-user-indicator'));
ReactDOM.unmountComponentAtNode(document.getElementById('super-user-indicator-mobile'));
}
}
function update_title(label, machine) {