{
if (condition.type === "Running") {
vmDefinition.running = condition.status === "True";
vmDefinition.runningConditionSince
= new Date(condition.lastTransitionTime);
- break;
+ } else if (condition.type === "Booted") {
+ vmDefinition.booted = condition.status === "True";
+ vmDefinition.bootedConditionSince
+ = new Date(condition.lastTransitionTime);
}
- }
+ })
} else {
vmDefinition = {};
}
diff --git a/org.jdrupes.vmoperator.vmmgmt/src/org/jdrupes/vmoperator/vmmgmt/VmMgmt.java b/org.jdrupes.vmoperator.vmmgmt/src/org/jdrupes/vmoperator/vmmgmt/VmMgmt.java
index 4cc63fa..10b4f48 100644
--- a/org.jdrupes.vmoperator.vmmgmt/src/org/jdrupes/vmoperator/vmmgmt/VmMgmt.java
+++ b/org.jdrupes.vmoperator.vmmgmt/src/org/jdrupes/vmoperator/vmmgmt/VmMgmt.java
@@ -43,8 +43,8 @@ import org.jdrupes.vmoperator.common.VmDefinition;
import org.jdrupes.vmoperator.common.VmDefinition.Permission;
import org.jdrupes.vmoperator.common.VmExtraData;
import org.jdrupes.vmoperator.manager.events.ChannelTracker;
-import org.jdrupes.vmoperator.manager.events.GetDisplayPassword;
import org.jdrupes.vmoperator.manager.events.ModifyVm;
+import org.jdrupes.vmoperator.manager.events.PrepareConsole;
import org.jdrupes.vmoperator.manager.events.ResetVm;
import org.jdrupes.vmoperator.manager.events.VmChannel;
import org.jdrupes.vmoperator.manager.events.VmDefChanged;
@@ -483,17 +483,22 @@ public class VmMgmt extends FreeMarkerConlet {
Map.of("autoClose", 5_000, "type", "Warning")));
return;
}
- var pwQuery = Event.onCompletion(new GetDisplayPassword(vmDef, user),
- e -> {
- vmDef.extra().map(xtra -> xtra.connectionFile(
- e.password().orElse(null), preferredIpVersion,
- deleteConnectionFile)).ifPresent(
- cf -> channel.respond(new NotifyConletView(type(),
- model.getConletId(), "openConsole", cf)));
- });
+ var pwQuery = Event.onCompletion(new PrepareConsole(vmDef, user),
+ e -> gotPassword(channel, model, vmDef, e));
fire(pwQuery, vmChannel);
}
+ private void gotPassword(ConsoleConnection channel, VmsModel model,
+ VmDefinition vmDef, PrepareConsole event) {
+ if (!event.passwordAvailable()) {
+ return;
+ }
+ vmDef.extra().map(xtra -> xtra.connectionFile(event.password(),
+ preferredIpVersion, deleteConnectionFile)).ifPresent(
+ cf -> channel.respond(new NotifyConletView(type(),
+ model.getConletId(), "openConsole", cf)));
+ }
+
@Override
protected boolean doSetLocale(SetLocale event, ConsoleConnection channel,
String conletId) throws Exception {
|