Update: SignalR 2.0.3 Migration; Noticeboards
Migrate all SignalR 1.x Persistent Connections to SignalR 2.x Hubs. Abstracts ScheduledTaskStatus with core interface and adds a Mock for optional status reporting. Noticeboards rewritten (with new theme) to be more resilient and accurate.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.34011
|
||||
// Runtime Version:4.0.30319.34014
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
@@ -47,6 +47,7 @@ namespace Disco.Web.Areas.Public.Views.HeldDevices
|
||||
#line 1 "..\..\Areas\Public\Views\HeldDevices\Noticeboard.cshtml"
|
||||
|
||||
Layout = null;
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/Knockout");
|
||||
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR");
|
||||
Html.BundleDeferred("~/ClientScripts/Core");
|
||||
Html.BundleDeferred("~/Style/Public/HeldDevicesNoticeboard");
|
||||
@@ -64,26 +65,58 @@ WriteLiteral(" http-equiv=\"X-UA-Compatible\"");
|
||||
|
||||
WriteLiteral(" content=\"IE=edge\"");
|
||||
|
||||
WriteLiteral(" />\r\n <title>Disco - Held Devices</title>\r\n");
|
||||
WriteLiteral(" />\r\n <title>Disco ICT - Held Devices</title>\r\n");
|
||||
|
||||
WriteLiteral(" ");
|
||||
|
||||
|
||||
#line 13 "..\..\Areas\Public\Views\HeldDevices\Noticeboard.cshtml"
|
||||
#line 14 "..\..\Areas\Public\Views\HeldDevices\Noticeboard.cshtml"
|
||||
Write(Html.BundleRenderDeferred());
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\r\n</head>\r\n<body>\r\n <div");
|
||||
WriteLiteral("\r\n</head>\r\n<body");
|
||||
|
||||
WriteLiteral(" class=\"status-connecting\"");
|
||||
|
||||
WriteLiteral(">\r\n <div");
|
||||
|
||||
WriteLiteral(" id=\"page\"");
|
||||
|
||||
WriteLiteral(">\r\n <header");
|
||||
|
||||
WriteLiteral(" id=\"mainHeader\"");
|
||||
WriteLiteral(" id=\"header\"");
|
||||
|
||||
WriteLiteral(">\r\n Held Devices\r\n </header>\r\n <section");
|
||||
WriteLiteral(">\r\n <div");
|
||||
|
||||
WriteLiteral(" id=\"heading\"");
|
||||
|
||||
WriteLiteral(">Held Devices</div>\r\n <div");
|
||||
|
||||
WriteLiteral(" id=\"statusConnecting\"");
|
||||
|
||||
WriteLiteral("><i");
|
||||
|
||||
WriteLiteral(" class=\"fa fa-cog fa-spin\"");
|
||||
|
||||
WriteLiteral("></i><span>connecting...</span></div>\r\n <div");
|
||||
|
||||
WriteLiteral(" id=\"statusError\"");
|
||||
|
||||
WriteLiteral("><i");
|
||||
|
||||
WriteLiteral(" class=\"fa fa-cog fa-spin\"");
|
||||
|
||||
WriteLiteral("></i><span>disconnected, reconnecting...</span></div>\r\n <div");
|
||||
|
||||
WriteLiteral(" id=\"credits\"");
|
||||
|
||||
WriteLiteral(">\r\n powered by Disco ICT <i");
|
||||
|
||||
WriteLiteral(" title=\"Disco ICT - Jobs\"");
|
||||
|
||||
WriteLiteral("></i>\r\n </div>\r\n </header>\r\n <section");
|
||||
|
||||
WriteLiteral(" id=\"mainSection\"");
|
||||
|
||||
@@ -93,403 +126,289 @@ WriteLiteral(" id=\"inProcess\"");
|
||||
|
||||
WriteLiteral(" class=\"list\"");
|
||||
|
||||
WriteLiteral(">\r\n <h3>In Process <span");
|
||||
WriteLiteral(">\r\n <h3>In Process (<span");
|
||||
|
||||
WriteLiteral(" id=\"inProcessCount\"");
|
||||
WriteLiteral(" data-bind=\"text: inProcess().length\"");
|
||||
|
||||
WriteLiteral("></span>\r\n </h3>\r\n <div");
|
||||
WriteLiteral("></span>)\r\n </h3>\r\n <div");
|
||||
|
||||
WriteLiteral(" class=\"content\"");
|
||||
|
||||
WriteLiteral(">\r\n <ul>\r\n </ul>\r\n </div>\r\n " +
|
||||
" </div>\r\n <div");
|
||||
WriteLiteral(">\r\n <!-- ko if: inProcess().length == 0 -->\r\n " +
|
||||
" <div");
|
||||
|
||||
WriteLiteral(" class=\"noContent\"");
|
||||
|
||||
WriteLiteral("><None></div>\r\n <!-- /ko -->\r\n <ul");
|
||||
|
||||
WriteLiteral(" data-bind=\"template: { name: \'item-template\', foreach: inProcess, afterRender: o" +
|
||||
"nAdd, beforeRemove: onRemove }\"");
|
||||
|
||||
WriteLiteral("></ul>\r\n </div>\r\n </div>\r\n <div");
|
||||
|
||||
WriteLiteral(" id=\"readyForReturn\"");
|
||||
|
||||
WriteLiteral(" class=\"list\"");
|
||||
|
||||
WriteLiteral(">\r\n <h3>Ready for Return <span");
|
||||
WriteLiteral(">\r\n <h3>Ready for Return (<span");
|
||||
|
||||
WriteLiteral(" id=\"readyForReturnCount\"");
|
||||
WriteLiteral(" data-bind=\"text: readyForReturn().length\"");
|
||||
|
||||
WriteLiteral("></span>\r\n </h3>\r\n <div");
|
||||
WriteLiteral("></span>)\r\n </h3>\r\n <div");
|
||||
|
||||
WriteLiteral(" class=\"content\"");
|
||||
|
||||
WriteLiteral(">\r\n <ul>\r\n </ul>\r\n </div>\r\n " +
|
||||
" </div>\r\n <div");
|
||||
WriteLiteral(">\r\n <!-- ko if: readyForReturn().length == 0 -->\r\n " +
|
||||
" <div");
|
||||
|
||||
WriteLiteral(" class=\"noContent\"");
|
||||
|
||||
WriteLiteral("><None></div>\r\n <!-- /ko -->\r\n <ul");
|
||||
|
||||
WriteLiteral(" data-bind=\"template: { name: \'item-template\', foreach: readyForReturn, afterRend" +
|
||||
"er: onAdd, beforeRemove: onRemove }\"");
|
||||
|
||||
WriteLiteral("></ul>\r\n </div>\r\n </div>\r\n <div");
|
||||
|
||||
WriteLiteral(" id=\"waitingForUserAction\"");
|
||||
|
||||
WriteLiteral(" class=\"list\"");
|
||||
|
||||
WriteLiteral(">\r\n <h3>Waiting for User Action <span");
|
||||
WriteLiteral(">\r\n <h3>Waiting for User Action (<span");
|
||||
|
||||
WriteLiteral(" id=\"waitingForUserActionCount\"");
|
||||
WriteLiteral(" data-bind=\"text: waitingForUserAction().length\"");
|
||||
|
||||
WriteLiteral("></span>\r\n </h3>\r\n <div");
|
||||
WriteLiteral("></span>)\r\n </h3>\r\n <div");
|
||||
|
||||
WriteLiteral(" class=\"content\"");
|
||||
|
||||
WriteLiteral(">\r\n <ul>\r\n </ul>\r\n </div>\r\n " +
|
||||
" </div>\r\n </section>\r\n <footer>\r\n </footer>\r\n " +
|
||||
"</div>\r\n <script");
|
||||
WriteLiteral(">\r\n <!-- ko if: waitingForUserAction().length == 0 -->\r\n " +
|
||||
" <div");
|
||||
|
||||
WriteLiteral(" type=\"text/javascript\"");
|
||||
WriteLiteral(" class=\"noContent\"");
|
||||
|
||||
WriteLiteral(">\r\n // Resizing\r\n $(function () {\r\n var $inProcess = $(\'" +
|
||||
"#inProcess\');\r\n var $inProcessContent = $inProcess.find(\'.content\');\r" +
|
||||
"\n var $inProcessHeader = $inProcess.find(\'.h3\');\r\n var $re" +
|
||||
"adyForReturn = $(\'#readyForReturn\');\r\n var $readyForReturnContent = $" +
|
||||
"readyForReturn.find(\'.content\');\r\n var $readyForReturnHeader = $ready" +
|
||||
"ForReturn.find(\'.h3\');\r\n var $waitingForUserAction = $(\'#waitingForUs" +
|
||||
"erAction\');\r\n var $waitingForUserActionContent = $waitingForUserActio" +
|
||||
"n.find(\'.content\');\r\n var $waitingForUserActionHeader = $waitingForUs" +
|
||||
"erAction.find(\'.h3\');\r\n var $mainSection = $(\'#mainSection\');\r\n " +
|
||||
" var $mainHeader = $(\'#mainHeader\');\r\n var $mainFooter = $(\'#mai" +
|
||||
"nFooter\');\r\n\r\n var onResize = function () {\r\n var widt" +
|
||||
"h = $mainSection.width();\r\n var height = $(window).height() - $ma" +
|
||||
"inHeader.outerHeight() - $mainFooter.outerHeight() - 25;\r\n\r\n $inP" +
|
||||
"rocess.height(height);\r\n $inProcess.width((width * .28) - 11);\r\n " +
|
||||
" $inProcessContent.height(height - $inProcessHeader.outerHeight() " +
|
||||
"- 56);\r\n\r\n $readyForReturn.height(height);\r\n $read" +
|
||||
"yForReturn.width((width * .36) - 11);\r\n $readyForReturnContent.he" +
|
||||
"ight(height - $readyForReturnHeader.outerHeight() - 56);\r\n\r\n $wai" +
|
||||
"tingForUserAction.height(height);\r\n $waitingForUserAction.width((" +
|
||||
"width * .36) - 11);\r\n $waitingForUserActionContent.height(height " +
|
||||
"- $waitingForUserActionHeader.outerHeight() - 56);\r\n };\r\n\r\n " +
|
||||
" $(window).resize(onResize);\r\n onResize();\r\n });\r\n </scrip" +
|
||||
"t>\r\n <script");
|
||||
WriteLiteral("><None></div>\r\n <!-- /ko -->\r\n <ul");
|
||||
|
||||
WriteLiteral(" type=\"text/javascript\"");
|
||||
WriteLiteral(" data-bind=\"template: { name: \'item-template\', foreach: waitingForUserAction, aft" +
|
||||
"erAdd: onAdd, beforeRemove: onRemove }\"");
|
||||
|
||||
WriteLiteral(@">
|
||||
// Hide Mouse Mouse
|
||||
$(function () {
|
||||
var mouseVisible = true;
|
||||
var mouseHideToken;
|
||||
var documentBody = $('body');
|
||||
WriteLiteral("></ul>\r\n </div>\r\n </div>\r\n <footer");
|
||||
|
||||
var hideMouse = function () {
|
||||
if (mouseVisible) {
|
||||
documentBody.css('cursor', 'none');
|
||||
mouseVisible = false;
|
||||
}
|
||||
};
|
||||
var showMouse = function () {
|
||||
if (!mouseVisible) {
|
||||
documentBody.css('cursor', 'auto');
|
||||
mouseVisible = true;
|
||||
}
|
||||
};
|
||||
WriteLiteral(" id=\"footer\"");
|
||||
|
||||
$(document).mousemove(function () {
|
||||
showMouse();
|
||||
if (mouseHideToken)
|
||||
window.clearTimeout(mouseHideToken);
|
||||
mouseHideToken = window.setTimeout(hideMouse, 2000);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script");
|
||||
WriteLiteral(">\r\n </footer>\r\n </section>\r\n </div>\r\n <script");
|
||||
|
||||
WriteLiteral(" type=\"text/javascript\"");
|
||||
WriteLiteral(" type=\"text/html\"");
|
||||
|
||||
WriteLiteral(">\r\n $(function () {\r\n var models = {};\r\n var modelsI" +
|
||||
"nProcessSorted = [];\r\n var modelsInProcessCount = 0;\r\n var" +
|
||||
" modelsReadyForReturnSorted = [];\r\n var modelsReadyForReturnCount = 0" +
|
||||
";\r\n var modelsWaitingForUserActionSorted = [];\r\n var model" +
|
||||
"sWaitingForUserActionCount = 0;\r\n var $inProcess = $(\'#inProcess\');\r\n" +
|
||||
" var $inProcessContent = $inProcess.find(\'.content ul\');\r\n " +
|
||||
" var $readyForReturn = $(\'#readyForReturn\');\r\n var $readyForReturnCon" +
|
||||
"tent = $readyForReturn.find(\'.content ul\');\r\n var $waitingForUserActi" +
|
||||
"on = $(\'#waitingForUserAction\');\r\n var $waitingForUserActionContent =" +
|
||||
" $waitingForUserAction.find(\'.content ul\');\r\n var modelsInProcessInde" +
|
||||
"xOffset = 0;\r\n var scrollInProcessToken = null;\r\n var mode" +
|
||||
"lsReadyForReturnIndexOffset = 0;\r\n var scrollReadyForReturnToken = nu" +
|
||||
"ll;\r\n var modelsWaitingForUserActionIndexOffset = 0;\r\n var" +
|
||||
" scrollWaitingForUserActionToken = null;\r\n var scrollSpeed = 3000;\r\n " +
|
||||
" var persistantConnection = null;\r\n var filterDeviceAddress" +
|
||||
"Include;\r\n var filterDeviceAddressExclude;\r\n var filterDev" +
|
||||
"iceProfileInclude;\r\n var filterDeviceProfileExclude;\r\n\r\n v" +
|
||||
"ar getParameterByName = function (name) {\r\n name = name.replace(/" +
|
||||
"[\\[]/, \"\\\\\\[\").replace(/[\\]]/, \"\\\\\\]\");\r\n var regexS = \"[\\\\?&]\" +" +
|
||||
" name + \"=([^&#]*)\";\r\n var regex = new RegExp(regexS);\r\n " +
|
||||
" var results = regex.exec(window.location.search);\r\n if (re" +
|
||||
"sults == null)\r\n return \"\";\r\n else\r\n " +
|
||||
" return decodeURIComponent(results[1].replace(/\\+/g, \" \"));\r\n " +
|
||||
" }\r\n\r\n var buildFilters = function () {\r\n var deviceA" +
|
||||
"ddressInclude = getParameterByName(\'deviceAddressInclude\');\r\n if " +
|
||||
"(deviceAddressInclude) {\r\n filterDeviceAddressInclude = {};\r\n" +
|
||||
" var split = deviceAddressInclude.split(\",\");\r\n " +
|
||||
" for (var i = 0; i < split.length; i++) {\r\n filterDe" +
|
||||
"viceAddressInclude[split[i].toLowerCase()] = true;\r\n }\r\n " +
|
||||
" } else {\r\n var deviceAddressExclude = getParameter" +
|
||||
"ByName(\'deviceAddressExclude\');\r\n if (deviceAddressExclude) {" +
|
||||
"\r\n filterDeviceAddressExclude = {};\r\n " +
|
||||
" var split = deviceAddressExclude.split(\",\");\r\n for (v" +
|
||||
"ar i = 0; i < split.length; i++) {\r\n filterDeviceAddr" +
|
||||
"essExclude[split[i].toLowerCase()] = true;\r\n }\r\n " +
|
||||
" } else {\r\n var deviceProfileInclude = getParam" +
|
||||
"eterByName(\'deviceProfileInclude\');\r\n if (deviceProfileIn" +
|
||||
"clude) {\r\n filterDeviceProfileInclude = {};\r\n " +
|
||||
" var deviceProfileIncludeSplit = deviceProfileInclude.split(\"" +
|
||||
",\");\r\n for (var i = 0; i < deviceProfileIncludeSplit." +
|
||||
"length; i++) {\r\n filterDeviceProfileInclude[parse" +
|
||||
"Int(deviceProfileIncludeSplit[i])] = true;\r\n }\r\n " +
|
||||
" } else {\r\n var deviceProfileExclud" +
|
||||
"e = getParameterByName(\'deviceProfileExclude\');\r\n if " +
|
||||
"(deviceProfileExclude) {\r\n filterDeviceProfileExc" +
|
||||
"lude = {};\r\n var deviceProfileExcludeSplit = devi" +
|
||||
"ceProfileExclude.split(\",\");\r\n for (var i = 0; i " +
|
||||
"< deviceProfileExcludeSplit.length; i++) {\r\n " +
|
||||
"filterDeviceProfileExclude[parseInt(deviceProfileExcludeSplit[i])] = true;\r\n " +
|
||||
" }\r\n }\r\n " +
|
||||
" }\r\n }\r\n }\r\n }\r\n va" +
|
||||
"r calculateFilter = function (model) {\r\n if (model) {\r\n " +
|
||||
" if (filterDeviceAddressInclude) {\r\n return (fil" +
|
||||
"terDeviceAddressInclude[model.DeviceAddress.toLowerCase()] == true)\r\n " +
|
||||
" }\r\n if (filterDeviceAddressExclude) {\r\n " +
|
||||
" return (!filterDeviceAddressExclude[model.DeviceAddress.toLowerCase()" +
|
||||
"])\r\n }\r\n if (filterDeviceProfileInclude) {" +
|
||||
"\r\n return (filterDeviceProfileInclude[model.DeviceProfile" +
|
||||
"Id] == true)\r\n }\r\n if (filterDeviceProfile" +
|
||||
"Exclude) {\r\n return (!filterDeviceProfileExclude[model.De" +
|
||||
"viceProfileId])\r\n }\r\n return true;\r\n " +
|
||||
" }\r\n return false;\r\n }\r\n\r\n var sor" +
|
||||
"tModels = function () {\r\n modelsInProcessSorted = [];\r\n " +
|
||||
" modelsReadyForReturnSorted = [];\r\n modelsWaitingForUserActi" +
|
||||
"onSorted = [];\r\n var modelSortFunc = function (a, b) {\r\n " +
|
||||
" if (a.DeviceSerialNumber.toUpperCase() == b.DeviceSerialNumber.toUppe" +
|
||||
"rCase()) {\r\n return 0;\r\n } else {\r\n " +
|
||||
" if (a.DeviceSerialNumber.toUpperCase() < b.DeviceSerialNumb" +
|
||||
"er.toUpperCase()) {\r\n return -1\r\n " +
|
||||
" } else {\r\n return 1\r\n }\r\n " +
|
||||
" }\r\n };\r\n for (var key in models" +
|
||||
") {\r\n var model = models[key];\r\n if (model" +
|
||||
") {\r\n if (model.WaitingForUserAction) {\r\n " +
|
||||
" modelsWaitingForUserActionSorted.push(model);\r\n " +
|
||||
" } else {\r\n if (model.ReadyForReturn) {\r\n " +
|
||||
" modelsReadyForReturnSorted.push(model);\r\n " +
|
||||
" } else {\r\n modelsInProcessSorted.push(" +
|
||||
"model);\r\n }\r\n }\r\n " +
|
||||
" }\r\n }\r\n modelsReadyForReturnSorted = models" +
|
||||
"ReadyForReturnSorted.sort(modelSortFunc);\r\n modelsInProcessSorted" +
|
||||
" = modelsInProcessSorted.sort(modelSortFunc);\r\n modelsWaitingForU" +
|
||||
"serActionSorted = modelsWaitingForUserActionSorted.sort(modelSortFunc);\r\n\r\n " +
|
||||
" if (modelsInProcessSorted.length != modelsInProcessCount) {\r\n " +
|
||||
" modelsInProcessCount = modelsInProcessSorted.length;\r\n " +
|
||||
" $(\'#inProcessCount\').text(\'(\' + modelsInProcessCount + \')\');\r\n " +
|
||||
" }\r\n if (modelsReadyForReturnSorted.length != modelsReadyForRe" +
|
||||
"turnCount) {\r\n modelsReadyForReturnCount = modelsReadyForRetu" +
|
||||
"rnSorted.length;\r\n $(\'#readyForReturnCount\').text(\'(\' + model" +
|
||||
"sReadyForReturnCount + \')\');\r\n }\r\n if (modelsWaiti" +
|
||||
"ngForUserActionSorted.length != modelsWaitingForUserActionCount) {\r\n " +
|
||||
" modelsWaitingForUserActionCount = modelsWaitingForUserActionSorted.lengt" +
|
||||
"h;\r\n $(\'#waitingForUserActionCount\').text(\'(\' + modelsWaiting" +
|
||||
"ForUserActionCount + \')\');\r\n }\r\n\r\n };\r\n\r\n v" +
|
||||
"ar scrollReadyForReturn = function () {\r\n $readyForReturnContent." +
|
||||
"find(\'li\').last().detach().prependTo($readyForReturnContent).hide().slideDown(\'s" +
|
||||
"low\');\r\n modelsReadyForReturnIndexOffset++;\r\n if (" +
|
||||
"modelsReadyForReturnIndexOffset >= modelsReadyForReturnSorted.length) {\r\n " +
|
||||
" modelsReadyForReturnIndexOffset = 0;\r\n }\r\n " +
|
||||
" scrollReadyForReturnToken = window.setTimeout(scrollReadyForReturn, scroll" +
|
||||
"Speed);\r\n };\r\n var updateScrollReadyForReturn = function (" +
|
||||
") {\r\n var containerHeight = $readyForReturn.find(\'.content\').heig" +
|
||||
"ht();\r\n var contentHeight = $readyForReturnContent.height();\r\n " +
|
||||
" if (containerHeight >= contentHeight && scrollReadyForReturnToken) " +
|
||||
"{\r\n window.clearTimeout(scrollReadyForReturnToken);\r\n " +
|
||||
" return;\r\n }\r\n if (containerHeight < co" +
|
||||
"ntentHeight && scrollReadyForReturnToken == null) {\r\n scrollR" +
|
||||
"eadyForReturnToken = window.setTimeout(scrollReadyForReturn, scrollSpeed);\r\n " +
|
||||
" }\r\n };\r\n var scrollInProcess = function () {\r\n" +
|
||||
" $inProcessContent.find(\'li\').last().detach().prependTo($inProces" +
|
||||
"sContent).hide().slideDown(\'slow\');\r\n modelsInProcessIndexOffset+" +
|
||||
"+;\r\n if (modelsInProcessIndexOffset >= modelsInProcessSorted.leng" +
|
||||
"th) {\r\n modelsInProcessIndexOffset = 0;\r\n }\r\n " +
|
||||
" scrollInProcessToken = window.setTimeout(scrollInProcess, scrollS" +
|
||||
"peed);\r\n };\r\n var updateScrollInProcess = function () {\r\n " +
|
||||
" var containerHeight = $inProcess.find(\'.content\').height();\r\n " +
|
||||
" var contentHeight = $inProcessContent.height();\r\n if " +
|
||||
"(containerHeight >= contentHeight && scrollInProcessToken) {\r\n " +
|
||||
" window.clearTimeout(scrollInProcessToken);\r\n return;\r\n " +
|
||||
" }\r\n if (containerHeight < contentHeight && scrollInPro" +
|
||||
"cessToken == null) {\r\n scrollInProcessToken = window.setTimeo" +
|
||||
"ut(scrollInProcess, scrollSpeed);\r\n }\r\n };\r\n " +
|
||||
" var scrollWaitingForUserAction = function () {\r\n $waitingForUse" +
|
||||
"rActionContent.find(\'li\').last().detach().prependTo($waitingForUserActionContent" +
|
||||
").hide().slideDown(\'slow\');\r\n modelsInProcessIndexOffset++;\r\n " +
|
||||
" if (modelsWaitingForUserActionIndexOffset >= modelsWaitingForUserAct" +
|
||||
"ionSorted.length) {\r\n modelsWaitingForUserActionIndexOffset =" +
|
||||
" 0;\r\n }\r\n scrollWaitingForUserActionToken = window" +
|
||||
".setTimeout(scrollWaitingForUserAction, scrollSpeed);\r\n };\r\n " +
|
||||
" var updateScrollWaitingForUserAction = function () {\r\n var con" +
|
||||
"tainerHeight = $waitingForUserAction.find(\'.content\').height();\r\n " +
|
||||
" var contentHeight = $waitingForUserActionContent.height();\r\n if " +
|
||||
"(containerHeight >= contentHeight && scrollWaitingForUserActionToken) {\r\n " +
|
||||
" window.clearTimeout(scrollWaitingForUserActionToken);\r\n " +
|
||||
" return;\r\n }\r\n if (containerHeight < conten" +
|
||||
"tHeight && scrollWaitingForUserActionToken == null) {\r\n scrol" +
|
||||
"lWaitingForUserActionToken = window.setTimeout(scrollWaitingForUserAction, scrol" +
|
||||
"lSpeed);\r\n }\r\n };\r\n\r\n var modelInsertIndex " +
|
||||
"= function (model) {\r\n sortModels();\r\n var findInd" +
|
||||
"ex = function (model, array, offset) {\r\n for (var i = 0; i < " +
|
||||
"array.length; i++) {\r\n if (model.DeviceSerialNumber == ar" +
|
||||
"ray[i].DeviceSerialNumber) {\r\n var index = i + offset" +
|
||||
";\r\n if (index > (array.length - 1)) {\r\n " +
|
||||
" index = index - (array.length - 1);\r\n " +
|
||||
" }\r\n return index;\r\n }\r\n " +
|
||||
" };\r\n };\r\n if (model.WaitingForUser" +
|
||||
"Action) {\r\n return findIndex(model, modelsWaitingForUserActio" +
|
||||
"nSorted, modelsWaitingForUserActionIndexOffset);\r\n } else {\r\n " +
|
||||
" if (model.ReadyForReturn) {\r\n return find" +
|
||||
"Index(model, modelsReadyForReturnSorted, modelsReadyForReturnIndexOffset);\r\n " +
|
||||
" } else {\r\n return findIndex(model, models" +
|
||||
"InProcessSorted, modelsInProcessIndexOffset);\r\n }\r\n " +
|
||||
" }\r\n }\r\n var modelInsert = function (model) {\r\n " +
|
||||
" var index = modelInsertIndex(model);\r\n var insertTo = f" +
|
||||
"unction (model, host) {\r\n var hostLi = host.children(\'li\');\r\n" +
|
||||
" if (hostLi.length == 0 || hostLi.length < index) {\r\n " +
|
||||
" host.append(model.htmlLi);\r\n } else {\r\n " +
|
||||
" if (index == 0) {\r\n host.prepend(mo" +
|
||||
"del.htmlLi);\r\n } else {\r\n $(ho" +
|
||||
"stLi.get(index - 1)).after(model.htmlLi);\r\n }\r\n " +
|
||||
" }\r\n }\r\n if (model.WaitingForUserAction) " +
|
||||
"{\r\n insertTo(model, $waitingForUserActionContent);\r\n " +
|
||||
" window.setTimeout(updateScrollWaitingForUserAction, 100);\r\n " +
|
||||
" } else {\r\n if (model.ReadyForReturn) {\r\n " +
|
||||
" insertTo(model, $readyForReturnContent);\r\n windo" +
|
||||
"w.setTimeout(updateScrollReadyForReturn, 100);\r\n } else {\r\n " +
|
||||
" insertTo(model, $inProcessContent);\r\n " +
|
||||
" window.setTimeout(updateScrollInProcess, 100);\r\n }\r\n " +
|
||||
" }\r\n }\r\n\r\n var removeModel = function (model) {\r\n" +
|
||||
" if (model) {\r\n model.htmlLi.slideUp(\'fast\', f" +
|
||||
"unction () {\r\n model.htmlLi.remove();\r\n " +
|
||||
" });\r\n }\r\n };\r\n\r\n var processModel = funct" +
|
||||
"ion (id, model, init) {\r\n if (!calculateFilter(model)) {\r\n " +
|
||||
" removeModel(models[id]);\r\n delete models[id];\r\n " +
|
||||
" sortModels();\r\n } else {\r\n " +
|
||||
"var existing = models[id];\r\n models[id] = model;\r\n\r\n " +
|
||||
" // Add\r\n model.htmlContent = $(\'<div>\').text(model" +
|
||||
".DeviceDescription);\r\n if (!model.ReadyForReturn && model.Est" +
|
||||
"imatedReturnTime) {\r\n model.htmlContent.append($(\'<span c" +
|
||||
"lass=\"small\">\').text(\' (Expected: \' + model.EstimatedReturnTime + \')\'));\r\n " +
|
||||
" }\r\n if (model.WaitingForUserAction) {\r\n " +
|
||||
" model.htmlContent.append($(\'<span class=\"small\">\').text(\' (Since" +
|
||||
" \' + model.WaitingForUserActionSince + \')\'));\r\n } else {\r\n " +
|
||||
" if (model.ReadyForReturn && model.ReadyForReturnSince) {\r\n " +
|
||||
" model.htmlContent.append($(\'<span class=\"small\">\').te" +
|
||||
"xt(\' (Ready \' + model.ReadyForReturnSince + \')\'));\r\n }\r\n " +
|
||||
" }\r\n\r\n if (existing) {\r\n " +
|
||||
" if (existing.ReadyForReturn != model.ReadyForReturn || existing.WaitingForU" +
|
||||
"serAction != model.WaitingForUserAction) {\r\n removeMo" +
|
||||
"del(existing);\r\n model.htmlLi = $(\'<li>\').html(model." +
|
||||
"htmlContent).data(\'ModelId\', id).hide();\r\n modelInser" +
|
||||
"t(model);\r\n if (init) {\r\n " +
|
||||
" model.htmlLi.fadeIn();\r\n } else {\r\n " +
|
||||
" model.htmlLi.slideDown();\r\n }\r\n " +
|
||||
" } else {\r\n model.htmlLi = existin" +
|
||||
"g.htmlLi;\r\n model.htmlLi.slideUp(\'fast\', function () " +
|
||||
"{\r\n model.htmlLi.html(model.htmlContent).slideDow" +
|
||||
"n();\r\n });\r\n }\r\n " +
|
||||
" } else {\r\n model.htmlLi = $(\'<li>\').html(model.html" +
|
||||
"Content).data(\'ModelId\', id).hide();\r\n modelInsert(model)" +
|
||||
";\r\n if (init) {\r\n model.htmlLi" +
|
||||
".fadeIn();\r\n } else {\r\n model." +
|
||||
"htmlLi.slideDown(\'slow\');\r\n }\r\n }\r\n " +
|
||||
" if (model.htmlLi && model.IsAlert) {\r\n m" +
|
||||
"odel.htmlLi.addClass(\'alert\');\r\n }\r\n }\r\n " +
|
||||
" };\r\n\r\n var updatedModel = function (id) {\r\n var " +
|
||||
"deviceSerialNumber = id.toString();\r\n\r\n $.ajax({\r\n " +
|
||||
" dataType: \'json\',\r\n url: \'");
|
||||
WriteLiteral(" id=\"item-template\"");
|
||||
|
||||
WriteLiteral(">\r\n <li data-bind=\"css: { alert: IsAlert }\">\r\n <span data-bind=" +
|
||||
"\"text: DeviceDescription\"></span>\r\n <!-- ko if: !ReadyForReturn && Es" +
|
||||
"timatedReturnTimeUnixEpoc -->\r\n <span class=\"small\">(Expected <span d" +
|
||||
"ata-bind=\"livestamp: EstimatedReturnTimeUnixEpoc\"></span>)</span>\r\n <" +
|
||||
"!-- /ko -->\r\n <!-- ko if: WaitingForUserAction -->\r\n <span" +
|
||||
" class=\"small\">(Since <span data-bind=\"livestamp: WaitingForUserActionSinceUnixE" +
|
||||
"poc\"></span>)</span>\r\n <!-- /ko -->\r\n <!-- ko if: ReadyFor" +
|
||||
"Return && !WaitingForUserAction -->\r\n <span class=\"small\">(Ready <spa" +
|
||||
"n data-bind=\"livestamp: ReadyForReturnSinceUnixEpoc\"></span>)</span>\r\n " +
|
||||
" <!-- /ko -->\r\n </li>\r\n </script>\r\n <script>\r\n ko.bindingHa" +
|
||||
"ndlers.livestamp = {\r\n init: function (element, valueAccessor, allBin" +
|
||||
"dings, viewModel, bindingContext) {\r\n var value = valueAccessor()" +
|
||||
";\r\n var valueUnwrapped = ko.unwrap(value);\r\n\r\n if " +
|
||||
"(valueUnwrapped)\r\n $(element).livestamp(valueUnwrapped);\r\n " +
|
||||
" else\r\n $(element).livestamp(\'destroy\');\r\n " +
|
||||
" }\r\n };\r\n </script>\r\n <script>\r\n $(function () {\r\n " +
|
||||
" var hub;\r\n var viewModel;\r\n\r\n var rotateSpeed = 3000" +
|
||||
";\r\n var itemFilters;\r\n\r\n var $inProcessList = $(\'#inProces" +
|
||||
"s\').find(\'ul\');\r\n var $readyForReturnList = $(\'#readyForReturn\').find" +
|
||||
"(\'ul\');\r\n var $waitingForUserActionList = $(\'#waitingForUserAction\')." +
|
||||
"find(\'ul\');\r\n\r\n function noticeboardViewModel(inProcess, readyForRetu" +
|
||||
"rn, waitingForUserAction) {\r\n var self = this;\r\n\r\n " +
|
||||
" self.initialized = false;\r\n\r\n self.inProcess = ko.observableArra" +
|
||||
"y(inProcess);\r\n self.readyForReturn = ko.observableArray(readyFor" +
|
||||
"Return);\r\n self.waitingForUserAction = ko.observableArray(waiting" +
|
||||
"ForUserAction);\r\n\r\n self.onRemove = function (element, index, dat" +
|
||||
"a) {\r\n $(element).slideUp(400, function () {\r\n " +
|
||||
" $(this).remove();\r\n });\r\n }\r\n " +
|
||||
" self.onAdd = function (element, index, data) {\r\n if (" +
|
||||
"self.initialized)\r\n $(element).hide().slideDown(400);\r\n " +
|
||||
" }\r\n }\r\n\r\n function init() {\r\n " +
|
||||
" // Connect to Hub\r\n hub = $.connection.noticeboardUpdates;\r\n\r\n " +
|
||||
" // Map Functions\r\n hub.client.updateHeldDevice = up" +
|
||||
"dateHeldDevice;\r\n\r\n $.connection.hub.qs = { Noticeboard: \'");
|
||||
|
||||
|
||||
#line 432 "..\..\Areas\Public\Views\HeldDevices\Noticeboard.cshtml"
|
||||
Write(Url.Action(MVC.Public.HeldDevices.HeldDevice()));
|
||||
#line 127 "..\..\Areas\Public\Views\HeldDevices\Noticeboard.cshtml"
|
||||
Write(Disco.Services.Jobs.Noticeboards.HeldDevices.Name);
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"',
|
||||
data: { id: deviceSerialNumber },
|
||||
success: function (data) {
|
||||
processModel(deviceSerialNumber, data, false);
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
if (textStatus == 'parsererror') // null Result
|
||||
processModel(deviceSerialNumber, null, false);
|
||||
}
|
||||
})
|
||||
};
|
||||
WriteLiteral(@"' };
|
||||
$.connection.hub.error(connectionError);
|
||||
$.connection.hub.disconnected(connectionError);
|
||||
$.connection.hub.reconnected(connectionError);
|
||||
|
||||
var connectionError = function () {
|
||||
if (persistantConnection) {
|
||||
persistantConnection.stop();
|
||||
persistantConnection = null;
|
||||
window.setTimeout(function () {
|
||||
window.location.href = '");
|
||||
// Start Connection
|
||||
$.connection.hub.start().fail(connectionError).done(loadData);
|
||||
}
|
||||
|
||||
// Called after SignalR is connected
|
||||
function loadData() {
|
||||
$.getJSON('");
|
||||
|
||||
|
||||
#line 449 "..\..\Areas\Public\Views\HeldDevices\Noticeboard.cshtml"
|
||||
Write(Url.Action(MVC.Public.HeldDevices.Noticeboard()));
|
||||
#line 138 "..\..\Areas\Public\Views\HeldDevices\Noticeboard.cshtml"
|
||||
Write(Url.Action(MVC.Public.HeldDevices.HeldDevices()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\';\r\n }, 10000);\r\n }\r\n }\r\n\r\n " +
|
||||
" var init = function () {\r\n buildFilters();\r\n " +
|
||||
" persistantConnection = $.connection(\'");
|
||||
|
||||
|
||||
#line 456 "..\..\Areas\Public\Views\HeldDevices\Noticeboard.cshtml"
|
||||
Write(Url.Content("~/Public/HeldDevices/Notifications"));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral("\');\r\n persistantConnection.received(updatedModel);\r\n " +
|
||||
" persistantConnection.error(connectionError);\r\n persistantConnec" +
|
||||
"tion.start(function () {\r\n $.getJSON(\'");
|
||||
|
||||
|
||||
#line 460 "..\..\Areas\Public\Views\HeldDevices\Noticeboard.cshtml"
|
||||
Write(Url.Action(MVC.Public.HeldDevices.HeldDevices()));
|
||||
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
WriteLiteral(@"', null, function (data) {
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
processModel(data[i].DeviceSerialNumber, data[i], true);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
init();
|
||||
|
||||
});
|
||||
</script>
|
||||
<div");
|
||||
|
||||
WriteLiteral(" id=\"mainFooter\"");
|
||||
|
||||
WriteLiteral(">\r\n <img");
|
||||
|
||||
WriteLiteral(" style=\"width: 34px; height: 34px; margin-top: -5px; margin-bottom: -12px;\"");
|
||||
|
||||
WriteAttribute("src", Tuple.Create(" src=\"", 22627), Tuple.Create("\"", 22677)
|
||||
|
||||
#line 472 "..\..\Areas\Public\Views\HeldDevices\Noticeboard.cshtml"
|
||||
, Tuple.Create(Tuple.Create("", 22633), Tuple.Create<System.Object, System.Int32>(Links.ClientSource.Style.Images.Heading_png
|
||||
|
||||
#line default
|
||||
#line hidden
|
||||
, 22633), false)
|
||||
);
|
||||
|
||||
WriteLiteral(" alt=\"Disco Logo\"");
|
||||
|
||||
WriteLiteral(" />\r\n powered by Disco\r\n </div>\r\n</body>\r\n</html>\r\n");
|
||||
WriteLiteral("\', null, function (data) {\r\n\r\n var inProcess = [];\r\n " +
|
||||
" var readyForReturn = [];\r\n var waitingForUserAction" +
|
||||
" = [];\r\n\r\n data.filter(function (heldDeviceItem) {\r\n " +
|
||||
" return includeItem(heldDeviceItem)\r\n }).forEac" +
|
||||
"h(function (heldDeviceItem) {\r\n if (isWaitingForUserActio" +
|
||||
"n(heldDeviceItem))\r\n waitingForUserAction.push(heldDe" +
|
||||
"viceItem);\r\n else if (isReadyForReturn(heldDeviceItem))\r\n" +
|
||||
" readyForReturn.push(heldDeviceItem);\r\n " +
|
||||
" else if (isInProcess(heldDeviceItem))\r\n inP" +
|
||||
"rocess.push(heldDeviceItem);\r\n });\r\n\r\n inP" +
|
||||
"rocess.sort(sortFunction);\r\n readyForReturn.sort(sortFunction" +
|
||||
");\r\n waitingForUserAction.sort(sortFunction);\r\n\r\n " +
|
||||
" viewModel = new noticeboardViewModel(inProcess, readyForReturn, waitingF" +
|
||||
"orUserAction);\r\n\r\n ko.applyBindings(viewModel);\r\n " +
|
||||
" viewModel.initialized = true;\r\n\r\n $(\'body\').removeCla" +
|
||||
"ss(\'status-connecting\');\r\n\r\n window.setTimeout(scheduleRotati" +
|
||||
"on, rotateSpeed);\r\n });\r\n buildFilters();\r\n " +
|
||||
" }\r\n\r\n // Called by SignalR\r\n function updateHeldDevic" +
|
||||
"e(updates) {\r\n if (viewModel) {\r\n\r\n $.each(upd" +
|
||||
"ates, function (deviceSerialNumber, heldDeviceItem) {\r\n /" +
|
||||
"/ Remove Existing\r\n removeItem(deviceSerialNumber);\r\n\r\n " +
|
||||
" // Add Item\r\n addItem(heldDeviceIte" +
|
||||
"m);\r\n });\r\n }\r\n }\r\n\r\n fu" +
|
||||
"nction removeItem(deviceSerialNumber) {\r\n removeItemFromArray(vie" +
|
||||
"wModel.inProcess, deviceSerialNumber);\r\n removeItemFromArray(view" +
|
||||
"Model.readyForReturn, deviceSerialNumber);\r\n removeItemFromArray(" +
|
||||
"viewModel.waitingForUserAction, deviceSerialNumber);\r\n }\r\n\r\n " +
|
||||
" function addItem(heldDeviceItem) {\r\n if (heldDeviceItem !== nu" +
|
||||
"ll &&\r\n heldDeviceItem !== undefined &&\r\n " +
|
||||
"includeItem(heldDeviceItem)) {\r\n\r\n var array;\r\n\r\n " +
|
||||
" if (isWaitingForUserAction(heldDeviceItem))\r\n arr" +
|
||||
"ay = viewModel.waitingForUserAction;\r\n else if (isReadyForRet" +
|
||||
"urn(heldDeviceItem))\r\n array = viewModel.readyForReturn;\r" +
|
||||
"\n else if (isInProcess(heldDeviceItem))\r\n " +
|
||||
" array = viewModel.inProcess;\r\n\r\n if (array().length === 0" +
|
||||
") {\r\n array.push(heldDeviceItem);\r\n } " +
|
||||
"else {\r\n var index = findSortedInsertIndex(array, heldDev" +
|
||||
"iceItem);\r\n if (index === -1)\r\n " +
|
||||
" array.push(heldDeviceItem);\r\n else\r\n " +
|
||||
" array.splice(index, 0, heldDeviceItem);\r\n }\r\n " +
|
||||
" }\r\n }\r\n\r\n function rotateArrays() {\r\n " +
|
||||
" rotateArray(viewModel.inProcess, $inProcessList);\r\n rotateArr" +
|
||||
"ay(viewModel.readyForReturn, $readyForReturnList);\r\n rotateArray(" +
|
||||
"viewModel.waitingForUserAction, $waitingForUserActionList);\r\n }\r\n\r\n " +
|
||||
" function scheduleRotation() {\r\n rotateArrays();\r\n\r\n " +
|
||||
" window.setTimeout(scheduleRotation, rotateSpeed);\r\n }\r\n\r\n" +
|
||||
" function includeItem(heldDeviceItem) {\r\n if (itemFilt" +
|
||||
"ers == null || itemFilters.length == 0)\r\n return true;\r\n\r\n " +
|
||||
" return itemFilters.reduce(function (previousValue, currentValue, in" +
|
||||
"dex, array) {\r\n if (previousValue === false)\r\n " +
|
||||
" return false;\r\n return currentValue(heldDeviceItem);" +
|
||||
"\r\n }, true);\r\n }\r\n\r\n function buildFilters(" +
|
||||
") {\r\n var filters = [];\r\n var queryStringParameter" +
|
||||
"s = getQueryStringParameters();\r\n\r\n if (queryStringParameters !==" +
|
||||
" null) {\r\n $.each(queryStringParameters, function (key, value" +
|
||||
") {\r\n switch (key.toLowerCase()) {\r\n " +
|
||||
" case \'deviceaddressinclude\':\r\n var deviceA" +
|
||||
"ddresses = value.split(\",\").map(function (v) { return v.toLowerCase(); });\r\n " +
|
||||
" if (deviceAddresses.length > 0) {\r\n " +
|
||||
" filters.push(function (heldDeviceItem) {\r\n " +
|
||||
" // false if DeviceAddressShortName is null\r\n " +
|
||||
" if (!heldDeviceItem.DeviceAddressShortName)\r\n " +
|
||||
" return false;\r\n\r\n " +
|
||||
" // true if DeviceAddressShortName is included\r\n " +
|
||||
" return $.inArray(heldDeviceItem.DeviceAddressShortName.toLower" +
|
||||
"Case(), deviceAddresses) >= 0;\r\n });\r\n " +
|
||||
" }\r\n break;\r\n " +
|
||||
" case \'deviceaddressexclude\':\r\n va" +
|
||||
"r deviceAddresses = value.split(\",\").map(function (v) { return v.toLowerCase(); " +
|
||||
"});\r\n if (deviceAddresses.length > 0) {\r\n " +
|
||||
" filters.push(function (heldDeviceItem) {\r\n " +
|
||||
" // true if DeviceAddressShortName is null\r\n " +
|
||||
" if (!heldDeviceItem.DeviceAddressShortName)\r\n " +
|
||||
" return true;\r\n\r\n " +
|
||||
" // true if DeviceAddressShortName is excluded\r\n " +
|
||||
" return $.inArray(heldDeviceItem.DeviceAddressShortName." +
|
||||
"toLowerCase(), deviceAddresses) < 0;\r\n });\r\n " +
|
||||
" }\r\n break;\r\n " +
|
||||
" case \'deviceprofileinclude\':\r\n " +
|
||||
" var deviceProfiles = value.split(\",\");\r\n if (" +
|
||||
"deviceProfiles.length > 0) {\r\n filters.push(f" +
|
||||
"unction (heldDeviceItem) {\r\n // true if D" +
|
||||
"eviceProfileId is included\r\n return $.inA" +
|
||||
"rray(heldDeviceItem.DeviceProfileId, deviceProfiles) >= 0;\r\n " +
|
||||
" });\r\n }\r\n " +
|
||||
" break;\r\n case \'deviceprofileexclude\':\r\n " +
|
||||
" var deviceProfiles = value.split(\",\");\r\n " +
|
||||
" if (deviceProfiles.length > 0) {\r\n " +
|
||||
" filters.push(function (heldDeviceItem) {\r\n " +
|
||||
" // true if DeviceProfileId is excluded\r\n " +
|
||||
" return $.inArray(heldDeviceItem.DeviceProfileId, deviceProfiles) < 0;\r" +
|
||||
"\n });\r\n }\r\n " +
|
||||
" break;\r\n }\r\n " +
|
||||
" });\r\n }\r\n\r\n if (filters.length > 0)\r\n " +
|
||||
" itemFilters = filters;\r\n else\r\n ite" +
|
||||
"mFilters = null;\r\n }\r\n\r\n function connectionError() {\r\n " +
|
||||
" try {\r\n $(\'body\').addClass(\'status-error\');\r\n " +
|
||||
" $.connection.hub.stop();\r\n } catch (e) {\r\n " +
|
||||
" // Ignore\r\n }\r\n\r\n window.setTimeout(" +
|
||||
"function () {\r\n window.location.href = window.location.href;\r" +
|
||||
"\n }, 10000);\r\n }\r\n\r\n // Helpers\r\n " +
|
||||
" function rotateArray(koArray, element) {\r\n var items = koArray(" +
|
||||
");\r\n\r\n if (items.length <= 1)\r\n return 0;\r\n\r\n " +
|
||||
" if (element.height() < (element.parent().height() - 30)) {\r\n\r\n " +
|
||||
" if (findUnsortedArrayTopIndex(items) !== 0)\r\n " +
|
||||
" koArray.sort(sortFunction);\r\n\r\n // Don\'t rotate if smal" +
|
||||
"l & sorted correctly\r\n return;\r\n }\r\n\r\n " +
|
||||
" // Move Last Item to Top\r\n var item = koArray.pop();\r\n " +
|
||||
" koArray.unshift(item);\r\n }\r\n function removeI" +
|
||||
"temFromArray(koArray, deviceSerialNumber) {\r\n var items = koArray" +
|
||||
"();\r\n for (var i = 0; i < items.length; i++) {\r\n " +
|
||||
" if (items[i].DeviceSerialNumber == deviceSerialNumber) {\r\n " +
|
||||
" koArray.splice(i, 1);\r\n items = koArray();\r\n " +
|
||||
" i--;\r\n }\r\n }\r\n }\r\n " +
|
||||
" function findUnsortedArrayTopIndex(items) {\r\n // Only " +
|
||||
"one Item\r\n if (items.length <= 1)\r\n return 0;\r" +
|
||||
"\n\r\n for (var i = 1; i < items.length; i++) {\r\n " +
|
||||
" var s = sortFunction(items[i - 1], items[i]);\r\n if (s > 0)\r\n" +
|
||||
" return i;\r\n }\r\n\r\n return 0" +
|
||||
";\r\n }\r\n function findSortedInsertIndex(koArray, heldDevice" +
|
||||
"Item) {\r\n var items = koArray();\r\n var startIndex " +
|
||||
"= findUnsortedArrayTopIndex(items);\r\n for (var i = startIndex; i " +
|
||||
"< items.length; i++) {\r\n var s = sortFunction(heldDeviceItem," +
|
||||
" items[i]);\r\n if (s <= 0)\r\n return i;\r" +
|
||||
"\n }\r\n if (startIndex !== 0) {\r\n " +
|
||||
" for (var i = 0; i < startIndex; i++) {\r\n var s = sortFun" +
|
||||
"ction(heldDeviceItem, items[i]);\r\n if (s <= 0)\r\n " +
|
||||
" return i;\r\n }\r\n return " +
|
||||
"startIndex;\r\n } else {\r\n return -1;\r\n " +
|
||||
" }\r\n }\r\n function sortFunction(l, r) {\r\n " +
|
||||
" return l.DeviceDescription.toLowerCase() == r.DeviceDescription.toLowerCase(" +
|
||||
") ? 0 : (l.DeviceDescription.toLowerCase() < r.DeviceDescription.toLowerCase() ?" +
|
||||
" -1 : 1)\r\n }\r\n function isInProcess(i) {\r\n " +
|
||||
"return !i.ReadyForReturn && !i.WaitingForUserAction;\r\n }\r\n " +
|
||||
" function isReadyForReturn(i) {\r\n return i.ReadyForReturn && !i.W" +
|
||||
"aitingForUserAction;\r\n }\r\n function isWaitingForUserAction" +
|
||||
"(i) {\r\n return i.WaitingForUserAction;\r\n }\r\n " +
|
||||
" function getQueryStringParameters() {\r\n\r\n if (window.location.s" +
|
||||
"earch.length === 0)\r\n return null;\r\n\r\n var par" +
|
||||
"ams = {};\r\n window.location.search.substr(1).split(\"&\").forEach(f" +
|
||||
"unction (pair) {\r\n if (pair === \"\") return;\r\n " +
|
||||
" var parts = pair.split(\"=\");\r\n params[parts[0]] = parts[1" +
|
||||
"] && decodeURIComponent(parts[1].replace(/\\+/g, \" \"));\r\n });\r\n " +
|
||||
" return params;\r\n }\r\n\r\n init();\r\n });\r\n" +
|
||||
" </script>\r\n</body>\r\n</html>");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user