diff --git a/Disco.BI/Properties/AssemblyInfo.cs b/Disco.BI/Properties/AssemblyInfo.cs index 4bbc5dc7..d47ef792 100644 --- a/Disco.BI/Properties/AssemblyInfo.cs +++ b/Disco.BI/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.2.0516.1941")] -[assembly: AssemblyFileVersion("1.2.0516.1941")] \ No newline at end of file +[assembly: AssemblyVersion("1.2.0516.2018")] +[assembly: AssemblyFileVersion("1.2.0516.2018")] \ No newline at end of file diff --git a/Disco.Client/Properties/AssemblyInfo.cs b/Disco.Client/Properties/AssemblyInfo.cs index e84cfa0f..151098f4 100644 --- a/Disco.Client/Properties/AssemblyInfo.cs +++ b/Disco.Client/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.2.0516.1941")] -[assembly: AssemblyFileVersion("1.2.0516.1941")] \ No newline at end of file +[assembly: AssemblyVersion("1.2.0516.2018")] +[assembly: AssemblyFileVersion("1.2.0516.2018")] \ No newline at end of file diff --git a/Disco.ClientBootstrapper/Properties/AssemblyInfo.cs b/Disco.ClientBootstrapper/Properties/AssemblyInfo.cs index 4b90b0d4..893dd862 100644 --- a/Disco.ClientBootstrapper/Properties/AssemblyInfo.cs +++ b/Disco.ClientBootstrapper/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.2.0516.1941")] -[assembly: AssemblyFileVersion("1.2.0516.1941")] \ No newline at end of file +[assembly: AssemblyVersion("1.2.0516.2018")] +[assembly: AssemblyFileVersion("1.2.0516.2018")] \ No newline at end of file diff --git a/Disco.Data/Properties/AssemblyInfo.cs b/Disco.Data/Properties/AssemblyInfo.cs index 91eb1bcf..09fc5bdf 100644 --- a/Disco.Data/Properties/AssemblyInfo.cs +++ b/Disco.Data/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.2.0516.1941")] -[assembly: AssemblyFileVersion("1.2.0516.1941")] \ No newline at end of file +[assembly: AssemblyVersion("1.2.0516.2018")] +[assembly: AssemblyFileVersion("1.2.0516.2018")] \ No newline at end of file diff --git a/Disco.Data/Repository/Monitor/RepositoryMonitor.cs b/Disco.Data/Repository/Monitor/RepositoryMonitor.cs index 95ffdae4..e165f9bd 100644 --- a/Disco.Data/Repository/Monitor/RepositoryMonitor.cs +++ b/Disco.Data/Repository/Monitor/RepositoryMonitor.cs @@ -8,6 +8,7 @@ using System.Reactive.Subjects; using System.Data.Entity.Infrastructure; using System.Collections.Concurrent; using System.Data.Objects; +using Disco.Models.Repository; namespace Disco.Data.Repository.Monitor { @@ -76,7 +77,7 @@ namespace Disco.Data.Repository.Monitor if (monitorEvent.EventType == RepositoryMonitorEventType.Added) { // Update Entity Key for Added Events - monitorEvent.EntityKey = monitorEvent.objectEntryState.EntityKey.EntityKeyValues.Select(kv => kv.Value).ToArray(); + monitorEvent.EntityKey = DetermineEntityKey(monitorEvent.objectEntryState); } } @@ -84,7 +85,7 @@ namespace Disco.Data.Repository.Monitor { RepositoryMonitorEventType eventType; string[] modifiedProperties = null; - object[] entityKey = null; + Dictionary entityKey = null; Type entityType; switch (entryState.State) @@ -118,7 +119,7 @@ namespace Disco.Data.Repository.Monitor // Don't pass entity key when entity newly added if (eventType != RepositoryMonitorEventType.Added) - entityKey = entryState.EntityKey.EntityKeyValues.Select(kv => kv.Value).ToArray(); + entityKey = DetermineEntityKey(entryState); return new RepositoryMonitorEvent() { @@ -132,5 +133,45 @@ namespace Disco.Data.Repository.Monitor objectEntryState = entryState }; } + + internal static Dictionary DetermineEntityKey(ObjectStateEntry entryState) + { + Dictionary key = entryState.EntityKey.EntityKeyValues.ToDictionary(kv => kv.Key, kv => kv.Value); + + if (entryState.Entity is DeviceAttachment) + { + key["DeviceSerialNumber"] = ((DeviceAttachment)entryState.Entity).DeviceSerialNumber; + } + if (entryState.Entity is DeviceCertificate) + { + key["DeviceSerialNumber"] = ((DeviceCertificate)entryState.Entity).DeviceSerialNumber; + } + if (entryState.Entity is DeviceComponent) + { + key["DeviceModelId"] = ((DeviceComponent)entryState.Entity).DeviceModelId; + } + if (entryState.Entity is DeviceUserAssignment) + { + key["AssignedUserId"] = ((DeviceUserAssignment)entryState.Entity).AssignedUserId; + } + if (entryState.Entity is JobAttachment) + { + key["JobId"] = ((JobAttachment)entryState.Entity).JobId; + } + if (entryState.Entity is JobComponent) + { + key["JobId"] = ((JobComponent)entryState.Entity).JobId; + } + if (entryState.Entity is JobLog) + { + key["JobId"] = ((JobLog)entryState.Entity).JobId; + } + if (entryState.Entity is UserAttachment) + { + key["UserId"] = ((UserAttachment)entryState.Entity).UserId; + } + + return key; + } } } diff --git a/Disco.Data/Repository/Monitor/RepositoryMonitorEvent.cs b/Disco.Data/Repository/Monitor/RepositoryMonitorEvent.cs index cf3cc5ca..547d1338 100644 --- a/Disco.Data/Repository/Monitor/RepositoryMonitorEvent.cs +++ b/Disco.Data/Repository/Monitor/RepositoryMonitorEvent.cs @@ -37,7 +37,7 @@ namespace Disco.Data.Repository.Monitor [JsonIgnore] public object Entity { get; set; } - public object[] EntityKey { get; set; } + public Dictionary EntityKey { get; set; } public string[] ModifiedProperties { get; set; } diff --git a/Disco.Models/Properties/AssemblyInfo.cs b/Disco.Models/Properties/AssemblyInfo.cs index 9b2d9f8a..6d62da0d 100644 --- a/Disco.Models/Properties/AssemblyInfo.cs +++ b/Disco.Models/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.2.0516.1941")] -[assembly: AssemblyFileVersion("1.2.0516.1941")] \ No newline at end of file +[assembly: AssemblyVersion("1.2.0516.2018")] +[assembly: AssemblyFileVersion("1.2.0516.2018")] \ No newline at end of file diff --git a/Disco.Services/Properties/AssemblyInfo.cs b/Disco.Services/Properties/AssemblyInfo.cs index 2bc7bf67..94d5d9e8 100644 --- a/Disco.Services/Properties/AssemblyInfo.cs +++ b/Disco.Services/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.2.0516.1941")] -[assembly: AssemblyFileVersion("1.2.0516.1941")] \ No newline at end of file +[assembly: AssemblyVersion("1.2.0516.2018")] +[assembly: AssemblyFileVersion("1.2.0516.2018")] \ No newline at end of file diff --git a/Disco.Web.Extensions/Properties/AssemblyInfo.cs b/Disco.Web.Extensions/Properties/AssemblyInfo.cs index 988fe59e..377c037e 100644 --- a/Disco.Web.Extensions/Properties/AssemblyInfo.cs +++ b/Disco.Web.Extensions/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.2.0516.1941")] -[assembly: AssemblyFileVersion("1.2.0516.1941")] \ No newline at end of file +[assembly: AssemblyVersion("1.2.0516.2018")] +[assembly: AssemblyFileVersion("1.2.0516.2018")] \ No newline at end of file diff --git a/Disco.Web/Properties/AssemblyInfo.cs b/Disco.Web/Properties/AssemblyInfo.cs index 27f16dd4..689b3266 100644 --- a/Disco.Web/Properties/AssemblyInfo.cs +++ b/Disco.Web/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("1.2.0516.1941")] -[assembly: AssemblyFileVersion("1.2.0516.1941")] \ No newline at end of file +[assembly: AssemblyVersion("1.2.0516.2018")] +[assembly: AssemblyFileVersion("1.2.0516.2018")] \ No newline at end of file diff --git a/Disco.Web/Views/Job/JobParts/Resources.cshtml b/Disco.Web/Views/Job/JobParts/Resources.cshtml index b82e6820..a611deeb 100644 --- a/Disco.Web/Views/Job/JobParts/Resources.cshtml +++ b/Disco.Web/Views/Job/JobParts/Resources.cshtml @@ -164,20 +164,22 @@ return false; } - function loadLiveComment(id) { - $.ajax({ - url: '@Url.Action(MVC.API.Job.Comment())', - dataType: 'json', - data: { id: id }, - success: function (d) { - if (d && d.JobId == jobId) { - addComment(d, false); + function loadLiveComment(key) { + if (key.JobId == jobId) { + $.ajax({ + url: '@Url.Action(MVC.API.Job.Comment())', + dataType: 'json', + data: { id: key.Id }, + success: function (d) { + if (d && d.JobId == jobId) { + addComment(d, false); + } + }, + error: function (jqXHR, textStatus, errorThrown) { + alert('Unable to load live comment ' + id + ': ' + textStatus); } - }, - error: function (jqXHR, textStatus, errorThrown) { - alert('Unable to load live comment ' + id + ': ' + textStatus); - } - }); + }); + } } function addComment(c, quick) { var e = $('
'); @@ -263,11 +265,13 @@ onLoadNavigation = navigationPath; } }; - function addAttachment(id, quick) { - var data = { id: id }; + function addAttachment(key, quick) { - $.ajax({ - url: '@Url.Action(MVC.API.Job.Attachment())', + if (key.JobId == jobId) { + var data = { id: key.Id }; + + $.ajax({ + url: '@Url.Action(MVC.API.Job.Attachment())', dataType: 'json', data: data, success: function (d) { @@ -300,14 +304,17 @@ } }); } - function removeAttachment(id) { - var $element = $attachmentOutput.find('a[data-attachmentid="' + id + '"]'); - if ($element.length > 0) { - $element.hide(300).delay(300).queue(function () { - if ($element.attr('data-mimetype').toLowerCase().indexOf('image/') == 0) - Shadowbox.removeCache(this); - $element.remove(); - }); + } + function removeAttachment(key) { + if (key.JobId == jobId) { + var $element = $attachmentOutput.find('a[data-attachmentid="' + key.Id + '"]'); + if ($element.length > 0) { + $element.hide(300).delay(300).queue(function () { + if ($element.attr('data-mimetype').toLowerCase().indexOf('image/') == 0) + Shadowbox.removeCache(this); + $element.remove(); + }); + } } } @@ -376,22 +383,24 @@ case 'JobAttachment': switch (d.EventType) { case 0: // Added - addAttachment(d.EntityKey[0], false); + addAttachment(d.EntityKey, false); break; case 1: // Removed - removeAttachment(d.EntityKey[0]); + removeAttachment(d.EntityKey); break; } break; case 'JobLog': switch (d.EventType) { case 0: // Added - loadLiveComment(d.EntityKey[0]); + loadLiveComment(d.EntityKey); break; case 1: // Removed - $CommentOutput.children('div[data-logid="' + d.EntityKey[0] + '"]').slideUp(300).delay(300).queue(function () { - $(this).remove(); - }); + if (d.EntityKey.JobId == jobId) { + $CommentOutput.children('div[data-logid="' + d.EntityKey.Id + '"]').slideUp(300).delay(300).queue(function () { + $(this).remove(); + }); + } break; } break; diff --git a/Disco.Web/Views/Job/JobParts/Resources.generated.cs b/Disco.Web/Views/Job/JobParts/Resources.generated.cs index f11d5351..48afb5ab 100644 --- a/Disco.Web/Views/Job/JobParts/Resources.generated.cs +++ b/Disco.Web/Views/Job/JobParts/Resources.generated.cs @@ -519,29 +519,31 @@ WriteLiteral(@"', return false; } - function loadLiveComment(id) { - $.ajax({ - url: '"); + function loadLiveComment(key) { + if (key.JobId == jobId) { + $.ajax({ + url: '"); - #line 169 "..\..\Views\Job\JobParts\Resources.cshtml" - Write(Url.Action(MVC.API.Job.Comment())); + #line 170 "..\..\Views\Job\JobParts\Resources.cshtml" + Write(Url.Action(MVC.API.Job.Comment())); #line default #line hidden WriteLiteral(@"', - dataType: 'json', - data: { id: id }, - success: function (d) { - if (d && d.JobId == jobId) { - addComment(d, false); + dataType: 'json', + data: { id: key.Id }, + success: function (d) { + if (d && d.JobId == jobId) { + addComment(d, false); + } + }, + error: function (jqXHR, textStatus, errorThrown) { + alert('Unable to load live comment ' + id + ': ' + textStatus); } - }, - error: function (jqXHR, textStatus, errorThrown) { - alert('Unable to load live comment ' + id + ': ' + textStatus); - } - }); + }); + } } function addComment(c, quick) { var e = $('
'); @@ -554,7 +556,7 @@ WriteLiteral(@"', commentHtml = commentHtml.replace(/\#(\d+)/g, '#$1'); '"); - #line 221 "..\..\Views\Job\JobParts\Resources.cshtml" + #line 223 "..\..\Views\Job\JobParts\Resources.cshtml" Write(Links.ClientBin.Disco_Silverlight_AttachmentUpload_xap); @@ -615,7 +617,7 @@ WriteLiteral(@"', 'UploadUrl="); - #line 233 "..\..\Views\Job\JobParts\Resources.cshtml" + #line 235 "..\..\Views\Job\JobParts\Resources.cshtml" Write(Url.Action(MVC.API.Job.AttachmentUpload(Model.Job.Id, null))); @@ -654,15 +656,17 @@ WriteLiteral(@"' onLoadNavigation = navigationPath; } }; - function addAttachment(id, quick) { - var data = { id: id }; + function addAttachment(key, quick) { - $.ajax({ - url: '"); + if (key.JobId == jobId) { + var data = { id: key.Id }; + + $.ajax({ + url: '"); - #line 270 "..\..\Views\Job\JobParts\Resources.cshtml" - Write(Url.Action(MVC.API.Job.Attachment())); + #line 274 "..\..\Views\Job\JobParts\Resources.cshtml" + Write(Url.Action(MVC.API.Job.Attachment())); #line default @@ -680,7 +684,7 @@ WriteLiteral(@"', e.attr('data-attachmentid', a.Id).attr('data-mimetype', a.MimeType).attr('href', '"); - #line 280 "..\..\Views\Job\JobParts\Resources.cshtml" + #line 284 "..\..\Views\Job\JobParts\Resources.cshtml" Write(Url.Action(MVC.API.Job.AttachmentDownload())); @@ -689,7 +693,7 @@ WriteLiteral(@"', WriteLiteral("/\' + a.Id);\r\n e.find(\'.icon img\').attr(\'src\', \'"); - #line 281 "..\..\Views\Job\JobParts\Resources.cshtml" + #line 285 "..\..\Views\Job\JobParts\Resources.cshtml" Write(Url.Action(MVC.API.Job.AttachmentThumbnail())); @@ -709,26 +713,27 @@ WriteLiteral("/\' + a.Id);\r\n e.find(\'.comments " alert(\'Unable to add attachment: \' + d.Result);\r\n }\r\n " + " },\r\n error: function (jqXHR, textStatus, e" + "rrorThrown) {\r\n alert(\'Unable to add attachment: \' + text" + -"Status);\r\n }\r\n });\r\n }\r\n fun" + -"ction removeAttachment(id) {\r\n var $element = $attachmentOutput.find(" + -"\'a[data-attachmentid=\"\' + id + \'\"]\');\r\n if ($element.length > 0) {\r\n " + -" $element.hide(300).delay(300).queue(function () {\r\n " + -" if ($element.attr(\'data-mimetype\').toLowerCase().indexOf(\'image/\') == 0)\r\n" + -" Shadowbox.removeCache(this);\r\n $eleme" + -"nt.remove();\r\n });\r\n }\r\n }\r\n\r\n function " + -"removeLocalAttachment() {\r\n $this = $(this).closest(\'a\');\r\n\r\n " + -" var data = { id: $this.attr(\'data-attachmentid\') };\r\n\r\n if (!$dia" + -"logRemoveAttachment) {\r\n $dialogRemoveAttachment = $(\'#dialogRemo" + -"veAttachment\').dialog({\r\n resizable: false,\r\n " + -" height: 140,\r\n modal: true,\r\n autoOpen" + -": false\r\n });\r\n }\r\n\r\n $dialogRemoveAttachme" + -"nt.dialog(\"enable\").dialog(\'option\', \'buttons\', {\r\n \"Remove\": fun" + -"ction () {\r\n $dialogRemoveAttachment.dialog(\"disable\");\r\n " + -" $dialogRemoveAttachment.dialog(\"option\", \"buttons\", null);\r\n " + -" $.ajax({\r\n url: \'"); +"Status);\r\n }\r\n });\r\n }\r\n }\r\n" + +" function removeAttachment(key) {\r\n if (key.JobId == jobId) {\r" + +"\n var $element = $attachmentOutput.find(\'a[data-attachmentid=\"\' +" + +" key.Id + \'\"]\');\r\n if ($element.length > 0) {\r\n " + +" $element.hide(300).delay(300).queue(function () {\r\n if " + +"($element.attr(\'data-mimetype\').toLowerCase().indexOf(\'image/\') == 0)\r\n " + +" Shadowbox.removeCache(this);\r\n $elemen" + +"t.remove();\r\n });\r\n }\r\n }\r\n " + +"}\r\n\r\n function removeLocalAttachment() {\r\n $this = $(this).clo" + +"sest(\'a\');\r\n\r\n var data = { id: $this.attr(\'data-attachmentid\') };\r\n\r" + +"\n if (!$dialogRemoveAttachment) {\r\n $dialogRemoveAttac" + +"hment = $(\'#dialogRemoveAttachment\').dialog({\r\n resizable: fa" + +"lse,\r\n height: 140,\r\n modal: true,\r\n " + +" autoOpen: false\r\n });\r\n }\r\n\r\n " + +" $dialogRemoveAttachment.dialog(\"enable\").dialog(\'option\', \'buttons\', {\r\n " + +" \"Remove\": function () {\r\n $dialogRemoveAttachment.di" + +"alog(\"disable\");\r\n $dialogRemoveAttachment.dialog(\"option\", \"" + +"buttons\", null);\r\n $.ajax({\r\n url: \'"); - #line 333 "..\..\Views\Job\JobParts\Resources.cshtml" + #line 340 "..\..\Views\Job\JobParts\Resources.cshtml" Write(Url.Action(MVC.API.Job.AttachmentRemove())); @@ -760,24 +765,25 @@ WriteLiteral("\',\r\n dataType: \'json\',\r\n " window.setTimeout(function () {\r\n switch (d.En" + "tityTypeName) {\r\n case \'JobAttachment\':\r\n " + " switch (d.EventType) {\r\n case 0: // A" + -"dded\r\n addAttachment(d.EntityKey[0], false);\r" + -"\n break;\r\n cas" + -"e 1: // Removed\r\n removeAttachment(d.EntityKe" + -"y[0]);\r\n break;\r\n " + -"}\r\n break;\r\n case \'JobLog\':\r\n " + -" switch (d.EventType) {\r\n " + -" case 0: // Added\r\n loadLiveComment(d.Entit" + -"yKey[0]);\r\n break;\r\n " + -" case 1: // Removed\r\n $CommentOutput.ch" + -"ildren(\'div[data-logid=\"\' + d.EntityKey[0] + \'\"]\').slideUp(300).delay(300).queue" + -"(function () {\r\n $(this).remove();\r\n " + -" });\r\n break;\r\n" + -" }\r\n break;\r\n " + -" }\r\n }, 100);\r\n }\r\n }\r\n var liveMe" + -"ssagesConnection = $.connection(\'"); +"dded\r\n addAttachment(d.EntityKey, false);\r\n " + +" break;\r\n case 1" + +": // Removed\r\n removeAttachment(d.EntityKey);" + +"\r\n break;\r\n }\r\n " + +" break;\r\n case \'JobLog\':\r\n " + +" switch (d.EventType) {\r\n cas" + +"e 0: // Added\r\n loadLiveComment(d.EntityKey);" + +"\r\n break;\r\n ca" + +"se 1: // Removed\r\n if (d.EntityKey.JobId == j" + +"obId) {\r\n $CommentOutput.children(\'div[da" + +"ta-logid=\"\' + d.EntityKey.Id + \'\"]\').slideUp(300).delay(300).queue(function () {" + +"\r\n $(this).remove();\r\n " + +" });\r\n }\r\n " + +" break;\r\n }\r\n " + +" break;\r\n }\r\n }, 100);\r\n " + +" }\r\n }\r\n var liveMessagesConnection = $.connection(\'"); - #line 402 "..\..\Views\Job\JobParts\Resources.cshtml" + #line 411 "..\..\Views\Job\JobParts\Resources.cshtml" Write(Url.Content("~/API/Repository/Notifications"));