diff --git a/src/app/components/wmks/wmks.component.ts b/src/app/components/wmks/wmks.component.ts index dc69e37..8f0b945 100644 --- a/src/app/components/wmks/wmks.component.ts +++ b/src/app/components/wmks/wmks.component.ts @@ -67,6 +67,8 @@ export class WmksComponent implements OnInit, OnDestroy { if (this.connectTimerSubscription != null) { this.connectTimerSubscription.unsubscribe(); } + + this.vmService.disconnect(); } private setVmId(value: string) { @@ -74,12 +76,7 @@ export class WmksComponent implements OnInit, OnDestroy { this.connectTimerSubscription.unsubscribe(); } - // destroy and re-create the wmksContainer - this.showWmks = false; - this.showWmks = true; - this._vmId = value; - this.vmService.disconnect(); } diff --git a/src/app/services/signalr/signalr.service.ts b/src/app/services/signalr/signalr.service.ts index 582c26d..ffa47d7 100644 --- a/src/app/services/signalr/signalr.service.ts +++ b/src/app/services/signalr/signalr.service.ts @@ -22,6 +22,7 @@ export class SignalRService { private userId: string; private viewId: string; + private activeVmId: string; private apiUrl: string; @@ -78,10 +79,15 @@ export class SignalRService { if (this.userId && this.viewId) { this.joinUser(this.userId, this.viewId); } + + if (this.activeVmId) { + this.setActiveVirtualMachine(this.activeVmId); + } } public joinUser(userId: string, viewId: string) { this.userId = userId; + this.viewId = viewId; this.startConnection().then(() => { this.hubConnection.invoke('JoinUser', userId, viewId).then((vmUser) => { @@ -100,12 +106,14 @@ export class SignalRService { } public setActiveVirtualMachine(vmId: string) { + this.activeVmId = vmId; this.startConnection().then(() => { this.hubConnection.invoke('SetActiveVirtualMachine', vmId); }); } public unsetActiveVirtualMachine() { + this.activeVmId = null; this.startConnection().then(() => { this.hubConnection.invoke('UnsetActiveVirtualMachine'); }); diff --git a/src/app/state/vsphere/vsphere.service.ts b/src/app/state/vsphere/vsphere.service.ts index f6e72b3..6c02fb2 100644 --- a/src/app/state/vsphere/vsphere.service.ts +++ b/src/app/state/vsphere/vsphere.service.ts @@ -387,9 +387,9 @@ export class VsphereService { public disconnect() { if (this.wmks != null) { - this.wmks.destroy(); this.wmks.unregister(); - // this.wmks.disconnect(); + this.wmks.disconnect(); + this.wmks.destroy(); this.wmks = null; } diff --git a/src/assets/config/settings.json b/src/assets/config/settings.json index 8388329..7514c51 100644 --- a/src/assets/config/settings.json +++ b/src/assets/config/settings.json @@ -36,6 +36,6 @@ { "name": "Slowest", "value": 500 } ], "WMKS": { - "RetryConnectionInterval": 5000 + "RetryConnectionInterval": 0 } }