Feature #14: Device Details

Initial Commit - LAN/WAN MAC Addresses
This commit is contained in:
Gary Sharp
2013-09-12 13:39:39 +10:00
parent 75ebfdaa80
commit 2e820cd720
20 changed files with 474 additions and 24 deletions
+5 -1
View File
@@ -66,7 +66,7 @@ namespace Disco.Web
Disco.BI.Interop.SignalRHandlers.RepositoryMonitorNotifications.Initialize();
}
public static void InitializeUpdateEnvironment(DiscoDataContext dbContext)
public static void InitializeUpdateEnvironment(DiscoDataContext dbContext, Version PreviousVersion)
{
// Initialize Logging
Disco.Services.Logging.LogContext.Initalize(dbContext, DiscoApplication.SchedulerFactory);
@@ -83,6 +83,10 @@ namespace Disco.Web
// Initialize Scheduled Tasks
Disco.Services.Tasks.ScheduledTasks.InitalizeScheduledTasks(dbContext, DiscoApplication.SchedulerFactory, true);
// Import MAC Address Migration
if (PreviousVersion != null && PreviousVersion < new Version(1, 2, 910, 0))
Disco.BI.DeviceBI.Migration.LogMacAddressImporting.SetRequired(dbContext);
}
public static void DisposeEnvironment()
@@ -506,5 +506,11 @@ namespace Disco.Web.Areas.API.Controllers
}
#endregion
public virtual ActionResult MigrateDeviceMacAddressesFromLog()
{
var taskStatus = Disco.BI.DeviceBI.Migration.LogMacAddressImporting.ScheduleImmediately();
return RedirectToAction(MVC.Config.Logging.TaskStatus(taskStatus.SessionId));
}
}
}
+30
View File
@@ -222,6 +222,36 @@
right: 220px;
margin-top: -24px;
}
#DeviceDetailTab-DetailsContainer > table {
border: solid 1px #e8eef4;
border-collapse: collapse;
}
#DeviceDetailTab-DetailsContainer > table > tbody > tr > td {
border: solid 1px #e8eef4;
background-color: #fff;
}
#DeviceDetailTab-DetailsContainer > table > tbody > tr:nth-child(odd) > td {
background-color: #fcfcfd;
}
#DeviceDetailTab-DetailsContainer > table > thead > tr > th,
#DeviceDetailTab-DetailsContainer > table > tbody > tr > th {
background-color: #e8eef4;
border: solid 1px #e8eef4;
}
#DeviceDetailTab-DetailsContainer > table > tbody > tr:hover > td {
background-color: #e8eef4;
}
#DeviceDetailTab-DetailsContainer > table > tfoot > tr > th,
#DeviceDetailTab-DetailsContainer > table > tfoot > tr > td {
background-color: #e8eef4;
}
#DeviceDetailTab-DetailsContainer > table > tbody > tr > th {
width: 150px;
}
#DeviceDetailTab-DetailsContainer > table > tbody > tr > th,
#DeviceDetailTab-DetailsContainer > table > tbody > tr > td {
padding: 10px 6px;
}
#deviceShowResources #Attachments {
padding: 0;
border: 1px solid #cccccc;
+17
View File
@@ -196,6 +196,23 @@
}
}
#DeviceDetailTab-DetailsContainer {
& > table {
.tableData();
& > tbody > tr {
& > th {
width: 150px;
}
& > th, & > td {
padding: 10px 6px;
}
}
}
}
#deviceShowResources {
#Attachments {
padding: 0;
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -118,7 +118,7 @@ namespace Disco.Web.Controllers
dbContext.Configuration.LazyLoadingEnabled = true;
m.Device = dbContext.Devices
m.Device = dbContext.Devices.Include("DeviceDetails")
.Where(d => d.SerialNumber == id)
.FirstOrDefault();
+2 -2
View File
@@ -62,7 +62,7 @@ namespace Disco.Web.Controllers
m.ErrorMessage = "A search term of at least two characters is required";
return View(m);
}
m.Devices = BI.DeviceBI.Searching.Search(dbContext, term);
m.Devices = BI.DeviceBI.Searching.Search(dbContext, term, null, searchDetails);
m.Jobs = BI.JobBI.Searching.Search(dbContext, term, null, true, searchDetails);
m.Users = BI.UserBI.Searching.Search(dbContext, term);
}
@@ -125,7 +125,7 @@ namespace Disco.Web.Controllers
m.ErrorMessage = "A search term of at least two characters is required";
return View(m);
}
m.Devices = BI.DeviceBI.Searching.Search(dbContext, term);
m.Devices = BI.DeviceBI.Searching.Search(dbContext, term, null, searchDetails);
if (m.Devices.Count == 1)
{
return RedirectToAction(MVC.Device.Show(m.Devices[0].SerialNumber));
+10 -1
View File
@@ -544,6 +544,11 @@
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
</Compile>
<Compile Include="Views\Device\DeviceParts\_Details.generated.cs">
<DependentUpon>_Details.cshtml</DependentUpon>
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
</Compile>
<Compile Include="Views\Device\DeviceParts\_AssignmentHistory.generated.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
@@ -1438,6 +1443,10 @@
<Generator>RazorGenerator</Generator>
<LastGenOutput>AddOffline.generated.cs</LastGenOutput>
</None>
<Content Include="Views\Device\DeviceParts\_Details.cshtml">
<Generator>RazorGenerator</Generator>
<LastGenOutput>_Details.generated.cs</LastGenOutput>
</Content>
<None Include="Views\Device\DeviceParts\_AssignmentHistory.cshtml">
<Generator>RazorGenerator</Generator>
<LastGenOutput>_AssignmentHistory.generated.cs</LastGenOutput>
@@ -1933,7 +1942,7 @@
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
<UserProperties BuildVersion_UpdateFileVersion="True" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.DeltaBaseYear.MonthAndDayStamp.TimeStamp" BuildVersion_DetectChanges="False" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildAction="Both" BuildVersion_StartDate="2011/7/1" />
<UserProperties BuildVersion_StartDate="2011/7/1" BuildVersion_BuildAction="Both" BuildVersion_UseGlobalSettings="False" BuildVersion_DetectChanges="False" BuildVersion_BuildVersioningStyle="None.DeltaBaseYear.MonthAndDayStamp.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_UpdateFileVersion="True" />
</VisualStudio>
</ProjectExtensions>
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
+3 -2
View File
@@ -44,7 +44,8 @@ namespace Disco.Web
using (DiscoDataContext dbContext = new DiscoDataContext())
{
// Check for Post-Update
bool isVersionUpdate = dbContext.DiscoConfiguration.InstalledDatabaseVersion != Disco.BI.Interop.Community.UpdateCheck.CurrentDiscoVersion();
var previousVersion = dbContext.DiscoConfiguration.InstalledDatabaseVersion;
bool isVersionUpdate = previousVersion != Disco.BI.Interop.Community.UpdateCheck.CurrentDiscoVersion();
bool ignoreVersionUpdate = false;
if (isVersionUpdate)
@@ -100,7 +101,7 @@ namespace Disco.Web
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterUpdateRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles();
AppConfig.InitializeUpdateEnvironment(dbContext);
AppConfig.InitializeUpdateEnvironment(dbContext, previousVersion);
}
}
}
+13
View File
@@ -1191,12 +1191,14 @@ namespace Disco.Web.Controllers
{
public readonly string _AssignmentHistory = "_AssignmentHistory";
public readonly string _Certificates = "_Certificates";
public readonly string _Details = "_Details";
public readonly string _Jobs = "_Jobs";
public readonly string _Resources = "_Resources";
public readonly string _Subject = "_Subject";
}
public readonly string _AssignmentHistory = "~/Views/Device/DeviceParts/_AssignmentHistory.cshtml";
public readonly string _Certificates = "~/Views/Device/DeviceParts/_Certificates.cshtml";
public readonly string _Details = "~/Views/Device/DeviceParts/_Details.cshtml";
public readonly string _Jobs = "~/Views/Device/DeviceParts/_Jobs.cshtml";
public readonly string _Resources = "~/Views/Device/DeviceParts/_Resources.cshtml";
public readonly string _Subject = "~/Views/Device/DeviceParts/_Subject.cshtml";
@@ -3386,6 +3388,7 @@ namespace Disco.Web.Areas.API.Controllers
public readonly string ImportParse = "ImportParse";
public readonly string ImportProcess = "ImportProcess";
public readonly string ExportAllDevices = "ExportAllDevices";
public readonly string MigrateDeviceMacAddressesFromLog = "MigrateDeviceMacAddressesFromLog";
}
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
@@ -3412,6 +3415,7 @@ namespace Disco.Web.Areas.API.Controllers
public const string ImportParse = "ImportParse";
public const string ImportProcess = "ImportProcess";
public const string ExportAllDevices = "ExportAllDevices";
public const string MigrateDeviceMacAddressesFromLog = "MigrateDeviceMacAddressesFromLog";
}
@@ -3845,6 +3849,15 @@ namespace Disco.Web.Areas.API.Controllers
return callInfo;
}
partial void MigrateDeviceMacAddressesFromLogOverride(T4MVC_System_Web_Mvc_ActionResult callInfo);
public override System.Web.Mvc.ActionResult MigrateDeviceMacAddressesFromLog()
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.MigrateDeviceMacAddressesFromLog);
MigrateDeviceMacAddressesFromLogOverride(callInfo);
return callInfo;
}
}
}
@@ -0,0 +1,20 @@
@model Disco.Web.Models.Device.ShowModel
<div id="DeviceDetailTab-Details" class="DevicePart">
<div id="DeviceDetailTab-DetailsContainer">
<table class="tableData">
<tbody>
<tr>
<th>LAN MAC Address</th>
<td>@(Model.Device.DeviceDetails.LanMacAddress() ?? "Unknown")</td>
</tr>
<tr>
<th>WLAN MAC Address</th>
<td>@(Model.Device.DeviceDetails.WLanMacAddress() ?? "Unknown")</td>
</tr>
</tbody>
</table>
</div>
<script>
$('#DeviceDetailTabItems').append('<li><a href="#DeviceDetailTab-Details">Details</a></li>');
</script>
</div>
@@ -0,0 +1,84 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18051
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Views.Device.DeviceParts
{
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.BI.Extensions;
using Disco.Models.Repository;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Views/Device/DeviceParts/_Details.cshtml")]
public partial class Details : System.Web.Mvc.WebViewPage<Disco.Web.Models.Device.ShowModel>
{
public Details()
{
}
public override void Execute()
{
WriteLiteral("<div");
WriteLiteral(" id=\"DeviceDetailTab-Details\"");
WriteLiteral(" class=\"DevicePart\"");
WriteLiteral(">\r\n <div");
WriteLiteral(" id=\"DeviceDetailTab-DetailsContainer\"");
WriteLiteral(">\r\n <table");
WriteLiteral(" class=\"tableData\"");
WriteLiteral(">\r\n <tbody>\r\n <tr>\r\n <th>LAN MAC Add" +
"ress</th>\r\n <td>");
#line 8 "..\..\Views\Device\DeviceParts\_Details.cshtml"
Write(Model.Device.DeviceDetails.LanMacAddress() ?? "Unknown");
#line default
#line hidden
WriteLiteral("</td>\r\n </tr>\r\n <tr>\r\n <th>WLAN " +
"MAC Address</th>\r\n <td>");
#line 12 "..\..\Views\Device\DeviceParts\_Details.cshtml"
Write(Model.Device.DeviceDetails.WLanMacAddress() ?? "Unknown");
#line default
#line hidden
WriteLiteral("</td>\r\n </tr>\r\n </tbody>\r\n </table>\r\n </div>\r" +
"\n <script>\r\n $(\'#DeviceDetailTabItems\').append(\'<li><a href=\"#DeviceDe" +
"tailTab-Details\">Details</a></li>\');\r\n </script>\r\n</div>\r\n");
}
}
}
#pragma warning restore 1591
+1
View File
@@ -46,6 +46,7 @@
<div id="DeviceDetailTabs">
<ul id="DeviceDetailTabItems"></ul>
@Html.Partial(MVC.Device.Views.DeviceParts._Jobs, Model)
@Html.Partial(MVC.Device.Views.DeviceParts._Details, Model)
@Html.Partial(MVC.Device.Views.DeviceParts._AssignmentHistory, Model)
@Html.Partial(MVC.Device.Views.DeviceParts._Resources, Model)
@Html.Partial(MVC.Device.Views.DeviceParts._Certificates, Model)
+14 -3
View File
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18033
// Runtime Version:4.0.30319.18051
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -155,7 +155,7 @@ WriteLiteral(" ");
#line 49 "..\..\Views\Device\Show.cshtml"
Write(Html.Partial(MVC.Device.Views.DeviceParts._AssignmentHistory, Model));
Write(Html.Partial(MVC.Device.Views.DeviceParts._Details, Model));
#line default
@@ -166,7 +166,7 @@ WriteLiteral(" ");
#line 50 "..\..\Views\Device\Show.cshtml"
Write(Html.Partial(MVC.Device.Views.DeviceParts._Resources, Model));
Write(Html.Partial(MVC.Device.Views.DeviceParts._AssignmentHistory, Model));
#line default
@@ -177,6 +177,17 @@ WriteLiteral(" ");
#line 51 "..\..\Views\Device\Show.cshtml"
Write(Html.Partial(MVC.Device.Views.DeviceParts._Resources, Model));
#line default
#line hidden
WriteLiteral("\r\n");
WriteLiteral(" ");
#line 52 "..\..\Views\Device\Show.cshtml"
Write(Html.Partial(MVC.Device.Views.DeviceParts._Certificates, Model));
+1 -1
View File
@@ -13,7 +13,7 @@
@if (Model != null)
{
@Html.Hidden("limit", Model)
if (Model == "jobs")
if (Model == "jobs" || Model == "devices")
{
<br />
<input type="checkbox" name="searchDetails" id="searchDetails" value="true" /><label
@@ -2,7 +2,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18033
// Runtime Version:4.0.30319.18051
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -108,7 +108,7 @@ WriteLiteral("\r\n");
#line 15 "..\..\Views\Shared\_SearchDialog.cshtml"
if (Model == "jobs")
if (Model == "jobs" || Model == "devices")
{