From 5510d348856edf72bfce9974b08abcc6cc8ec3c0 Mon Sep 17 00:00:00 2001 From: Gary Sharp Date: Mon, 2 Jun 2014 19:06:07 +1000 Subject: [PATCH] Bug Fix: Document Generation and SignalR iFrame Performing page navigation (within an iFrame, or the top window) causes the foreverFrame transport in SignalR to abort which takes several seconds to reconnect. Popup windows are now used to navigate to Document Generation API when the foreverFrame transport is in use. --- .../Views/Device/DeviceParts/_Subject.cshtml | 22 +- .../Device/DeviceParts/_Subject.generated.cs | 334 ++++++------ Disco.Web/Views/Job/JobParts/_Subject.cshtml | 22 +- .../Views/Job/JobParts/_Subject.generated.cs | 480 +++++++++--------- .../Views/User/UserParts/_Subject.cshtml | 22 +- .../User/UserParts/_Subject.generated.cs | 164 +++--- 6 files changed, 571 insertions(+), 473 deletions(-) diff --git a/Disco.Web/Views/Device/DeviceParts/_Subject.cshtml b/Disco.Web/Views/Device/DeviceParts/_Subject.cshtml index e6143531..794543b9 100644 --- a/Disco.Web/Views/Device/DeviceParts/_Subject.cshtml +++ b/Disco.Web/Views/Device/DeviceParts/_Subject.cshtml @@ -228,10 +228,30 @@ $(function () { var generatePdfUrl = '@Url.Action(MVC.API.Device.GeneratePdf(Model.Device.SerialNumber.ToString(), null))?DocumentTemplateId='; var $documentTemplates = $('#Device_Show_GenerateDocument'); + var $generationHost; + $documentTemplates.change(function () { var v = $documentTemplates.val(); if (v) { - window.location.href = generatePdfUrl + v; + var url = generatePdfUrl + v; + + if ($.connection && $.connection.hub && $.connection.hub.transport && + $.connection.hub.transport.name == 'foreverFrame') { + // SignalR active with foreverFrame transport - use popup window + window.open(url, '_blank', 'height=150,width=250,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no'); + } else { + // use iFrame + if (!$generationHost) { + $generationHost = $('