Feature #33: Enhanced Device Importing
Dynamic device importing. better input parsing and 5 additional import fields.
This commit is contained in:
@@ -105,6 +105,10 @@
|
||||
<Compile Include="Services\Devices\Exporting\DeviceExportResult.cs" />
|
||||
<Compile Include="Services\Devices\Exporting\DeviceExportTypes.cs" />
|
||||
<Compile Include="Services\Devices\Exporting\DeviceExportOptions.cs" />
|
||||
<Compile Include="Services\Devices\Importing\DeviceImportFieldTypes.cs" />
|
||||
<Compile Include="Services\Devices\Importing\IDeviceImportRecord.cs" />
|
||||
<Compile Include="Services\Devices\Importing\IDeviceImportContext.cs" />
|
||||
<Compile Include="Services\Devices\Importing\IDeviceImportField.cs" />
|
||||
<Compile Include="Services\Jobs\JobLists\JobLocationReference.cs" />
|
||||
<Compile Include="Services\Jobs\JobLists\JobTableItemModel.cs" />
|
||||
<Compile Include="Services\Jobs\JobLists\JobTableModel.cs" />
|
||||
@@ -151,6 +155,7 @@
|
||||
<Compile Include="UI\Config\Organisation\ConfigOrganisationIndexModel.cs" />
|
||||
<Compile Include="UI\Device\DeviceAddOfflineModel.cs" />
|
||||
<Compile Include="UI\Device\DeviceExportModel.cs" />
|
||||
<Compile Include="UI\Device\DeviceImportHeadersModel.cs" />
|
||||
<Compile Include="UI\Device\DeviceImportModel.cs" />
|
||||
<Compile Include="UI\Device\DeviceImportReviewModel.cs" />
|
||||
<Compile Include="UI\Device\DeviceIndexModel.cs" />
|
||||
@@ -166,9 +171,7 @@
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Services\Devices\Importing\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
|
||||
@@ -83,19 +83,19 @@ namespace Disco.Models.Services.Devices.Exporting
|
||||
public bool ProfileShortName { get; set; }
|
||||
|
||||
// User
|
||||
[Display(ShortName = "Assigned User", Name = "Identifier", Description = "The identifier of the user assigned with the device")]
|
||||
[Display(ShortName = "Assigned User", Name = "Identifier", Description = "The identifier of the user assigned to the device")]
|
||||
public bool AssignedUserId { get; set; }
|
||||
[Display(ShortName = "Assigned User", Name = "Assigned Date", Description = "The date the device was assigned to the user")]
|
||||
public bool AssignedUserDate { get; set; }
|
||||
[Display(ShortName = "Assigned User", Name = "Display Name", Description = "The display name of the user assigned with the device")]
|
||||
[Display(ShortName = "Assigned User", Name = "Display Name", Description = "The display name of the user assigned to the device")]
|
||||
public bool AssignedUserDisplayName { get; set; }
|
||||
[Display(ShortName = "Assigned User", Name = "Surname", Description = "The surname of the user assigned with the device")]
|
||||
[Display(ShortName = "Assigned User", Name = "Surname", Description = "The surname of the user assigned to the device")]
|
||||
public bool AssignedUserSurname { get; set; }
|
||||
[Display(ShortName = "Assigned User", Name = "Given Name", Description = "The given name of the user assigned with the device")]
|
||||
[Display(ShortName = "Assigned User", Name = "Given Name", Description = "The given name of the user assigned to the device")]
|
||||
public bool AssignedUserGivenName { get; set; }
|
||||
[Display(ShortName = "Assigned User", Name = "Phone Number", Description = "The phone number of the user assigned with the device")]
|
||||
[Display(ShortName = "Assigned User", Name = "Phone Number", Description = "The phone number of the user assigned to the device")]
|
||||
public bool AssignedUserPhoneNumber { get; set; }
|
||||
[Display(ShortName = "Assigned User", Name = "Email Address", Description = "The email address of the user assigned with the device")]
|
||||
[Display(ShortName = "Assigned User", Name = "Email Address", Description = "The email address of the user assigned to the device")]
|
||||
public bool AssignedUserEmailAddress { get; set; }
|
||||
|
||||
// Jobs
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Models.Services.Devices.Importing
|
||||
{
|
||||
public enum DeviceImportFieldTypes
|
||||
{
|
||||
[Required, Display(Name = "Device Serial Number", Description = "The device serial number")]
|
||||
DeviceSerialNumber,
|
||||
[Display(Name = "Device Asset Number", Description = "The device asset number")]
|
||||
DeviceAssetNumber,
|
||||
[Display(Name = "Device Location", Description = "The device location")]
|
||||
DeviceLocation,
|
||||
[Display(Name = "Device Decommissioned Date", Description = "The date the device was decommissioned in Disco")]
|
||||
DeviceDecommissionedDate,
|
||||
[Display(Name = "Device Decommissioned Reason", Description = "The reason the device was decommissioned")]
|
||||
DeviceDecommissionedReason,
|
||||
|
||||
[Display(Name = "Device LAN MAC Address", Description = "The LAN MAC Address associated with the device")]
|
||||
DetailLanMacAddress,
|
||||
[Display(Name = "Device Wireless LAN MAC Address", Description = "The Wireless LAN MAC Address associated with the device")]
|
||||
DetailWLanMacAddress,
|
||||
[Display(Name = "Device AC Adapter", Description = "The AC Adapter associated with the device")]
|
||||
DetailACAdapter,
|
||||
|
||||
[Display(Name = "Model Identifier", Description = "The identifier of the device model associated with the device")]
|
||||
ModelId,
|
||||
|
||||
[Display(Name = "Batch Identifier", Description = "The identifier of the device batch associated with the device")]
|
||||
BatchId,
|
||||
|
||||
[Display(Name = "Profile Identifier", Description = "The identifier of the device profile associated with the device")]
|
||||
ProfileId,
|
||||
|
||||
[Display(Name = "Assigned User Identifier", Description = "The identifier of the user assigned to the device")]
|
||||
AssignedUserId,
|
||||
|
||||
[Display(Name = "Ignore Column", Description = "The column will be ignored during the import")]
|
||||
IgnoreColumn
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Models.Services.Devices.Importing
|
||||
{
|
||||
public interface IDeviceImportContext
|
||||
{
|
||||
string SessionId { get; }
|
||||
string Filename { get; }
|
||||
List<Tuple<string, DeviceImportFieldTypes>> Header { get; }
|
||||
List<Tuple<string, DeviceImportFieldTypes, Func<string[], string>, Type>> ParsedHeaders { get; }
|
||||
List<string[]> RawData { get; }
|
||||
|
||||
List<IDeviceImportRecord> Records { get; }
|
||||
int AffectedRecords { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Models.Services.Devices.Importing
|
||||
{
|
||||
public interface IDeviceImportField
|
||||
{
|
||||
DeviceImportFieldTypes FieldType { get; }
|
||||
EntityState? FieldAction { get; }
|
||||
|
||||
string ErrorMessage { get; }
|
||||
|
||||
object RawParsedValue { get; }
|
||||
string FriendlyValue { get; }
|
||||
string FriendlyPreviousValue { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Disco.Models.Services.Devices.Importing
|
||||
{
|
||||
public interface IDeviceImportRecord
|
||||
{
|
||||
string DeviceSerialNumber { get; }
|
||||
|
||||
IEnumerable<IDeviceImportField> Fields { get; }
|
||||
|
||||
EntityState RecordAction { get; }
|
||||
|
||||
bool HasError { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
using Disco.Models.Services.Devices.Importing;
|
||||
|
||||
namespace Disco.Models.UI.Device
|
||||
{
|
||||
public interface DeviceImportHeadersModel : BaseUIModel
|
||||
{
|
||||
IDeviceImportContext Context { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,15 @@
|
||||
using Disco.Models.BI.Device;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Disco.Models.Services.Devices.Importing;
|
||||
|
||||
namespace Disco.Models.UI.Device
|
||||
{
|
||||
public interface DeviceImportReviewModel : BaseUIModel
|
||||
{
|
||||
string ImportParseTaskId { get; set; }
|
||||
string ImportFilename { get; set; }
|
||||
List<ImportDevice> ImportDevices { get; set; }
|
||||
IDeviceImportContext Context { get; set; }
|
||||
|
||||
int StatisticErrorRecords { get; set; }
|
||||
int StatisticNewRecords { get; set; }
|
||||
int StatisticModifiedRecords { get; set; }
|
||||
int StatisticUnmodifiedRecords { get; set; }
|
||||
int StatisticImportRecords { get; }
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user