From de10f92c02f3d2becc03cf4fe091f6ca06381a88 Mon Sep 17 00:00:00 2001 From: Gary Sharp Date: Wed, 10 Sep 2025 15:23:06 +1000 Subject: [PATCH] minor bug fixes --- Disco.Web/Areas/Config/Views/Shared/TaskStatus.cshtml | 3 +-- Disco.Web/Areas/Config/Views/Shared/TaskStatus.generated.cs | 4 ++-- .../Scripts/Modules/Disco-PropertyChangeHelpers.js | 2 +- .../Scripts/Modules/Disco-PropertyChangeHelpers.min.js | 2 +- .../disco.propertychangehelpers.js | 2 +- Disco.Web/Disco.Web.csproj | 6 +++--- 6 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Disco.Web/Areas/Config/Views/Shared/TaskStatus.cshtml b/Disco.Web/Areas/Config/Views/Shared/TaskStatus.cshtml index de6a36e8..dba08553 100644 --- a/Disco.Web/Areas/Config/Views/Shared/TaskStatus.cshtml +++ b/Disco.Web/Areas/Config/Views/Shared/TaskStatus.cshtml @@ -250,8 +250,7 @@ console.log('Server connection error: ' + error); }); - $.connection.hub.start() - .fail(onHubFailed); + $.connection.hub.start(); } }); diff --git a/Disco.Web/Areas/Config/Views/Shared/TaskStatus.generated.cs b/Disco.Web/Areas/Config/Views/Shared/TaskStatus.generated.cs index f84c8064..e9d2169f 100644 --- a/Disco.Web/Areas/Config/Views/Shared/TaskStatus.generated.cs +++ b/Disco.Web/Areas/Config/Views/Shared/TaskStatus.generated.cs @@ -281,8 +281,8 @@ WriteLiteral("\';\r\n\r\n var view = $(\'#Logging_Task_Status\');\r\n "sHub.client.updateTaskStatus = vm.Update;\r\n\r\n $.connection.hub.qs = {" + " TaskSessionId: sessionId };\r\n $.connection.hub.error(function (error" + ") {\r\n console.log(\'Server connection error: \' + error);\r\n " + -" });\r\n\r\n $.connection.hub.start()\r\n .fail(onHubFail" + -"ed);\r\n }\r\n\r\n });\r\n\r\n"); +" });\r\n\r\n $.connection.hub.start();\r\n }\r\n\r\n });\r\n\r\n"); } } diff --git a/Disco.Web/ClientSource/Scripts/Modules/Disco-PropertyChangeHelpers.js b/Disco.Web/ClientSource/Scripts/Modules/Disco-PropertyChangeHelpers.js index b7b54a5b..309e61d1 100644 --- a/Disco.Web/ClientSource/Scripts/Modules/Disco-PropertyChangeHelpers.js +++ b/Disco.Web/ClientSource/Scripts/Modules/Disco-PropertyChangeHelpers.js @@ -29,7 +29,7 @@ if (!document.DiscoFunctions.PropertyChangeHelper) { const body = new FormData(); body.append('__RequestVerificationToken', document.body.dataset.antiforgery); - if (!data) { + if (data) { for (const prop in data) { body.append(prop, data[prop]); } diff --git a/Disco.Web/ClientSource/Scripts/Modules/Disco-PropertyChangeHelpers.min.js b/Disco.Web/ClientSource/Scripts/Modules/Disco-PropertyChangeHelpers.min.js index 1c5e2e29..bb5ff73e 100644 --- a/Disco.Web/ClientSource/Scripts/Modules/Disco-PropertyChangeHelpers.min.js +++ b/Disco.Web/ClientSource/Scripts/Modules/Disco-PropertyChangeHelpers.min.js @@ -1 +1 @@ -if(document.DiscoFunctions||(document.DiscoFunctions={}),document.DiscoFunctions.PropertyChangeHelper||(document.DiscoFunctions.PropertyValue=function(n){return n[0].nodeName.toLowerCase()=="input"&&n.attr("type")=="checkbox"?n.is(":checked"):n.val()},document.DiscoFunctions.PropertyChangeHelper=function(n,t,i,r,u,f){var h=document.DiscoFunctions.PropertyValue(n),o=null,e=n.nextAll(".ajaxSave").first(),s=n.nextAll(".ajaxLoading").first(),c=function(){e.hide();var t=document.DiscoFunctions.PropertyValue(n);if(h!=t){if(f&&!f(t))return;h=t;o&&window.clearTimeout(o);o=window.setTimeout(async function(){s.show();const n=new FormData;if(n.append("__RequestVerificationToken",document.body.dataset.antiforgery),!u)for(const t in u)n.append(t,u[t]);n.append(r,h);try{const t=await fetch(i,{method:"POST",body:n});t.ok?s.hide().next(".ajaxOk").show().delay("fast").fadeOut("slow"):(alert('Unable to change property "'+r+'":\n'+t.statusText),s.hide())}catch(t){alert('Unable to change property "'+r+'":\n'+t);s.hide()}o=null},500)}};n[0].nodeName.toLowerCase()=="input"&&n.attr("type")=="checkbox"?n.click(c):n.change(c);n[0].nodeName.toLowerCase()=="input"&&n.attr("type")=="text"&&(n.keydown(function(n){e.show();n.which==13&&$(this).blur()}).blur(function(){e.hide()}).focus(function(){$(this).select()}),t&&n.watermark(t));n[0].nodeName.toLowerCase()=="textarea"&&n.keydown(function(){e.show()}).blur(function(){e.hide()})}),document.DiscoFunctions.DateChangeUserHelper||(document.DiscoFunctions.DateChangeUserHelper=function(n,t,i,r,u,f,e){var h=n.val(),o=null,s=t.next(".ajaxLoading");n.watermark(i).change(function(){var i=n.val();h.toLowerCase()!=i.toLowerCase()&&(h=i,o&&window.clearTimeout(o),o=window.setTimeout(async function(){s.show();const n=new FormData;n.append("__RequestVerificationToken",document.body.dataset.antiforgery);n.append(u,h);try{const i=await fetch(r,{method:"POST",body:n});if(i.ok){const n=await i.json();t.text("by "+n.UserDescription);s.hide().next(".ajaxOk").show().delay("fast").fadeOut("slow")}else alert("Unable to change Date:\n"+i.statusText),s.hide()}catch(i){alert("Unable to change Date:\n"+response.statusText);s.hide()}o=null},500))}).focus(function(){$(this).select()});e?n.datepicker({defaultDate:new Date,minDate:moment(f).toDate(),changeYear:!0,changeMonth:!0,dateFormat:"yy/mm/dd",beforeShow:function(n){$input=$(n);$input.val()||$input.datepicker("setDate",new Date)}}):n.datetimepicker({defaultDate:new Date,ampm:!0,minDate:moment(f).toDate(),changeYear:!0,changeMonth:!0,dateFormat:"yy/mm/dd",beforeShow:function(n){$input=$(n);$input.val()||$input.datetimepicker("setDate",new Date)}})}),document.DiscoFunctions.DateChangeHelper||(document.DiscoFunctions.DateChangeHelper=function(n,t,i,r,u,f){var s=n.val(),e=null,o=n.next(".ajaxLoading");n.watermark(t).change(function(){var t=n.val();s.toLowerCase()!=t.toLowerCase()&&(s=t,e&&window.clearTimeout(e),e=window.setTimeout(async function(){o.show();const n=new FormData;n.append("__RequestVerificationToken",document.body.dataset.antiforgery);n.append(r,s);try{const t=await fetch(i,{method:"POST",body:n});t.ok?o.hide().next(".ajaxOk").show().delay("fast").fadeOut("slow"):(alert("Unable to change Date:\n"+t.statusText),o.hide())}catch(t){alert("Unable to change Date:\n"+response.statusText);o.hide()}e=null},500))}).focus(function(){$(this).select()});f?n.datepicker({defaultDate:new Date,minDate:moment(u).toDate(),changeYear:!0,changeMonth:!0,dateFormat:"yy/mm/dd",beforeShow:function(n){$input=$(n);$input.val()||$input.datepicker("setDate",new Date)}}):n.datetimepicker({defaultDate:new Date,ampm:!0,minDate:moment(u).toDate(),changeYear:!0,changeMonth:!0,dateFormat:"yy/mm/dd",beforeShow:function(n){$input=$(n);$input.val()||$input.datetimepicker("setDate",new Date)}})}),!document.DiscoFunctions.DateDialogCreateUpdater){var dialog,dialogForm,dialogHeader,dialogDateBox,dialogDatePropertyNameBox,updateUrl,friendlyName,dateField,userField,updatePropertyName,notSetDisplay,minDate,useAjax;function n(){if(!dialog){dialog=$("
").attr({"class":"dialog"});dialogForm=$("
").attr({action:"/",method:"post"}).appendTo(dialog);var n=$("

").appendTo(dialogForm);dialogHeader=$("

").attr("autofocus","autofocus").appendTo(n);dialogDatePropertyNameBox=$("").attr({type:"hidden",name:"key"}).appendTo(n);dialogDateBox=$("").attr({type:"datetime",name:"value"}).css({display:"block","margin-top":15,"margin-left":"auto","margin-right":"auto"}).appendTo(n);$("").attr({type:"hidden",name:"redirect"}).val("true").appendTo(n);dialog.dialog({resizable:!1,modal:!0,autoOpen:!1,buttons:{Update:function(){t()},Cancel:function(){$(this).dialog("close")}},open:function(){dialog.dialog("widget").find(".ui-dialog-buttonpane :tabbable:first").focus()}});dialogDateBox.datetimepicker({defaultDate:new Date,ampm:!0,changeYear:!0,changeMonth:!0,dateFormat:"yy/mm/dd"})}return dialog}async function t(){var r=dialogDateBox.val(),t,n,i;if(useAjax){t=$("#"+dateField);userField&&(n=$("#"+userField));dialog.dialog("close");i=(n?n.next(".ajaxLoading"):t.next(".ajaxLoading")).show();const u=new FormData;u.append("__RequestVerificationToken",document.body.dataset.antiforgery);u.append("key",updatePropertyName);u.append("value",r);try{const r=await fetch(updateUrl,{method:"POST",body:u});if(r.ok){const u=await r.json();u.DateTimeFull?t.attr("data-isodate",u.DateTimeISO8601).attr("data-livestamp",u.DateTimeUnixEpoc).attr("title",u.DateTimeFull).text(u.DateTimeFriendly):t.attr("data-isodate","").attr("data-livestamp","-1").attr("title",notSetDisplay).text(notSetDisplay);n&&n.text("by "+u.UserDescription);i.hide().next(".ajaxOk").show().delay("fast").fadeOut("slow")}else alert("Unable to change "+friendlyName+" Date:\n"+r.statusText),i.hide()}catch(u){alert("Unable to change "+friendlyName+" Date:\n"+response.statusText);i.hide()}}else dialog.dialog("disable"),dialog.dialog("option","buttons",null),dialogDatePropertyNameBox.val(updatePropertyName),dialogForm.attr("action",updateUrl),dialogForm.submit()}function i(t,i,r,u,f,e,o,s){var h,c;updateUrl=t;friendlyName=i;dateField=r;userField=u;updatePropertyName=f;notSetDisplay=e;minDate=o;useAjax=s;h=n();h.dialog("option","title",friendlyName);dialogHeader.text(friendlyName+" Date");c=$("#"+r).attr("data-isodate");c?dialogDateBox.datetimepicker("setDate",new Date(c)):dialogDateBox.datetimepicker("setDate",new Date);o?dialogDateBox.datetimepicker("option","minDate",moment(minDate).toDate()):dialogDateBox.datetimepicker("option","minDate",null);h.dialog("open")}function r(n,t,r,u,f,e,o,s){$("").attr({href:"#","class":"button small",style:"margin-right: 5px;"}).text("Update").click(function(h){h.preventDefault();i(n,t,r,u,f,e,o,s)}).insertBefore("#"+r)}document.DiscoFunctions.DateDialogCreateUpdater=r} \ No newline at end of file +if(document.DiscoFunctions||(document.DiscoFunctions={}),document.DiscoFunctions.PropertyChangeHelper||(document.DiscoFunctions.PropertyValue=function(n){return n[0].nodeName.toLowerCase()=="input"&&n.attr("type")=="checkbox"?n.is(":checked"):n.val()},document.DiscoFunctions.PropertyChangeHelper=function(n,t,i,r,u,f){var h=document.DiscoFunctions.PropertyValue(n),o=null,e=n.nextAll(".ajaxSave").first(),s=n.nextAll(".ajaxLoading").first(),c=function(){e.hide();var t=document.DiscoFunctions.PropertyValue(n);if(h!=t){if(f&&!f(t))return;h=t;o&&window.clearTimeout(o);o=window.setTimeout(async function(){s.show();const n=new FormData;if(n.append("__RequestVerificationToken",document.body.dataset.antiforgery),u)for(const t in u)n.append(t,u[t]);n.append(r,h);try{const t=await fetch(i,{method:"POST",body:n});t.ok?s.hide().next(".ajaxOk").show().delay("fast").fadeOut("slow"):(alert('Unable to change property "'+r+'":\n'+t.statusText),s.hide())}catch(t){alert('Unable to change property "'+r+'":\n'+t);s.hide()}o=null},500)}};n[0].nodeName.toLowerCase()=="input"&&n.attr("type")=="checkbox"?n.click(c):n.change(c);n[0].nodeName.toLowerCase()=="input"&&n.attr("type")=="text"&&(n.keydown(function(n){e.show();n.which==13&&$(this).blur()}).blur(function(){e.hide()}).focus(function(){$(this).select()}),t&&n.watermark(t));n[0].nodeName.toLowerCase()=="textarea"&&n.keydown(function(){e.show()}).blur(function(){e.hide()})}),document.DiscoFunctions.DateChangeUserHelper||(document.DiscoFunctions.DateChangeUserHelper=function(n,t,i,r,u,f,e){var h=n.val(),o=null,s=t.next(".ajaxLoading");n.watermark(i).change(function(){var i=n.val();h.toLowerCase()!=i.toLowerCase()&&(h=i,o&&window.clearTimeout(o),o=window.setTimeout(async function(){s.show();const n=new FormData;n.append("__RequestVerificationToken",document.body.dataset.antiforgery);n.append(u,h);try{const i=await fetch(r,{method:"POST",body:n});if(i.ok){const n=await i.json();t.text("by "+n.UserDescription);s.hide().next(".ajaxOk").show().delay("fast").fadeOut("slow")}else alert("Unable to change Date:\n"+i.statusText),s.hide()}catch(i){alert("Unable to change Date:\n"+response.statusText);s.hide()}o=null},500))}).focus(function(){$(this).select()});e?n.datepicker({defaultDate:new Date,minDate:moment(f).toDate(),changeYear:!0,changeMonth:!0,dateFormat:"yy/mm/dd",beforeShow:function(n){$input=$(n);$input.val()||$input.datepicker("setDate",new Date)}}):n.datetimepicker({defaultDate:new Date,ampm:!0,minDate:moment(f).toDate(),changeYear:!0,changeMonth:!0,dateFormat:"yy/mm/dd",beforeShow:function(n){$input=$(n);$input.val()||$input.datetimepicker("setDate",new Date)}})}),document.DiscoFunctions.DateChangeHelper||(document.DiscoFunctions.DateChangeHelper=function(n,t,i,r,u,f){var s=n.val(),e=null,o=n.next(".ajaxLoading");n.watermark(t).change(function(){var t=n.val();s.toLowerCase()!=t.toLowerCase()&&(s=t,e&&window.clearTimeout(e),e=window.setTimeout(async function(){o.show();const n=new FormData;n.append("__RequestVerificationToken",document.body.dataset.antiforgery);n.append(r,s);try{const t=await fetch(i,{method:"POST",body:n});t.ok?o.hide().next(".ajaxOk").show().delay("fast").fadeOut("slow"):(alert("Unable to change Date:\n"+t.statusText),o.hide())}catch(t){alert("Unable to change Date:\n"+response.statusText);o.hide()}e=null},500))}).focus(function(){$(this).select()});f?n.datepicker({defaultDate:new Date,minDate:moment(u).toDate(),changeYear:!0,changeMonth:!0,dateFormat:"yy/mm/dd",beforeShow:function(n){$input=$(n);$input.val()||$input.datepicker("setDate",new Date)}}):n.datetimepicker({defaultDate:new Date,ampm:!0,minDate:moment(u).toDate(),changeYear:!0,changeMonth:!0,dateFormat:"yy/mm/dd",beforeShow:function(n){$input=$(n);$input.val()||$input.datetimepicker("setDate",new Date)}})}),!document.DiscoFunctions.DateDialogCreateUpdater){var dialog,dialogForm,dialogHeader,dialogDateBox,dialogDatePropertyNameBox,updateUrl,friendlyName,dateField,userField,updatePropertyName,notSetDisplay,minDate,useAjax;function n(){if(!dialog){dialog=$("
").attr({"class":"dialog"});dialogForm=$("").attr({action:"/",method:"post"}).appendTo(dialog);var n=$("

").appendTo(dialogForm);dialogHeader=$("

").attr("autofocus","autofocus").appendTo(n);dialogDatePropertyNameBox=$("").attr({type:"hidden",name:"key"}).appendTo(n);dialogDateBox=$("").attr({type:"datetime",name:"value"}).css({display:"block","margin-top":15,"margin-left":"auto","margin-right":"auto"}).appendTo(n);$("").attr({type:"hidden",name:"redirect"}).val("true").appendTo(n);dialog.dialog({resizable:!1,modal:!0,autoOpen:!1,buttons:{Update:function(){t()},Cancel:function(){$(this).dialog("close")}},open:function(){dialog.dialog("widget").find(".ui-dialog-buttonpane :tabbable:first").focus()}});dialogDateBox.datetimepicker({defaultDate:new Date,ampm:!0,changeYear:!0,changeMonth:!0,dateFormat:"yy/mm/dd"})}return dialog}async function t(){var r=dialogDateBox.val(),t,n,i;if(useAjax){t=$("#"+dateField);userField&&(n=$("#"+userField));dialog.dialog("close");i=(n?n.next(".ajaxLoading"):t.next(".ajaxLoading")).show();const u=new FormData;u.append("__RequestVerificationToken",document.body.dataset.antiforgery);u.append("key",updatePropertyName);u.append("value",r);try{const r=await fetch(updateUrl,{method:"POST",body:u});if(r.ok){const u=await r.json();u.DateTimeFull?t.attr("data-isodate",u.DateTimeISO8601).attr("data-livestamp",u.DateTimeUnixEpoc).attr("title",u.DateTimeFull).text(u.DateTimeFriendly):t.attr("data-isodate","").attr("data-livestamp","-1").attr("title",notSetDisplay).text(notSetDisplay);n&&n.text("by "+u.UserDescription);i.hide().next(".ajaxOk").show().delay("fast").fadeOut("slow")}else alert("Unable to change "+friendlyName+" Date:\n"+r.statusText),i.hide()}catch(u){alert("Unable to change "+friendlyName+" Date:\n"+response.statusText);i.hide()}}else dialog.dialog("disable"),dialog.dialog("option","buttons",null),dialogDatePropertyNameBox.val(updatePropertyName),dialogForm.attr("action",updateUrl),dialogForm.submit()}function i(t,i,r,u,f,e,o,s){var h,c;updateUrl=t;friendlyName=i;dateField=r;userField=u;updatePropertyName=f;notSetDisplay=e;minDate=o;useAjax=s;h=n();h.dialog("option","title",friendlyName);dialogHeader.text(friendlyName+" Date");c=$("#"+r).attr("data-isodate");c?dialogDateBox.datetimepicker("setDate",new Date(c)):dialogDateBox.datetimepicker("setDate",new Date);o?dialogDateBox.datetimepicker("option","minDate",moment(minDate).toDate()):dialogDateBox.datetimepicker("option","minDate",null);h.dialog("open")}function r(n,t,r,u,f,e,o,s){$("").attr({href:"#","class":"button small",style:"margin-right: 5px;"}).text("Update").click(function(h){h.preventDefault();i(n,t,r,u,f,e,o,s)}).insertBefore("#"+r)}document.DiscoFunctions.DateDialogCreateUpdater=r} \ No newline at end of file diff --git a/Disco.Web/ClientSource/Scripts/Modules/Disco-PropertyChangeHelpers/disco.propertychangehelpers.js b/Disco.Web/ClientSource/Scripts/Modules/Disco-PropertyChangeHelpers/disco.propertychangehelpers.js index 167e1b7d..3c02c1e7 100644 --- a/Disco.Web/ClientSource/Scripts/Modules/Disco-PropertyChangeHelpers/disco.propertychangehelpers.js +++ b/Disco.Web/ClientSource/Scripts/Modules/Disco-PropertyChangeHelpers/disco.propertychangehelpers.js @@ -29,7 +29,7 @@ if (!document.DiscoFunctions.PropertyChangeHelper) { const body = new FormData(); body.append('__RequestVerificationToken', document.body.dataset.antiforgery); - if (!data) { + if (data) { for (const prop in data) { body.append(prop, data[prop]); } diff --git a/Disco.Web/Disco.Web.csproj b/Disco.Web/Disco.Web.csproj index 5b67c8c2..78e88265 100644 --- a/Disco.Web/Disco.Web.csproj +++ b/Disco.Web/Disco.Web.csproj @@ -1403,10 +1403,10 @@ RazorGenerator Create.generated.cs - + RazorGenerator BulkGenerateDevice.generated.cs - + RazorGenerator BulkGenerateUser.generated.cs @@ -1572,7 +1572,7 @@ - +