564 lines
20 KiB
C#
564 lines
20 KiB
C#
#pragma warning disable 1591
|
|
//------------------------------------------------------------------------------
|
|
// <auto-generated>
|
|
// This code was generated by a tool.
|
|
// Runtime Version:4.0.30319.42000
|
|
//
|
|
// Changes to this file may cause incorrect behavior and will be lost if
|
|
// the code is regenerated.
|
|
// </auto-generated>
|
|
//------------------------------------------------------------------------------
|
|
|
|
namespace Disco.Web.Views.Device
|
|
{
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Net;
|
|
using System.Text;
|
|
using System.Web;
|
|
using System.Web.Helpers;
|
|
using System.Web.Mvc;
|
|
using System.Web.Mvc.Ajax;
|
|
using System.Web.Mvc.Html;
|
|
using System.Web.Routing;
|
|
using System.Web.Security;
|
|
using System.Web.UI;
|
|
using System.Web.WebPages;
|
|
using Disco;
|
|
using Disco.Models.Repository;
|
|
using Disco.Services;
|
|
using Disco.Services.Authorization;
|
|
|
|
#line 2 "..\..\Views\Device\Show.cshtml"
|
|
using Disco.Services.Devices.DeviceFlags;
|
|
|
|
#line default
|
|
#line hidden
|
|
using Disco.Services.Web;
|
|
using Disco.Web;
|
|
using Disco.Web.Extensions;
|
|
|
|
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
|
|
[System.Web.WebPages.PageVirtualPathAttribute("~/Views/Device/Show.cshtml")]
|
|
public partial class Show : Disco.Services.Web.WebViewPage<Disco.Web.Models.Device.ShowModel>
|
|
{
|
|
public Show()
|
|
{
|
|
}
|
|
public override void Execute()
|
|
{
|
|
|
|
#line 3 "..\..\Views\Device\Show.cshtml"
|
|
|
|
ViewBag.Title = Html.ToBreadcrumb("Devices", MVC.Device.Index(), string.Format("Device: {0}", Model.Device.SerialNumber));
|
|
|
|
var requiresLive = Authorization.HasAny(Claims.Device.ShowComments, Claims.Device.ShowAttachments);
|
|
|
|
if (requiresLive)
|
|
{
|
|
Html.BundleDeferred("~/ClientScripts/Modules/jQuery-SignalR");
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\r\n<div");
|
|
|
|
WriteLiteral(" id=\"Device_Show\"");
|
|
|
|
WriteLiteral(" data-deviceserialnumber=\"");
|
|
|
|
|
|
#line 13 "..\..\Views\Device\Show.cshtml"
|
|
Write(Model.Device.SerialNumber);
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\"");
|
|
|
|
WriteLiteral(">\r\n <div");
|
|
|
|
WriteLiteral(" id=\"Device_Show_Status\"");
|
|
|
|
WriteLiteral(">\r\n <i");
|
|
|
|
WriteAttribute("class", Tuple.Create(" class=\"", 561), Tuple.Create("\"", 623)
|
|
, Tuple.Create(Tuple.Create("", 569), Tuple.Create("fa", 569), true)
|
|
, Tuple.Create(Tuple.Create(" ", 571), Tuple.Create("fa-square", 572), true)
|
|
, Tuple.Create(Tuple.Create(" ", 581), Tuple.Create("deviceStatus", 582), true)
|
|
|
|
#line 15 "..\..\Views\Device\Show.cshtml"
|
|
, Tuple.Create(Tuple.Create(" ", 594), Tuple.Create<System.Object, System.Int32>(Model.Device.StatusCode()
|
|
|
|
#line default
|
|
#line hidden
|
|
, 595), false)
|
|
);
|
|
|
|
WriteLiteral("></i> ");
|
|
|
|
|
|
#line 15 "..\..\Views\Device\Show.cshtml"
|
|
Write(Model.Device.Status());
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\r\n <script");
|
|
|
|
WriteLiteral(" type=\"text/javascript\"");
|
|
|
|
WriteLiteral(">\r\n $(function () {\r\n $(\'#Device_Show_Status\').appendTo" +
|
|
"(\'#layout_PageHeading\')\r\n });\r\n </script>\r\n </div>\r\n");
|
|
|
|
|
|
#line 22 "..\..\Views\Device\Show.cshtml"
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 22 "..\..\Views\Device\Show.cshtml"
|
|
if (Authorization.Has(Claims.Device.ShowFlagAssignments))
|
|
{
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" <div");
|
|
|
|
WriteLiteral(" id=\"Device_Show_Flags\"");
|
|
|
|
WriteLiteral(">\r\n");
|
|
|
|
|
|
#line 25 "..\..\Views\Device\Show.cshtml"
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 25 "..\..\Views\Device\Show.cshtml"
|
|
foreach (var flag in Model.Device.DeviceFlagAssignments.Where(f => !f.RemovedDate.HasValue).Select(f => Tuple.Create(f, DeviceFlagService.GetDeviceFlag(f.DeviceFlagId))))
|
|
{
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" <i");
|
|
|
|
WriteAttribute("class", Tuple.Create(" class=\"", 1178), Tuple.Create("\"", 1254)
|
|
, Tuple.Create(Tuple.Create("", 1186), Tuple.Create("flag", 1186), true)
|
|
, Tuple.Create(Tuple.Create(" ", 1190), Tuple.Create("fa", 1191), true)
|
|
, Tuple.Create(Tuple.Create(" ", 1193), Tuple.Create("fa-", 1194), true)
|
|
|
|
#line 27 "..\..\Views\Device\Show.cshtml"
|
|
, Tuple.Create(Tuple.Create("", 1197), Tuple.Create<System.Object, System.Int32>(flag.Item2.Icon
|
|
|
|
#line default
|
|
#line hidden
|
|
, 1197), false)
|
|
, Tuple.Create(Tuple.Create(" ", 1215), Tuple.Create("fa-fw", 1216), true)
|
|
, Tuple.Create(Tuple.Create(" ", 1221), Tuple.Create("fa-lg", 1222), true)
|
|
, Tuple.Create(Tuple.Create(" ", 1227), Tuple.Create("d-", 1228), true)
|
|
|
|
#line 27 "..\..\Views\Device\Show.cshtml"
|
|
, Tuple.Create(Tuple.Create("", 1230), Tuple.Create<System.Object, System.Int32>(flag.Item2.IconColour
|
|
|
|
#line default
|
|
#line hidden
|
|
, 1230), false)
|
|
);
|
|
|
|
WriteLiteral(">\r\n <span");
|
|
|
|
WriteLiteral(" class=\"details\"");
|
|
|
|
WriteLiteral(">\r\n <span");
|
|
|
|
WriteLiteral(" class=\"name\"");
|
|
|
|
WriteLiteral(">");
|
|
|
|
|
|
#line 29 "..\..\Views\Device\Show.cshtml"
|
|
Write(flag.Item2.Name);
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("</span>");
|
|
|
|
|
|
#line 29 "..\..\Views\Device\Show.cshtml"
|
|
if (flag.Item1.Comments != null)
|
|
{
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("<span");
|
|
|
|
WriteLiteral(" class=\"comments\"");
|
|
|
|
WriteLiteral(">");
|
|
|
|
|
|
#line 30 "..\..\Views\Device\Show.cshtml"
|
|
Write(flag.Item1.Comments.ToHtmlComment());
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("</span>");
|
|
|
|
|
|
#line 30 "..\..\Views\Device\Show.cshtml"
|
|
}
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("<span");
|
|
|
|
WriteLiteral(" class=\"added\"");
|
|
|
|
WriteLiteral(">");
|
|
|
|
|
|
#line 30 "..\..\Views\Device\Show.cshtml"
|
|
Write(CommonHelpers.FriendlyDateAndUser(flag.Item1.AddedDate, flag.Item1.AddedUser));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("</span>\r\n </span>\r\n </i>\r\n");
|
|
|
|
|
|
#line 33 "..\..\Views\Device\Show.cshtml"
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" </div>\r\n");
|
|
|
|
WriteLiteral(" <script");
|
|
|
|
WriteLiteral(" type=\"text/javascript\"");
|
|
|
|
WriteLiteral(@">
|
|
$(function () {
|
|
$('#Device_Show_Flags')
|
|
.appendTo('#layout_PageHeading')
|
|
.tooltip({
|
|
items: 'i.flag',
|
|
content: function () {
|
|
var $this = $(this);
|
|
return $this.children('.details').html();
|
|
},
|
|
tooltipClass: 'FlagAssignment_Tooltip',
|
|
position: {
|
|
my: ""right top"",
|
|
at: ""right bottom"",
|
|
collision: ""flipfit flip""
|
|
},
|
|
hade: {
|
|
effect: ''
|
|
},
|
|
close: function (e, ui) {
|
|
ui.tooltip.hover(
|
|
function () {
|
|
$(this).stop(true).fadeTo(100, 1);
|
|
},
|
|
function () {
|
|
$(this).fadeOut(100, function () { $(this).remove(); });
|
|
});
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
");
|
|
|
|
|
|
#line 66 "..\..\Views\Device\Show.cshtml"
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" ");
|
|
|
|
|
|
#line 67 "..\..\Views\Device\Show.cshtml"
|
|
Write(Html.Partial(MVC.Device.Views.DeviceParts._Subject, Model));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("\r\n <script");
|
|
|
|
WriteLiteral(" type=\"text/javascript\"");
|
|
|
|
WriteLiteral(">\r\n $(function () {\r\n var $tabs = $(\'#DeviceDetailTabs\');\r\n " +
|
|
" if ($tabs.children().length > 1) {\r\n $tabs.tabs({\r\n " +
|
|
" activate: function (event, ui) {\r\n window.s" +
|
|
"etTimeout(function () {\r\n var $window = $(window);\r\n " +
|
|
" var tabHeight = $tabs.height();\r\n " +
|
|
" var tabOffset = $tabs.offset();\r\n var windowS" +
|
|
"crollTop = $window.scrollTop();\r\n var windowHeight = " +
|
|
"$window.height();\r\n\r\n var tabTopNotShown = windowScro" +
|
|
"llTop - tabOffset.top;\r\n if (tabTopNotShown > 0) {\r\n " +
|
|
" $(\'html\').animate({ scrollTop: tabOffset.top }, 1" +
|
|
"25);\r\n } else {\r\n var " +
|
|
"tabBottomNotShown = ((windowScrollTop + windowHeight) - (tabHeight + tabOffset.t" +
|
|
"op)) * -1;\r\n if (tabBottomNotShown > 0) {\r\n " +
|
|
" if (tabHeight > windowHeight)\r\n " +
|
|
" $(\'html\').animate({ scrollTop: tabOffset.top }, 125);\r\n " +
|
|
" else\r\n $(" +
|
|
"\'html\').animate({ scrollTop: windowScrollTop + tabBottomNotShown }, 125);\r\n " +
|
|
" }\r\n }\r\n " +
|
|
" }, 1);\r\n }\r\n });\r\n } else {\r\n " +
|
|
" $tabs.hide();\r\n }\r\n });\r\n </script>\r\n <di" +
|
|
"v");
|
|
|
|
WriteLiteral(" id=\"DeviceDetailTabs\"");
|
|
|
|
WriteLiteral(">\r\n <ul");
|
|
|
|
WriteLiteral(" id=\"DeviceDetailTabItems\"");
|
|
|
|
WriteLiteral("></ul>\r\n");
|
|
|
|
|
|
#line 103 "..\..\Views\Device\Show.cshtml"
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 103 "..\..\Views\Device\Show.cshtml"
|
|
if (Authorization.HasAny(Claims.Device.ShowComments, Claims.Device.ShowJobs))
|
|
{
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 105 "..\..\Views\Device\Show.cshtml"
|
|
Write(Html.Partial(MVC.Device.Views.DeviceParts._CommentsAndJobs, Model));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 105 "..\..\Views\Device\Show.cshtml"
|
|
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" ");
|
|
|
|
|
|
#line 107 "..\..\Views\Device\Show.cshtml"
|
|
if (Authorization.Has(Claims.Device.ShowDetails))
|
|
{
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 109 "..\..\Views\Device\Show.cshtml"
|
|
Write(Html.Partial(MVC.Device.Views.DeviceParts._Details, Model));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 109 "..\..\Views\Device\Show.cshtml"
|
|
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" ");
|
|
|
|
|
|
#line 111 "..\..\Views\Device\Show.cshtml"
|
|
if (Authorization.Has(Claims.Device.ShowAssignmentHistory))
|
|
{
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 113 "..\..\Views\Device\Show.cshtml"
|
|
Write(Html.Partial(MVC.Device.Views.DeviceParts._AssignmentHistory, Model));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 113 "..\..\Views\Device\Show.cshtml"
|
|
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" ");
|
|
|
|
|
|
#line 115 "..\..\Views\Device\Show.cshtml"
|
|
if (Authorization.Has(Claims.Device.ShowAttachments))
|
|
{
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 117 "..\..\Views\Device\Show.cshtml"
|
|
Write(Html.Partial(MVC.Device.Views.DeviceParts._Resources, Model));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 117 "..\..\Views\Device\Show.cshtml"
|
|
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" ");
|
|
|
|
|
|
#line 119 "..\..\Views\Device\Show.cshtml"
|
|
if (Authorization.Has(Claims.Device.ShowFlagAssignments))
|
|
{
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 121 "..\..\Views\Device\Show.cshtml"
|
|
Write(Html.Partial(MVC.Device.Views.DeviceParts._Flags, Model));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 121 "..\..\Views\Device\Show.cshtml"
|
|
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" ");
|
|
|
|
|
|
#line 123 "..\..\Views\Device\Show.cshtml"
|
|
if (Authorization.Has(Claims.Device.ShowCertificates))
|
|
{
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 125 "..\..\Views\Device\Show.cshtml"
|
|
Write(Html.Partial(MVC.Device.Views.DeviceParts._Certificates, Model));
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 125 "..\..\Views\Device\Show.cshtml"
|
|
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" </div>\r\n");
|
|
|
|
|
|
#line 128 "..\..\Views\Device\Show.cshtml"
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
|
|
#line 128 "..\..\Views\Device\Show.cshtml"
|
|
if (requiresLive)
|
|
{
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral(" <script>\r\n $(function () {\r\n if (!document.Disc" +
|
|
"oFunctions)\r\n return;\r\n\r\n const deviceSerialNu" +
|
|
"mber = $(\'#Device_Show\').attr(\'data-deviceserialnumber\');\r\n // Co" +
|
|
"nnect to Hub\r\n var hub = $.connection.deviceUpdates;\r\n\r\n " +
|
|
" // Map Functions\r\n if (document.DiscoFunctions.onCommentAd" +
|
|
"ded)\r\n hub.client.commentAdded = document.DiscoFunctions.onCo" +
|
|
"mmentAdded;\r\n if (document.DiscoFunctions.onCommentRemoved)\r\n " +
|
|
" hub.client.commentRemoved = document.DiscoFunctions.onCommentRem" +
|
|
"oved;\r\n if (document.DiscoFunctions.onAttachmentAdded)\r\n " +
|
|
" hub.client.attachmentAdded = document.DiscoFunctions.onAttachmentAdde" +
|
|
"d;\r\n if (document.DiscoFunctions.onAttachmentRemoved)\r\n " +
|
|
" hub.client.attachmentRemoved = document.DiscoFunctions.onAttachmentRem" +
|
|
"oved;\r\n\r\n $.connection.hub.qs = { DeviceSerialNumber: deviceSeria" +
|
|
"lNumber };\r\n $.connection.hub.error(onHubFailed);\r\n " +
|
|
" $.connection.hub.disconnected(onHubFailed);\r\n\r\n $.connection.hu" +
|
|
"b.reconnecting(function () {\r\n $(\'#AttachmentsContainer\').fin" +
|
|
"d(\'span.action.enabled\').addClass(\'disabled\');\r\n $(\'#Comments" +
|
|
"\').find(\'button\').prop(\'disabled\', true);\r\n });\r\n " +
|
|
"$.connection.hub.reconnected(function () {\r\n $(\'#AttachmentsC" +
|
|
"ontainer\').find(\'span.action.enabled\').removeClass(\'disabled\');\r\n " +
|
|
" $(\'#Comments\').find(\'button\').prop(\'disabled\', false);\r\n });" +
|
|
"\r\n\r\n // Start Connection\r\n $.connection.hub.start(" +
|
|
"function () {\r\n $(\'#AttachmentsContainer\').find(\'span.action." +
|
|
"enabled\').removeClass(\'disabled\');\r\n $(\'#Comments\').find(\'but" +
|
|
"ton\').prop(\'disabled\', false);\r\n }).fail(onHubFailed);\r\n\r\n " +
|
|
" function onHubFailed(error) {\r\n // Disable UI\r\n " +
|
|
" $(\'#AttachmentsContainer\').find(\'span.action.enabled\').addClass(\'" +
|
|
"disabled\');\r\n $(\'#Comments\').find(\'button\').prop(\'disabled\', " +
|
|
"true);\r\n\r\n // Show Dialog Message\r\n if ($(" +
|
|
"\'.disconnected-dialog\').length == 0) {\r\n $(\'<div>\')\r\n " +
|
|
" .addClass(\'dialog disconnected-dialog\')\r\n " +
|
|
" .html(\'<h3><span class=\"fa-stack fa-lg\"><i class=\"fa fa-wifi fa-sta" +
|
|
"ck-1x\"></i><i class=\"fa fa-ban fa-stack-2x error\"></i></span>Disconnected from t" +
|
|
"he Disco ICT Server</h3><div>This page is not receiving live updates. Please ens" +
|
|
"ure you are connected to the server, then refresh this page to enable features.<" +
|
|
"/div>\')\r\n .dialog({\r\n " +
|
|
"resizable: false,\r\n title: \'Disconnected\',\r\n " +
|
|
" width: 400,\r\n modal: t" +
|
|
"rue,\r\n buttons: {\r\n " +
|
|
" \'Refresh Now\': function () {\r\n $(th" +
|
|
"is).dialog(\'option\', \'buttons\', null);\r\n " +
|
|
"window.location.reload(true);\r\n },\r\n " +
|
|
" \'Close\': function () {\r\n " +
|
|
" $(this).dialog(\'destroy\');\r\n }\r\n " +
|
|
" }\r\n });\r\n " +
|
|
" }\r\n }\r\n });\r\n </script>\r\n");
|
|
|
|
|
|
#line 197 "..\..\Views\Device\Show.cshtml"
|
|
}
|
|
|
|
|
|
#line default
|
|
#line hidden
|
|
WriteLiteral("</div>\r\n");
|
|
|
|
}
|
|
}
|
|
}
|
|
#pragma warning restore 1591
|