feature: batch device decommissioning
This commit is contained in:
@@ -21,5 +21,6 @@ namespace Disco.Models.Services.Devices.Importing
|
|||||||
|
|
||||||
List<IDeviceImportRecord> Records { get; set; }
|
List<IDeviceImportRecord> Records { get; set; }
|
||||||
int AffectedRecords { get; set; }
|
int AffectedRecords { get; set; }
|
||||||
|
bool AllowBacktracking { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,5 +16,6 @@ namespace Disco.Models.UI.Config.DeviceBatch
|
|||||||
int DeviceCount { get; set; }
|
int DeviceCount { get; set; }
|
||||||
int DeviceDecommissionedCount { get; set; }
|
int DeviceDecommissionedCount { get; set; }
|
||||||
bool CanDelete { get; set; }
|
bool CanDelete { get; set; }
|
||||||
|
bool CanDecommission { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,28 +5,28 @@ using Disco.Services.Devices.ManagedGroups;
|
|||||||
using Disco.Services.Interop.ActiveDirectory;
|
using Disco.Services.Interop.ActiveDirectory;
|
||||||
using Disco.Services.Users;
|
using Disco.Services.Users;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Data.Entity;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace Disco.Services
|
namespace Disco.Services
|
||||||
{
|
{
|
||||||
public static class DeviceBatchExtensions
|
public static class DeviceBatchExtensions
|
||||||
{
|
{
|
||||||
public static bool CanDelete(this DeviceBatch db, DiscoDataContext Database)
|
public static bool CanDelete(this DeviceBatch db, DiscoDataContext database)
|
||||||
{
|
{
|
||||||
if (!UserService.CurrentAuthorization.Has(Claims.Config.DeviceBatch.Delete))
|
if (!UserService.CurrentAuthorization.Has(Claims.Config.DeviceBatch.Delete))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Can't Delete if Contains Devices
|
// Can't Delete if Contains Devices
|
||||||
var deviceCount = Database.Devices.Count(d => d.DeviceBatchId == db.Id);
|
if (database.Devices.Any(d => d.DeviceBatchId == db.Id))
|
||||||
if (deviceCount > 0)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Delete(this DeviceBatch db, DiscoDataContext Database)
|
public static void Delete(this DeviceBatch db, DiscoDataContext database)
|
||||||
{
|
{
|
||||||
if (!db.CanDelete(Database))
|
if (!db.CanDelete(database))
|
||||||
throw new InvalidOperationException("The state of this Device Batch doesn't allow it to be deleted");
|
throw new InvalidOperationException("The state of this Device Batch doesn't allow it to be deleted");
|
||||||
|
|
||||||
// Remove Linked Group
|
// Remove Linked Group
|
||||||
@@ -34,7 +34,26 @@ namespace Disco.Services
|
|||||||
ActiveDirectory.Context.ManagedGroups.Remove(DeviceBatchAssignedUsersManagedGroup.GetKey(db));
|
ActiveDirectory.Context.ManagedGroups.Remove(DeviceBatchAssignedUsersManagedGroup.GetKey(db));
|
||||||
|
|
||||||
// Delete Batch
|
// Delete Batch
|
||||||
Database.DeviceBatches.Remove(db);
|
database.DeviceBatches.Remove(db);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool CanDecommission(this DeviceBatch db, DiscoDataContext database)
|
||||||
|
{
|
||||||
|
if (!UserService.CurrentAuthorization.Has(Claims.Device.Actions.Import))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!database.Devices.Any(d => d.DeviceBatchId == db.Id && d.DecommissionedDate == null))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Decommission(this DeviceBatch db, DiscoDataContext database, DecommissionReasons Reason, bool unassignUsers)
|
||||||
|
{
|
||||||
|
if (!db.CanDecommission(database))
|
||||||
|
throw new InvalidOperationException("Decommission of Device Batch is Denied");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ namespace Disco.Services.Devices.Importing
|
|||||||
public List<IDeviceImportRecord> Records { get; set; }
|
public List<IDeviceImportRecord> Records { get; set; }
|
||||||
public int AffectedRecords { get; set; }
|
public int AffectedRecords { get; set; }
|
||||||
|
|
||||||
|
public bool AllowBacktracking { get; } = true;
|
||||||
|
|
||||||
public int ColumnCount { get { return columns.Count; } }
|
public int ColumnCount { get { return columns.Count; } }
|
||||||
public IEnumerable<IDeviceImportColumn> Columns
|
public IEnumerable<IDeviceImportColumn> Columns
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -0,0 +1,111 @@
|
|||||||
|
using Disco.Data.Repository;
|
||||||
|
using Disco.Models.Repository;
|
||||||
|
using Disco.Models.Services.Devices.Importing;
|
||||||
|
using Disco.Services.Devices.Importing.Fields;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data;
|
||||||
|
using System.Data.Entity;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace Disco.Services.Devices.Importing
|
||||||
|
{
|
||||||
|
public class DeviceDecommissionImportContext : IDeviceImportContext
|
||||||
|
{
|
||||||
|
private readonly List<IDeviceImportRecord> records;
|
||||||
|
|
||||||
|
public string SessionId { get; }
|
||||||
|
public string Filename { get; }
|
||||||
|
public string DatasetName { get; }
|
||||||
|
public int ColumnCount { get; }
|
||||||
|
public IEnumerable<IDeviceImportColumn> Columns { get; }
|
||||||
|
|
||||||
|
public int RecordCount => records.Count;
|
||||||
|
public List<IDeviceImportRecord> Records { get => records; set => throw new NotImplementedException(); }
|
||||||
|
public int AffectedRecords { get; set; }
|
||||||
|
public bool AllowBacktracking { get; } = false;
|
||||||
|
|
||||||
|
private DeviceDecommissionImportContext(string sourceName, List<Device> devices, DecommissionReasons decommissionReason, bool unassignUsers)
|
||||||
|
{
|
||||||
|
SessionId = Guid.NewGuid().ToString("D");
|
||||||
|
Filename = DatasetName = sourceName;
|
||||||
|
|
||||||
|
var columns = new List<IDeviceImportColumn>(3)
|
||||||
|
{
|
||||||
|
new DeviceImportColumn()
|
||||||
|
{
|
||||||
|
Index = 0,
|
||||||
|
Type = DeviceImportFieldTypes.DeviceSerialNumber,
|
||||||
|
Handler = typeof(DeviceSerialNumberImportField),
|
||||||
|
Name = "Device Serial Number",
|
||||||
|
},
|
||||||
|
new DeviceImportColumn()
|
||||||
|
{
|
||||||
|
Index = 1,
|
||||||
|
Type = DeviceImportFieldTypes.DeviceDecommissionedReason,
|
||||||
|
Handler = typeof(DeviceDecommissionedReasonImportField),
|
||||||
|
Name = "Device Decommissioned Reason",
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (unassignUsers && devices.Any(d => d.AssignedUserId != null))
|
||||||
|
{
|
||||||
|
ColumnCount = 3;
|
||||||
|
columns.Add(new DeviceImportColumn()
|
||||||
|
{
|
||||||
|
Index = 2,
|
||||||
|
Type = DeviceImportFieldTypes.AssignedUserId,
|
||||||
|
Handler = typeof(AssignedUserIdImportField),
|
||||||
|
Name = "Assigned User Identifier",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
unassignUsers = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Columns = columns;
|
||||||
|
ColumnCount = columns.Count;
|
||||||
|
|
||||||
|
records = devices.Select<Device, IDeviceImportRecord>((d, i) =>
|
||||||
|
{
|
||||||
|
var fields = new List<IDeviceImportField>(ColumnCount)
|
||||||
|
{
|
||||||
|
DeviceSerialNumberImportField.Create(d),
|
||||||
|
DeviceDecommissionedReasonImportField.Create(d, decommissionReason, true, unassignUsers),
|
||||||
|
};
|
||||||
|
if (unassignUsers)
|
||||||
|
{
|
||||||
|
fields.Add(AssignedUserIdImportField.CreateUnassigned(d));
|
||||||
|
}
|
||||||
|
return new DeviceDecommissionImportRecord(d, i, fields);
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DeviceDecommissionImportContext Create(DiscoDataContext database, DeviceBatch deviceBatch, DecommissionReasons decommissionReason, bool unassignUsers)
|
||||||
|
{
|
||||||
|
var devices = database.Devices
|
||||||
|
.Include(d => d.Jobs)
|
||||||
|
.Include(d => d.AssignedUser)
|
||||||
|
.Where(d => d.DeviceBatchId == deviceBatch.Id && d.DecommissionedDate == null)
|
||||||
|
.ToList();
|
||||||
|
return new DeviceDecommissionImportContext($"Batch: {deviceBatch.Name} ({deviceBatch.Id})", devices, decommissionReason, unassignUsers);
|
||||||
|
}
|
||||||
|
|
||||||
|
public IDeviceImportColumn GetColumn(int Index)
|
||||||
|
=> throw new NotImplementedException();
|
||||||
|
|
||||||
|
public int? GetColumnByType(DeviceImportFieldTypes FieldType)
|
||||||
|
=> throw new NotImplementedException();
|
||||||
|
|
||||||
|
public IDeviceImportDataReader GetDataReader()
|
||||||
|
=> throw new NotImplementedException();
|
||||||
|
|
||||||
|
public IEnumerable<KeyValuePair<DeviceImportFieldTypes, Type>> GetFieldHandlers()
|
||||||
|
=> throw new NotImplementedException();
|
||||||
|
|
||||||
|
public void SetColumnType(int Index, DeviceImportFieldTypes Type)
|
||||||
|
=> throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
using Disco.Models.Repository;
|
||||||
|
using Disco.Models.Services.Devices.Importing;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Data;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace Disco.Services.Devices.Importing
|
||||||
|
{
|
||||||
|
internal class DeviceDecommissionImportRecord : IDeviceImportRecord
|
||||||
|
{
|
||||||
|
public int Index { get; }
|
||||||
|
public string DeviceSerialNumber { get; }
|
||||||
|
public IEnumerable<IDeviceImportField> Fields { get; }
|
||||||
|
public EntityState RecordAction { get; }
|
||||||
|
public bool HasError { get; }
|
||||||
|
|
||||||
|
public DeviceDecommissionImportRecord(Device device, int index, IEnumerable<IDeviceImportField> fields)
|
||||||
|
{
|
||||||
|
Index = index;
|
||||||
|
DeviceSerialNumber = device.SerialNumber;
|
||||||
|
|
||||||
|
if (fields.Any(f => !f.FieldAction.HasValue))
|
||||||
|
RecordAction = EntityState.Detached;
|
||||||
|
else if (fields.Any(f => f.FieldAction == EntityState.Modified))
|
||||||
|
RecordAction = EntityState.Modified;
|
||||||
|
else
|
||||||
|
RecordAction = EntityState.Unchanged;
|
||||||
|
|
||||||
|
Fields = fields;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -40,6 +40,9 @@ namespace Disco.Services.Devices.Importing
|
|||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static IDeviceImportContext BeginDecommissionImport(DiscoDataContext database, DeviceBatch deviceBatch, DecommissionReasons decommissionReason, bool unassignUsers)
|
||||||
|
=> DeviceDecommissionImportContext.Create(database, deviceBatch, decommissionReason, unassignUsers);
|
||||||
|
|
||||||
private static void GuessHeaderTypes(this IDeviceImportContext Context, DiscoDataContext Database)
|
private static void GuessHeaderTypes(this IDeviceImportContext Context, DiscoDataContext Database)
|
||||||
{
|
{
|
||||||
using (var dataReader = Context.GetDataReader())
|
using (var dataReader = Context.GetDataReader())
|
||||||
@@ -151,11 +154,11 @@ namespace Disco.Services.Devices.Importing
|
|||||||
|
|
||||||
int affectedRecords = 0;
|
int affectedRecords = 0;
|
||||||
|
|
||||||
foreach (var record in Context.Records.Cast<DeviceImportRecord>().Select((r, i) => Tuple.Create(r, i)))
|
foreach (var (record, index) in Context.Records.Select((r, i) => Tuple.Create(r, i)))
|
||||||
{
|
{
|
||||||
Status.UpdateStatus(((double)record.Item2 / Context.Records.Count) * 100, string.Format("Applying: {0}", record.Item1.DeviceSerialNumber));
|
Status.UpdateStatus(((double)index / Context.Records.Count) * 100, $"Applying: {record.DeviceSerialNumber}");
|
||||||
|
|
||||||
if (record.Item1.Apply(Database))
|
if (DeviceImportRecord.Apply(record, Database))
|
||||||
affectedRecords++;
|
affectedRecords++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,22 +30,22 @@ namespace Disco.Services.Devices.Importing
|
|||||||
this.RecordAction = RecordAction;
|
this.RecordAction = RecordAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Apply(DiscoDataContext Database)
|
public static bool Apply(IDeviceImportRecord record, DiscoDataContext Database)
|
||||||
{
|
{
|
||||||
if (RecordAction == EntityState.Detached || !HasError)
|
if (record.RecordAction == EntityState.Detached || !record.HasError)
|
||||||
{
|
{
|
||||||
Device device;
|
Device device;
|
||||||
|
|
||||||
if (RecordAction == EntityState.Unchanged)
|
if (record.RecordAction == EntityState.Unchanged)
|
||||||
{
|
{
|
||||||
// Unchanged - No Action Required
|
// Unchanged - No Action Required
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else if (RecordAction == EntityState.Modified)
|
else if (record.RecordAction == EntityState.Modified)
|
||||||
{
|
{
|
||||||
device = Database.Devices.Find(DeviceSerialNumber);
|
device = Database.Devices.Find(record.DeviceSerialNumber);
|
||||||
}
|
}
|
||||||
else if (RecordAction == EntityState.Added)
|
else if (record.RecordAction == EntityState.Added)
|
||||||
{
|
{
|
||||||
// Use 'Add Device Offline' default if available
|
// Use 'Add Device Offline' default if available
|
||||||
var deviceProfileId = Database.DiscoConfiguration.DeviceProfiles.DefaultAddDeviceOfflineDeviceProfileId;
|
var deviceProfileId = Database.DiscoConfiguration.DeviceProfiles.DefaultAddDeviceOfflineDeviceProfileId;
|
||||||
@@ -57,7 +57,7 @@ namespace Disco.Services.Devices.Importing
|
|||||||
// Create Device
|
// Create Device
|
||||||
device = new Device()
|
device = new Device()
|
||||||
{
|
{
|
||||||
SerialNumber = DeviceSerialNumber.ToUpper(),
|
SerialNumber = record.DeviceSerialNumber.ToUpper(),
|
||||||
CreatedDate = DateTime.Now,
|
CreatedDate = DateTime.Now,
|
||||||
AllowUnauthenticatedEnrol = true,
|
AllowUnauthenticatedEnrol = true,
|
||||||
DeviceProfileId = deviceProfileId,
|
DeviceProfileId = deviceProfileId,
|
||||||
@@ -71,9 +71,9 @@ namespace Disco.Services.Devices.Importing
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool changesMade = (RecordAction == EntityState.Added);
|
bool changesMade = (record.RecordAction == EntityState.Added);
|
||||||
|
|
||||||
foreach (var field in Fields.Cast<DeviceImportFieldBase>())
|
foreach (var field in record.Fields.Cast<DeviceImportFieldBase>())
|
||||||
{
|
{
|
||||||
changesMade = field.Apply(Database, device) || changesMade;
|
changesMade = field.Apply(Database, device) || changesMade;
|
||||||
}
|
}
|
||||||
@@ -84,7 +84,7 @@ namespace Disco.Services.Devices.Importing
|
|||||||
|
|
||||||
bool adDescriptionSet = false;
|
bool adDescriptionSet = false;
|
||||||
|
|
||||||
foreach (var field in Fields.Cast<DeviceImportFieldBase>())
|
foreach (var field in record.Fields.Cast<DeviceImportFieldBase>())
|
||||||
{
|
{
|
||||||
field.Applied(Database, device, ref adDescriptionSet);
|
field.Applied(Database, device, ref adDescriptionSet);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,25 @@ namespace Disco.Services.Devices.Importing.Fields
|
|||||||
public override string FriendlyValue { get { return friendlyValue; } }
|
public override string FriendlyValue { get { return friendlyValue; } }
|
||||||
public override string FriendlyPreviousValue { get { return friendlyPreviousValue; } }
|
public override string FriendlyPreviousValue { get { return friendlyPreviousValue; } }
|
||||||
|
|
||||||
|
public static AssignedUserIdImportField CreateUnassigned(Device device)
|
||||||
|
{
|
||||||
|
var field = new AssignedUserIdImportField()
|
||||||
|
{
|
||||||
|
parsedValue = null,
|
||||||
|
friendlyValue = null,
|
||||||
|
};
|
||||||
|
if (device.AssignedUser != null)
|
||||||
|
{
|
||||||
|
field.friendlyPreviousValue = $"{device.AssignedUser.DisplayName} [{device.AssignedUser.UserId}]";
|
||||||
|
field.Success(EntityState.Modified);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
field.Success(EntityState.Unchanged);
|
||||||
|
}
|
||||||
|
return field;
|
||||||
|
}
|
||||||
|
|
||||||
public override bool Parse(DiscoDataContext Database, IDeviceImportCache Cache, IDeviceImportContext Context, string DeviceSerialNumber, Device ExistingDevice, List<IDeviceImportRecord> PreviousRecords, IDeviceImportDataReader DataReader, int ColumnIndex)
|
public override bool Parse(DiscoDataContext Database, IDeviceImportCache Cache, IDeviceImportContext Context, string DeviceSerialNumber, Device ExistingDevice, List<IDeviceImportRecord> PreviousRecords, IDeviceImportDataReader DataReader, int ColumnIndex)
|
||||||
{
|
{
|
||||||
var value = friendlyValue = DataReader.GetString(ColumnIndex);
|
var value = friendlyValue = DataReader.GetString(ColumnIndex);
|
||||||
|
|||||||
@@ -158,36 +158,48 @@ namespace Disco.Services.Devices.Importing.Fields
|
|||||||
return possibleColumns.Select(h => (int?)h.Index).FirstOrDefault();
|
return possibleColumns.Select(h => (int?)h.Index).FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool CanDecommissionDevice(Device Device, IDeviceImportContext Context, IDeviceImportDataReader DataReader, out string ErrorMessage)
|
public static bool CanDecommissionDevice(Device device, IDeviceImportContext context, IDeviceImportDataReader dataReader, out string errorMessage)
|
||||||
{
|
{
|
||||||
if (Device == null)
|
var isAssigningUser = false;
|
||||||
|
var assigningUserId = default(string);
|
||||||
|
var assignedUserIndex = context.GetColumnByType(DeviceImportFieldTypes.AssignedUserId);
|
||||||
|
if (assignedUserIndex.HasValue)
|
||||||
{
|
{
|
||||||
ErrorMessage = "Cannot decommission new devices";
|
isAssigningUser = true;
|
||||||
|
assigningUserId = dataReader.GetString(assignedUserIndex.Value);
|
||||||
|
}
|
||||||
|
var hasOpenJobs = device.Jobs.Any(j => !j.ClosedDate.HasValue);
|
||||||
|
|
||||||
|
return CanDecommissionDevice(device, isAssigningUser, assigningUserId, hasOpenJobs, out errorMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool CanDecommissionDevice(Device device, bool isAssigningUser, string assigningUserId, bool hasOpenJobs, out string errorMessage)
|
||||||
|
{
|
||||||
|
if (device == null)
|
||||||
|
{
|
||||||
|
errorMessage = "Cannot decommission new devices";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check device is assigned (or being removed in this import)
|
// Check device is assigned (or being removed in this import)
|
||||||
|
if (isAssigningUser && !string.IsNullOrEmpty(assigningUserId) ||
|
||||||
var assignedUserIndex = Context.GetColumnByType(DeviceImportFieldTypes.AssignedUserId);
|
(!isAssigningUser && device.AssignedUserId != null))
|
||||||
if ((!assignedUserIndex.HasValue && Device.AssignedUserId != null) ||
|
|
||||||
(assignedUserIndex.HasValue && !string.IsNullOrWhiteSpace(DataReader.GetString(assignedUserIndex.Value))))
|
|
||||||
{
|
{
|
||||||
if (Device.AssignedUserId != null)
|
if (!isAssigningUser)
|
||||||
ErrorMessage = $"The device is assigned to a user ({Device.AssignedUser.DisplayName} [{Device.AssignedUser.UserId}]) and cannot be decommissioned";
|
errorMessage = $"The device is assigned to a user ({device.AssignedUser.DisplayName} [{device.AssignedUser.UserId}]) and cannot be decommissioned";
|
||||||
else
|
else
|
||||||
ErrorMessage = $"The device is being assigned to a user ({DataReader.GetString(assignedUserIndex.Value)}) and cannot be decommissioned";
|
errorMessage = $"The device is being assigned to a user ({assigningUserId}) and cannot be decommissioned";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check device doesn't have any open jobs
|
// Check device doesn't have any open jobs
|
||||||
var openJobCount = Device.Jobs.Count(j => !j.ClosedDate.HasValue);
|
if (hasOpenJobs)
|
||||||
if (openJobCount > 0)
|
|
||||||
{
|
{
|
||||||
ErrorMessage = $"The device is associated with {openJobCount} open job{(openJobCount == 1 ? null : "s")} and cannot be decommissioned";
|
errorMessage = $"The device is associated with an open job and cannot be decommissioned";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorMessage = null;
|
errorMessage = null;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,26 @@ namespace Disco.Services.Devices.Importing.Fields
|
|||||||
public override string FriendlyValue { get { return parsedValue.HasValue ? parsedValue.Value.ToString() : rawValue; } }
|
public override string FriendlyValue { get { return parsedValue.HasValue ? parsedValue.Value.ToString() : rawValue; } }
|
||||||
public override string FriendlyPreviousValue { get { return previousValue.HasValue ? previousValue.Value.ToString() : null; } }
|
public override string FriendlyPreviousValue { get { return previousValue.HasValue ? previousValue.Value.ToString() : null; } }
|
||||||
|
|
||||||
|
public static DeviceDecommissionedReasonImportField Create(Device device, DecommissionReasons? decommissionReason, bool setDate, bool isUnassigningUser)
|
||||||
|
{
|
||||||
|
var field = new DeviceDecommissionedReasonImportField()
|
||||||
|
{
|
||||||
|
rawValue = decommissionReason?.ToString(),
|
||||||
|
parsedValue = decommissionReason,
|
||||||
|
previousValue = device.DecommissionReason,
|
||||||
|
setDate = setDate
|
||||||
|
};
|
||||||
|
var hasOpenJobs = device.Jobs.Any(j => !j.ClosedDate.HasValue);
|
||||||
|
if (!DeviceDecommissionedDateImportField.CanDecommissionDevice(device, isUnassigningUser, null, hasOpenJobs, out var errorMessage))
|
||||||
|
field.Error(errorMessage);
|
||||||
|
else if (device.DecommissionReason == decommissionReason)
|
||||||
|
field.Success(EntityState.Unchanged);
|
||||||
|
else
|
||||||
|
field.Success(EntityState.Modified);
|
||||||
|
|
||||||
|
return field;
|
||||||
|
}
|
||||||
|
|
||||||
public override bool Parse(DiscoDataContext Database, IDeviceImportCache Cache, IDeviceImportContext Context, string DeviceSerialNumber, Device ExistingDevice, List<IDeviceImportRecord> PreviousRecords, IDeviceImportDataReader DataReader, int ColumnIndex)
|
public override bool Parse(DiscoDataContext Database, IDeviceImportCache Cache, IDeviceImportContext Context, string DeviceSerialNumber, Device ExistingDevice, List<IDeviceImportRecord> PreviousRecords, IDeviceImportDataReader DataReader, int ColumnIndex)
|
||||||
{
|
{
|
||||||
var value = DataReader.GetString(ColumnIndex);
|
var value = DataReader.GetString(ColumnIndex);
|
||||||
@@ -50,8 +70,7 @@ namespace Disco.Services.Devices.Importing.Fields
|
|||||||
var decommissionedDateIndex = Context.GetColumnByType(DeviceImportFieldTypes.DeviceDecommissionedDate);
|
var decommissionedDateIndex = Context.GetColumnByType(DeviceImportFieldTypes.DeviceDecommissionedDate);
|
||||||
if (parsedValue.HasValue && !decommissionedDateIndex.HasValue)
|
if (parsedValue.HasValue && !decommissionedDateIndex.HasValue)
|
||||||
{
|
{
|
||||||
string errorMessage;
|
if (!DeviceDecommissionedDateImportField.CanDecommissionDevice(ExistingDevice, Context, DataReader, out var errorMessage))
|
||||||
if (!DeviceDecommissionedDateImportField.CanDecommissionDevice(ExistingDevice, Context, DataReader, out errorMessage))
|
|
||||||
return Error(errorMessage);
|
return Error(errorMessage);
|
||||||
|
|
||||||
setDate = true;
|
setDate = true;
|
||||||
|
|||||||
@@ -19,6 +19,16 @@ namespace Disco.Services.Devices.Importing.Fields
|
|||||||
public override string FriendlyValue { get { return parsedValue; } }
|
public override string FriendlyValue { get { return parsedValue; } }
|
||||||
public override string FriendlyPreviousValue { get { return parsedValue; } }
|
public override string FriendlyPreviousValue { get { return parsedValue; } }
|
||||||
|
|
||||||
|
public static DeviceSerialNumberImportField Create(Device device)
|
||||||
|
{
|
||||||
|
var field = new DeviceSerialNumberImportField()
|
||||||
|
{
|
||||||
|
parsedValue = device.SerialNumber,
|
||||||
|
};
|
||||||
|
field.Success(EntityState.Unchanged);
|
||||||
|
return field;
|
||||||
|
}
|
||||||
|
|
||||||
public override bool Parse(DiscoDataContext Database, IDeviceImportCache Cache, IDeviceImportContext Context, string DeviceSerialNumber, Device ExistingDevice, List<IDeviceImportRecord> PreviousRecords, IDeviceImportDataReader DataReader, int ColumnIndex)
|
public override bool Parse(DiscoDataContext Database, IDeviceImportCache Cache, IDeviceImportContext Context, string DeviceSerialNumber, Device ExistingDevice, List<IDeviceImportRecord> PreviousRecords, IDeviceImportDataReader DataReader, int ColumnIndex)
|
||||||
{
|
{
|
||||||
var value = DataReader.GetString(ColumnIndex);
|
var value = DataReader.GetString(ColumnIndex);
|
||||||
|
|||||||
@@ -366,6 +366,8 @@
|
|||||||
<Compile Include="Devices\DeviceFlags\DeviceFlagService.cs" />
|
<Compile Include="Devices\DeviceFlags\DeviceFlagService.cs" />
|
||||||
<Compile Include="Devices\DeviceFlags\DeviceFlagDeviceAssignedUsersManagedGroup.cs" />
|
<Compile Include="Devices\DeviceFlags\DeviceFlagDeviceAssignedUsersManagedGroup.cs" />
|
||||||
<Compile Include="Devices\DeviceFlags\DeviceFlagDevicesManagedGroup.cs" />
|
<Compile Include="Devices\DeviceFlags\DeviceFlagDevicesManagedGroup.cs" />
|
||||||
|
<Compile Include="Devices\Importing\DeviceDecommissionImportContext.cs" />
|
||||||
|
<Compile Include="Devices\Importing\DeviceDecommissionImportRecord.cs" />
|
||||||
<Compile Include="Documents\DocumentExport.cs" />
|
<Compile Include="Documents\DocumentExport.cs" />
|
||||||
<Compile Include="Exporting\Exporter.cs" />
|
<Compile Include="Exporting\Exporter.cs" />
|
||||||
<Compile Include="Exporting\ExportTask.cs" />
|
<Compile Include="Exporting\ExportTask.cs" />
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
using Disco.Data.Repository;
|
using Disco.Data.Repository;
|
||||||
using Disco.Models.Repository;
|
using Disco.Models.Repository;
|
||||||
using Disco.Services.Authorization;
|
|
||||||
using Disco.Services.Users;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
|||||||
@@ -715,6 +715,21 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
return RedirectToAction(MVC.Config.Logging.TaskStatus(status.SessionId));
|
return RedirectToAction(MVC.Config.Logging.TaskStatus(status.SessionId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[DiscoAuthorize(Claims.Device.Actions.Import)]
|
||||||
|
[HttpPost, ValidateAntiForgeryToken]
|
||||||
|
public virtual ActionResult DeviceBatchDecommission(int id, DecommissionReasons? decommissionReason = null, bool? unassignUsers = null)
|
||||||
|
{
|
||||||
|
var deviceBatch = Database.DeviceBatches.Find(id)
|
||||||
|
?? throw new ArgumentException("Invalid Device Batch Id", nameof(id));
|
||||||
|
if (decommissionReason == null)
|
||||||
|
throw new ArgumentNullException(nameof(decommissionReason), "Decommission Reason is required");
|
||||||
|
|
||||||
|
var context = DeviceImport.BeginDecommissionImport(Database, deviceBatch, decommissionReason.Value, unassignUsers.GetValueOrDefault());
|
||||||
|
Import_StoreContext(context);
|
||||||
|
|
||||||
|
return RedirectToAction(MVC.Device.ImportReview(context.SessionId));
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Exporting
|
#region Exporting
|
||||||
|
|||||||
@@ -48,8 +48,8 @@ namespace Disco.Web.Areas.Config.Controllers
|
|||||||
if (DeviceBatchDevicesManagedGroup.TryGetManagedGroup(m.DeviceBatch, out devicesManagedGroup))
|
if (DeviceBatchDevicesManagedGroup.TryGetManagedGroup(m.DeviceBatch, out devicesManagedGroup))
|
||||||
m.DevicesLinkedGroup = devicesManagedGroup;
|
m.DevicesLinkedGroup = devicesManagedGroup;
|
||||||
|
|
||||||
if (Authorization.Has(Claims.Config.DeviceBatch.Delete))
|
|
||||||
m.CanDelete = m.DeviceBatch.CanDelete(Database);
|
m.CanDelete = m.DeviceBatch.CanDelete(Database);
|
||||||
|
m.CanDecommission = m.DeviceBatch.CanDecommission(Database);
|
||||||
|
|
||||||
if (Authorization.Has(Claims.Config.DeviceBatch.Configure))
|
if (Authorization.Has(Claims.Config.DeviceBatch.Configure))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ namespace Disco.Web.Areas.Config.Models.DeviceBatch
|
|||||||
public int DeviceCount { get; set; }
|
public int DeviceCount { get; set; }
|
||||||
public int DeviceDecommissionedCount { get; set; }
|
public int DeviceDecommissionedCount { get; set; }
|
||||||
public bool CanDelete { get; set; }
|
public bool CanDelete { get; set; }
|
||||||
|
public bool CanDecommission { get; set; }
|
||||||
|
|
||||||
public override int DeviceGroupId => DeviceBatch.Id;
|
public override int DeviceGroupId => DeviceBatch.Id;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,14 +28,16 @@
|
|||||||
<div class="form deviceBatches@(hideAdvanced ? " Config_HideAdvanced" : null)" style="width: 730px">
|
<div class="form deviceBatches@(hideAdvanced ? " Config_HideAdvanced" : null)" style="width: 730px">
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th style="width: 150px">Id:
|
<th style="width: 150px">
|
||||||
|
Id:
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
@Html.DisplayFor(model => model.DeviceBatch.Id)
|
@Html.DisplayFor(model => model.DeviceBatch.Id)
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Name:
|
<th>
|
||||||
|
Name:
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
@if (canConfig)
|
@if (canConfig)
|
||||||
@@ -61,9 +63,11 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Default Device Model:
|
<th>
|
||||||
|
Default Device Model:
|
||||||
</th>
|
</th>
|
||||||
<td>@if (canConfig)
|
<td>
|
||||||
|
@if (canConfig)
|
||||||
{
|
{
|
||||||
@Html.DropDownListFor(model => model.DeviceBatch.DefaultDeviceModelId, Model.DeviceModels.ToSelectListItems(null, true))
|
@Html.DropDownListFor(model => model.DeviceBatch.DefaultDeviceModelId, Model.DeviceModels.ToSelectListItems(null, true))
|
||||||
@AjaxHelpers.AjaxSave()
|
@AjaxHelpers.AjaxSave()
|
||||||
@@ -88,8 +92,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
<br />
|
<br />
|
||||||
<span class="smallMessage">Devices added offline will default to this Device Model.
|
<span class="smallMessage">
|
||||||
Once a device enrols the Device Model will be accurately represented.</span>
|
Devices added offline will default to this Device Model.
|
||||||
|
Once a device enrols the Device Model will be accurately represented.
|
||||||
|
</span>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -154,12 +160,14 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Purchase:
|
<th>
|
||||||
|
Purchase:
|
||||||
</th>
|
</th>
|
||||||
<td class="details">
|
<td class="details">
|
||||||
<table class="sub">
|
<table class="sub">
|
||||||
<tr>
|
<tr>
|
||||||
<th class="name" style="width: 100px">Purchase Date:
|
<th class="name" style="width: 100px">
|
||||||
|
Purchase Date:
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
@if (canConfig)
|
@if (canConfig)
|
||||||
@@ -187,9 +195,11 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Supplier:
|
<th>
|
||||||
|
Supplier:
|
||||||
</th>
|
</th>
|
||||||
<td>@if (canConfig)
|
<td>
|
||||||
|
@if (canConfig)
|
||||||
{
|
{
|
||||||
@Html.EditorFor(model => model.DeviceBatch.Supplier)
|
@Html.EditorFor(model => model.DeviceBatch.Supplier)
|
||||||
@AjaxHelpers.AjaxSave()
|
@AjaxHelpers.AjaxSave()
|
||||||
@@ -215,9 +225,11 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Unit Cost:
|
<th>
|
||||||
|
Unit Cost:
|
||||||
</th>
|
</th>
|
||||||
<td>@if (canConfig)
|
<td>
|
||||||
|
@if (canConfig)
|
||||||
{
|
{
|
||||||
@Html.EditorFor(model => model.DeviceBatch.UnitCost)
|
@Html.EditorFor(model => model.DeviceBatch.UnitCost)
|
||||||
@AjaxHelpers.AjaxSave()
|
@AjaxHelpers.AjaxSave()
|
||||||
@@ -243,9 +255,11 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Quantity:
|
<th>
|
||||||
|
Quantity:
|
||||||
</th>
|
</th>
|
||||||
<td>@if (canConfig)
|
<td>
|
||||||
|
@if (canConfig)
|
||||||
{
|
{
|
||||||
@Html.EditorFor(model => model.DeviceBatch.UnitQuantity)
|
@Html.EditorFor(model => model.DeviceBatch.UnitQuantity)
|
||||||
@AjaxHelpers.AjaxSave()
|
@AjaxHelpers.AjaxSave()
|
||||||
@@ -341,12 +355,14 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Warranty:
|
<th>
|
||||||
|
Warranty:
|
||||||
</th>
|
</th>
|
||||||
<td class="details">
|
<td class="details">
|
||||||
<table class="sub">
|
<table class="sub">
|
||||||
<tr>
|
<tr>
|
||||||
<th class="name" style="width: 100px">Valid Until:
|
<th class="name" style="width: 100px">
|
||||||
|
Valid Until:
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
@if (canConfig)
|
@if (canConfig)
|
||||||
@@ -444,14 +460,17 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Insurance:
|
<th>
|
||||||
|
Insurance:
|
||||||
</th>
|
</th>
|
||||||
<td class="details">
|
<td class="details">
|
||||||
<table class="sub">
|
<table class="sub">
|
||||||
<tr>
|
<tr>
|
||||||
<th class="name" style="width: 100px">Supplier:
|
<th class="name" style="width: 100px">
|
||||||
|
Supplier:
|
||||||
</th>
|
</th>
|
||||||
<td>@if (canConfig)
|
<td>
|
||||||
|
@if (canConfig)
|
||||||
{
|
{
|
||||||
@Html.EditorFor(model => model.DeviceBatch.InsuranceSupplier)
|
@Html.EditorFor(model => model.DeviceBatch.InsuranceSupplier)
|
||||||
@AjaxHelpers.AjaxSave()
|
@AjaxHelpers.AjaxSave()
|
||||||
@@ -478,9 +497,11 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="name">Insured Date:
|
<th class="name">
|
||||||
|
Insured Date:
|
||||||
</th>
|
</th>
|
||||||
<td>@if (canConfig)
|
<td>
|
||||||
|
@if (canConfig)
|
||||||
{
|
{
|
||||||
@Html.EditorFor(model => model.DeviceBatch.InsuredDate)
|
@Html.EditorFor(model => model.DeviceBatch.InsuredDate)
|
||||||
@AjaxHelpers.AjaxLoader()
|
@AjaxHelpers.AjaxLoader()
|
||||||
@@ -505,9 +526,11 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="name">Insured Until:
|
<th class="name">
|
||||||
|
Insured Until:
|
||||||
</th>
|
</th>
|
||||||
<td>@if (canConfig)
|
<td>
|
||||||
|
@if (canConfig)
|
||||||
{
|
{
|
||||||
@Html.EditorFor(model => model.DeviceBatch.InsuredUntil)
|
@Html.EditorFor(model => model.DeviceBatch.InsuredUntil)
|
||||||
@AjaxHelpers.AjaxLoader()
|
@AjaxHelpers.AjaxLoader()
|
||||||
@@ -600,10 +623,12 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Comments:<br />
|
<th>
|
||||||
|
Comments:<br />
|
||||||
@AjaxHelpers.AjaxLoader("ajaxComments")
|
@AjaxHelpers.AjaxLoader("ajaxComments")
|
||||||
</th>
|
</th>
|
||||||
<td>@if (canConfig)
|
<td>
|
||||||
|
@if (canConfig)
|
||||||
{
|
{
|
||||||
@Html.EditorFor(model => model.DeviceBatch.Comments)
|
@Html.EditorFor(model => model.DeviceBatch.Comments)
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@@ -983,7 +1008,8 @@
|
|||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
<tr class="Config_HideAdvanced_Item">
|
<tr class="Config_HideAdvanced_Item">
|
||||||
<th>Linked Groups:
|
<th>
|
||||||
|
Linked Groups:
|
||||||
</th>
|
</th>
|
||||||
<td>
|
<td>
|
||||||
<div>
|
<div>
|
||||||
@@ -1014,6 +1040,65 @@
|
|||||||
</div>
|
</div>
|
||||||
@Html.Partial(MVC.Config.Shared.Views._DeviceGroupDocumentBulkGenerate, Model)
|
@Html.Partial(MVC.Config.Shared.Views._DeviceGroupDocumentBulkGenerate, Model)
|
||||||
<div class="actionBar">
|
<div class="actionBar">
|
||||||
|
@if (Model.CanDecommission)
|
||||||
|
{
|
||||||
|
<button id="DeviceBatch_Decommission" class="button">Decommission All Devices</button>
|
||||||
|
<div id="DeviceBatch_Decommission_Dialog" class="dialog" title="Batch Device Decommission">
|
||||||
|
@using (Html.BeginForm(MVC.API.Device.DeviceBatchDecommission(Model.DeviceBatch.Id), FormMethod.Post))
|
||||||
|
{
|
||||||
|
@Html.AntiForgeryToken()
|
||||||
|
<div class="clearfix" style="margin-bottom: 10px;">
|
||||||
|
<i class="fa fa-question-circle fa-lg information"></i> Why are these devices to be decommissioned?
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<ul class="none">
|
||||||
|
@foreach (DecommissionReasons decommissionReason in Enum.GetValues(typeof(DecommissionReasons)).Cast<DecommissionReasons>().OrderBy(r => r.ToString()))
|
||||||
|
{
|
||||||
|
<li>
|
||||||
|
<input type="radio" id="DeviceBatch_Decommission_Dialog_Reason_@((int)decommissionReason)"
|
||||||
|
name="decommissionReason" value="@((int)decommissionReason)" @((decommissionReason == DecommissionReasons.EndOfLife) ? "checked=\"checked\"" : string.Empty) />
|
||||||
|
<label for="DeviceBatch_Decommission_Dialog_Reason_@((int)decommissionReason)">@(decommissionReason.ReasonMessage())</label>
|
||||||
|
</li>
|
||||||
|
}
|
||||||
|
</ul>
|
||||||
|
<br />
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" value="true" name="unassignUsers" />
|
||||||
|
Unassign devices users
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(function () {
|
||||||
|
let buttonDialog = null;
|
||||||
|
$('#DeviceBatch_Decommission').click(function () {
|
||||||
|
if (!buttonDialog) {
|
||||||
|
buttonDialog = $('#DeviceBatch_Decommission_Dialog')
|
||||||
|
.dialog({
|
||||||
|
resizable: false,
|
||||||
|
modal: true,
|
||||||
|
autoOpen: false,
|
||||||
|
buttons: {
|
||||||
|
"Decommission": function () {
|
||||||
|
const $this = $(this);
|
||||||
|
$this.find('form').trigger('submit');
|
||||||
|
$this.dialog("disable");
|
||||||
|
$this.dialog("option", "buttons", null);
|
||||||
|
},
|
||||||
|
Cancel: function () {
|
||||||
|
$(this).dialog("close");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
buttonDialog.dialog('open');
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
}
|
||||||
@if (Model.CanDelete)
|
@if (Model.CanDelete)
|
||||||
{
|
{
|
||||||
@Html.ActionLinkButton("Delete", MVC.API.DeviceBatch.Delete(Model.DeviceBatch.Id, true), "buttonDelete")
|
@Html.ActionLinkButton("Delete", MVC.API.DeviceBatch.Delete(Model.DeviceBatch.Id, true), "buttonDelete")
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,5 @@
|
|||||||
using Disco.Models.Repository;
|
using Disco.Models.Repository;
|
||||||
using Disco.Models.Services.Devices;
|
using Disco.Models.Services.Devices;
|
||||||
using Disco.Models.Services.Documents;
|
|
||||||
using Disco.Models.Services.Jobs.JobLists;
|
using Disco.Models.Services.Jobs.JobLists;
|
||||||
using Disco.Models.UI.Device;
|
using Disco.Models.UI.Device;
|
||||||
using Disco.Services;
|
using Disco.Services;
|
||||||
|
|||||||
@@ -218,6 +218,12 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
}
|
}
|
||||||
[NonAction]
|
[NonAction]
|
||||||
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
|
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
|
||||||
|
public virtual System.Web.Mvc.ActionResult DeviceBatchDecommission()
|
||||||
|
{
|
||||||
|
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.DeviceBatchDecommission);
|
||||||
|
}
|
||||||
|
[NonAction]
|
||||||
|
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
|
||||||
public virtual System.Web.Mvc.ActionResult Export()
|
public virtual System.Web.Mvc.ActionResult Export()
|
||||||
{
|
{
|
||||||
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Export);
|
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Export);
|
||||||
@@ -276,6 +282,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
public readonly string ImportBegin = "ImportBegin";
|
public readonly string ImportBegin = "ImportBegin";
|
||||||
public readonly string ImportParse = "ImportParse";
|
public readonly string ImportParse = "ImportParse";
|
||||||
public readonly string ImportApply = "ImportApply";
|
public readonly string ImportApply = "ImportApply";
|
||||||
|
public readonly string DeviceBatchDecommission = "DeviceBatchDecommission";
|
||||||
public readonly string Export = "Export";
|
public readonly string Export = "Export";
|
||||||
public readonly string ExportRetrieve = "ExportRetrieve";
|
public readonly string ExportRetrieve = "ExportRetrieve";
|
||||||
public readonly string SaveExport = "SaveExport";
|
public readonly string SaveExport = "SaveExport";
|
||||||
@@ -311,6 +318,7 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
public const string ImportBegin = "ImportBegin";
|
public const string ImportBegin = "ImportBegin";
|
||||||
public const string ImportParse = "ImportParse";
|
public const string ImportParse = "ImportParse";
|
||||||
public const string ImportApply = "ImportApply";
|
public const string ImportApply = "ImportApply";
|
||||||
|
public const string DeviceBatchDecommission = "DeviceBatchDecommission";
|
||||||
public const string Export = "Export";
|
public const string Export = "Export";
|
||||||
public const string ExportRetrieve = "ExportRetrieve";
|
public const string ExportRetrieve = "ExportRetrieve";
|
||||||
public const string SaveExport = "SaveExport";
|
public const string SaveExport = "SaveExport";
|
||||||
@@ -557,6 +565,16 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
{
|
{
|
||||||
public readonly string Id = "Id";
|
public readonly string Id = "Id";
|
||||||
}
|
}
|
||||||
|
static readonly ActionParamsClass_DeviceBatchDecommission s_params_DeviceBatchDecommission = new ActionParamsClass_DeviceBatchDecommission();
|
||||||
|
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
|
||||||
|
public ActionParamsClass_DeviceBatchDecommission DeviceBatchDecommissionParams { get { return s_params_DeviceBatchDecommission; } }
|
||||||
|
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
|
||||||
|
public class ActionParamsClass_DeviceBatchDecommission
|
||||||
|
{
|
||||||
|
public readonly string id = "id";
|
||||||
|
public readonly string decommissionReason = "decommissionReason";
|
||||||
|
public readonly string unassignUsers = "unassignUsers";
|
||||||
|
}
|
||||||
static readonly ActionParamsClass_Export s_params_Export = new ActionParamsClass_Export();
|
static readonly ActionParamsClass_Export s_params_Export = new ActionParamsClass_Export();
|
||||||
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
|
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
|
||||||
public ActionParamsClass_Export ExportParams { get { return s_params_Export; } }
|
public ActionParamsClass_Export ExportParams { get { return s_params_Export; } }
|
||||||
@@ -943,6 +961,20 @@ namespace Disco.Web.Areas.API.Controllers
|
|||||||
return callInfo;
|
return callInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[NonAction]
|
||||||
|
partial void DeviceBatchDecommissionOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id, Disco.Models.Repository.DecommissionReasons? decommissionReason, bool? unassignUsers);
|
||||||
|
|
||||||
|
[NonAction]
|
||||||
|
public override System.Web.Mvc.ActionResult DeviceBatchDecommission(int id, Disco.Models.Repository.DecommissionReasons? decommissionReason, bool? unassignUsers)
|
||||||
|
{
|
||||||
|
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.DeviceBatchDecommission);
|
||||||
|
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
|
||||||
|
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "decommissionReason", decommissionReason);
|
||||||
|
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "unassignUsers", unassignUsers);
|
||||||
|
DeviceBatchDecommissionOverride(callInfo, id, decommissionReason, unassignUsers);
|
||||||
|
return callInfo;
|
||||||
|
}
|
||||||
|
|
||||||
[NonAction]
|
[NonAction]
|
||||||
partial void ExportOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, Disco.Web.Models.Device.ExportModel model);
|
partial void ExportOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, Disco.Web.Models.Device.ExportModel model);
|
||||||
|
|
||||||
|
|||||||
@@ -217,7 +217,7 @@
|
|||||||
{
|
{
|
||||||
<div id="Devices_Import_Completed_Dialog" class="dialog" title="Device Import Completed">
|
<div id="Devices_Import_Completed_Dialog" class="dialog" title="Device Import Completed">
|
||||||
<h3><i class="fa fa-lg fa-check"></i>Successfully imported/updated @Model.CompletedImportSessionContext.AffectedRecords device@(Model.CompletedImportSessionContext.AffectedRecords != 1 ? "s" : null).</h3>
|
<h3><i class="fa fa-lg fa-check"></i>Successfully imported/updated @Model.CompletedImportSessionContext.AffectedRecords device@(Model.CompletedImportSessionContext.AffectedRecords != 1 ? "s" : null).</h3>
|
||||||
<div>File: <code>@Model.CompletedImportSessionContext.Filename</code></div>
|
<div><code>@Model.CompletedImportSessionContext.Filename</code></div>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
$(function () {
|
$(function () {
|
||||||
|
|||||||
@@ -668,7 +668,7 @@ WriteLiteral(" device");
|
|||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral(".</h3>\r\n <div>File: <code>");
|
WriteLiteral(".</h3>\r\n <div><code>");
|
||||||
|
|
||||||
|
|
||||||
#line 220 "..\..\Views\Device\Import.cshtml"
|
#line 220 "..\..\Views\Device\Import.cshtml"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
@{
|
@{
|
||||||
Authorization.Require(Claims.Device.Actions.Import);
|
Authorization.Require(Claims.Device.Actions.Import);
|
||||||
|
|
||||||
ViewBag.Title = Html.ToBreadcrumb("Devices", MVC.Device.Index(), "Import Devices", MVC.Device.Import(), string.Format("File: {0}", Model.Context.DatasetName));
|
ViewBag.Title = Html.ToBreadcrumb("Devices", MVC.Device.Index(), "Import Devices", MVC.Device.Import(), Model.Context.DatasetName);
|
||||||
}
|
}
|
||||||
<div id="Devices_Import_Headers">
|
<div id="Devices_Import_Headers">
|
||||||
|
|
||||||
@@ -29,7 +29,8 @@
|
|||||||
{
|
{
|
||||||
<td data-headerindex="@header.Index" class="header@(header.Type.ToString())">
|
<td data-headerindex="@header.Index" class="header@(header.Type.ToString())">
|
||||||
<ul class="importHeaderType" data-headerindex="@header.Index" data-headertype="@header.Type.ToString()">
|
<ul class="importHeaderType" data-headerindex="@header.Index" data-headertype="@header.Type.ToString()">
|
||||||
<li><a href="#"><span class="headerTypeTitle">@(Model.HeaderTypes.FirstOrDefault(h => h.Item1 == header.Type).Item2)</span></a>
|
<li>
|
||||||
|
<a href="#"><span class="headerTypeTitle">@(Model.HeaderTypes.FirstOrDefault(h => h.Item1 == header.Type).Item2)</span></a>
|
||||||
<ul>
|
<ul>
|
||||||
@foreach (var headerType in Model.HeaderTypes)
|
@foreach (var headerType in Model.HeaderTypes)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ namespace Disco.Web.Views.Device
|
|||||||
|
|
||||||
Authorization.Require(Claims.Device.Actions.Import);
|
Authorization.Require(Claims.Device.Actions.Import);
|
||||||
|
|
||||||
ViewBag.Title = Html.ToBreadcrumb("Devices", MVC.Device.Index(), "Import Devices", MVC.Device.Import(), string.Format("File: {0}", Model.Context.DatasetName));
|
ViewBag.Title = Html.ToBreadcrumb("Devices", MVC.Device.Index(), "Import Devices", MVC.Device.Import(), Model.Context.DatasetName);
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
@@ -138,15 +138,15 @@ WriteLiteral(" data-headerindex=\"");
|
|||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral("\"");
|
WriteLiteral("\"");
|
||||||
|
|
||||||
WriteAttribute("class", Tuple.Create(" class=\"", 947), Tuple.Create("\"", 986)
|
WriteAttribute("class", Tuple.Create(" class=\"", 919), Tuple.Create("\"", 958)
|
||||||
, Tuple.Create(Tuple.Create("", 955), Tuple.Create("header", 955), true)
|
, Tuple.Create(Tuple.Create("", 927), Tuple.Create("header", 927), true)
|
||||||
|
|
||||||
#line 24 "..\..\Views\Device\ImportHeaders.cshtml"
|
#line 24 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||||
, Tuple.Create(Tuple.Create("", 961), Tuple.Create<System.Object, System.Int32>(header.Type.ToString()
|
, Tuple.Create(Tuple.Create("", 933), Tuple.Create<System.Object, System.Int32>(header.Type.ToString()
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 961), false)
|
, 933), false)
|
||||||
);
|
);
|
||||||
|
|
||||||
WriteLiteral(">");
|
WriteLiteral(">");
|
||||||
@@ -196,15 +196,15 @@ WriteLiteral(" data-headerindex=\"");
|
|||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral("\"");
|
WriteLiteral("\"");
|
||||||
|
|
||||||
WriteAttribute("class", Tuple.Create(" class=\"", 1226), Tuple.Create("\"", 1265)
|
WriteAttribute("class", Tuple.Create(" class=\"", 1198), Tuple.Create("\"", 1237)
|
||||||
, Tuple.Create(Tuple.Create("", 1234), Tuple.Create("header", 1234), true)
|
, Tuple.Create(Tuple.Create("", 1206), Tuple.Create("header", 1206), true)
|
||||||
|
|
||||||
#line 30 "..\..\Views\Device\ImportHeaders.cshtml"
|
#line 30 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||||
, Tuple.Create(Tuple.Create("", 1240), Tuple.Create<System.Object, System.Int32>(header.Type.ToString()
|
, Tuple.Create(Tuple.Create("", 1212), Tuple.Create<System.Object, System.Int32>(header.Type.ToString()
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 1240), false)
|
, 1212), false)
|
||||||
);
|
);
|
||||||
|
|
||||||
WriteLiteral(">\r\n <ul");
|
WriteLiteral(">\r\n <ul");
|
||||||
@@ -233,7 +233,7 @@ WriteLiteral(" data-headertype=\"");
|
|||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral("\"");
|
WriteLiteral("\"");
|
||||||
|
|
||||||
WriteLiteral(">\r\n <li><a");
|
WriteLiteral(">\r\n <li>\r\n <a");
|
||||||
|
|
||||||
WriteLiteral(" href=\"#\"");
|
WriteLiteral(" href=\"#\"");
|
||||||
|
|
||||||
@@ -244,7 +244,7 @@ WriteLiteral(" class=\"headerTypeTitle\"");
|
|||||||
WriteLiteral(">");
|
WriteLiteral(">");
|
||||||
|
|
||||||
|
|
||||||
#line 32 "..\..\Views\Device\ImportHeaders.cshtml"
|
#line 33 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||||
Write(Model.HeaderTypes.FirstOrDefault(h => h.Item1 == header.Type).Item2);
|
Write(Model.HeaderTypes.FirstOrDefault(h => h.Item1 == header.Type).Item2);
|
||||||
|
|
||||||
|
|
||||||
@@ -253,13 +253,13 @@ WriteLiteral(">");
|
|||||||
WriteLiteral("</span></a>\r\n <ul>\r\n");
|
WriteLiteral("</span></a>\r\n <ul>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 34 "..\..\Views\Device\ImportHeaders.cshtml"
|
#line 35 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 34 "..\..\Views\Device\ImportHeaders.cshtml"
|
#line 35 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||||
foreach (var headerType in Model.HeaderTypes)
|
foreach (var headerType in Model.HeaderTypes)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -271,7 +271,7 @@ WriteLiteral(" <li");
|
|||||||
WriteLiteral(" data-headertype=\"");
|
WriteLiteral(" data-headertype=\"");
|
||||||
|
|
||||||
|
|
||||||
#line 36 "..\..\Views\Device\ImportHeaders.cshtml"
|
#line 37 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||||
Write(headerType.Item1);
|
Write(headerType.Item1);
|
||||||
|
|
||||||
|
|
||||||
@@ -286,7 +286,7 @@ WriteLiteral(" href=\"#\"");
|
|||||||
WriteLiteral(">");
|
WriteLiteral(">");
|
||||||
|
|
||||||
|
|
||||||
#line 36 "..\..\Views\Device\ImportHeaders.cshtml"
|
#line 37 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||||
Write(headerType.Item2);
|
Write(headerType.Item2);
|
||||||
|
|
||||||
|
|
||||||
@@ -295,7 +295,7 @@ WriteLiteral(">");
|
|||||||
WriteLiteral("</a></li>\r\n");
|
WriteLiteral("</a></li>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 37 "..\..\Views\Device\ImportHeaders.cshtml"
|
#line 38 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -305,7 +305,7 @@ WriteLiteral(" </ul>\r\n
|
|||||||
"\n </ul>\r\n </td>\r\n");
|
"\n </ul>\r\n </td>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 42 "..\..\Views\Device\ImportHeaders.cshtml"
|
#line 43 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -314,13 +314,13 @@ WriteLiteral(" </ul>\r\n
|
|||||||
WriteLiteral(" </tr>\r\n </thead>\r\n <tbody>\r\n");
|
WriteLiteral(" </tr>\r\n </thead>\r\n <tbody>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 46 "..\..\Views\Device\ImportHeaders.cshtml"
|
#line 47 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 46 "..\..\Views\Device\ImportHeaders.cshtml"
|
#line 47 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||||
using (var dataReader = Model.Context.GetDataReader())
|
using (var dataReader = Model.Context.GetDataReader())
|
||||||
{
|
{
|
||||||
for (int r = 0; r < Math.Min(10, Model.Context.RecordCount); r++)
|
for (int r = 0; r < Math.Min(10, Model.Context.RecordCount); r++)
|
||||||
@@ -333,13 +333,13 @@ WriteLiteral(" </tr>\r\n </thead>\r\n <tbod
|
|||||||
WriteLiteral(" <tr>\r\n");
|
WriteLiteral(" <tr>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 52 "..\..\Views\Device\ImportHeaders.cshtml"
|
#line 53 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 52 "..\..\Views\Device\ImportHeaders.cshtml"
|
#line 53 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||||
for (int c = 0; c < Model.Context.ColumnCount; c++)
|
for (int c = 0; c < Model.Context.ColumnCount; c++)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -351,7 +351,7 @@ WriteLiteral(" <td");
|
|||||||
WriteLiteral(" data-headerindex=\"");
|
WriteLiteral(" data-headerindex=\"");
|
||||||
|
|
||||||
|
|
||||||
#line 54 "..\..\Views\Device\ImportHeaders.cshtml"
|
#line 55 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||||
Write(c);
|
Write(c);
|
||||||
|
|
||||||
|
|
||||||
@@ -362,7 +362,7 @@ WriteLiteral("\"");
|
|||||||
WriteLiteral(">");
|
WriteLiteral(">");
|
||||||
|
|
||||||
|
|
||||||
#line 54 "..\..\Views\Device\ImportHeaders.cshtml"
|
#line 55 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||||
Write(dataReader.GetString(c));
|
Write(dataReader.GetString(c));
|
||||||
|
|
||||||
|
|
||||||
@@ -371,7 +371,7 @@ WriteLiteral(">");
|
|||||||
WriteLiteral("</td>\r\n");
|
WriteLiteral("</td>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 55 "..\..\Views\Device\ImportHeaders.cshtml"
|
#line 56 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -380,7 +380,7 @@ WriteLiteral("</td>\r\n");
|
|||||||
WriteLiteral(" </tr>\r\n");
|
WriteLiteral(" </tr>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 57 "..\..\Views\Device\ImportHeaders.cshtml"
|
#line 58 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -394,13 +394,13 @@ WriteLiteral(" class=\"actionBar\"");
|
|||||||
WriteLiteral(">\r\n");
|
WriteLiteral(">\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 63 "..\..\Views\Device\ImportHeaders.cshtml"
|
#line 64 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 63 "..\..\Views\Device\ImportHeaders.cshtml"
|
#line 64 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||||
using (Html.BeginForm(MVC.API.Device.ImportParse(Model.Context.SessionId, null)))
|
using (Html.BeginForm(MVC.API.Device.ImportParse(Model.Context.SessionId, null)))
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -415,10 +415,10 @@ WriteLiteral(" href=\"#\"");
|
|||||||
|
|
||||||
WriteLiteral(" class=\"button\"");
|
WriteLiteral(" class=\"button\"");
|
||||||
|
|
||||||
WriteLiteral(">Parse Device Import</a> \r\n");
|
WriteLiteral(">Parse Device Import</a>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 66 "..\..\Views\Device\ImportHeaders.cshtml"
|
#line 67 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -442,13 +442,13 @@ WriteLiteral("></i>Parsing device import...</h4>\r\n</div>\r\n<script>\r\n $(
|
|||||||
" var headerTypes = {\r\n");
|
" var headerTypes = {\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 75 "..\..\Views\Device\ImportHeaders.cshtml"
|
#line 76 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 75 "..\..\Views\Device\ImportHeaders.cshtml"
|
#line 76 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||||
foreach (var h in Model.HeaderTypes)
|
foreach (var h in Model.HeaderTypes)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -460,7 +460,7 @@ WriteLiteral(" ");
|
|||||||
WriteLiteral("\'");
|
WriteLiteral("\'");
|
||||||
|
|
||||||
|
|
||||||
#line 77 "..\..\Views\Device\ImportHeaders.cshtml"
|
#line 78 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||||
Write(h.Item1);
|
Write(h.Item1);
|
||||||
|
|
||||||
|
|
||||||
@@ -469,7 +469,7 @@ WriteLiteral("\'");
|
|||||||
WriteLiteral("\': \'");
|
WriteLiteral("\': \'");
|
||||||
|
|
||||||
|
|
||||||
#line 77 "..\..\Views\Device\ImportHeaders.cshtml"
|
#line 78 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||||
Write(h.Item2);
|
Write(h.Item2);
|
||||||
|
|
||||||
|
|
||||||
@@ -480,7 +480,7 @@ WriteLiteral("\',");
|
|||||||
WriteLiteral("\r\n");
|
WriteLiteral("\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 78 "..\..\Views\Device\ImportHeaders.cshtml"
|
#line 79 "..\..\Views\Device\ImportHeaders.cshtml"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
@{
|
@{
|
||||||
Authorization.Require(Claims.Device.Actions.Import);
|
Authorization.Require(Claims.Device.Actions.Import);
|
||||||
|
|
||||||
ViewBag.Title = Html.ToBreadcrumb("Devices", MVC.Device.Index(), "Import Devices", MVC.Device.Import(), string.Format("File: {0}", Model.Context.Filename));
|
ViewBag.Title = Html.ToBreadcrumb("Devices", MVC.Device.Index(), "Import Devices", MVC.Device.Import(), Model.Context.Filename);
|
||||||
}
|
}
|
||||||
<div id="Devices_Import_Review">
|
<div id="Devices_Import_Review">
|
||||||
|
|
||||||
@@ -23,20 +23,28 @@
|
|||||||
<div id="Devices_Import_Review_Navigation">
|
<div id="Devices_Import_Review_Navigation">
|
||||||
<ul class="none">
|
<ul class="none">
|
||||||
@if (Model.StatisticErrorRecords > 0)
|
@if (Model.StatisticErrorRecords > 0)
|
||||||
{<li class="actionDetached">
|
{
|
||||||
|
<li class="actionDetached">
|
||||||
<input id="Devices_Import_Review_Navigation_Error" type="checkbox" checked /><label for="Devices_Import_Review_Navigation_Error">Show Errors (@(Model.StatisticErrorRecords))</label>
|
<input id="Devices_Import_Review_Navigation_Error" type="checkbox" checked /><label for="Devices_Import_Review_Navigation_Error">Show Errors (@(Model.StatisticErrorRecords))</label>
|
||||||
</li>}@if (Model.StatisticNewRecords > 0)
|
</li>
|
||||||
{<li class="actionAdded">
|
}@if (Model.StatisticNewRecords > 0)
|
||||||
|
{
|
||||||
|
<li class="actionAdded">
|
||||||
<input id="Devices_Import_Review_Navigation_New" type="checkbox" checked /><label for="Devices_Import_Review_Navigation_New">Show New Devices (@(Model.StatisticNewRecords))</label>
|
<input id="Devices_Import_Review_Navigation_New" type="checkbox" checked /><label for="Devices_Import_Review_Navigation_New">Show New Devices (@(Model.StatisticNewRecords))</label>
|
||||||
</li>}@if (Model.StatisticModifiedRecords > 0)
|
</li>
|
||||||
{<li class="actionModified">
|
}@if (Model.StatisticModifiedRecords > 0)
|
||||||
|
{
|
||||||
|
<li class="actionModified">
|
||||||
<input id="Devices_Import_Review_Navigation_Modified" type="checkbox" checked /><label for="Devices_Import_Review_Navigation_Modified">Show Modified Devices (@(Model.StatisticModifiedRecords))</label>
|
<input id="Devices_Import_Review_Navigation_Modified" type="checkbox" checked /><label for="Devices_Import_Review_Navigation_Modified">Show Modified Devices (@(Model.StatisticModifiedRecords))</label>
|
||||||
</li>}@if (Model.StatisticUnmodifiedRecords > 0)
|
</li>
|
||||||
{<li class="actionUnchanged">
|
}@if (Model.StatisticUnmodifiedRecords > 0)
|
||||||
|
{
|
||||||
|
<li class="actionUnchanged">
|
||||||
<input id="Devices_Import_Review_Navigation_Unchanged" type="checkbox" checked /><label for="Devices_Import_Review_Navigation_Unchanged">Show Unchanged Devices (@(Model.StatisticUnmodifiedRecords))</label>
|
<input id="Devices_Import_Review_Navigation_Unchanged" type="checkbox" checked /><label for="Devices_Import_Review_Navigation_Unchanged">Show Unchanged Devices (@(Model.StatisticUnmodifiedRecords))</label>
|
||||||
</li>}
|
</li>
|
||||||
</ul>
|
}
|
||||||
<script>
|
</ul>
|
||||||
|
<script>
|
||||||
$(function () {
|
$(function () {
|
||||||
$navigationContainer = $('#Devices_Import_Review_Navigation');
|
$navigationContainer = $('#Devices_Import_Review_Navigation');
|
||||||
$tableBody = $('#Devices_Import_Review_TableContainer').find('tbody');
|
$tableBody = $('#Devices_Import_Review_TableContainer').find('tbody');
|
||||||
@@ -56,9 +64,9 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</div>
|
</div>
|
||||||
<div id="Devices_Import_Review_TableContainer">
|
<div id="Devices_Import_Review_TableContainer">
|
||||||
<table class="tableData">
|
<table class="tableData">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -98,10 +106,10 @@
|
|||||||
{<span class="smallMessage"><None></span>}
|
{<span class="smallMessage"><None></span>}
|
||||||
else if (field.FieldType == DeviceImportFieldTypes.DeviceSerialNumber && field.FieldAction.HasValue && field.FieldAction.Value != EntityState.Added)
|
else if (field.FieldType == DeviceImportFieldTypes.DeviceSerialNumber && field.FieldAction.HasValue && field.FieldAction.Value != EntityState.Added)
|
||||||
{
|
{
|
||||||
@Html.ActionLink(friendlyValue, MVC.Device.Show((string)field.RawParsedValue), new { target="_blank" })}
|
@Html.ActionLink(friendlyValue, MVC.Device.Show((string)field.RawParsedValue), new { target = "_blank" })}
|
||||||
else if (field.FieldType == DeviceImportFieldTypes.AssignedUserId && field.FieldAction.HasValue && field.FieldAction.Value != EntityState.Unchanged)
|
else if (field.FieldType == DeviceImportFieldTypes.AssignedUserId && field.FieldAction.HasValue && field.FieldAction.Value != EntityState.Unchanged)
|
||||||
{
|
{
|
||||||
@Html.ActionLink(friendlyValue, MVC.User.Show((string)field.RawParsedValue), new { target="_blank" })}
|
@Html.ActionLink(friendlyValue, MVC.User.Show((string)field.RawParsedValue), new { target = "_blank" })}
|
||||||
else
|
else
|
||||||
{@friendlyValue}
|
{@friendlyValue}
|
||||||
</td>
|
</td>
|
||||||
@@ -110,9 +118,12 @@
|
|||||||
}
|
}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class="actionBar">
|
<div class="actionBar">
|
||||||
|
@if (Model.Context.AllowBacktracking)
|
||||||
|
{
|
||||||
<a id="Devices_Import_Review_ChangeHeaders" href="@Url.Action(MVC.Device.ImportHeaders(Model.Context.SessionId))" class="button"><i class="fa fa-caret-left"></i>Change Import Columns</a>
|
<a id="Devices_Import_Review_ChangeHeaders" href="@Url.Action(MVC.Device.ImportHeaders(Model.Context.SessionId))" class="button"><i class="fa fa-caret-left"></i>Change Import Columns</a>
|
||||||
|
}
|
||||||
@if (Model.StatisticImportRecords == 0)
|
@if (Model.StatisticImportRecords == 0)
|
||||||
{
|
{
|
||||||
<a id="Devices_Import_Review_Apply" href="#" class="button disabled" disabled><i class="fa fa-wrench"></i>Apply Device Import</a>
|
<a id="Devices_Import_Review_Apply" href="#" class="button disabled" disabled><i class="fa fa-wrench"></i>Apply Device Import</a>
|
||||||
@@ -121,7 +132,7 @@
|
|||||||
{
|
{
|
||||||
<a id="Devices_Import_Review_Apply" href="@Url.Action(MVC.API.Device.ImportApply(Model.Context.SessionId))" class="button"><i class="fa fa-wrench"></i>Apply Device Import</a>
|
<a id="Devices_Import_Review_Apply" href="@Url.Action(MVC.API.Device.ImportApply(Model.Context.SessionId))" class="button"><i class="fa fa-wrench"></i>Apply Device Import</a>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
$(function () {
|
$(function () {
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ namespace Disco.Web.Views.Device
|
|||||||
|
|
||||||
Authorization.Require(Claims.Device.Actions.Import);
|
Authorization.Require(Claims.Device.Actions.Import);
|
||||||
|
|
||||||
ViewBag.Title = Html.ToBreadcrumb("Devices", MVC.Device.Index(), "Import Devices", MVC.Device.Import(), string.Format("File: {0}", Model.Context.Filename));
|
ViewBag.Title = Html.ToBreadcrumb("Devices", MVC.Device.Index(), "Import Devices", MVC.Device.Import(), Model.Context.Filename);
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
@@ -186,9 +186,10 @@ WriteLiteral(">\r\n");
|
|||||||
if (Model.StatisticErrorRecords > 0)
|
if (Model.StatisticErrorRecords > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral("<li");
|
WriteLiteral(" <li");
|
||||||
|
|
||||||
WriteLiteral(" class=\"actionDetached\"");
|
WriteLiteral(" class=\"actionDetached\"");
|
||||||
|
|
||||||
@@ -205,28 +206,29 @@ WriteLiteral(" for=\"Devices_Import_Review_Navigation_Error\"");
|
|||||||
WriteLiteral(">Show Errors (");
|
WriteLiteral(">Show Errors (");
|
||||||
|
|
||||||
|
|
||||||
#line 27 "..\..\Views\Device\ImportReview.cshtml"
|
#line 28 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
Write(Model.StatisticErrorRecords);
|
Write(Model.StatisticErrorRecords);
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral(")</label>\r\n </li>");
|
WriteLiteral(")</label>\r\n </li>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 28 "..\..\Views\Device\ImportReview.cshtml"
|
#line 30 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
}
|
}
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 28 "..\..\Views\Device\ImportReview.cshtml"
|
#line 30 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
if (Model.StatisticNewRecords > 0)
|
if (Model.StatisticNewRecords > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral("<li");
|
WriteLiteral(" <li");
|
||||||
|
|
||||||
WriteLiteral(" class=\"actionAdded\"");
|
WriteLiteral(" class=\"actionAdded\"");
|
||||||
|
|
||||||
@@ -243,28 +245,29 @@ WriteLiteral(" for=\"Devices_Import_Review_Navigation_New\"");
|
|||||||
WriteLiteral(">Show New Devices (");
|
WriteLiteral(">Show New Devices (");
|
||||||
|
|
||||||
|
|
||||||
#line 30 "..\..\Views\Device\ImportReview.cshtml"
|
#line 33 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
Write(Model.StatisticNewRecords);
|
Write(Model.StatisticNewRecords);
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral(")</label>\r\n </li>");
|
WriteLiteral(")</label>\r\n </li>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 31 "..\..\Views\Device\ImportReview.cshtml"
|
#line 35 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
}
|
}
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 31 "..\..\Views\Device\ImportReview.cshtml"
|
#line 35 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
if (Model.StatisticModifiedRecords > 0)
|
if (Model.StatisticModifiedRecords > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral("<li");
|
WriteLiteral(" <li");
|
||||||
|
|
||||||
WriteLiteral(" class=\"actionModified\"");
|
WriteLiteral(" class=\"actionModified\"");
|
||||||
|
|
||||||
@@ -281,28 +284,29 @@ WriteLiteral(" for=\"Devices_Import_Review_Navigation_Modified\"");
|
|||||||
WriteLiteral(">Show Modified Devices (");
|
WriteLiteral(">Show Modified Devices (");
|
||||||
|
|
||||||
|
|
||||||
#line 33 "..\..\Views\Device\ImportReview.cshtml"
|
#line 38 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
Write(Model.StatisticModifiedRecords);
|
Write(Model.StatisticModifiedRecords);
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral(")</label>\r\n </li>");
|
WriteLiteral(")</label>\r\n </li>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 34 "..\..\Views\Device\ImportReview.cshtml"
|
#line 40 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
}
|
}
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 34 "..\..\Views\Device\ImportReview.cshtml"
|
#line 40 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
if (Model.StatisticUnmodifiedRecords > 0)
|
if (Model.StatisticUnmodifiedRecords > 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral("<li");
|
WriteLiteral(" <li");
|
||||||
|
|
||||||
WriteLiteral(" class=\"actionUnchanged\"");
|
WriteLiteral(" class=\"actionUnchanged\"");
|
||||||
|
|
||||||
@@ -319,23 +323,23 @@ WriteLiteral(" for=\"Devices_Import_Review_Navigation_Unchanged\"");
|
|||||||
WriteLiteral(">Show Unchanged Devices (");
|
WriteLiteral(">Show Unchanged Devices (");
|
||||||
|
|
||||||
|
|
||||||
#line 36 "..\..\Views\Device\ImportReview.cshtml"
|
#line 43 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
Write(Model.StatisticUnmodifiedRecords);
|
Write(Model.StatisticUnmodifiedRecords);
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral(")</label>\r\n </li>");
|
WriteLiteral(")</label>\r\n </li>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 37 "..\..\Views\Device\ImportReview.cshtml"
|
#line 45 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral(@" </ul>
|
WriteLiteral(@"</ul>
|
||||||
<script>
|
<script>
|
||||||
$(function () {
|
$(function () {
|
||||||
$navigationContainer = $('#Devices_Import_Review_Navigation');
|
$navigationContainer = $('#Devices_Import_Review_Navigation');
|
||||||
$tableBody = $('#Devices_Import_Review_TableContainer').find('tbody');
|
$tableBody = $('#Devices_Import_Review_TableContainer').find('tbody');
|
||||||
@@ -355,9 +359,9 @@ WriteLiteral(@" </ul>
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</div>
|
</div>
|
||||||
<div");
|
<div");
|
||||||
|
|
||||||
WriteLiteral(" id=\"Devices_Import_Review_TableContainer\"");
|
WriteLiteral(" id=\"Devices_Import_Review_TableContainer\"");
|
||||||
|
|
||||||
@@ -365,43 +369,8 @@ WriteLiteral(">\r\n <table");
|
|||||||
|
|
||||||
WriteLiteral(" class=\"tableData\"");
|
WriteLiteral(" class=\"tableData\"");
|
||||||
|
|
||||||
WriteLiteral(">\r\n <thead>\r\n <tr>\r\n <th>Action</th>" +
|
WriteLiteral(">\r\n <thead>\r\n <tr>\r\n <th>Action</th>\r\n " +
|
||||||
"\r\n <th>Row</th>\r\n");
|
" <th>Row</th>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 67 "..\..\Views\Device\ImportReview.cshtml"
|
|
||||||
|
|
||||||
|
|
||||||
#line default
|
|
||||||
#line hidden
|
|
||||||
|
|
||||||
#line 67 "..\..\Views\Device\ImportReview.cshtml"
|
|
||||||
foreach (var header in Model.Context.Columns.Where(c => c.Type != DeviceImportFieldTypes.IgnoreColumn))
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
#line default
|
|
||||||
#line hidden
|
|
||||||
WriteLiteral(" <th>");
|
|
||||||
|
|
||||||
|
|
||||||
#line 69 "..\..\Views\Device\ImportReview.cshtml"
|
|
||||||
Write(Model.HeaderTypes.FirstOrDefault(h => h.Item1 == header.Type).Item2);
|
|
||||||
|
|
||||||
|
|
||||||
#line default
|
|
||||||
#line hidden
|
|
||||||
WriteLiteral("</th>\r\n");
|
|
||||||
|
|
||||||
|
|
||||||
#line 70 "..\..\Views\Device\ImportReview.cshtml"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#line default
|
|
||||||
#line hidden
|
|
||||||
WriteLiteral(" </tr>\r\n <tr>\r\n <th> </th>\r" +
|
|
||||||
"\n <th> </th>\r\n");
|
|
||||||
|
|
||||||
|
|
||||||
#line 75 "..\..\Views\Device\ImportReview.cshtml"
|
#line 75 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
@@ -421,7 +390,7 @@ WriteLiteral(" <th>");
|
|||||||
|
|
||||||
|
|
||||||
#line 77 "..\..\Views\Device\ImportReview.cshtml"
|
#line 77 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
Write(header.Name);
|
Write(Model.HeaderTypes.FirstOrDefault(h => h.Item1 == header.Type).Item2);
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
@@ -435,16 +404,51 @@ WriteLiteral("</th>\r\n");
|
|||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral(" </tr>\r\n </thead>\r\n <tbody>\r\n");
|
WriteLiteral(" </tr>\r\n <tr>\r\n <th> </th>\r\n " +
|
||||||
|
" <th> </th>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 82 "..\..\Views\Device\ImportReview.cshtml"
|
#line 83 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 82 "..\..\Views\Device\ImportReview.cshtml"
|
#line 83 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
|
foreach (var header in Model.Context.Columns.Where(c => c.Type != DeviceImportFieldTypes.IgnoreColumn))
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
WriteLiteral(" <th>");
|
||||||
|
|
||||||
|
|
||||||
|
#line 85 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
|
Write(header.Name);
|
||||||
|
|
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
WriteLiteral("</th>\r\n");
|
||||||
|
|
||||||
|
|
||||||
|
#line 86 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
WriteLiteral(" </tr>\r\n </thead>\r\n <tbody>\r\n");
|
||||||
|
|
||||||
|
|
||||||
|
#line 90 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
|
|
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
#line 90 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
foreach (var recordEntry in Model.Context.Records.Select((r, i) => Tuple.Create(r, i)))
|
foreach (var recordEntry in Model.Context.Records.Select((r, i) => Tuple.Create(r, i)))
|
||||||
{
|
{
|
||||||
var record = recordEntry.Item1;
|
var record = recordEntry.Item1;
|
||||||
@@ -454,15 +458,15 @@ WriteLiteral(" </tr>\r\n </thead>\r\n <tbod
|
|||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral(" <tr");
|
WriteLiteral(" <tr");
|
||||||
|
|
||||||
WriteAttribute("class", Tuple.Create(" class=\"", 4401), Tuple.Create("\"", 4437)
|
WriteAttribute("class", Tuple.Create(" class=\"", 4017), Tuple.Create("\"", 4053)
|
||||||
, Tuple.Create(Tuple.Create("", 4409), Tuple.Create("action", 4409), true)
|
, Tuple.Create(Tuple.Create("", 4025), Tuple.Create("action", 4025), true)
|
||||||
|
|
||||||
#line 85 "..\..\Views\Device\ImportReview.cshtml"
|
#line 93 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
, Tuple.Create(Tuple.Create("", 4415), Tuple.Create<System.Object, System.Int32>(record.RecordAction
|
, Tuple.Create(Tuple.Create("", 4031), Tuple.Create<System.Object, System.Int32>(record.RecordAction
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 4415), false)
|
, 4031), false)
|
||||||
);
|
);
|
||||||
|
|
||||||
WriteLiteral(">\r\n <td");
|
WriteLiteral(">\r\n <td");
|
||||||
@@ -476,7 +480,7 @@ WriteLiteral(" class=\"fa fa-fw\"");
|
|||||||
WriteLiteral("></i></td>\r\n <td>");
|
WriteLiteral("></i></td>\r\n <td>");
|
||||||
|
|
||||||
|
|
||||||
#line 87 "..\..\Views\Device\ImportReview.cshtml"
|
#line 95 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
Write(recordEntry.Item2 + 1);
|
Write(recordEntry.Item2 + 1);
|
||||||
|
|
||||||
|
|
||||||
@@ -485,13 +489,13 @@ WriteLiteral("></i></td>\r\n <td>");
|
|||||||
WriteLiteral("</td>\r\n");
|
WriteLiteral("</td>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 88 "..\..\Views\Device\ImportReview.cshtml"
|
#line 96 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 88 "..\..\Views\Device\ImportReview.cshtml"
|
#line 96 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
foreach (var field in record.Fields)
|
foreach (var field in record.Fields)
|
||||||
{
|
{
|
||||||
var friendlyValue = field.FriendlyValue;
|
var friendlyValue = field.FriendlyValue;
|
||||||
@@ -501,29 +505,29 @@ WriteLiteral("</td>\r\n");
|
|||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral(" <td");
|
WriteLiteral(" <td");
|
||||||
|
|
||||||
WriteAttribute("class", Tuple.Create(" class=\"", 4765), Tuple.Create("\"", 4874)
|
WriteAttribute("class", Tuple.Create(" class=\"", 4357), Tuple.Create("\"", 4466)
|
||||||
, Tuple.Create(Tuple.Create("", 4773), Tuple.Create("header", 4773), true)
|
, Tuple.Create(Tuple.Create("", 4365), Tuple.Create("header", 4365), true)
|
||||||
|
|
||||||
#line 91 "..\..\Views\Device\ImportReview.cshtml"
|
#line 99 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
, Tuple.Create(Tuple.Create("", 4779), Tuple.Create<System.Object, System.Int32>(field.FieldType
|
, Tuple.Create(Tuple.Create("", 4371), Tuple.Create<System.Object, System.Int32>(field.FieldType
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 4779), false)
|
, 4371), false)
|
||||||
, Tuple.Create(Tuple.Create(" ", 4797), Tuple.Create("action", 4798), true)
|
, Tuple.Create(Tuple.Create(" ", 4389), Tuple.Create("action", 4390), true)
|
||||||
|
|
||||||
#line 91 "..\..\Views\Device\ImportReview.cshtml"
|
#line 99 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
, Tuple.Create(Tuple.Create("", 4804), Tuple.Create<System.Object, System.Int32>(field.FieldAction.HasValue ? field.FieldAction.ToString() : "Error"
|
, Tuple.Create(Tuple.Create("", 4396), Tuple.Create<System.Object, System.Int32>(field.FieldAction.HasValue ? field.FieldAction.ToString() : "Error"
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 4804), false)
|
, 4396), false)
|
||||||
);
|
);
|
||||||
|
|
||||||
WriteLiteral(" data-previousvalue=\"");
|
WriteLiteral(" data-previousvalue=\"");
|
||||||
|
|
||||||
|
|
||||||
#line 91 "..\..\Views\Device\ImportReview.cshtml"
|
#line 99 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
Write(field.FieldAction.HasValue && field.FieldAction.Value == System.Data.EntityState.Modified ? field.FriendlyPreviousValue : null);
|
Write(field.FieldAction.HasValue && field.FieldAction.Value == System.Data.EntityState.Modified ? field.FriendlyPreviousValue : null);
|
||||||
|
|
||||||
|
|
||||||
@@ -534,13 +538,13 @@ WriteLiteral("\"");
|
|||||||
WriteLiteral(">\r\n");
|
WriteLiteral(">\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 92 "..\..\Views\Device\ImportReview.cshtml"
|
#line 100 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 92 "..\..\Views\Device\ImportReview.cshtml"
|
#line 100 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
if (!field.FieldAction.HasValue)
|
if (!field.FieldAction.HasValue)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -554,7 +558,7 @@ WriteLiteral(" class=\"errorMessage\"");
|
|||||||
WriteLiteral("><strong>Error:</strong> ");
|
WriteLiteral("><strong>Error:</strong> ");
|
||||||
|
|
||||||
|
|
||||||
#line 94 "..\..\Views\Device\ImportReview.cshtml"
|
#line 102 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
Write(field.ErrorMessage);
|
Write(field.ErrorMessage);
|
||||||
|
|
||||||
|
|
||||||
@@ -569,7 +573,7 @@ WriteLiteral(" class=\"fa fa-exclamation-triangle fa-fw\"");
|
|||||||
WriteLiteral("></i>\r\n");
|
WriteLiteral("></i>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 96 "..\..\Views\Device\ImportReview.cshtml"
|
#line 104 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -578,7 +582,7 @@ WriteLiteral("></i>\r\n");
|
|||||||
WriteLiteral(" ");
|
WriteLiteral(" ");
|
||||||
|
|
||||||
|
|
||||||
#line 97 "..\..\Views\Device\ImportReview.cshtml"
|
#line 105 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
if (string.IsNullOrEmpty(friendlyValue))
|
if (string.IsNullOrEmpty(friendlyValue))
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -591,7 +595,7 @@ WriteLiteral(" class=\"smallMessage\"");
|
|||||||
WriteLiteral("><None></span>");
|
WriteLiteral("><None></span>");
|
||||||
|
|
||||||
|
|
||||||
#line 98 "..\..\Views\Device\ImportReview.cshtml"
|
#line 106 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
}
|
}
|
||||||
else if (field.FieldType == DeviceImportFieldTypes.DeviceSerialNumber && field.FieldAction.HasValue && field.FieldAction.Value != EntityState.Added)
|
else if (field.FieldType == DeviceImportFieldTypes.DeviceSerialNumber && field.FieldAction.HasValue && field.FieldAction.Value != EntityState.Added)
|
||||||
{
|
{
|
||||||
@@ -600,14 +604,14 @@ WriteLiteral("><None></span>");
|
|||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 101 "..\..\Views\Device\ImportReview.cshtml"
|
#line 109 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
Write(Html.ActionLink(friendlyValue, MVC.Device.Show((string)field.RawParsedValue), new { target="_blank" }));
|
Write(Html.ActionLink(friendlyValue, MVC.Device.Show((string)field.RawParsedValue), new { target = "_blank" }));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 101 "..\..\Views\Device\ImportReview.cshtml"
|
#line 109 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
}
|
}
|
||||||
else if (field.FieldType == DeviceImportFieldTypes.AssignedUserId && field.FieldAction.HasValue && field.FieldAction.Value != EntityState.Unchanged)
|
else if (field.FieldType == DeviceImportFieldTypes.AssignedUserId && field.FieldAction.HasValue && field.FieldAction.Value != EntityState.Unchanged)
|
||||||
{
|
{
|
||||||
@@ -616,14 +620,14 @@ WriteLiteral("><None></span>");
|
|||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 104 "..\..\Views\Device\ImportReview.cshtml"
|
#line 112 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
Write(Html.ActionLink(friendlyValue, MVC.User.Show((string)field.RawParsedValue), new { target="_blank" }));
|
Write(Html.ActionLink(friendlyValue, MVC.User.Show((string)field.RawParsedValue), new { target = "_blank" }));
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 104 "..\..\Views\Device\ImportReview.cshtml"
|
#line 112 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -631,14 +635,14 @@ WriteLiteral("><None></span>");
|
|||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 106 "..\..\Views\Device\ImportReview.cshtml"
|
#line 114 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
Write(friendlyValue);
|
Write(friendlyValue);
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
|
||||||
#line 106 "..\..\Views\Device\ImportReview.cshtml"
|
#line 114 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -647,7 +651,7 @@ WriteLiteral("><None></span>");
|
|||||||
WriteLiteral(" </td>\r\n");
|
WriteLiteral(" </td>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 108 "..\..\Views\Device\ImportReview.cshtml"
|
#line 116 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -656,28 +660,44 @@ WriteLiteral(" </td>\r\n");
|
|||||||
WriteLiteral(" </tr>\r\n");
|
WriteLiteral(" </tr>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 110 "..\..\Views\Device\ImportReview.cshtml"
|
#line 118 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral(" </tbody>\r\n </table>\r\n </div>\r\n <div");
|
WriteLiteral(" </tbody>\r\n </table>\r\n</div>\r\n<div");
|
||||||
|
|
||||||
WriteLiteral(" class=\"actionBar\"");
|
WriteLiteral(" class=\"actionBar\"");
|
||||||
|
|
||||||
WriteLiteral(">\r\n <a");
|
WriteLiteral(">\r\n");
|
||||||
|
|
||||||
WriteLiteral(" id=\"Devices_Import_Review_ChangeHeaders\"");
|
|
||||||
|
|
||||||
WriteAttribute("href", Tuple.Create(" href=\"", 6568), Tuple.Create("\"", 6637)
|
#line 123 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
|
|
||||||
#line 115 "..\..\Views\Device\ImportReview.cshtml"
|
|
||||||
, Tuple.Create(Tuple.Create("", 6575), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.Device.ImportHeaders(Model.Context.SessionId))
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 6575), false)
|
|
||||||
|
#line 123 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
|
if (Model.Context.AllowBacktracking)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
WriteLiteral(" <a");
|
||||||
|
|
||||||
|
WriteLiteral(" id=\"Devices_Import_Review_ChangeHeaders\"");
|
||||||
|
|
||||||
|
WriteAttribute("href", Tuple.Create(" href=\"", 6122), Tuple.Create("\"", 6191)
|
||||||
|
|
||||||
|
#line 125 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
|
, Tuple.Create(Tuple.Create("", 6129), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.Device.ImportHeaders(Model.Context.SessionId))
|
||||||
|
|
||||||
|
#line default
|
||||||
|
#line hidden
|
||||||
|
, 6129), false)
|
||||||
);
|
);
|
||||||
|
|
||||||
WriteLiteral(" class=\"button\"");
|
WriteLiteral(" class=\"button\"");
|
||||||
@@ -689,13 +709,16 @@ WriteLiteral(" class=\"fa fa-caret-left\"");
|
|||||||
WriteLiteral("></i>Change Import Columns</a>\r\n");
|
WriteLiteral("></i>Change Import Columns</a>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 116 "..\..\Views\Device\ImportReview.cshtml"
|
#line 126 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
|
WriteLiteral(" ");
|
||||||
|
|
||||||
#line 116 "..\..\Views\Device\ImportReview.cshtml"
|
|
||||||
|
#line 127 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
if (Model.StatisticImportRecords == 0)
|
if (Model.StatisticImportRecords == 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -717,7 +740,7 @@ WriteLiteral(" class=\"fa fa-wrench\"");
|
|||||||
WriteLiteral("></i>Apply Device Import</a>\r\n");
|
WriteLiteral("></i>Apply Device Import</a>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 119 "..\..\Views\Device\ImportReview.cshtml"
|
#line 130 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -729,14 +752,14 @@ WriteLiteral(" <a");
|
|||||||
|
|
||||||
WriteLiteral(" id=\"Devices_Import_Review_Apply\"");
|
WriteLiteral(" id=\"Devices_Import_Review_Apply\"");
|
||||||
|
|
||||||
WriteAttribute("href", Tuple.Create(" href=\"", 6999), Tuple.Create("\"", 7070)
|
WriteAttribute("href", Tuple.Create(" href=\"", 6532), Tuple.Create("\"", 6603)
|
||||||
|
|
||||||
#line 122 "..\..\Views\Device\ImportReview.cshtml"
|
#line 133 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
, Tuple.Create(Tuple.Create("", 7006), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Device.ImportApply(Model.Context.SessionId))
|
, Tuple.Create(Tuple.Create("", 6539), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.Device.ImportApply(Model.Context.SessionId))
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
, 7006), false)
|
, 6539), false)
|
||||||
);
|
);
|
||||||
|
|
||||||
WriteLiteral(" class=\"button\"");
|
WriteLiteral(" class=\"button\"");
|
||||||
@@ -748,39 +771,39 @@ WriteLiteral(" class=\"fa fa-wrench\"");
|
|||||||
WriteLiteral("></i>Apply Device Import</a>\r\n");
|
WriteLiteral("></i>Apply Device Import</a>\r\n");
|
||||||
|
|
||||||
|
|
||||||
#line 123 "..\..\Views\Device\ImportReview.cshtml"
|
#line 134 "..\..\Views\Device\ImportReview.cshtml"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#line default
|
#line default
|
||||||
#line hidden
|
#line hidden
|
||||||
WriteLiteral(" </div>\r\n</div>\r\n<script>\r\n $(function () {\r\n $Devices_Import_Review" +
|
WriteLiteral("</div>\r\n</div>\r\n<script>\r\n $(function () {\r\n $Devices_Import_Review_Tab" +
|
||||||
"_TableContainer = $(\'#Devices_Import_Review_TableContainer\');\r\n\r\n $Device" +
|
"leContainer = $(\'#Devices_Import_Review_TableContainer\');\r\n\r\n $Devices_Im" +
|
||||||
"s_Import_Review_TableContainer.find(\'tbody\').tooltip({\r\n items: \'td.a" +
|
"port_Review_TableContainer.find(\'tbody\').tooltip({\r\n items: \'td.actio" +
|
||||||
"ction, td.actionError, td.actionModified\',\r\n content: function () {\r\n" +
|
"n, td.actionError, td.actionModified\',\r\n content: function () {\r\n " +
|
||||||
" var $this = $(this);\r\n\r\n if ($this.hasClass(\'acti" +
|
" var $this = $(this);\r\n\r\n if ($this.hasClass(\'action\')" +
|
||||||
"on\')) {\r\n var record = $(this).closest(\'tr\');\r\n\r\n " +
|
") {\r\n var record = $(this).closest(\'tr\');\r\n\r\n " +
|
||||||
" if (record.hasClass(\'actionDetached\')) {\r\n return" +
|
" if (record.hasClass(\'actionDetached\')) {\r\n return \'<s" +
|
||||||
" \'<strong>Error Parsing Record</strong><div>Review the record fields for details" +
|
"trong>Error Parsing Record</strong><div>Review the record fields for details abo" +
|
||||||
" about any errors.</div><div class=\"smallMessage\">This record will be skipped.</" +
|
"ut any errors.</div><div class=\"smallMessage\">This record will be skipped.</div>" +
|
||||||
"div>\';\r\n } else if (record.hasClass(\'actionUnchanged\')) {\r\n " +
|
"\';\r\n } else if (record.hasClass(\'actionUnchanged\')) {\r\n " +
|
||||||
" return \'<strong>No Changes</strong><div>No changes were fo" +
|
" return \'<strong>No Changes</strong><div>No changes were found " +
|
||||||
"und while parsing this record.</div><div class=\"smallMessage\">This record will b" +
|
"while parsing this record.</div><div class=\"smallMessage\">This record will be sk" +
|
||||||
"e skipped.</div>\';\r\n } else if (record.hasClass(\'actionModifi" +
|
"ipped.</div>\';\r\n } else if (record.hasClass(\'actionModified\')" +
|
||||||
"ed\')) {\r\n return \'<strong>Pending Changes</strong><div>Th" +
|
") {\r\n return \'<strong>Pending Changes</strong><div>This r" +
|
||||||
"is record contains changes which will be applied.</div>\';\r\n }" +
|
"ecord contains changes which will be applied.</div>\';\r\n } els" +
|
||||||
" else if (record.hasClass(\'actionAdded\')) {\r\n return \'<st" +
|
"e if (record.hasClass(\'actionAdded\')) {\r\n return \'<strong" +
|
||||||
"rong>New Record</strong><div>This record will be imported.</div>\';\r\n " +
|
">New Record</strong><div>This record will be imported.</div>\';\r\n " +
|
||||||
" }\r\n } else if ($this.hasClass(\'actionError\')) {\r\n " +
|
" }\r\n } else if ($this.hasClass(\'actionError\')) {\r\n " +
|
||||||
" return $(this).find(\'span.errorMessage\').html();\r\n } " +
|
" return $(this).find(\'span.errorMessage\').html();\r\n } else" +
|
||||||
"else if ($this.hasClass(\'actionModified\')) {\r\n var v = $(this" +
|
" if ($this.hasClass(\'actionModified\')) {\r\n var v = $(this).at" +
|
||||||
").attr(\'data-previousvalue\');\r\n if (v) {\r\n " +
|
"tr(\'data-previousvalue\');\r\n if (v) {\r\n " +
|
||||||
" return \'<strong>Previous Value:</strong><br />\' + v;\r\n }" +
|
" return \'<strong>Previous Value:</strong><br />\' + v;\r\n } els" +
|
||||||
" else {\r\n return \'<strong>Previous Value:</strong><br /><" +
|
"e {\r\n return \'<strong>Previous Value:</strong><br /><em>&" +
|
||||||
"em><None></em>\';\r\n }\r\n }\r\n }," +
|
"lt;None></em>\';\r\n }\r\n }\r\n },\r\n " +
|
||||||
"\r\n position: {\r\n my: \"left top\",\r\n at: " +
|
" position: {\r\n my: \"left top\",\r\n at: \"lef" +
|
||||||
"\"left bottom\",\r\n collision: \"flipfit flip\"\r\n }\r\n " +
|
"t bottom\",\r\n collision: \"flipfit flip\"\r\n }\r\n })" +
|
||||||
" });\r\n\r\n });\r\n</script>\r\n");
|
";\r\n\r\n });\r\n</script>\r\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user