machines: Check if 'ui' is defined before accessing it
machines: Check if 'ui' is defined before accessing it

Otherwise oops can happen:
`TypeError: Cannot read property 'initiallyOpenedConsoleTab' of undefined`.

From what I can see this must be a timing related issue so just don't try
to access the object if not ready yet.

Closes #14272
garrett/cockpit,deryni/cockpit,mvollmer/cockpit,deryni/cockpit,moraleslazaro/cockpit,moraleslazaro/cockpit,moraleslazaro/cockpit,martinpitt/cockpit,garrett/cockpit,cockpit-project/cockpit,garrett/cockpit,martinpitt/cockpit,garrett/cockpit,garrett/cockpit,cockpit-project/cockpit,martinpitt/cockpit,cockpit-project/cockpit,cockpit-project/cockpit,mvollmer/cockpit,deryni/cockpit,mvollmer/cockpit,cockpit-project/cockpit,moraleslazaro/cockpit,deryni/cockpit,martinpitt/cockpit,moraleslazaro/cockpit,mvollmer/cockpit,mvollmer/cockpit,deryni/cockpit,moraleslazaro/cockpit,moraleslazaro/cockpit,deryni/cockpit,deryni/cockpit,martinpitt/cockpit