Merge branch 'device-flags'

This commit is contained in:
Gary Sharp
2024-01-14 19:13:51 +11:00
98 changed files with 11975 additions and 1253 deletions
+7
View File
@@ -175,6 +175,10 @@
<Compile Include="Migrations\202304150715559_DBv22.Designer.cs">
<DependentUpon>202304150715559_DBv22.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\202401130531317_DBv23.cs" />
<Compile Include="Migrations\202401130531317_DBv23.Designer.cs">
<DependentUpon>202401130531317_DBv23.cs</DependentUpon>
</Compile>
<Compile Include="Migrations\Configuration.cs" />
<Compile Include="Migrations\DiscoDataMigrator.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
@@ -256,6 +260,9 @@
<EmbeddedResource Include="Migrations\202304150715559_DBv22.resx">
<DependentUpon>202304150715559_DBv22.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Migrations\202401130531317_DBv23.resx">
<DependentUpon>202401130531317_DBv23.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
+27
View File
@@ -0,0 +1,27 @@
// <auto-generated />
namespace Disco.Data.Migrations
{
using System.Data.Entity.Migrations;
using System.Data.Entity.Migrations.Infrastructure;
using System.Resources;
public sealed partial class DBv23 : IMigrationMetadata
{
private readonly ResourceManager Resources = new ResourceManager(typeof(DBv23));
string IMigrationMetadata.Id
{
get { return "202401130531317_DBv23"; }
}
string IMigrationMetadata.Source
{
get { return null; }
}
string IMigrationMetadata.Target
{
get { return Resources.GetString("Target"); }
}
}
}
@@ -0,0 +1,67 @@
namespace Disco.Data.Migrations
{
using System;
using System.Data.Entity.Migrations;
public partial class DBv23 : DbMigration
{
public override void Up()
{
CreateTable(
"dbo.DeviceFlagAssignments",
c => new
{
Id = c.Int(nullable: false, identity: true),
DeviceFlagId = c.Int(nullable: false),
DeviceSerialNumber = c.String(nullable: false, maxLength: 60),
AddedDate = c.DateTime(nullable: false),
AddedUserId = c.String(nullable: false, maxLength: 50),
RemovedDate = c.DateTime(),
RemovedUserId = c.String(maxLength: 50),
Comments = c.String(),
OnAssignmentExpressionResult = c.String(),
OnUnassignmentExpressionResult = c.String(),
})
.PrimaryKey(t => t.Id)
.ForeignKey("dbo.DeviceFlags", t => t.DeviceFlagId)
.ForeignKey("dbo.Devices", t => t.DeviceSerialNumber)
.ForeignKey("dbo.Users", t => t.AddedUserId)
.ForeignKey("dbo.Users", t => t.RemovedUserId)
.Index(t => t.DeviceFlagId)
.Index(t => t.DeviceSerialNumber)
.Index(t => t.AddedUserId)
.Index(t => t.RemovedUserId);
CreateTable(
"dbo.DeviceFlags",
c => new
{
Id = c.Int(nullable: false, identity: true),
Name = c.String(nullable: false, maxLength: 100),
Description = c.String(maxLength: 500),
Icon = c.String(nullable: false, maxLength: 25),
IconColour = c.String(nullable: false, maxLength: 10),
DevicesLinkedGroup = c.String(),
DeviceUsersLinkedGroup = c.String(),
OnAssignmentExpression = c.String(),
OnUnassignmentExpression = c.String(),
})
.PrimaryKey(t => t.Id);
}
public override void Down()
{
DropIndex("dbo.DeviceFlagAssignments", new[] { "RemovedUserId" });
DropIndex("dbo.DeviceFlagAssignments", new[] { "AddedUserId" });
DropIndex("dbo.DeviceFlagAssignments", new[] { "DeviceSerialNumber" });
DropIndex("dbo.DeviceFlagAssignments", new[] { "DeviceFlagId" });
DropForeignKey("dbo.DeviceFlagAssignments", "RemovedUserId", "dbo.Users");
DropForeignKey("dbo.DeviceFlagAssignments", "AddedUserId", "dbo.Users");
DropForeignKey("dbo.DeviceFlagAssignments", "DeviceSerialNumber", "dbo.Devices");
DropForeignKey("dbo.DeviceFlagAssignments", "DeviceFlagId", "dbo.DeviceFlags");
DropTable("dbo.DeviceFlags");
DropTable("dbo.DeviceFlagAssignments");
}
}
}
File diff suppressed because one or more lines are too long
+4 -5
View File
@@ -1,9 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Disco.Models.Repository;
using System;
using System.Data.Entity;
using Disco.Models.Repository;
using System.Data.Entity.ModelConfiguration.Conventions;
namespace Disco.Data.Repository
@@ -38,6 +35,8 @@ namespace Disco.Data.Repository
public virtual DbSet<DeviceBatchAttachment> DeviceBatchAttachments { get; set; }
public virtual DbSet<DeviceComponent> DeviceComponents { get; set; }
public virtual DbSet<DeviceAttachment> DeviceAttachments { get; set; }
public virtual DbSet<DeviceFlag> DeviceFlags { get; set; }
public virtual DbSet<DeviceFlagAssignment> DeviceFlagAssignments { get; set; }
public virtual DbSet<DeviceCertificate> DeviceCertificates { get; set; }
+8
View File
@@ -52,6 +52,10 @@
<Compile Include="Exporting\ExportFieldMetadata.cs" />
<Compile Include="Exporting\ExportFormat.cs" />
<Compile Include="Exporting\IExportRecord.cs" />
<Compile Include="Repository\Device\Flag\DeviceFlag.cs" />
<Compile Include="Repository\Device\Flag\DeviceFlagAssignment.cs" />
<Compile Include="Services\Devices\DeviceFlags\DeviceFlagExportOptions.cs" />
<Compile Include="Services\Devices\DeviceFlags\DeviceFlagExportRecord.cs" />
<Compile Include="Services\Expressions\Extensions\ImageExpressionFormat.cs" />
<Compile Include="ClientServices\EnrolmentInformation\BaseBoard.cs" />
<Compile Include="ClientServices\EnrolmentInformation\Battery.cs" />
@@ -198,6 +202,10 @@
<Compile Include="UI\Config\Shared\ConfigSharedDeviceGroupDocumentTemplateBulkGenerate.cs" />
<Compile Include="UI\Config\Shared\ConfigSharedTaskStatusModel.cs" />
<Compile Include="UI\Config\Organisation\ConfigOrganisationIndexModel.cs" />
<Compile Include="UI\Config\DeviceFlag\ConfigDeviceFlagCreateModel.cs" />
<Compile Include="UI\Config\DeviceFlag\ConfigDeviceFlagExportModel.cs" />
<Compile Include="UI\Config\DeviceFlag\ConfigDeviceFlagIndexModel.cs" />
<Compile Include="UI\Config\DeviceFlag\ConfigDeviceFlagShowModel.cs" />
<Compile Include="UI\Config\UserFlag\ConfigUserFlagCreateModel.cs" />
<Compile Include="UI\Config\UserFlag\ConfigUserFlagIndexModel.cs" />
<Compile Include="UI\Config\UserFlag\ConfigUserFlagShowModel.cs" />
+1
View File
@@ -51,6 +51,7 @@ namespace Disco.Models.Repository
[InverseProperty("DeviceSerialNumber")]
public virtual IList<Job> Jobs { get; set; }
public virtual IList<DeviceFlagAssignment> DeviceFlagAssignments { get; set; }
public override string ToString()
{
@@ -0,0 +1,37 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace Disco.Models.Repository
{
public class DeviceFlag
{
[Key]
public int Id { get; set; }
[Required, StringLength(100)]
public string Name { get; set; }
[StringLength(500), DataType(DataType.MultilineText)]
public string Description { get; set; }
[Required, StringLength(25)]
public string Icon { get; set; }
[Required, StringLength(10)]
public string IconColour { get; set; }
public string DevicesLinkedGroup { get; set; }
public string DeviceUsersLinkedGroup { get; set; }
[DataType(DataType.MultilineText)]
public string OnAssignmentExpression { get; set; }
[DataType(DataType.MultilineText)]
public string OnUnassignmentExpression { get; set; }
public virtual IList<DeviceFlagAssignment> DeviceFlagAssignments { get; set; }
public override string ToString()
{
return Name;
}
}
}
@@ -0,0 +1,44 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Disco.Models.Repository
{
public class DeviceFlagAssignment
{
[Key]
public int Id { get; set; }
[Required]
public int DeviceFlagId { get; set; }
[Required]
public string DeviceSerialNumber { get; set; }
[Required]
public DateTime AddedDate { get; set; }
[Required]
public string AddedUserId { get; set; }
public DateTime? RemovedDate { get; set; }
public string RemovedUserId { get; set; }
public string Comments { get; set; }
public string OnAssignmentExpressionResult { get; set; }
public string OnUnassignmentExpressionResult { get; set; }
[ForeignKey(nameof(DeviceFlagId)), InverseProperty("DeviceFlagAssignments")]
public virtual DeviceFlag DeviceFlag { get; set; }
[ForeignKey(nameof(DeviceSerialNumber)), InverseProperty("DeviceFlagAssignments")]
public virtual Device Device { get; set; }
[ForeignKey("AddedUserId")]
public virtual User AddedUser { get; set; }
[ForeignKey("RemovedUserId")]
public virtual User RemovedUser { get; set; }
public override string ToString()
{
return $"Device Flag Id: {DeviceFlagId}; Device Serial Number: {DeviceSerialNumber}; Added: {AddedDate:s}";
}
}
}
@@ -0,0 +1,192 @@
using Disco.Models.Exporting;
using Disco.Models.Services.Exporting;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace Disco.Models.Services.Devices.DeviceFlag
{
public class DeviceFlagExportOptions : IExportOptions
{
public ExportFormat Format { get; set; }
public string FilenamePrefix { get; } = "DiscoDeviceFlagExport";
public string ExcelWorksheetName { get; } = "DeviceFlagExport";
public string ExcelTableName { get; } = "DeviceFlags";
[Required]
public List<int> DeviceFlagIds { get; set; } = new List<int>();
[Display(Name = "Current Only")]
public bool CurrentOnly { get; set; }
// Device Flag
[Display(ShortName = "Device Flag", Name = "Identifier", Description = "The identifier of the device flag")]
public bool Id { get; set; }
[Display(ShortName = "Device Flag", Name = "Name", Description = "The name of the device flag")]
public bool Name { get; set; }
[Display(ShortName = "Device Flag", Name = "Description", Description = "The description of the device flag")]
public bool Description { get; set; }
[Display(ShortName = "Device Flag", Name = "Icon", Description = "The icon assigned to the device flag")]
public bool Icon { get; set; }
[Display(ShortName = "Device Flag", Name = "Icon Colour", Description = "The icon colour assigned to the device flag")]
public bool IconColour { get; set; }
[Display(ShortName = "Device Flag", Name = "Assignment Identifier", Description = "The identifier of the device flag assignment")]
public bool AssignmentId { get; set; }
[Display(ShortName = "Device Flag", Name = "Added Date", Description = "The date the device flag was assigned to the user")]
public bool AddedDate { get; set; }
[Display(ShortName = "Device Flag", Name = "Added User Identifier", Description = "The identifier of the user who assigned the device flag")]
public bool AddedUserId { get; set; }
[Display(ShortName = "Device Flag", Name = "Removed Date", Description = "The date the device flag was unassigned from the user")]
public bool RemovedDate { get; set; }
[Display(ShortName = "Device Flag", Name = "Removed User Identifier", Description = "The identifier of the user who unassigned the device flag")]
public bool RemovedUserId { get; set; }
[Display(ShortName = "Device Flag", Name = "Comments", Description = "The comments associated with the device flag assignment")]
public bool Comments { get; set; }
// Device
[Display(ShortName = "Device", Name = "Serial Number", Description = "The device serial number")]
public bool DeviceSerialNumber { get; set; }
[Display(ShortName = "Device", Name = "Asset Number", Description = "The device asset number")]
public bool DeviceAssetNumber { get; set; }
[Display(ShortName = "Device", Name = "Location", Description = "The device location")]
public bool DeviceLocation { get; set; }
[Display(ShortName = "Device", Name = "Computer Name", Description = "The device computer name")]
public bool DeviceComputerName { get; set; }
[Display(ShortName = "Device", Name = "Last Network Logon", Description = "The last recorded time the device access the network")]
public bool DeviceLastNetworkLogon { get; set; }
[Display(ShortName = "Device", Name = "Created Date", Description = "The date the device was created in Disco ICT")]
public bool DeviceCreatedDate { get; set; }
[Display(ShortName = "Device", Name = "First Enrolled Date", Description = "The date the device was first enrolled in Disco ICT")]
public bool DeviceFirstEnrolledDate { get; set; }
[Display(ShortName = "Device", Name = "Last Enrolled Date", Description = "The date the device was last enrolled in Disco ICT")]
public bool DeviceLastEnrolledDate { get; set; }
[Display(ShortName = "Device", Name = "Enrolment Trusted", Description = "The device is trusted to complete an unauthenticated enrolment")]
public bool DeviceAllowUnauthenticatedEnrol { get; set; }
[Display(ShortName = "Device", Name = "Decommissioned Date", Description = "The date the device was decommissioned in Disco ICT")]
public bool DeviceDecommissionedDate { get; set; }
[Display(ShortName = "Device", Name = "Decommissioned Reason", Description = "The reason the device was decommissioned")]
public bool DeviceDecommissionedReason { get; set; }
public bool HasDeviceOptions()
{
return DeviceSerialNumber ||
DeviceAssetNumber ||
DeviceLocation ||
DeviceComputerName ||
DeviceLastNetworkLogon ||
DeviceCreatedDate ||
DeviceFirstEnrolledDate ||
DeviceLastEnrolledDate ||
DeviceAllowUnauthenticatedEnrol ||
DeviceDecommissionedDate ||
DeviceDecommissionedReason;
}
// Model
[Display(ShortName = "Model", Name = "Identifier", Description = "The identifier of the device model associated with the device")]
public bool ModelId { get; set; }
[Display(ShortName = "Model", Name = "Description", Description = "The description of the device model associated with the device")]
public bool ModelDescription { get; set; }
[Display(ShortName = "Model", Name = "Manufacturer", Description = "The manufacturer of the device model associated with the device")]
public bool ModelManufacturer { get; set; }
[Display(ShortName = "Model", Name = "Model", Description = "The model of the device model associated with the device")]
public bool ModelModel { get; set; }
[Display(ShortName = "Model", Name = "Type", Description = "The type of device model associated with the device")]
public bool ModelType { get; set; }
public bool HasDeviceModelOptions()
{
return ModelId ||
ModelDescription ||
ModelManufacturer ||
ModelModel ||
ModelType;
}
// Batch
[Display(ShortName = "Batch", Name = "Identifier", Description = "The identifier of the device batch associated with the device")]
public bool BatchId { get; set; }
[Display(ShortName = "Batch", Name = "Name", Description = "The name of the device batch associated with the device")]
public bool BatchName { get; set; }
[Display(ShortName = "Batch", Name = "Purchase Date", Description = "The purchase date of the device batch associated with the device")]
public bool BatchPurchaseDate { get; set; }
[Display(ShortName = "Batch", Name = "Supplier", Description = "The supplier of the device batch associated with the device")]
public bool BatchSupplier { get; set; }
[Display(ShortName = "Batch", Name = "Unit Cost", Description = "The unit cost of the device batch associated with the device")]
public bool BatchUnitCost { get; set; }
[Display(ShortName = "Batch", Name = "Warranty Valid Until Date", Description = "The warranty valid until date of the device batch associated with the device")]
public bool BatchWarrantyValidUntilDate { get; set; }
[Display(ShortName = "Batch", Name = "Insured Date", Description = "The insured date of the device batch associated with the device")]
public bool BatchInsuredDate { get; set; }
[Display(ShortName = "Batch", Name = "Insurance Supplier", Description = "The insurance supplier of the device batch associated with the device")]
public bool BatchInsuranceSupplier { get; set; }
[Display(ShortName = "Batch", Name = "Insured Until Date", Description = "The insured until date of the device batch associated with the device")]
public bool BatchInsuredUntilDate { get; set; }
public bool HasDeviceBatchOptions()
{
return BatchId ||
BatchName ||
BatchPurchaseDate ||
BatchSupplier ||
BatchUnitCost ||
BatchWarrantyValidUntilDate ||
BatchInsuredDate ||
BatchInsuranceSupplier ||
BatchInsuredUntilDate;
}
// Profile
[Display(ShortName = "Profile", Name = "Identifier", Description = "The identifier of the device profile associated with the device")]
public bool ProfileId { get; set; }
[Display(ShortName = "Profile", Name = "Name", Description = "The name of the device profile associated with the device")]
public bool ProfileName { get; set; }
[Display(ShortName = "Profile", Name = "Short Name", Description = "The short name of the device profile associated with the device")]
public bool ProfileShortName { get; set; }
public bool HasDeviceProfileOptions()
{
return ProfileId ||
ProfileName ||
ProfileShortName;
}
// Assigned User
[Display(ShortName = "Assigned User", Name = "Identifier", Description = "The identifier of the user assigned to the device flag")]
public bool AssignedUserId { get; set; }
[Display(ShortName = "Assigned User", Name = "Display Name", Description = "The display name of the user assigned to the device flag")]
public bool AssignedUserDisplayName { get; set; }
[Display(ShortName = "Assigned User", Name = "Surname", Description = "The surname of the user assigned to the device flag")]
public bool AssignedUserSurname { get; set; }
[Display(ShortName = "Assigned User", Name = "Given Name", Description = "The given name of the user assigned to the device flag")]
public bool AssignedUserGivenName { get; set; }
[Display(ShortName = "Assigned User", Name = "Phone Number", Description = "The phone number of the user assigned to the device flag")]
public bool AssignedUserPhoneNumber { get; set; }
[Display(ShortName = "Assigned User", Name = "Email Address", Description = "The email address of the user assigned to the device flag")]
public bool AssignedUserEmailAddress { get; set; }
[Display(ShortName = "Assigned User", Name = "Custom Details", Description = "The custom details provided by plugins for the user assigned to the device flag")]
public bool AssignedUserDetailCustom { get; set; }
public bool HasAssignedUserOptions()
{
return AssignedUserId ||
AssignedUserDisplayName ||
AssignedUserSurname ||
AssignedUserGivenName ||
AssignedUserPhoneNumber ||
AssignedUserEmailAddress;
}
public static DeviceFlagExportOptions DefaultOptions()
{
return new DeviceFlagExportOptions()
{
Format = ExportFormat.Xlsx,
CurrentOnly = true,
Name = true,
AddedDate = true,
DeviceSerialNumber = true,
ModelDescription = true,
ProfileName = true,
AssignedUserId = true,
AssignedUserDisplayName = true,
Comments = true,
};
}
}
}
@@ -0,0 +1,12 @@
using Disco.Models.Exporting;
using Disco.Models.Repository;
using System.Collections.Generic;
namespace Disco.Models.Services.Devices.DeviceFlag
{
public class DeviceFlagExportRecord : IExportRecord
{
public DeviceFlagAssignment Assignment { get; set; }
public Dictionary<string, string> AssignedUserCustomDetails { get; set; }
}
}
@@ -1,4 +1,5 @@
using System;
using Disco.Models.Repository;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -44,6 +45,7 @@ namespace Disco.Models.Services.Searching
public string DeviceBatchName { get; set; }
public int JobCount { get; set; }
public DateTime? DecommissionedDate { get; set; }
public IList<DeviceFlagAssignment> DeviceFlagAssignments { get; set; }
private string[] BuildScoreValues()
{
@@ -1,5 +1,4 @@
using Disco.Models.Exporting;
using Disco.Models.Services.Devices.Exporting;
using Disco.Models.Services.Exporting;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
@@ -16,7 +15,7 @@ namespace Disco.Models.Services.Users.UserFlags
[Required]
public List<int> UserFlagIds { get; set; } = new List<int>();
[DisplayAttribute(Name = "Current Only")]
[Display(Name = "Current Only")]
public bool CurrentOnly { get; set; }
// User Flag
@@ -0,0 +1,7 @@
namespace Disco.Models.UI.Config.DeviceFlag
{
public interface ConfigDeviceFlagCreateModel : BaseUIModel
{
Repository.DeviceFlag DeviceFlag { get; set; }
}
}
@@ -0,0 +1,17 @@
using Disco.Models.Services.Devices.DeviceFlag;
using Disco.Models.Services.Exporting;
using Disco.Models.UI;
using System.Collections.Generic;
namespace Disco.Models.Areas.Config.UI.DeviceFlag
{
public interface ConfigDeviceFlagExportModel : BaseUIModel
{
DeviceFlagExportOptions Options { get; set; }
string ExportSessionId { get; set; }
ExportResult ExportSessionResult { get; set; }
List<Repository.DeviceFlag> DeviceFlags { get; set; }
}
}
@@ -0,0 +1,9 @@
using System.Collections.Generic;
namespace Disco.Models.UI.Config.DeviceFlag
{
public interface ConfigDeviceFlagIndexModel : BaseUIModel
{
Dictionary<Repository.DeviceFlag, int> DeviceFlags { get; set; }
}
}
@@ -0,0 +1,15 @@
using System.Collections.Generic;
namespace Disco.Models.UI.Config.DeviceFlag
{
public interface ConfigDeviceFlagShowModel : BaseUIModel
{
Repository.DeviceFlag DeviceFlag { get; set; }
int CurrentAssignmentCount { get; set; }
int TotalAssignmentCount { get; set; }
IEnumerable<KeyValuePair<string, string>> Icons { get; set; }
IEnumerable<KeyValuePair<string, string>> ThemeColours { get; set; }
}
}
@@ -1,4 +1,5 @@
using Disco.Models.BI.Config;
using Disco.Models.Repository;
using Disco.Models.Services.Documents;
using Disco.Models.Services.Jobs.JobLists;
using System.Collections.Generic;
@@ -22,6 +23,9 @@ namespace Disco.Models.UI.Device
List<Repository.DocumentTemplate> DocumentTemplates { get; set; }
List<DocumentTemplatePackage> DocumentTemplatePackages { get; set; }
List<DeviceFlag> AvailableDeviceFlags { get; set; }
Dictionary<string, string> AssignedUserDetails { get; set; }
bool HasAssignedUserPhoto { get; set; }
}
+82 -4
View File
@@ -1,7 +1,4 @@

// <auto-generated />
// <auto-generated />
// This file was generated by a T4 template.
// Don't change it directly as your change would get overwritten. Instead, make changes
// to the .tt file (i.e. the T4 template) and save it to regenerate this file.
@@ -34,6 +31,11 @@ namespace Disco.Services.Authorization
{ "Config.DeviceBatch.Delete", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.DeviceBatch.Delete, (c, v) => c.Config.DeviceBatch.Delete = v, "Delete Device Batches", "Can delete device batches", false) },
{ "Config.DeviceBatch.Show", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.DeviceBatch.Show, (c, v) => c.Config.DeviceBatch.Show = v, "Show Device Batches", "Can show device batches", false) },
{ "Config.DeviceBatch.ShowTimeline", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.DeviceBatch.ShowTimeline, (c, v) => c.Config.DeviceBatch.ShowTimeline = v, "Show Timeline", "Can show device batch timeline", false) },
{ "Config.DeviceFlag.Configure", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.DeviceFlag.Configure, (c, v) => c.Config.DeviceFlag.Configure = v, "Configure Device Flags", "Can configure device flags", false) },
{ "Config.DeviceFlag.Create", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.DeviceFlag.Create, (c, v) => c.Config.DeviceFlag.Create = v, "Create Device Flags", "Can create device flags", false) },
{ "Config.DeviceFlag.Delete", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.DeviceFlag.Delete, (c, v) => c.Config.DeviceFlag.Delete = v, "Delete Device Flags", "Can delete device flags", false) },
{ "Config.DeviceFlag.Export", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.DeviceFlag.Export, (c, v) => c.Config.DeviceFlag.Export = v, "Export Device Flag Assignments", "Can export user device assignments", false) },
{ "Config.DeviceFlag.Show", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.DeviceFlag.Show, (c, v) => c.Config.DeviceFlag.Show = v, "Show Device Flags", "Can show device flags", false) },
{ "Config.DeviceModel.ConfigureComponents", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.DeviceModel.ConfigureComponents, (c, v) => c.Config.DeviceModel.ConfigureComponents = v, "Configure Device Model Components", "Can configure device model components", false) },
{ "Config.DeviceModel.Configure", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.DeviceModel.Configure, (c, v) => c.Config.DeviceModel.Configure = v, "Configure Device Models", "Can configure device models", false) },
{ "Config.DeviceModel.Delete", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Config.DeviceModel.Delete, (c, v) => c.Config.DeviceModel.Delete = v, "Delete Device Models", "Can delete device models", false) },
@@ -186,22 +188,26 @@ namespace Disco.Services.Authorization
{ "Device.Properties.DeviceProfile", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Properties.DeviceProfile, (c, v) => c.Device.Properties.DeviceProfile = v, "Device Profile Property", "Can update property", false) },
{ "Device.Properties.Location", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Properties.Location, (c, v) => c.Device.Properties.Location = v, "Location Property", "Can update property", false) },
{ "Device.Actions.AddAttachments", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Actions.AddAttachments, (c, v) => c.Device.Actions.AddAttachments = v, "Add Attachments", "Can add attachments to devices", false) },
{ "Device.Actions.AddFlags", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Actions.AddFlags, (c, v) => c.Device.Actions.AddFlags = v, "Add Device Flags", "Can add device flags", false) },
{ "Device.Actions.AllowUnauthenticatedEnrol", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Actions.AllowUnauthenticatedEnrol, (c, v) => c.Device.Actions.AllowUnauthenticatedEnrol = v, "Allow Unauthenticated Enrol", "Can allow devices to enrol without authentication", false) },
{ "Device.Actions.AssignUser", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Actions.AssignUser, (c, v) => c.Device.Actions.AssignUser = v, "Assign User", "Can update the user assignment of devices", false) },
{ "Device.Actions.Decommission", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Actions.Decommission, (c, v) => c.Device.Actions.Decommission = v, "Decommission", "Can decommission devices", false) },
{ "Device.Actions.Delete", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Actions.Delete, (c, v) => c.Device.Actions.Delete = v, "Delete", "Can delete devices", false) },
{ "Device.Actions.EditFlags", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Actions.EditFlags, (c, v) => c.Device.Actions.EditFlags = v, "Edit Device Flags", "Can edit device flags", false) },
{ "Device.Actions.EnrolDevices", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Actions.EnrolDevices, (c, v) => c.Device.Actions.EnrolDevices = v, "Enrol Devices", "Can add devices offline and enrol devices with the Bootstrapper", false) },
{ "Device.Actions.Export", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Actions.Export, (c, v) => c.Device.Actions.Export = v, "Export Devices", "Can export devices in a bulk format", false) },
{ "Device.Actions.GenerateDocuments", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Actions.GenerateDocuments, (c, v) => c.Device.Actions.GenerateDocuments = v, "Generate Documents", "Can generate documents for jobs", false) },
{ "Device.Actions.Import", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Actions.Import, (c, v) => c.Device.Actions.Import = v, "Import Devices", "Can bulk import devices", false) },
{ "Device.Actions.Recommission", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Actions.Recommission, (c, v) => c.Device.Actions.Recommission = v, "Recommission", "Can recommission devices", false) },
{ "Device.Actions.RemoveAnyAttachments", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Actions.RemoveAnyAttachments, (c, v) => c.Device.Actions.RemoveAnyAttachments = v, "Remove Any Attachments", "Can remove any attachments from devices", false) },
{ "Device.Actions.RemoveFlags", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Actions.RemoveFlags, (c, v) => c.Device.Actions.RemoveFlags = v, "Remove Device Flags", "Can remove device flags", false) },
{ "Device.Actions.RemoveOwnAttachments", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Actions.RemoveOwnAttachments, (c, v) => c.Device.Actions.RemoveOwnAttachments = v, "Remove Own Attachments", "Can remove own attachments from devices", false) },
{ "Device.Search", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Search, (c, v) => c.Device.Search = v, "Search Devices", "Can search devices", false) },
{ "Device.ShowAssignmentHistory", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.ShowAssignmentHistory, (c, v) => c.Device.ShowAssignmentHistory = v, "Show Assignment History", "Can show the assignment history for devices", false) },
{ "Device.ShowAttachments", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.ShowAttachments, (c, v) => c.Device.ShowAttachments = v, "Show Attachments", "Can show device attachments", false) },
{ "Device.ShowCertificates", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.ShowCertificates, (c, v) => c.Device.ShowCertificates = v, "Show Certificates", "Can show certificates associated with devices", false) },
{ "Device.ShowDetails", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.ShowDetails, (c, v) => c.Device.ShowDetails = v, "Show Details", "Can show details associated with devices", false) },
{ "Device.ShowFlagAssignments", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.ShowFlagAssignments, (c, v) => c.Device.ShowFlagAssignments = v, "Show Device Flag Assignments", "Can show flags associated with devices", false) },
{ "Device.Show", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.Show, (c, v) => c.Device.Show = v, "Show Devices", "Can show devices", false) },
{ "Device.ShowJobs", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.Device.ShowJobs, (c, v) => c.Device.ShowJobs = v, "Show Devices Jobs", "Can show jobs associated with devices", false) },
{ "User.Actions.AddAttachments", new Tuple<Func<RoleClaims, bool>, Action<RoleClaims, bool>, string, string, bool>(c => c.User.Actions.AddAttachments, (c, v) => c.User.Actions.AddAttachments = v, "Add Attachments", "Can add attachments to users", false) },
@@ -239,6 +245,13 @@ namespace Disco.Services.Authorization
new ClaimNavigatorItem("Config.DeviceCertificate", "Device Certificates", "Permissions related to Device Certificates", false, new List<IClaimNavigatorItem>() {
new ClaimNavigatorItem("Config.DeviceCertificate.DownloadCertificates", false)
}),
new ClaimNavigatorItem("Config.DeviceFlag", "Device Flags", "Permissions related to Device Flags", false, new List<IClaimNavigatorItem>() {
new ClaimNavigatorItem("Config.DeviceFlag.Configure", false),
new ClaimNavigatorItem("Config.DeviceFlag.Create", false),
new ClaimNavigatorItem("Config.DeviceFlag.Delete", false),
new ClaimNavigatorItem("Config.DeviceFlag.Export", false),
new ClaimNavigatorItem("Config.DeviceFlag.Show", false)
}),
new ClaimNavigatorItem("Config.DeviceModel", "Device Models", "Permissions related to Device Models", false, new List<IClaimNavigatorItem>() {
new ClaimNavigatorItem("Config.DeviceModel.ConfigureComponents", false),
new ClaimNavigatorItem("Config.DeviceModel.Configure", false),
@@ -431,16 +444,19 @@ namespace Disco.Services.Authorization
new ClaimNavigatorItem("Device", "Device", "Permissions related to Devices", false, new List<IClaimNavigatorItem>() {
new ClaimNavigatorItem("Device.Actions", "Actions", "Permissions related to Device Actions", false, new List<IClaimNavigatorItem>() {
new ClaimNavigatorItem("Device.Actions.AddAttachments", false),
new ClaimNavigatorItem("Device.Actions.AddFlags", false),
new ClaimNavigatorItem("Device.Actions.AllowUnauthenticatedEnrol", false),
new ClaimNavigatorItem("Device.Actions.AssignUser", false),
new ClaimNavigatorItem("Device.Actions.Decommission", false),
new ClaimNavigatorItem("Device.Actions.Delete", false),
new ClaimNavigatorItem("Device.Actions.EditFlags", false),
new ClaimNavigatorItem("Device.Actions.EnrolDevices", false),
new ClaimNavigatorItem("Device.Actions.Export", false),
new ClaimNavigatorItem("Device.Actions.GenerateDocuments", false),
new ClaimNavigatorItem("Device.Actions.Import", false),
new ClaimNavigatorItem("Device.Actions.Recommission", false),
new ClaimNavigatorItem("Device.Actions.RemoveAnyAttachments", false),
new ClaimNavigatorItem("Device.Actions.RemoveFlags", false),
new ClaimNavigatorItem("Device.Actions.RemoveOwnAttachments", false)
}),
new ClaimNavigatorItem("Device.Properties", "Device Properties", "Permissions related to Device Properties", false, new List<IClaimNavigatorItem>() {
@@ -455,6 +471,7 @@ namespace Disco.Services.Authorization
new ClaimNavigatorItem("Device.ShowAttachments", false),
new ClaimNavigatorItem("Device.ShowCertificates", false),
new ClaimNavigatorItem("Device.ShowDetails", false),
new ClaimNavigatorItem("Device.ShowFlagAssignments", false),
new ClaimNavigatorItem("Device.Show", false),
new ClaimNavigatorItem("Device.ShowJobs", false)
}),
@@ -552,6 +569,11 @@ namespace Disco.Services.Authorization
c.Config.DeviceBatch.Delete = true;
c.Config.DeviceBatch.Show = true;
c.Config.DeviceBatch.ShowTimeline = true;
c.Config.DeviceFlag.Configure = true;
c.Config.DeviceFlag.Create = true;
c.Config.DeviceFlag.Delete = true;
c.Config.DeviceFlag.Export = true;
c.Config.DeviceFlag.Show = true;
c.Config.DeviceModel.ConfigureComponents = true;
c.Config.DeviceModel.Configure = true;
c.Config.DeviceModel.Delete = true;
@@ -704,22 +726,26 @@ namespace Disco.Services.Authorization
c.Device.Properties.DeviceProfile = true;
c.Device.Properties.Location = true;
c.Device.Actions.AddAttachments = true;
c.Device.Actions.AddFlags = true;
c.Device.Actions.AllowUnauthenticatedEnrol = true;
c.Device.Actions.AssignUser = true;
c.Device.Actions.Decommission = true;
c.Device.Actions.Delete = true;
c.Device.Actions.EditFlags = true;
c.Device.Actions.EnrolDevices = true;
c.Device.Actions.Export = true;
c.Device.Actions.GenerateDocuments = true;
c.Device.Actions.Import = true;
c.Device.Actions.Recommission = true;
c.Device.Actions.RemoveAnyAttachments = true;
c.Device.Actions.RemoveFlags = true;
c.Device.Actions.RemoveOwnAttachments = true;
c.Device.Search = true;
c.Device.ShowAssignmentHistory = true;
c.Device.ShowAttachments = true;
c.Device.ShowCertificates = true;
c.Device.ShowDetails = true;
c.Device.ShowFlagAssignments = true;
c.Device.Show = true;
c.Device.ShowJobs = true;
c.User.Actions.AddAttachments = true;
@@ -828,6 +854,38 @@ namespace Disco.Services.Authorization
public const string ShowTimeline = "Config.DeviceBatch.ShowTimeline";
}
/// <summary>Device Flags
/// <para>Permissions related to Device Flags</para>
/// </summary>
public static class DeviceFlag
{
/// <summary>Configure Device Flags
/// <para>Can configure device flags</para>
/// </summary>
public const string Configure = "Config.DeviceFlag.Configure";
/// <summary>Create Device Flags
/// <para>Can create device flags</para>
/// </summary>
public const string Create = "Config.DeviceFlag.Create";
/// <summary>Delete Device Flags
/// <para>Can delete device flags</para>
/// </summary>
public const string Delete = "Config.DeviceFlag.Delete";
/// <summary>Export Device Flag Assignments
/// <para>Can export user device assignments</para>
/// </summary>
public const string Export = "Config.DeviceFlag.Export";
/// <summary>Show Device Flags
/// <para>Can show device flags</para>
/// </summary>
public const string Show = "Config.DeviceFlag.Show";
}
/// <summary>Device Models
/// <para>Permissions related to Device Models</para>
/// </summary>
@@ -1734,6 +1792,11 @@ namespace Disco.Services.Authorization
/// </summary>
public const string AddAttachments = "Device.Actions.AddAttachments";
/// <summary>Add Device Flags
/// <para>Can add device flags</para>
/// </summary>
public const string AddFlags = "Device.Actions.AddFlags";
/// <summary>Allow Unauthenticated Enrol
/// <para>Can allow devices to enrol without authentication</para>
/// </summary>
@@ -1754,6 +1817,11 @@ namespace Disco.Services.Authorization
/// </summary>
public const string Delete = "Device.Actions.Delete";
/// <summary>Edit Device Flags
/// <para>Can edit device flags</para>
/// </summary>
public const string EditFlags = "Device.Actions.EditFlags";
/// <summary>Enrol Devices
/// <para>Can add devices offline and enrol devices with the Bootstrapper</para>
/// </summary>
@@ -1784,6 +1852,11 @@ namespace Disco.Services.Authorization
/// </summary>
public const string RemoveAnyAttachments = "Device.Actions.RemoveAnyAttachments";
/// <summary>Remove Device Flags
/// <para>Can remove device flags</para>
/// </summary>
public const string RemoveFlags = "Device.Actions.RemoveFlags";
/// <summary>Remove Own Attachments
/// <para>Can remove own attachments from devices</para>
/// </summary>
@@ -1815,6 +1888,11 @@ namespace Disco.Services.Authorization
/// </summary>
public const string ShowDetails = "Device.ShowDetails";
/// <summary>Show Device Flag Assignments
/// <para>Can show flags associated with devices</para>
/// </summary>
public const string ShowFlagAssignments = "Device.ShowFlagAssignments";
/// <summary>Show Devices
/// <para>Can show devices</para>
/// </summary>
-3
View File
@@ -20,9 +20,6 @@
<#@ import namespace="System.Runtime.InteropServices.CustomMarshalers" #>
<#@ import namespace="System.Runtime.InteropServices" #>
<#@ import namespace="System.Reflection" #>
<#
// Get the DTE service from the host
EnvDTE.DTE Dte = null;
@@ -22,6 +22,7 @@ namespace Disco.Services.Authorization.Roles.ClaimGroups.Configuration
DeviceCertificate = new DeviceCertificateClaims();
Enrolment = new EnrolmentClaims();
DeviceBatch = new DeviceBatchClaims();
DeviceFlag = new DeviceFlagClaims();
DeviceModel = new DeviceModelClaims();
DeviceProfile = new DeviceProfileClaims();
DocumentTemplate = new DocumentTemplateClaims();
@@ -43,6 +44,8 @@ namespace Disco.Services.Authorization.Roles.ClaimGroups.Configuration
public DeviceBatchClaims DeviceBatch { get; set; }
public DeviceFlagClaims DeviceFlag { get; set; }
public DeviceModelClaims DeviceModel { get; set; }
public DeviceProfileClaims DeviceProfile { get; set; }
@@ -0,0 +1,20 @@
namespace Disco.Services.Authorization.Roles.ClaimGroups.Configuration.UserFlag
{
[ClaimDetails("Device Flags", "Permissions related to Device Flags")]
public class DeviceFlagClaims : BaseRoleClaimGroup
{
[ClaimDetails("Configure Device Flags", "Can configure device flags")]
public bool Configure { get; set; }
[ClaimDetails("Create Device Flags", "Can create device flags")]
public bool Create { get; set; }
[ClaimDetails("Delete Device Flags", "Can delete device flags")]
public bool Delete { get; set; }
[ClaimDetails("Export Device Flag Assignments", "Can export user device assignments")]
public bool Export { get; set; }
[ClaimDetails("Show Device Flags", "Can show device flags")]
public bool Show { get; set; }
}
}
@@ -25,6 +25,12 @@
[ClaimDetails("Generate Documents", "Can generate documents for jobs")]
public bool GenerateDocuments { get; set; }
[ClaimDetails("Add Device Flags", "Can add device flags")]
public bool AddFlags { get; set; }
[ClaimDetails("Remove Device Flags", "Can remove device flags")]
public bool RemoveFlags { get; set; }
[ClaimDetails("Edit Device Flags", "Can edit device flags")]
public bool EditFlags { get; set; }
[ClaimDetails("Enrol Devices", "Can add devices offline and enrol devices with the Bootstrapper")]
public bool EnrolDevices { get; set; }
@@ -25,7 +25,8 @@
public bool ShowJobs { get; set; }
[ClaimDetails("Show Assignment History", "Can show the assignment history for devices")]
public bool ShowAssignmentHistory { get; set; }
[ClaimDetails("Show Device Flag Assignments", "Can show flags associated with devices")]
public bool ShowFlagAssignments { get; set; }
public DevicePropertiesClaims Properties { get; set; }
@@ -0,0 +1,61 @@
using Disco.Data.Repository;
using Disco.Models.Repository;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
namespace Disco.Services.Devices.DeviceFlags
{
internal class Cache
{
private ConcurrentDictionary<int, DeviceFlag> _Cache;
public Cache(DiscoDataContext Database)
{
Initialize(Database);
}
public void ReInitialize(DiscoDataContext Database)
{
Initialize(Database);
}
private void Initialize(DiscoDataContext Database)
{
// Queues from Database
var flags = Database.DeviceFlags.ToList();
// Add Queues to In-Memory Cache
_Cache = new ConcurrentDictionary<int, DeviceFlag>(flags.Select(f => new KeyValuePair<int, DeviceFlag>(f.Id, f)));
}
public DeviceFlag GetDeviceFlag(int deviceFlagId)
{
if (_Cache.TryGetValue(deviceFlagId, out var item))
return item;
else
return null;
}
public List<DeviceFlag> GetDeviceFlags()
{
return _Cache.Values.ToList();
}
public void AddOrUpdate(DeviceFlag flag)
{
_Cache.AddOrUpdate(flag.Id, flag, (key, existingItem) => flag);
}
public DeviceFlag Remove(int deviceFlagId)
{
if (_Cache.TryRemove(deviceFlagId, out var item))
return item;
else
return null;
}
public DeviceFlag Remove(DeviceFlag deviceFlag)
{
return Remove(deviceFlag.Id);
}
}
}
@@ -0,0 +1,184 @@
using Disco.Data.Repository;
using Disco.Data.Repository.Monitor;
using Disco.Models.Repository;
using Disco.Models.Services.Interop.ActiveDirectory;
using Disco.Services.Interop.ActiveDirectory;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Linq;
namespace Disco.Services.Devices.DeviceFlags
{
public class DeviceFlagDeviceAssignedUsersManagedGroup : ADManagedGroup
{
private const string KeyFormat = "DeviceFlag_{0}_DeviceAssignedUsers";
private const string DescriptionFormat = "User associated with devices which have the {0} Flag will be added to this Active Directory group.";
private const string CategoryDescriptionFormat = "Device Assigned Users Linked Group";
private const string GroupDescriptionFormat = "{0} [Device Flag Device Assigned Users]";
private IDisposable repositorySubscription;
private int deviceFlagId;
private string deviceFlagName;
public override string Description { get { return string.Format(DescriptionFormat, deviceFlagName); } }
public override string CategoryDescription { get { return CategoryDescriptionFormat; } }
public override string GroupDescription { get { return string.Format(GroupDescriptionFormat, deviceFlagName); } }
public override bool IncludeFilterBeginDate { get { return true; } }
private DeviceFlagDeviceAssignedUsersManagedGroup(string Key, ADManagedGroupConfiguration Configuration, DeviceFlag deviceFlag)
: base(Key, Configuration)
{
deviceFlagId = deviceFlag.Id;
deviceFlagName = deviceFlag.Name;
}
public override void Initialize()
{
// Subscribe to changes
repositorySubscription = DeviceFlagService.DeviceFlagAssignmentRepositoryEvents.Value
.Where(e =>
(((DeviceFlagAssignment)e.Entity).DeviceFlagId == deviceFlagId))
.Subscribe(ProcessRepositoryEvent);
}
public static string GetKey(DeviceFlag deviceFlag)
{
return string.Format(KeyFormat, deviceFlag.Id);
}
public static string GetDescription(DeviceFlag deviceFlag)
{
return string.Format(DescriptionFormat, deviceFlag.Name);
}
public static string GetCategoryDescription(DeviceFlag deviceFlag)
{
return CategoryDescriptionFormat;
}
public static bool TryGetManagedGroup(DeviceFlag deviceFlag, out DeviceFlagDeviceAssignedUsersManagedGroup managedGroup)
{
return ActiveDirectory.Context.ManagedGroups.TryGetValue(GetKey(deviceFlag), out managedGroup);
}
public static DeviceFlagDeviceAssignedUsersManagedGroup Initialize(DeviceFlag deviceFlag)
{
if (deviceFlag.Id > 0)
{
var key = GetKey(deviceFlag);
if (!string.IsNullOrEmpty(deviceFlag.DeviceUsersLinkedGroup))
{
var config = ConfigurationFromJson(deviceFlag.DeviceUsersLinkedGroup);
if (config != null && !string.IsNullOrWhiteSpace(config.GroupId))
{
var group = new DeviceFlagDeviceAssignedUsersManagedGroup(
key,
config,
deviceFlag);
// Add to AD Context
ActiveDirectory.Context.ManagedGroups.AddOrUpdate(group);
return group;
}
}
// Remove from AD Context
ActiveDirectory.Context.ManagedGroups.Remove(key);
}
return null;
}
public override IEnumerable<string> DetermineMembers(DiscoDataContext Database)
{
var query = (IQueryable<User>)Database.Users;
if (Configuration.FilterBeginDate.HasValue)
{
query = query
.Where(u => u.DeviceUserAssignments.Any(a =>
a.UnassignedDate == null &&
a.Device.DeviceFlagAssignments.Any(fa =>
fa.DeviceFlagId == deviceFlagId &&
!fa.RemovedDate.HasValue &&
fa.AddedDate >= Configuration.FilterBeginDate)));
}
else
{
query = query
.Where(u => u.DeviceUserAssignments.Any(a =>
a.UnassignedDate == null &&
a.Device.DeviceFlagAssignments.Any(fa =>
fa.DeviceFlagId == deviceFlagId &&
!fa.RemovedDate.HasValue)));
}
return query.Select(u => u.UserId)
.Distinct()
.ToList()
.Where(ActiveDirectory.IsValidDomainAccountId)
.ToList();
}
private void ProcessRepositoryEvent(RepositoryMonitorEvent Event)
{
var assignment = (DeviceFlagAssignment)Event.Entity;
string userId = assignment.Device?.AssignedUserId;
if (!ActiveDirectory.IsValidDomainAccountId(userId))
return;
switch (Event.EventType)
{
case RepositoryMonitorEventType.Added:
if (Configuration.FilterBeginDate.HasValue)
{
if (!assignment.RemovedDate.HasValue && assignment.AddedDate >= Configuration.FilterBeginDate)
{
AddMember(userId);
}
}
else
{
if (!assignment.RemovedDate.HasValue)
{
AddMember(userId);
}
}
break;
case RepositoryMonitorEventType.Modified:
if (!Configuration.FilterBeginDate.HasValue || assignment.AddedDate >= Configuration.FilterBeginDate)
{
if (assignment.RemovedDate.HasValue)
RemoveMember(userId, (database) =>
{
if (database.Users.Any(u => u.DeviceUserAssignments.Any(a =>
a.UnassignedDate == null &&
a.Device.DeviceFlagAssignments.Any(fa =>
fa.DeviceFlagId == deviceFlagId &&
!fa.RemovedDate.HasValue))))
{
return null;
}
else
{
return new[] { userId };
}
}
);
else
AddMember(userId);
}
break;
}
}
public override void Dispose()
{
if (repositorySubscription != null)
repositorySubscription.Dispose();
}
}
}
@@ -0,0 +1,202 @@
using Disco.Data.Repository;
using Disco.Data.Repository.Monitor;
using Disco.Models.Repository;
using Disco.Models.Services.Interop.ActiveDirectory;
using Disco.Services.Interop.ActiveDirectory;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Linq;
namespace Disco.Services.Devices.DeviceFlags
{
public class DeviceFlagDevicesManagedGroup : ADManagedGroup
{
private const string KeyFormat = "DeviceFlag_{0}_Devices";
private const string DescriptionFormat = "Devices associated with the {0} Flag will be added to this Active Directory group.";
private const string CategoryDescriptionFormat = "Assigned Devices Linked Group";
private const string GroupDescriptionFormat = "{0} [Device Flag Devices]";
private IDisposable repositorySubscription;
private int deviceFlagId;
private string deviceFlagName;
public override string Description { get { return string.Format(DescriptionFormat, deviceFlagName); } }
public override string CategoryDescription { get { return CategoryDescriptionFormat; } }
public override string GroupDescription { get { return string.Format(GroupDescriptionFormat, deviceFlagName); } }
public override bool IncludeFilterBeginDate { get { return true; } }
private DeviceFlagDevicesManagedGroup(string Key, ADManagedGroupConfiguration Configuration, DeviceFlag DeviceFlag)
: base(Key, Configuration)
{
deviceFlagId = DeviceFlag.Id;
deviceFlagName = DeviceFlag.Name;
}
public override void Initialize()
{
// Subscribe to changes
repositorySubscription = DeviceFlagService.DeviceFlagAssignmentRepositoryEvents.Value
.Where(e =>
((DeviceFlagAssignment)e.Entity).DeviceFlagId == deviceFlagId)
.Subscribe(ProcessRepositoryEvent);
}
public static string GetKey(DeviceFlag deviceFlag)
{
return string.Format(KeyFormat, deviceFlag.Id);
}
public static string GetDescription(DeviceFlag deviceFlag)
{
return string.Format(DescriptionFormat, deviceFlag.Name);
}
public static string GetCategoryDescription(DeviceFlag deviceFlag)
{
return CategoryDescriptionFormat;
}
public static bool TryGetManagedGroup(DeviceFlag deviceFlag, out DeviceFlagDevicesManagedGroup managedGroup)
{
return ActiveDirectory.Context.ManagedGroups.TryGetValue(GetKey(deviceFlag), out managedGroup);
}
public static DeviceFlagDevicesManagedGroup Initialize(DeviceFlag deviceFlag)
{
if (deviceFlag.Id > 0)
{
var key = GetKey(deviceFlag);
if (!string.IsNullOrEmpty(deviceFlag.DevicesLinkedGroup))
{
var config = ConfigurationFromJson(deviceFlag.DevicesLinkedGroup);
if (config != null && !string.IsNullOrWhiteSpace(config.GroupId))
{
var group = new DeviceFlagDevicesManagedGroup(
key,
config,
deviceFlag);
// Add to AD Context
ActiveDirectory.Context.ManagedGroups.AddOrUpdate(group);
return group;
}
}
// Remove from AD Context
ActiveDirectory.Context.ManagedGroups.Remove(key);
}
return null;
}
public override IEnumerable<string> DetermineMembers(DiscoDataContext Database)
{
var query = Database.DeviceFlagAssignments
.Where(a => a.DeviceFlagId == deviceFlagId && !a.RemovedDate.HasValue && a.Device.DeviceDomainId != null);
if (Configuration.FilterBeginDate.HasValue)
query = query.Where(a => a.AddedDate >= Configuration.FilterBeginDate);
return query
.Select(a => a.Device.DeviceDomainId)
.ToList()
.Where(ActiveDirectory.IsValidDomainAccountId)
.Select(id => id + "$");
}
private void ProcessRepositoryEvent(RepositoryMonitorEvent Event)
{
var assignment = (DeviceFlagAssignment)Event.Entity;
var domainId = assignment.Device?.DeviceDomainId;
if (!ActiveDirectory.IsValidDomainAccountId(domainId))
return;
domainId += "$";
switch (Event.EventType)
{
case RepositoryMonitorEventType.Added:
if (Configuration.FilterBeginDate.HasValue)
{
if (!assignment.RemovedDate.HasValue && assignment.AddedDate >= Configuration.FilterBeginDate)
{
AddMember(domainId);
}
}
else
{
if (!assignment.RemovedDate.HasValue)
{
AddMember(domainId);
}
}
break;
case RepositoryMonitorEventType.Modified:
if (Configuration.FilterBeginDate.HasValue)
{
if (assignment.AddedDate >= Configuration.FilterBeginDate)
{
if (assignment.RemovedDate.HasValue)
{
RemoveMember(domainId);
}
else
{
AddMember(domainId);
}
}
}
else
{
if (assignment.RemovedDate.HasValue)
{
RemoveMember(domainId);
}
else
{
AddMember(domainId);
}
}
break;
case RepositoryMonitorEventType.Deleted:
// Remove the device if no other (non-removed) assignments exist.
var serialNumber = assignment.DeviceSerialNumber;
RemoveMember(domainId, (database) =>
{
if (Configuration.FilterBeginDate.HasValue)
{
if (database.DeviceFlagAssignments.Any(a => a.DeviceFlagId == deviceFlagId && a.DeviceSerialNumber == serialNumber && !a.RemovedDate.HasValue && a.AddedDate >= Configuration.FilterBeginDate))
{
return null;
}
else
{
return new string[] { domainId };
}
}
else
{
if (database.DeviceFlagAssignments.Any(a => a.DeviceFlagId == deviceFlagId && a.DeviceSerialNumber == serialNumber && !a.RemovedDate.HasValue))
{
return null;
}
else
{
return new string[] { domainId };
}
}
});
break;
}
}
public override void Dispose()
{
if (repositorySubscription != null)
repositorySubscription.Dispose();
}
}
}
@@ -0,0 +1,229 @@
using Disco.Data.Repository;
using Disco.Models.Exporting;
using Disco.Models.Services.Devices.DeviceFlag;
using Disco.Models.Services.Exporting;
using Disco.Services.Plugins.Features.DetailsProvider;
using Disco.Services.Tasks;
using Disco.Services.Users;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Data.Entity;
using System.Linq;
namespace Disco.Services.Devices.DeviceFlags
{
using Metadata = ExportFieldMetadata<DeviceFlagExportRecord>;
public class DeviceFlagExport
{
private readonly DiscoDataContext database;
private readonly DeviceFlagExportOptions options;
public DeviceFlagExport(DiscoDataContext database, DeviceFlagExportOptions options)
{
this.database = database;
this.options = options;
}
public ExportResult Generate(IScheduledTaskStatus status)
{
var records = BuildRecords(status);
var metadata = BuildMetadata(records, status);
if (metadata.Count == 0)
throw new ArgumentException("At least one export field must be specified", nameof(options));
status.UpdateStatus(90, $"Formatting {records.Count} records for export");
return ExportHelpers.WriteExport(options, status, metadata, records);
}
private List<DeviceFlagExportRecord> BuildRecords(IScheduledTaskStatus status)
{
var query = database.DeviceFlagAssignments
.Include(a => a.DeviceFlag);
if (options.HasDeviceOptions())
query = query.Include(a => a.Device);
if (options.HasDeviceModelOptions())
query = query.Include(a => a.Device.DeviceModel);
if (options.HasDeviceBatchOptions())
query = query.Include(a => a.Device.DeviceBatch);
if (options.HasDeviceProfileOptions())
query = query.Include(a => a.Device.DeviceProfile);
if (options.HasAssignedUserOptions())
query = query.Include(a => a.Device.AssignedUser);
if (options.AssignedUserDetailCustom)
query = query.Include(a => a.Device.AssignedUser.UserDetails);
query = query.Where(a => options.DeviceFlagIds.Contains(a.DeviceFlagId));
if (options.CurrentOnly)
{
query = query.Where(a => !a.RemovedDate.HasValue);
}
// Update Users
if (options.HasAssignedUserOptions())
{
status.UpdateStatus(5, "Refreshing user details from Active Directory");
var userIds = query.Where(d => d.Device.AssignedUserId != null).Select(d => d.Device.AssignedUserId).Distinct().ToList();
foreach (var userId in userIds)
{
try
{
UserService.GetUser(userId, database);
}
catch (Exception) { } // Ignore Errors
}
}
status.UpdateStatus(15, "Extracting records from the database");
var records = query.Select(a => new DeviceFlagExportRecord()
{
Assignment = a
}).ToList();
if (options.AssignedUserDetailCustom)
{
status.UpdateStatus(50, "Extracting custom user detail records");
var detailsService = new DetailsProviderService(database);
var cache = new Dictionary<string, Dictionary<string, string>>(StringComparer.Ordinal);
foreach (var record in records)
{
var userId = record.Assignment.Device.AssignedUserId;
if (userId == null)
continue;
if (!cache.TryGetValue(userId, out var details))
details = detailsService.GetDetails(record.Assignment.Device.AssignedUser);
record.AssignedUserCustomDetails = details;
}
}
return records;
}
private List<Metadata> BuildMetadata(List<DeviceFlagExportRecord> records, IScheduledTaskStatus status)
{
status.UpdateStatus(80, "Building metadata");
IEnumerable<string> userDetailCustomKeys = null;
if (options.AssignedUserDetailCustom)
userDetailCustomKeys = records.Where(r => r.AssignedUserCustomDetails != null).SelectMany(r => r.AssignedUserCustomDetails.Keys).Distinct(StringComparer.OrdinalIgnoreCase).ToList();
var accessors = BuildAccessors(userDetailCustomKeys);
return typeof(DeviceFlagExportOptions).GetProperties()
.Where(p => p.PropertyType == typeof(bool))
.Select(p => new
{
property = p,
details = (DisplayAttribute)p.GetCustomAttributes(typeof(DisplayAttribute), false).FirstOrDefault()
})
.Where(p => p.details != null && p.property.Name != nameof(options.CurrentOnly) && (bool)p.property.GetValue(options))
.SelectMany(p =>
{
var fieldMetadata = accessors[p.property.Name];
fieldMetadata.ForEach(f =>
{
if (f.ColumnName == null)
f.ColumnName = (p.details.ShortName == "Device Flag") ? p.details.Name : $"{p.details.ShortName} {p.details.Name}";
});
return fieldMetadata;
}).ToList();
}
private static Dictionary<string, List<Metadata>> BuildAccessors(IEnumerable<string> userDetailsCustomKeys)
{
const string DateFormat = "yyyy-MM-dd";
const string DateTimeFormat = DateFormat + " HH:mm:ss";
Func<object, string> csvStringEncoded = (o) => o == null ? null : $"\"{((string)o).Replace("\"", "\"\"")}\"";
Func<object, string> csvToStringEncoded = (o) => o == null ? null : o.ToString();
Func<object, string> csvCurrencyEncoded = (o) => ((decimal?)o).HasValue ? ((decimal?)o).Value.ToString("C") : null;
Func<object, string> csvDateEncoded = (o) => ((DateTime)o).ToString(DateFormat);
Func<object, string> csvDateTimeEncoded = (o) => ((DateTime)o).ToString(DateTimeFormat);
Func<object, string> csvNullableDateEncoded = (o) => ((DateTime?)o).HasValue ? csvDateEncoded(o) : null;
Func<object, string> csvNullableDateTimeEncoded = (o) => ((DateTime?)o).HasValue ? csvDateTimeEncoded(o) : null;
var metadata = new Dictionary<string, List<Metadata>>();
// Device Flag
metadata.Add(nameof(DeviceFlagExportOptions.Id), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.Id), typeof(string), r => r.Assignment.DeviceFlagId, csvToStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.Name), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.Name), typeof(string), r => r.Assignment.DeviceFlag.Name, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.Description), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.Description), typeof(string), r => r.Assignment.DeviceFlag.Description, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.Icon), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.Icon), typeof(string), r => r.Assignment.DeviceFlag.Icon, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.IconColour), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.IconColour), typeof(string), r => r.Assignment.DeviceFlag.IconColour, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.AssignmentId), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.AssignmentId), typeof(string), r => r.Assignment.Id, csvToStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.AddedDate), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.AddedDate), typeof(string), r => r.Assignment.AddedDate, csvDateTimeEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.AddedUserId), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.AddedUserId), typeof(string), r => r.Assignment.AddedUserId, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.RemovedUserId), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.RemovedUserId), typeof(string), r => r.Assignment.RemovedUserId, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.RemovedDate), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.RemovedDate), typeof(string), r => r.Assignment.RemovedDate, csvNullableDateTimeEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.Comments), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.Comments), typeof(string), r => r.Assignment.Comments, csvStringEncoded) });
// Device
metadata.Add(nameof(DeviceFlagExportOptions.DeviceSerialNumber), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.DeviceSerialNumber), typeof(string), r => r.Assignment.Device.SerialNumber, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.DeviceAssetNumber), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.DeviceAssetNumber), typeof(string), r => r.Assignment.Device.AssetNumber, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.DeviceLocation), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.DeviceLocation), typeof(string), r => r.Assignment.Device.Location, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.DeviceComputerName), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.DeviceComputerName), typeof(string), r => r.Assignment.Device.DeviceDomainId, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.DeviceLastNetworkLogon), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.DeviceLastNetworkLogon), typeof(DateTime), r => r.Assignment.Device.LastNetworkLogonDate, csvNullableDateTimeEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.DeviceCreatedDate), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.DeviceCreatedDate), typeof(DateTime), r => r.Assignment.Device.CreatedDate, csvDateTimeEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.DeviceFirstEnrolledDate), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.DeviceFirstEnrolledDate), typeof(DateTime), r => r.Assignment.Device.EnrolledDate, csvNullableDateTimeEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.DeviceLastEnrolledDate), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.DeviceLastEnrolledDate), typeof(DateTime), r => r.Assignment.Device.LastEnrolDate, csvNullableDateTimeEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.DeviceAllowUnauthenticatedEnrol), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.DeviceAllowUnauthenticatedEnrol), typeof(bool), r => r.Assignment.Device.AllowUnauthenticatedEnrol, csvToStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.DeviceDecommissionedDate), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.DeviceDecommissionedDate), typeof(DateTime), r => r.Assignment.Device.DecommissionedDate, csvNullableDateTimeEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.DeviceDecommissionedReason), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.DeviceDecommissionedReason), typeof(string), r => r.Assignment.Device.DecommissionReason, csvToStringEncoded) });
// Model
metadata.Add(nameof(DeviceFlagExportOptions.ModelId), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.ModelId), typeof(int), r => r.Assignment.Device.DeviceModel.Id, csvToStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.ModelDescription), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.ModelDescription), typeof(string), r => r.Assignment.Device.DeviceModel.Description, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.ModelManufacturer), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.ModelManufacturer), typeof(string), r => r.Assignment.Device.DeviceModel.Manufacturer, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.ModelModel), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.ModelModel), typeof(string), r => r.Assignment.Device.DeviceModel.Model, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.ModelType), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.ModelType), typeof(string), r => r.Assignment.Device.DeviceModel.ModelType, csvStringEncoded) });
// Batch
metadata.Add(nameof(DeviceFlagExportOptions.BatchId), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.BatchId), typeof(int), r => r.Assignment.Device.DeviceBatch?.Id, csvToStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.BatchName), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.BatchName), typeof(string), r => r.Assignment.Device.DeviceBatch?.Name, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.BatchPurchaseDate), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.BatchPurchaseDate), typeof(DateTime), r => r.Assignment.Device.DeviceBatch?.PurchaseDate, csvNullableDateEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.BatchSupplier), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.BatchSupplier), typeof(string), r => r.Assignment.Device.DeviceBatch?.Supplier, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.BatchUnitCost), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.BatchUnitCost), typeof(decimal), r => r.Assignment.Device.DeviceBatch?.UnitCost, csvCurrencyEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.BatchWarrantyValidUntilDate), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.BatchWarrantyValidUntilDate), typeof(DateTime), r => r.Assignment.Device.DeviceBatch?.WarrantyValidUntil, csvNullableDateEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.BatchInsuredDate), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.BatchInsuredDate), typeof(DateTime), r => r.Assignment.Device.DeviceBatch?.InsuredDate, csvNullableDateEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.BatchInsuranceSupplier), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.BatchInsuranceSupplier), typeof(string), r => r.Assignment.Device.DeviceBatch?.InsuranceSupplier, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.BatchInsuredUntilDate), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.BatchInsuredUntilDate), typeof(DateTime), r => r.Assignment.Device.DeviceBatch?.InsuredUntil, csvNullableDateEncoded) });
// Profile
metadata.Add(nameof(DeviceFlagExportOptions.ProfileId), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.ProfileId), typeof(int), r => r.Assignment.Device.DeviceProfile?.Id, csvToStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.ProfileName), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.ProfileName), typeof(string), r => r.Assignment.Device.DeviceProfile?.Name, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.ProfileShortName), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.ProfileShortName), typeof(string), r => r.Assignment.Device.DeviceProfile?.ShortName, csvStringEncoded) });
// User
metadata.Add(nameof(DeviceFlagExportOptions.AssignedUserId), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.AssignedUserId), typeof(string), r => r.Assignment.Device?.AssignedUser?.UserId, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.AssignedUserDisplayName), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.AssignedUserDisplayName), typeof(string), r => r.Assignment.Device?.AssignedUser?.DisplayName, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.AssignedUserSurname), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.AssignedUserSurname), typeof(string), r => r.Assignment.Device?.AssignedUser?.Surname, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.AssignedUserGivenName), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.AssignedUserGivenName), typeof(string), r => r.Assignment.Device?.AssignedUser?.GivenName, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.AssignedUserPhoneNumber), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.AssignedUserPhoneNumber), typeof(string), r => r.Assignment.Device?.AssignedUser?.PhoneNumber, csvStringEncoded) });
metadata.Add(nameof(DeviceFlagExportOptions.AssignedUserEmailAddress), new List<Metadata>() { new Metadata(nameof(DeviceFlagExportOptions.AssignedUserEmailAddress), typeof(string), r => r.Assignment.Device?.AssignedUser?.EmailAddress, csvStringEncoded) });
if (userDetailsCustomKeys != null)
{
var userDetailCustomFields = new List<Metadata>();
foreach (var detailKey in userDetailsCustomKeys.OrderBy(k => k, StringComparer.OrdinalIgnoreCase))
{
var key = detailKey;
userDetailCustomFields.Add(new Metadata(detailKey, detailKey, typeof(string), r => r.AssignedUserCustomDetails != null && r.AssignedUserCustomDetails.TryGetValue(key, out var value) ? value : null, csvStringEncoded));
}
metadata.Add(nameof(DeviceFlagExportOptions.AssignedUserDetailCustom), userDetailCustomFields);
}
return metadata;
}
}
}
@@ -0,0 +1,46 @@
using Disco.Data.Repository;
using Disco.Models.Services.Devices.DeviceFlag;
using Disco.Services.Exporting;
using Disco.Services.Tasks;
using Quartz;
namespace Disco.Services.Devices.DeviceFlags
{
public class DeviceFlagExportTask : ScheduledTask
{
private const string JobDataMapContext = "Context";
public override string TaskName { get; } = "Export Device Flags";
public override bool SingleInstanceTask { get { return false; } }
public override bool CancelInitiallySupported { get { return false; } }
public static ExportTaskContext<DeviceFlagExportOptions> ScheduleNow(DeviceFlagExportOptions options)
{
// Build Context
var context = new ExportTaskContext<DeviceFlagExportOptions>(options);
// Build Data Map
var task = new DeviceFlagExportTask();
JobDataMap taskData = new JobDataMap() { { JobDataMapContext, context } };
// Schedule Task
context.TaskStatus = task.ScheduleTask(taskData);
return context;
}
protected override void ExecuteTask()
{
var context = (ExportTaskContext<DeviceFlagExportOptions>)ExecutionContext.JobDetail.JobDataMap[JobDataMapContext];
Status.UpdateStatus(10, "Exporting Device Flag Records", "Starting...");
using (DiscoDataContext Database = new DiscoDataContext())
{
var export = new DeviceFlagExport(Database, context.Options);
context.Result = export.Generate(Status);
}
}
}
}
@@ -0,0 +1,196 @@
using Disco.Data.Repository;
using Disco.Models.Repository;
using Disco.Services.Authorization;
using Disco.Services.Expressions;
using Disco.Services.Logging;
using Disco.Services.Users;
using System;
using System.Collections;
using System.Data.Entity;
using System.Linq;
namespace Disco.Services
{
public static class DeviceFlagExtensions
{
#region Edit Comments
public static bool CanEditComments(this DeviceFlagAssignment fa)
{
return UserService.CurrentAuthorization.Has(Claims.Device.Actions.EditFlags);
}
public static void OnEditComments(this DeviceFlagAssignment fa, string Comments)
{
if (!fa.CanEditComments())
throw new InvalidOperationException("Editing comments for device flags is denied");
fa.Comments = string.IsNullOrWhiteSpace(Comments) ? null : Comments.Trim();
}
#endregion
#region Remove
public static bool CanRemove(this DeviceFlagAssignment fa)
{
if (fa.RemovedDate.HasValue)
return false;
return UserService.CurrentAuthorization.Has(Claims.Device.Actions.RemoveFlags);
}
public static void OnRemove(this DeviceFlagAssignment fa, DiscoDataContext Database, User RemovingUser)
{
if (!fa.CanRemove())
throw new InvalidOperationException("Removing device flags is denied");
fa.OnRemoveUnsafe(Database, RemovingUser);
}
public static void OnRemoveUnsafe(this DeviceFlagAssignment fa, DiscoDataContext Database, User RemovingUser)
{
fa = Database.DeviceFlagAssignments
.Include(a => a.DeviceFlag)
.First(a => a.Id == fa.Id);
RemovingUser = Database.Users.First(u => u.UserId == RemovingUser.UserId);
fa.RemovedDate = DateTime.Now;
fa.RemovedUserId = RemovingUser.UserId;
if (!string.IsNullOrWhiteSpace(fa.DeviceFlag.OnUnassignmentExpression))
{
try
{
Database.SaveChanges();
var expressionResult = fa.EvaluateOnUnassignmentExpression(Database, RemovingUser, fa.AddedDate);
if (!string.IsNullOrWhiteSpace(expressionResult))
{
fa.OnUnassignmentExpressionResult = expressionResult;
Database.SaveChanges();
}
}
catch (Exception ex)
{
SystemLog.LogException("Device Flag Expression - OnUnassignmentExpression", ex);
}
}
}
#endregion
#region Add
public static bool CanAddDeviceFlags(this Device d)
{
return UserService.CurrentAuthorization.Has(Claims.Device.Actions.AddFlags);
}
public static bool CanAddDeviceFlag(this Device d, DeviceFlag flag)
{
// Shortcut
if (!d.CanAddDeviceFlags())
return false;
// Already has Device Flag?
if (d.DeviceFlagAssignments.Any(fa => !fa.RemovedDate.HasValue && fa.DeviceFlagId == flag.Id))
return false;
return true;
}
public static DeviceFlagAssignment OnAddDeviceFlag(this Device d, DiscoDataContext Database, DeviceFlag flag, User AddingUser, string Comments)
{
if (!d.CanAddDeviceFlag(flag))
throw new InvalidOperationException("Adding device flag is denied");
return d.OnAddDeviceFlagUnsafe(Database, flag, AddingUser, Comments);
}
public static DeviceFlagAssignment OnAddDeviceFlagUnsafe(this Device d, DiscoDataContext Database, DeviceFlag flag, User AddingUser, string Comments)
{
flag = Database.DeviceFlags.First(f => f.Id == flag.Id);
d = Database.Devices.First(de => de.SerialNumber == d.SerialNumber);
AddingUser = Database.Users.First(user => user.UserId == AddingUser.UserId);
var fa = new DeviceFlagAssignment()
{
DeviceFlag = flag,
Device = d,
AddedDate = DateTime.Now,
AddedUser = AddingUser,
AddedUserId = AddingUser.UserId,
Comments = string.IsNullOrWhiteSpace(Comments) ? null : Comments.Trim()
};
Database.DeviceFlagAssignments.Add(fa);
if (!string.IsNullOrWhiteSpace(flag.OnAssignmentExpression))
{
try
{
Database.SaveChanges();
var expressionResult = fa.EvaluateOnAssignmentExpression(Database, AddingUser, fa.AddedDate);
if (!string.IsNullOrWhiteSpace(expressionResult))
{
fa.OnAssignmentExpressionResult = expressionResult;
Database.SaveChanges();
}
}
catch (Exception ex)
{
SystemLog.LogException("Device Flag Expression - OnAssignmentExpression", ex);
}
}
return fa;
}
#endregion
#region Expressions
public static Expression OnAssignmentExpressionFromCache(this DeviceFlag uf)
{
return ExpressionCache.GetOrCreateSingleExpressions($"DeviceFlag_OnAssignmentExpression_{uf.Id}", () => Expression.TokenizeSingleDynamic(null, uf.OnAssignmentExpression, 0));
}
public static void OnAssignmentExpressionInvalidateCache(this DeviceFlag uf)
{
ExpressionCache.InvalidateSingleCache($"DeviceFlag_OnAssignmentExpression_{uf.Id}");
}
public static string EvaluateOnAssignmentExpression(this DeviceFlagAssignment dfa, DiscoDataContext Database, User AddingUser, DateTime TimeStamp)
{
if (!string.IsNullOrEmpty(dfa.DeviceFlag.OnAssignmentExpression))
{
Expression compiledExpression = dfa.DeviceFlag.OnAssignmentExpressionFromCache();
IDictionary evaluatorVariables = Expression.StandardVariables(null, Database, AddingUser, TimeStamp, null, dfa.Device);
object result = compiledExpression.EvaluateFirst<object>(dfa, evaluatorVariables);
if (result == null)
return null;
else
return result.ToString();
}
return null;
}
public static Expression OnUnassignmentExpressionFromCache(this DeviceFlag df)
{
return ExpressionCache.GetOrCreateSingleExpressions($"DeviceFlag_OnUnassignmentExpression_{df.Id}", () => Expression.TokenizeSingleDynamic(null, df.OnUnassignmentExpression, 0));
}
public static void OnUnassignmentExpressionInvalidateCache(this DeviceFlag df)
{
ExpressionCache.InvalidateSingleCache($"DeviceFlag_OnUnassignmentExpression_{df.Id}");
}
public static string EvaluateOnUnassignmentExpression(this DeviceFlagAssignment dfa, DiscoDataContext Database, User RemovingUser, DateTime TimeStamp)
{
if (!string.IsNullOrEmpty(dfa.DeviceFlag.OnUnassignmentExpression))
{
Expression compiledExpression = dfa.DeviceFlag.OnUnassignmentExpressionFromCache();
IDictionary evaluatorVariables = Expression.StandardVariables(null, Database, RemovingUser, TimeStamp, null, dfa.Device);
object result = compiledExpression.EvaluateFirst<object>(dfa, evaluatorVariables);
if (result == null)
return null;
else
return result.ToString();
}
return null;
}
#endregion
}
}
@@ -0,0 +1,241 @@
using Disco.Data.Repository;
using Disco.Data.Repository.Monitor;
using Disco.Models.Repository;
using Disco.Services.Extensions;
using Disco.Services.Tasks;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Reactive.Linq;
namespace Disco.Services.Devices.DeviceFlags
{
public static class DeviceFlagService
{
private static Cache _cache;
internal static Lazy<IObservable<RepositoryMonitorEvent>> DeviceFlagAssignmentRepositoryEvents;
static DeviceFlagService()
{
// Statically defined (lazy) Assignment Repository Definition
DeviceFlagAssignmentRepositoryEvents =
new Lazy<IObservable<RepositoryMonitorEvent>>(() =>
RepositoryMonitor.StreamAfterCommit.Where(e =>
e.EntityType == typeof(DeviceFlagAssignment) &&
(e.EventType != RepositoryMonitorEventType.Modified ||
e.ModifiedProperties.Contains(nameof(DeviceFlagAssignment.RemovedDate)))
)
);
}
public static void Initialize(DiscoDataContext database)
{
_cache = new Cache(database);
// Initialize Managed Groups (if configured)
_cache.GetDeviceFlags().ForEach(uf =>
{
DeviceFlagDevicesManagedGroup.Initialize(uf);
DeviceFlagDeviceAssignedUsersManagedGroup.Initialize(uf);
});
}
public static List<DeviceFlag> GetDeviceFlags() { return _cache.GetDeviceFlags(); }
public static DeviceFlag GetDeviceFlag(int deviceFlagId) { return _cache.GetDeviceFlag(deviceFlagId); }
#region Device Flag Maintenance
public static DeviceFlag CreateDeviceFlag(DiscoDataContext database, DeviceFlag deviceFlag)
{
// Verify
if (string.IsNullOrWhiteSpace(deviceFlag.Name))
throw new ArgumentException("The Device Flag Name is required", nameof(deviceFlag));
// Name Unique
if (_cache.GetDeviceFlags().Any(f => f.Name == deviceFlag.Name))
throw new ArgumentException("Another Device Flag already exists with that name", nameof(deviceFlag));
// Clone to break reference
var flag = new DeviceFlag()
{
Name = deviceFlag.Name,
Description = deviceFlag.Description,
Icon = deviceFlag.Icon,
IconColour = deviceFlag.IconColour,
DevicesLinkedGroup = deviceFlag.DevicesLinkedGroup,
DeviceUsersLinkedGroup = deviceFlag.DeviceUsersLinkedGroup,
};
database.DeviceFlags.Add(flag);
database.SaveChanges();
_cache.AddOrUpdate(flag);
return flag;
}
public static DeviceFlag Update(DiscoDataContext database, DeviceFlag deviceFlag)
{
// Verify
if (string.IsNullOrWhiteSpace(deviceFlag.Name))
throw new ArgumentException("The Device Flag Name is required", nameof(deviceFlag));
// Name Unique
if (_cache.GetDeviceFlags().Any(f => f.Id != deviceFlag.Id && f.Name == deviceFlag.Name))
throw new ArgumentException("Another Device Flag already exists with that name", nameof(deviceFlag));
database.SaveChanges();
_cache.AddOrUpdate(deviceFlag);
DeviceFlagDevicesManagedGroup.Initialize(deviceFlag);
DeviceFlagDeviceAssignedUsersManagedGroup.Initialize(deviceFlag);
return deviceFlag;
}
public static void DeleteDeviceFlag(DiscoDataContext database, int deviceFlagId, IScheduledTaskStatus status)
{
var flag = database.DeviceFlags.Find(deviceFlagId);
// Dispose of AD Managed Groups
Interop.ActiveDirectory.ActiveDirectory.Context.ManagedGroups.Remove(DeviceFlagDeviceAssignedUsersManagedGroup.GetKey(flag));
Interop.ActiveDirectory.ActiveDirectory.Context.ManagedGroups.Remove(DeviceFlagDevicesManagedGroup.GetKey(flag));
// Delete Assignments
status.UpdateStatus(0, $"Removing '{flag.Name}' [{flag.Id}] Device Flag", "Starting");
var flagAssignments = database.DeviceFlagAssignments.Where(fa => fa.DeviceFlagId == flag.Id).ToList();
if (flagAssignments.Count > 0)
{
status.UpdateStatus(20, "Removing flag from devices");
flagAssignments.ForEach(flagAssignment => database.DeviceFlagAssignments.Remove(flagAssignment));
database.SaveChanges();
}
// Delete Flag
status.UpdateStatus(90, "Deleting Device Flag");
database.DeviceFlags.Remove(flag);
database.SaveChanges();
// Remove from Cache
_cache.Remove(deviceFlagId);
status.Finished($"Successfully Deleted Device Flag: '{flag.Name}' [{flag.Id}]");
}
#endregion
#region Bulk Assignment
public static IEnumerable<DeviceFlagAssignment> BulkAssignAddDevices(DiscoDataContext database, DeviceFlag deviceFlag, User technician, string comments, List<Device> devices, IScheduledTaskStatus status)
{
if (devices.Count > 0)
{
double progressInterval;
const int databaseChunkSize = 100;
comments = string.IsNullOrWhiteSpace(comments) ? null : comments.Trim();
var addDevices = devices.Where(d => !d.DeviceFlagAssignments.Any(a => a.DeviceFlagId == deviceFlag.Id && !a.RemovedDate.HasValue)).ToList();
progressInterval = (double)100 / addDevices.Count;
var addedDeviceAssignments = addDevices.Chunk(databaseChunkSize).SelectMany((chunk, chunkIndex) =>
{
var chunkIndexOffset = databaseChunkSize * chunkIndex;
var chunkResults = chunk.Select((device, index) =>
{
status.UpdateStatus((chunkIndexOffset + index) * progressInterval, $"Assigning Flag: {device}");
return device.OnAddDeviceFlag(database, deviceFlag, technician, comments);
}).ToList();
// Save Chunk Items to Database
database.SaveChanges();
return chunkResults;
}).Where(fa => fa != null).ToList();
status.SetFinishedMessage($"{addDevices.Count} Devices/s Added; {(devices.Count - addDevices.Count)} Devices/s Skipped");
return addedDeviceAssignments;
}
else
{
status.SetFinishedMessage("No changes found");
return Enumerable.Empty<DeviceFlagAssignment>();
}
}
public static IEnumerable<DeviceFlagAssignment> BulkAssignOverrideDevices(DiscoDataContext database, DeviceFlag deviceFlag, User technician, string comments, List<Device> devices, IScheduledTaskStatus status)
{
double progressInterval;
const int databaseChunkSize = 100;
comments = string.IsNullOrWhiteSpace(comments) ? null : comments.Trim();
status.UpdateStatus(0, "Calculating assignment changes");
var currentAssignments = database.DeviceFlagAssignments.Include(fa => fa.Device).Where(a => a.DeviceFlagId == deviceFlag.Id && !a.RemovedDate.HasValue).ToList();
var removeAssignments = currentAssignments.Where(ca => !devices.Any(d => d.SerialNumber.Equals(ca.DeviceSerialNumber, StringComparison.OrdinalIgnoreCase))).ToList();
var addAssignments = devices.Where(d => !currentAssignments.Any(ca => ca.DeviceSerialNumber.Equals(d.SerialNumber, StringComparison.OrdinalIgnoreCase))).ToList();
if (removeAssignments.Count > 0 || addAssignments.Count > 0)
{
progressInterval = (double)100 / (removeAssignments.Count + addAssignments.Count);
var removedDateTime = DateTime.Now;
// Remove Assignments
removeAssignments.Chunk(databaseChunkSize).SelectMany((chunk, chunkIndex) =>
{
var chunkIndexOffset = (chunkIndex * databaseChunkSize) + removeAssignments.Count;
var chunkResults = chunk.Select((flagAssignment, index) =>
{
status.UpdateStatus((chunkIndexOffset + index) * progressInterval, $"Removing Flag: {flagAssignment.Device}");
flagAssignment.OnRemoveUnsafe(database, technician);
return flagAssignment;
}).ToList();
// Save Chunk Items to Database
database.SaveChanges();
return chunkResults;
}).ToList();
// Add Assignments
var addedAssignments = addAssignments.Chunk(databaseChunkSize).SelectMany((chunk, chunkIndex) =>
{
var chunkIndexOffset = (chunkIndex * databaseChunkSize) + removeAssignments.Count;
var chunkResults = chunk.Select((device, index) =>
{
status.UpdateStatus((chunkIndexOffset + index) * progressInterval, $"Assigning Flag: {device}");
return device.OnAddDeviceFlag(database, deviceFlag, technician, comments);
}).ToList();
// Save Chunk Items to Database
database.SaveChanges();
return chunkResults;
}).ToList();
status.SetFinishedMessage($"{addAssignments.Count} Devices/s Added; {removeAssignments.Count} Devices/s Removed; {(devices.Count - addAssignments.Count)} Devices/s Skipped");
return addedAssignments;
}
else
{
status.SetFinishedMessage("No changes found");
return Enumerable.Empty<DeviceFlagAssignment>();
}
}
#endregion
public static string RandomUnusedIcon()
{
return UIHelpers.RandomIcon(_cache.GetDeviceFlags().Select(f => f.Icon));
}
public static string RandomUnusedThemeColour()
{
return UIHelpers.RandomThemeColour(_cache.GetDeviceFlags().Select(f => f.IconColour));
}
}
}
@@ -0,0 +1,84 @@
using Disco.Data.Repository;
using Disco.Models.Repository;
using Disco.Services.Tasks;
using Quartz;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
namespace Disco.Services.Devices.DeviceFlags
{
public class DeviceFlagBulkAssignTask : ScheduledTask
{
public override string TaskName { get { return "Device Flags - Bulk Assign Devices"; } }
public override bool SingleInstanceTask { get { return false; } }
public override bool CancelInitiallySupported { get { return false; } }
public override bool LogExceptionsOnly { get { return true; } }
protected override void ExecuteTask()
{
int deviceFlagId = (int)ExecutionContext.JobDetail.JobDataMap["DeviceFlagId"];
string technicianUserId = (string)ExecutionContext.JobDetail.JobDataMap["TechnicianUserId"];
string comments = (string)ExecutionContext.JobDetail.JobDataMap["Comments"];
List<string> deviceSerialNumbers = (List<string>)ExecutionContext.JobDetail.JobDataMap["DeviceSerialNumbers"];
bool @override = (bool)ExecutionContext.JobDetail.JobDataMap["Override"];
using (DiscoDataContext Database = new DiscoDataContext())
{
// Load Flag
var flag = Database.DeviceFlags.FirstOrDefault(uf => uf.Id == deviceFlagId);
if (flag == null)
throw new Exception("Invalid Device Flag Id");
Status.UpdateStatus(0, string.Format("Bulk Assigning Devices to Device Flag: {0}", flag.Name), "Preparing to start");
// Load Technician
var technician = Database.Users.FirstOrDefault(user => user.UserId == technicianUserId);
if (technician == null)
throw new Exception("Invalid Technician User Id");
// Parse Devices
Status.UpdateStatus(10, "Loading devices from the database");
var devices = Database.Devices
.Include(d => d.DeviceFlagAssignments)
.Where(d => deviceSerialNumbers.Contains(d.SerialNumber)).ToList();
var missingDevices = deviceSerialNumbers.Where(sn => !devices.Any(u => string.Equals(sn, u.SerialNumber, StringComparison.OrdinalIgnoreCase))).ToList();
if (missingDevices.Count > 0)
{
throw new InvalidOperationException(string.Format("Bulk assignment aborted, invalid Serial Numbers: {0}", string.Join(", ", missingDevices)));
}
devices = devices.OrderBy(d => d.SerialNumber).ToList();
Status.ProgressOffset = 50;
Status.ProgressMultiplier = 0.5;
if (@override)
{
DeviceFlagService.BulkAssignOverrideDevices(Database, flag, technician, comments, devices, Status);
}
else
{
DeviceFlagService.BulkAssignAddDevices(Database, flag, technician, comments, devices, Status);
}
}
}
public static ScheduledTaskStatus ScheduleBulkAssignDevices(DeviceFlag deviceFlag, User technician, string comments, List<string> deviceSerialNumbers, bool @override)
{
JobDataMap taskData = new JobDataMap() {
{"DeviceFlagId", deviceFlag.Id },
{"TechnicianUserId", technician.UserId },
{"Comments", comments },
{"DeviceSerialNumbers", deviceSerialNumbers },
{"Override", @override }
};
var instance = new DeviceFlagBulkAssignTask();
return instance.ScheduleTask(taskData);
}
}
}
@@ -0,0 +1,34 @@
using Disco.Data.Repository;
using Disco.Services.Tasks;
using Quartz;
namespace Disco.Services.Devices.DeviceFlags
{
public class DeviceFlagDeleteTask : ScheduledTask
{
public override string TaskName { get { return "Device Flags - Delete Flag"; } }
public override bool SingleInstanceTask { get { return false; }}
public override bool CancelInitiallySupported { get { return false; } }
public override bool LogExceptionsOnly { get { return true; } }
protected override void ExecuteTask()
{
int deviceFlagId = (int)ExecutionContext.JobDetail.JobDataMap["DeviceFlagId"];
using (DiscoDataContext Database = new DiscoDataContext())
{
DeviceFlagService.DeleteDeviceFlag(Database, deviceFlagId, Status);
}
}
public static ScheduledTaskStatus ScheduleNow(int deviceFlagId)
{
var taskData = new JobDataMap() { { "DeviceFlagId", deviceFlagId } };
var instance = new DeviceFlagDeleteTask();
return instance.ScheduleTask(taskData);
}
}
}
+10
View File
@@ -194,6 +194,7 @@
<Compile Include="Authorization\Roles\ClaimGroups\Configuration\ConfigClaims.cs" />
<Compile Include="Authorization\Roles\ClaimGroups\Configuration\DeviceBatch\DeviceBatchClaims.cs" />
<Compile Include="Authorization\Roles\ClaimGroups\Configuration\DeviceCertificate\DeviceCertificateClaims.cs" />
<Compile Include="Authorization\Roles\ClaimGroups\Configuration\DeviceFlag\DeviceFlagClaims.cs" />
<Compile Include="Authorization\Roles\ClaimGroups\Configuration\DeviceModel\DeviceModelClaims.cs" />
<Compile Include="Authorization\Roles\ClaimGroups\Configuration\DeviceProfile\DeviceProfileClaims.cs" />
<Compile Include="Authorization\Roles\ClaimGroups\Configuration\DocumentTemplate\DocumentTemplateClaims.cs" />
@@ -248,6 +249,15 @@
<Compile Include="Devices\Enrolment\MacDeviceEnrolment.cs" />
<Compile Include="Devices\Exporting\DeviceExport.cs" />
<Compile Include="Devices\Exporting\DeviceExportTask.cs" />
<Compile Include="Devices\DeviceFlags\Cache.cs" />
<Compile Include="Devices\DeviceFlags\DeviceFlagExport.cs" />
<Compile Include="Devices\DeviceFlags\DeviceFlagExportTask.cs" />
<Compile Include="Devices\DeviceFlags\DeviceFlagExtensions.cs" />
<Compile Include="Devices\DeviceFlags\DeviceFlagsBulkAssignTask.cs" />
<Compile Include="Devices\DeviceFlags\DeviceFlagsDeleteTask.cs" />
<Compile Include="Devices\DeviceFlags\DeviceFlagService.cs" />
<Compile Include="Devices\DeviceFlags\DeviceFlagDeviceAssignedUsersManagedGroup.cs" />
<Compile Include="Devices\DeviceFlags\DeviceFlagDevicesManagedGroup.cs" />
<Compile Include="Exporting\ExportHelpers.cs" />
<Compile Include="Exporting\ExportTaskContext.cs" />
<Compile Include="Devices\Importing\BaseDeviceImportContext.cs" />
@@ -61,10 +61,25 @@ namespace Disco.Services.Interop.ActiveDirectory
return false;
}
public bool TryGetValue(string Key, out ADManagedGroup ManagedGroup)
{
return managedGroups.TryGetValue(Key, out ManagedGroup);
}
public bool TryGetValue<T>(string key, out T managedGroup) where T : ADManagedGroup
{
if (managedGroups.TryGetValue(key, out var item) && item is T typedItem)
{
managedGroup = typedItem;
return true;
}
else
{
managedGroup = null;
return false;
}
}
public List<ADManagedGroup> Values
{
get
+10 -1
View File
@@ -229,6 +229,14 @@ namespace Disco.Services.Searching
.ToUserSearchResultItems(null);
}
public static List<DeviceSearchResultItem> SearchDeviceFlag(DiscoDataContext Database, int deviceFlagId)
{
return Database.DeviceFlagAssignments
.Where(a => a.DeviceFlagId == deviceFlagId && !a.RemovedDate.HasValue)
.Select(a => a.Device)
.ToDeviceSearchResultItems(null);
}
private static List<UserSearchResultItem> ToUserSearchResultItems(this IQueryable<User> Query, int? LimitCount = ActiveDirectory.DefaultSearchResultLimit)
{
if (LimitCount.HasValue)
@@ -315,7 +323,8 @@ namespace Disco.Services.Searching
DecommissionedDate = d.DecommissionedDate,
AssignedUserId = d.AssignedUserId,
AssignedUserDisplayName = d.AssignedUser.DisplayName,
JobCount = d.Jobs.Count()
JobCount = d.Jobs.Count(),
DeviceFlagAssignments = d.DeviceFlagAssignments,
}).ToList();
}
#endregion
+2 -1
View File
@@ -59,8 +59,9 @@ namespace Disco.Web
// Initialize Job Queues
Disco.Services.Jobs.JobQueues.JobQueueService.Initialize(Database);
// Initialize User Flags
// Initialize Flags
Disco.Services.Users.UserFlags.UserFlagService.Initialize(Database);
Disco.Services.Devices.DeviceFlags.DeviceFlagService.Initialize(Database);
// Initialize Satellite Managed Groups (which don't belong to any other component)
Disco.Services.Devices.ManagedGroups.DeviceManagedGroups.Initialize(Database);
@@ -0,0 +1,123 @@
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using System;
using System.Data.Entity;
using System.Linq;
using System.Web.Mvc;
namespace Disco.Web.Areas.API.Controllers
{
public partial class DeviceFlagAssignmentController : AuthorizedDatabaseController
{
const string pComments = "comments";
public virtual ActionResult Update(int id, string key, string value = null, bool? redirect = null)
{
try
{
if (id < 0)
throw new ArgumentOutOfRangeException(nameof(id));
if (string.IsNullOrEmpty(key))
throw new ArgumentNullException(nameof(key));
var assignment = Database.DeviceFlagAssignments.FirstOrDefault(a => a.Id == id);
if (assignment != null)
{
switch (key.ToLower())
{
case pComments:
UpdateComments(assignment, value);
break;
default:
throw new Exception("Invalid Update Key");
}
}
else
{
throw new Exception("Invalid Device Flag Assignment Id");
}
if (redirect.HasValue && redirect.Value)
return Redirect($"{Url.Action(MVC.Device.Show(assignment.DeviceSerialNumber))}#DeviceDetailTab-Flags");
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
if (redirect.HasValue && redirect.Value)
throw;
else
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
}
}
#region Update Shortcut Methods
[DiscoAuthorizeAny(Claims.Device.Actions.EditFlags)]
public virtual ActionResult UpdateComments(int id, string Comments = null, bool? redirect = null)
{
return Update(id, pComments, Comments, redirect);
}
#endregion
#region Update Properties
private void UpdateComments(DeviceFlagAssignment assignment, string Comments)
{
if (!assignment.CanEditComments())
throw new InvalidOperationException("Editing comments for device flags is denied");
assignment.OnEditComments(Comments);
Database.SaveChanges();
}
#endregion
#region Actions
[DiscoAuthorizeAny(Claims.Device.Actions.AddFlags)]
public virtual ActionResult AddDevice(int id, string DeviceSerialNumber, string Comments)
{
Database.Configuration.LazyLoadingEnabled = true;
var flag = Database.DeviceFlags.Find(id);
if (flag == null)
throw new ArgumentException("Invalid Device Flag Id", nameof(id));
var device = Database.Devices.Include(u => u.DeviceFlagAssignments).FirstOrDefault(d => d.SerialNumber == DeviceSerialNumber);
if (device == null)
throw new ArgumentException("Invalid Device Serial Number", nameof(DeviceSerialNumber));
if (!device.CanAddDeviceFlag(flag))
throw new InvalidOperationException("Adding device flag is denied");
var addingUser = Database.Users.Find(CurrentUser.UserId);
var assignment = device.OnAddDeviceFlag(Database, flag, addingUser, Comments);
Database.SaveChanges();
return Redirect($"{Url.Action(MVC.Device.Show(device.SerialNumber))}#DeviceDetailTab-Flags");
}
[DiscoAuthorizeAny(Claims.Device.Actions.RemoveFlags)]
public virtual ActionResult RemoveDevice(int id)
{
Database.Configuration.LazyLoadingEnabled = true;
var assignment = Database.DeviceFlagAssignments.FirstOrDefault(a => a.Id == id);
if (assignment == null)
throw new ArgumentException("Invalid Device Flag Assignment Id", nameof(id));
if (!assignment.CanRemove())
throw new InvalidOperationException("Removing device flag assignment is denied");
var removingUser = Database.Users.Find(CurrentUser.UserId);
assignment.OnRemove(Database, removingUser);
Database.SaveChanges();
return Redirect($"{Url.Action(MVC.Device.Show(assignment.DeviceSerialNumber))}#DeviceDetailTab-Flags");
}
#endregion
}
}
@@ -0,0 +1,454 @@
using Disco.Models.Repository;
using Disco.Models.Services.Devices.DeviceFlag;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Devices.DeviceFlags;
using Disco.Services.Exporting;
using Disco.Services.Interop.ActiveDirectory;
using Disco.Services.Tasks;
using Disco.Services.Web;
using Disco.Web.Areas.Config.Models.DeviceFlag;
using Disco.Web.Extensions;
using System;
using System.Linq;
using System.Web;
using System.Web.Caching;
using System.Web.Mvc;
namespace Disco.Web.Areas.API.Controllers
{
public partial class DeviceFlagController : AuthorizedDatabaseController
{
const string pName = "name";
const string pDescription = "description";
const string pIcon = "icon";
const string pIconColour = "iconcolour";
const string pOnAssignmentExpression = "onassignmentexpression";
const string pOnUnassignmentExpression = "onunassignmentexpression";
[DiscoAuthorize(Claims.Config.DeviceFlag.Configure)]
public virtual ActionResult Update(int id, string key, string value = null, bool? redirect = null)
{
Authorization.Require(Claims.Config.DeviceFlag.Configure);
try
{
if (id < 0)
throw new ArgumentOutOfRangeException("id");
if (string.IsNullOrEmpty(key))
throw new ArgumentNullException("key");
var flag = Database.DeviceFlags.Find(id);
if (flag != null)
{
switch (key.ToLower())
{
case pName:
UpdateName(flag, value);
break;
case pDescription:
UpdateDescription(flag, value);
break;
case pIcon:
UpdateIcon(flag, value);
break;
case pIconColour:
UpdateIconColour(flag, value);
break;
case pOnAssignmentExpression:
UpdateOnAssignmentExpression(flag, value);
break;
case pOnUnassignmentExpression:
UpdateOnUnassignmentExpression(flag, value);
break;
default:
throw new Exception("Invalid Update Key");
}
}
else
{
throw new Exception("Invalid Device Flag Id");
}
if (redirect.HasValue && redirect.Value)
return RedirectToAction(MVC.Config.DeviceFlag.Index(flag.Id));
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
if (redirect.HasValue && redirect.Value)
throw;
else
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
}
}
#region Update Shortcut Methods
[DiscoAuthorize(Claims.Config.DeviceFlag.Configure)]
public virtual ActionResult UpdateName(int id, string FlagName = null, bool? redirect = null)
{
return Update(id, pName, FlagName, redirect);
}
[DiscoAuthorize(Claims.Config.DeviceFlag.Configure)]
public virtual ActionResult UpdateDescription(int id, string Description = null, bool? redirect = null)
{
return Update(id, pDescription, Description, redirect);
}
[DiscoAuthorize(Claims.Config.DeviceFlag.Configure)]
public virtual ActionResult UpdateIcon(int id, string Icon = null, bool? redirect = null)
{
return Update(id, pIcon, Icon, redirect);
}
[DiscoAuthorize(Claims.Config.DeviceFlag.Configure)]
public virtual ActionResult UpdateIconColour(int id, string IconColour = null, bool? redirect = null)
{
return Update(id, pIconColour, IconColour, redirect);
}
[DiscoAuthorize(Claims.Config.DeviceFlag.Configure)]
public virtual ActionResult UpdateIconAndColour(int id, string Icon = null, string IconColour = null, bool redirect = false)
{
try
{
if (id < 0)
throw new ArgumentOutOfRangeException("id");
var DeviceFlag = Database.DeviceFlags.Find(id);
if (DeviceFlag != null)
{
UpdateIconAndColour(DeviceFlag, Icon, IconColour);
}
else
{
throw new ArgumentException("Invalid Device Flag Id", "id");
}
if (redirect)
return RedirectToAction(MVC.Config.DeviceFlag.Index(DeviceFlag.Id));
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
if (redirect)
throw;
else
return Json(string.Format("Error: {0}", ex.Message), JsonRequestBehavior.AllowGet);
}
}
[DiscoAuthorize(Claims.Config.DeviceFlag.Configure)]
public virtual ActionResult UpdateOnAssignmentExpression(int id, string OnAssignmentExpression = null, bool redirect = false)
{
return Update(id, pOnAssignmentExpression, OnAssignmentExpression, redirect);
}
[DiscoAuthorize(Claims.Config.DeviceFlag.Configure)]
public virtual ActionResult UpdateOnUnassignmentExpression(int id, string OnUnassignmentExpression = null, bool redirect = false)
{
return Update(id, pOnUnassignmentExpression, OnUnassignmentExpression, redirect);
}
[DiscoAuthorize(Claims.Config.DeviceFlag.Configure)]
public virtual ActionResult UpdateDevicesLinkedGroup(int id, string GroupId = null, DateTime? FilterBeginDate = null, bool redirect = false)
{
try
{
if (id < 0)
throw new ArgumentOutOfRangeException("id");
var deviceFlag = Database.DeviceFlags.Find(id);
if (deviceFlag == null)
throw new ArgumentException("Invalid Device Flag Id", "id");
var syncTaskStatus = UpdateDevicesLinkedGroup(deviceFlag, GroupId, FilterBeginDate);
if (redirect)
if (syncTaskStatus == null)
return RedirectToAction(MVC.Config.DeviceFlag.Index(deviceFlag.Id));
else
{
syncTaskStatus.SetFinishedUrl(Url.Action(MVC.Config.DeviceFlag.Index(deviceFlag.Id)));
return RedirectToAction(MVC.Config.Logging.TaskStatus(syncTaskStatus.SessionId));
}
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
if (redirect)
throw;
else
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
}
}
[DiscoAuthorize(Claims.Config.DeviceFlag.Configure)]
public virtual ActionResult UpdateAssignedUserLinkedGroup(int id, string GroupId = null, DateTime? FilterBeginDate = null, bool redirect = false)
{
try
{
if (id < 0)
throw new ArgumentOutOfRangeException("id");
var DeviceFlag = Database.DeviceFlags.Find(id);
if (DeviceFlag == null)
throw new ArgumentException("Invalid Device Flag Id", "id");
var syncTaskStatus = UpdateAssignedUserLinkedGroup(DeviceFlag, GroupId, FilterBeginDate);
if (redirect)
if (syncTaskStatus == null)
return RedirectToAction(MVC.Config.DeviceFlag.Index(DeviceFlag.Id));
else
{
syncTaskStatus.SetFinishedUrl(Url.Action(MVC.Config.DeviceFlag.Index(DeviceFlag.Id)));
return RedirectToAction(MVC.Config.Logging.TaskStatus(syncTaskStatus.SessionId));
}
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
catch (Exception ex)
{
if (redirect)
throw;
else
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
}
}
#endregion
#region Update Properties
private void UpdateIconAndColour(DeviceFlag deviceFlag, string icon, string iconColour)
{
if (string.IsNullOrWhiteSpace(icon))
throw new ArgumentNullException("Icon");
if (string.IsNullOrWhiteSpace(iconColour))
throw new ArgumentNullException("IconColour");
if (deviceFlag.Icon != icon ||
deviceFlag.IconColour != iconColour)
{
deviceFlag.Icon = icon;
deviceFlag.IconColour = iconColour;
DeviceFlagService.Update(Database, deviceFlag);
}
}
private void UpdateIcon(DeviceFlag deviceFlag, string icon)
{
if (string.IsNullOrWhiteSpace(icon))
throw new ArgumentNullException("Icon");
if (deviceFlag.Icon != icon)
{
deviceFlag.Icon = icon;
DeviceFlagService.Update(Database, deviceFlag);
}
}
private void UpdateIconColour(DeviceFlag deviceFlag, string iconColour)
{
if (string.IsNullOrWhiteSpace(iconColour))
throw new ArgumentNullException("IconColour");
if (deviceFlag.IconColour != iconColour)
{
deviceFlag.IconColour = iconColour;
DeviceFlagService.Update(Database, deviceFlag);
}
}
private void UpdateName(DeviceFlag deviceFlag, string name)
{
if (deviceFlag.Name != name)
{
deviceFlag.Name = name;
DeviceFlagService.Update(Database, deviceFlag);
}
}
private void UpdateDescription(DeviceFlag deviceFlag, string description)
{
if (deviceFlag.Description != description)
{
deviceFlag.Description = description;
DeviceFlagService.Update(Database, deviceFlag);
}
}
private void UpdateOnAssignmentExpression(DeviceFlag deviceFlag, string onAssignmentExpression)
{
if (string.IsNullOrWhiteSpace(onAssignmentExpression))
{
deviceFlag.OnAssignmentExpression = null;
}
else
{
deviceFlag.OnAssignmentExpression = onAssignmentExpression.Trim();
}
// Invalidate Cache
deviceFlag.OnAssignmentExpressionInvalidateCache();
DeviceFlagService.Update(Database, deviceFlag);
}
private void UpdateOnUnassignmentExpression(DeviceFlag deviceFlag, string onUnassignmentExpression)
{
if (string.IsNullOrWhiteSpace(onUnassignmentExpression))
{
deviceFlag.OnUnassignmentExpression = null;
}
else
{
deviceFlag.OnUnassignmentExpression = onUnassignmentExpression.Trim();
}
// Invalidate Cache
deviceFlag.OnUnassignmentExpressionInvalidateCache();
DeviceFlagService.Update(Database, deviceFlag);
}
private ScheduledTaskStatus UpdateDevicesLinkedGroup(DeviceFlag deviceFlag, string devicesLinkedGroup, DateTime? filterBeginDate)
{
var configJson = ADManagedGroup.ValidConfigurationToJson(DeviceFlagDevicesManagedGroup.GetKey(deviceFlag), devicesLinkedGroup, filterBeginDate);
if (deviceFlag.DevicesLinkedGroup != configJson)
{
deviceFlag.DevicesLinkedGroup = configJson;
DeviceFlagService.Update(Database, deviceFlag);
if (deviceFlag.DevicesLinkedGroup != null && DeviceFlagDevicesManagedGroup.TryGetManagedGroup(deviceFlag, out var managedGroup))
{
// Sync Group
return ADManagedGroupsSyncTask.ScheduleSync(managedGroup);
}
}
return null;
}
private ScheduledTaskStatus UpdateAssignedUserLinkedGroup(DeviceFlag deviceFlag, string assignedUserLinkedGroup, DateTime? filterBeginDate)
{
var configJson = ADManagedGroup.ValidConfigurationToJson(DeviceFlagDeviceAssignedUsersManagedGroup.GetKey(deviceFlag), assignedUserLinkedGroup, filterBeginDate);
if (deviceFlag.DeviceUsersLinkedGroup != configJson)
{
deviceFlag.DeviceUsersLinkedGroup = configJson;
DeviceFlagService.Update(Database, deviceFlag);
if (deviceFlag.DeviceUsersLinkedGroup != null && DeviceFlagDeviceAssignedUsersManagedGroup.TryGetManagedGroup(deviceFlag, out var managedGroup))
{
// Sync Group
return ADManagedGroupsSyncTask.ScheduleSync(managedGroup);
}
}
return null;
}
#endregion
#region Actions
[DiscoAuthorizeAll(Claims.Config.DeviceFlag.Configure, Claims.Config.DeviceFlag.Delete)]
public virtual ActionResult Delete(int id, bool? redirect = false)
{
try
{
var uf = Database.DeviceFlags.FirstOrDefault(f => f.Id == id);
if (uf != null)
{
var status = DeviceFlagDeleteTask.ScheduleNow(uf.Id);
status.SetFinishedUrl(Url.Action(MVC.Config.DeviceFlag.Index(null)));
if (redirect.HasValue && redirect.Value)
return RedirectToAction(MVC.Config.Logging.TaskStatus(status.SessionId));
else
return Json("OK", JsonRequestBehavior.AllowGet);
}
throw new ArgumentException("Invalid Device Flag Id", nameof(id));
}
catch (Exception ex)
{
if (redirect.HasValue && redirect.Value)
throw;
else
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
}
}
[DiscoAuthorizeAll(Claims.Config.DeviceFlag.Configure, Claims.Device.Actions.AddFlags, Claims.Device.Actions.RemoveFlags, Claims.Device.ShowFlagAssignments)]
public virtual ActionResult BulkAssignDevices(int id, bool Override, string DeviceSerialNumbers = null, string Comments = null)
{
if (id < 0)
throw new ArgumentNullException("id");
var flag = Database.DeviceFlags.FirstOrDefault(f => f.Id == id);
if (flag == null)
throw new ArgumentException("Invalid Device Flag Id", nameof(id));
var serialNumbers = DeviceSerialNumbers.Split(new string[] { Environment.NewLine, ",", ";" }, StringSplitOptions.RemoveEmptyEntries).Select(d => d.Trim()).Where(d => !string.IsNullOrEmpty(d)).ToList();
var taskStatus = DeviceFlagBulkAssignTask.ScheduleBulkAssignDevices(flag, CurrentUser, Comments, serialNumbers, Override);
taskStatus.SetFinishedUrl(Url.Action(MVC.Config.DeviceFlag.Index(flag.Id)));
return RedirectToAction(MVC.Config.Logging.TaskStatus(taskStatus.SessionId));
}
[DiscoAuthorizeAll(Claims.Config.DeviceFlag.Configure, Claims.Device.Actions.AddFlags, Claims.Device.Actions.RemoveFlags, Claims.Device.ShowFlagAssignments)]
public virtual ActionResult AssignedDevices(int id)
{
if (id < 0)
throw new ArgumentNullException(nameof(id));
var flag = Database.DeviceFlags.FirstOrDefault(f => f.Id == id);
if (flag == null)
throw new ArgumentException("Invalid Device Flag Id", nameof(id));
var serialNumbers = Database
.DeviceFlagAssignments
.Where(a => a.DeviceFlagId == flag.Id && !a.RemovedDate.HasValue)
.OrderBy(a => a.DeviceSerialNumber).Select(a => a.DeviceSerialNumber).ToList();
return Json(serialNumbers, JsonRequestBehavior.AllowGet);
}
#endregion
#region Exporting
internal const string ExportSessionCacheKey = "DeviceFlagExportContext_{0}";
[DiscoAuthorize(Claims.Config.DeviceFlag.Export)]
public virtual ActionResult Export(ExportModel Model)
{
if (Model == null || Model.Options == null)
throw new ArgumentNullException(nameof(Model));
// Start Export
var exportContext = DeviceFlagExportTask.ScheduleNow(Model.Options);
// Store Export Context in Web Cache
string key = string.Format(ExportSessionCacheKey, exportContext.TaskStatus.SessionId);
HttpRuntime.Cache.Insert(key, exportContext, null, DateTime.Now.AddMinutes(60), Cache.NoSlidingExpiration, CacheItemPriority.NotRemovable, null);
// Set Task Finished Url
var finishedActionResult = MVC.Config.DeviceFlag.Export(exportContext.TaskStatus.SessionId, null, null);
exportContext.TaskStatus.SetFinishedUrl(Url.Action(finishedActionResult));
// Try waiting for completion
if (exportContext.TaskStatus.WaitUntilFinished(TimeSpan.FromSeconds(2)))
return RedirectToAction(finishedActionResult);
else
return RedirectToAction(MVC.Config.Logging.TaskStatus(exportContext.TaskStatus.SessionId));
}
[DiscoAuthorize(Claims.Config.DeviceFlag.Export)]
public virtual ActionResult ExportRetrieve(string Id)
{
if (string.IsNullOrWhiteSpace(Id))
throw new ArgumentNullException("Id");
string key = string.Format(ExportSessionCacheKey, Id);
var context = HttpRuntime.Cache.Get(key) as ExportTaskContext<DeviceFlagExportOptions>;
if (context == null)
throw new ArgumentException("The Id specified is invalid, or the export data expired (60 minutes)", nameof(Id));
if (context.Result == null || context.Result.Result == null)
throw new ArgumentException("The export session is still running, or failed to complete successfully", nameof(Id));
var fileStream = context.Result.Result;
return this.File(fileStream.GetBuffer(), 0, (int)fileStream.Length, context.Result.MimeType, context.Result.Filename);
}
#endregion
}
}
@@ -0,0 +1,159 @@
using Disco.Models.Areas.Config.UI.DeviceFlag;
using Disco.Models.Repository;
using Disco.Models.Services.Devices.DeviceFlag;
using Disco.Models.UI.Config.DeviceFlag;
using Disco.Services.Authorization;
using Disco.Services.Devices.DeviceFlags;
using Disco.Services.Exporting;
using Disco.Services.Extensions;
using Disco.Services.Plugins.Features.UIExtension;
using Disco.Services.Web;
using Disco.Web.Areas.Config.Models.DeviceFlag;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Disco.Web.Areas.Config.Controllers
{
public partial class DeviceFlagController : AuthorizedDatabaseController
{
[DiscoAuthorize(Claims.Config.DeviceFlag.Show)]
public virtual ActionResult Index(int? id)
{
if (id.HasValue)
{
// Show
var m = Database.DeviceFlags.Where(f => f.Id == id.Value).Select(f =>
new ShowModel()
{
DeviceFlag = f,
CurrentAssignmentCount = f.DeviceFlagAssignments.Count(a => !a.RemovedDate.HasValue),
TotalAssignmentCount = f.DeviceFlagAssignments.Count()
}).FirstOrDefault();
if (m == null)
throw new ArgumentException("Invalid Device Flag Id");
if (DeviceFlagDevicesManagedGroup.TryGetManagedGroup(m.DeviceFlag, out var devicesManagedGroup))
m.DevicesLinkedGroup = devicesManagedGroup;
if (DeviceFlagDeviceAssignedUsersManagedGroup.TryGetManagedGroup(m.DeviceFlag, out var assignedUsersManagedGroup))
m.AssignedUserLinkedGroup = assignedUsersManagedGroup;
if (Authorization.Has(Claims.Config.DeviceFlag.Configure))
{
m.Icons = UIHelpers.Icons;
m.ThemeColours = UIHelpers.ThemeColours;
}
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDeviceFlagShowModel>(this.ControllerContext, m);
return View(MVC.Config.DeviceFlag.Views.Show, m);
}
else
{
// List Index
var m = new Models.DeviceFlag.IndexModel()
{
DeviceFlags = Database.DeviceFlags
.Select(uf => new
{
flag = uf,
assignmentCount = uf.DeviceFlagAssignments.Count(fa => !fa.RemovedDate.HasValue)
})
.ToDictionary(
pair => pair.flag,
pair => pair.assignmentCount)
};
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDeviceFlagIndexModel>(this.ControllerContext, m);
return View(m);
}
}
[DiscoAuthorizeAll(Claims.Config.DeviceFlag.Create, Claims.Config.DeviceFlag.Configure)]
public virtual ActionResult Create()
{
// Default Queue
var m = new CreateModel()
{
DeviceFlag = new DeviceFlag()
{
Icon = DeviceFlagService.RandomUnusedIcon(),
IconColour = DeviceFlagService.RandomUnusedThemeColour()
}
};
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDeviceFlagCreateModel>(this.ControllerContext, m);
return View(m);
}
[DiscoAuthorizeAll(Claims.Config.DeviceFlag.Create, Claims.Config.DeviceFlag.Configure), HttpPost]
public virtual ActionResult Create(CreateModel model)
{
if (ModelState.IsValid)
{
// Check for Existing
var existing = Database.DeviceFlags.Where(m => m.Name == model.DeviceFlag.Name).FirstOrDefault();
if (existing == null)
{
var flag = DeviceFlagService.CreateDeviceFlag(Database, model.DeviceFlag);
return RedirectToAction(MVC.Config.DeviceFlag.Index(flag.Id));
}
else
{
ModelState.AddModelError("Name", "A Device Flag with this name already exists.");
}
}
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDeviceFlagCreateModel>(this.ControllerContext, model);
return View(model);
}
#region Export
[DiscoAuthorizeAny(Claims.Config.DeviceFlag.Export), HttpGet]
public virtual ActionResult Export(string DownloadId, int? DeviceFlagId, bool? CurrentOnly)
{
var m = new ExportModel()
{
Options = DeviceFlagExportOptions.DefaultOptions(),
DeviceFlags = DeviceFlagService.GetDeviceFlags(),
};
if (!string.IsNullOrWhiteSpace(DownloadId))
{
string key = string.Format(API.Controllers.DeviceFlagController.ExportSessionCacheKey, DownloadId);
var context = HttpRuntime.Cache.Get(key) as ExportTaskContext<DeviceFlagExportOptions>;
if (context != null)
{
m.ExportSessionResult = context.Result;
m.ExportSessionId = DownloadId;
}
}
if (DeviceFlagId.HasValue && CurrentOnly.HasValue)
{
m.Options.DeviceFlagIds = new List<int>() { DeviceFlagId.Value };
m.Options.CurrentOnly = CurrentOnly.Value;
}
// UI Extensions
UIExtensions.ExecuteExtensions<ConfigDeviceFlagExportModel>(this.ControllerContext, m);
return View(m);
}
#endregion
}
}
@@ -0,0 +1,9 @@
using Disco.Models.UI.Config.DeviceFlag;
namespace Disco.Web.Areas.Config.Models.DeviceFlag
{
public class CreateModel : ConfigDeviceFlagCreateModel
{
public Disco.Models.Repository.DeviceFlag DeviceFlag { get; set; }
}
}
@@ -0,0 +1,17 @@
using Disco.Models.Areas.Config.UI.DeviceFlag;
using Disco.Models.Services.Devices.DeviceFlag;
using Disco.Models.Services.Exporting;
using System.Collections.Generic;
namespace Disco.Web.Areas.Config.Models.DeviceFlag
{
public class ExportModel : ConfigDeviceFlagExportModel
{
public DeviceFlagExportOptions Options { get; set; }
public string ExportSessionId { get; set; }
public ExportResult ExportSessionResult { get; set; }
public List<Disco.Models.Repository.DeviceFlag> DeviceFlags { get; set; }
}
}
@@ -0,0 +1,10 @@
using Disco.Models.UI.Config.DeviceFlag;
using System.Collections.Generic;
namespace Disco.Web.Areas.Config.Models.DeviceFlag
{
public class IndexModel : ConfigDeviceFlagIndexModel
{
public Dictionary<Disco.Models.Repository.DeviceFlag, int> DeviceFlags { get; set; }
}
}
@@ -0,0 +1,20 @@
using Disco.Models.UI.Config.DeviceFlag;
using Disco.Services.Devices.DeviceFlags;
using System.Collections.Generic;
namespace Disco.Web.Areas.Config.Models.DeviceFlag
{
public class ShowModel : ConfigDeviceFlagShowModel
{
public Disco.Models.Repository.DeviceFlag DeviceFlag { get; set; }
public int CurrentAssignmentCount { get; set; }
public int TotalAssignmentCount { get; set; }
public DeviceFlagDevicesManagedGroup DevicesLinkedGroup { get; set; }
public DeviceFlagDeviceAssignedUsersManagedGroup AssignedUserLinkedGroup { get; set; }
public IEnumerable<KeyValuePair<string, string>> Icons { get; set; }
public IEnumerable<KeyValuePair<string, string>> ThemeColours { get; set; }
}
}
@@ -72,7 +72,14 @@
<i class="fa fa-cog"></i>@Html.ActionLinkClass("Profiles", MVC.Config.DeviceProfile.Index(), "config")
<div class="pageMenuBlurb">
Configure Device Profiles including computer name generation, distribution and Active
Directory OU layout.
Directory OU layout.
</div>
}
@if (Authorization.Has(Claims.Config.DeviceFlag.Show))
{
<i class="fa fa-cog"></i>@Html.ActionLinkClass("Flags", MVC.Config.DeviceFlag.Index(), "config")
<div class="pageMenuBlurb">
Create and manage device flags.
</div>
}
@if (Authorization.Has(Claims.Config.Enrolment.Show))
@@ -114,7 +121,7 @@
<h2>Users</h2>
@if (Authorization.Has(Claims.Config.UserFlag.Show))
{
<i class="fa fa-cog"></i>@Html.ActionLinkClass("User Flags", MVC.Config.UserFlag.Index(), "config")
<i class="fa fa-cog"></i>@Html.ActionLinkClass("Flags", MVC.Config.UserFlag.Index(), "config")
<div class="pageMenuBlurb">
Create and manage user flags.
</div>
@@ -508,8 +508,8 @@ WriteLiteral(" <div");
WriteLiteral(" class=\"pageMenuBlurb\"");
WriteLiteral(">\r\n Configure Device Profiles including computer name " +
"generation, distribution and Active\r\n Directory OU layout.\r\n " +
" </div>\r\n");
"generation, distribution and Active\r\n Directory OU la" +
"yout.\r\n </div>\r\n");
#line 77 "..\..\Areas\Config\Views\Config\Index.cshtml"
@@ -522,7 +522,7 @@ WriteLiteral(" ");
#line 78 "..\..\Areas\Config\Views\Config\Index.cshtml"
if (Authorization.Has(Claims.Config.Enrolment.Show))
if (Authorization.Has(Claims.Config.DeviceFlag.Show))
{
@@ -542,13 +542,63 @@ WriteLiteral("></i>");
#line hidden
#line 80 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("Enrolment", MVC.Config.Enrolment.Index(), "config"));
Write(Html.ActionLinkClass("Flags", MVC.Config.DeviceFlag.Index(), "config"));
#line default
#line hidden
#line 80 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"pageMenuBlurb\"");
WriteLiteral(">\r\n Create and manage device flags.\r\n " +
" </div>\r\n");
#line 84 "..\..\Areas\Config\Views\Config\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" ");
#line 85 "..\..\Areas\Config\Views\Config\Index.cshtml"
if (Authorization.Has(Claims.Config.Enrolment.Show))
{
#line default
#line hidden
WriteLiteral(" <i");
WriteLiteral(" class=\"fa fa-cog\"");
WriteLiteral("></i>");
#line 87 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line default
#line hidden
#line 87 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("Enrolment", MVC.Config.Enrolment.Index(), "config"));
#line default
#line hidden
#line 87 "..\..\Areas\Config\Views\Config\Index.cshtml"
@@ -562,7 +612,7 @@ WriteLiteral(">\r\n Configure Enrolment settings incl
"entials.\r\n </div>\r\n");
#line 84 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 91 "..\..\Areas\Config\Views\Config\Index.cshtml"
}
@@ -571,7 +621,7 @@ WriteLiteral(">\r\n Configure Enrolment settings incl
WriteLiteral(" </div>\r\n </td>\r\n");
#line 87 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 94 "..\..\Areas\Config\Views\Config\Index.cshtml"
}
@@ -580,7 +630,7 @@ WriteLiteral(" </div>\r\n </td>\r\n");
WriteLiteral(" ");
#line 88 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 95 "..\..\Areas\Config\Views\Config\Index.cshtml"
if (Authorization.HasAny(Claims.Config.JobPreferences.Show, Claims.Config.JobQueue.Show, Claims.Config.UserFlag.Show, Claims.Config.DocumentTemplate.Show))
{
@@ -590,13 +640,13 @@ WriteLiteral(" ");
WriteLiteral(" <td>\r\n");
#line 91 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 98 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line default
#line hidden
#line 91 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 98 "..\..\Areas\Config\Views\Config\Index.cshtml"
if (Authorization.HasAny(Claims.Config.JobPreferences.Show, Claims.Config.JobQueue.Show))
{
@@ -610,13 +660,13 @@ WriteLiteral(" class=\"pageMenuArea noSeperator\"");
WriteLiteral(">\r\n <h2>Jobs</h2>\r\n");
#line 95 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 102 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line default
#line hidden
#line 95 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 102 "..\..\Areas\Config\Views\Config\Index.cshtml"
if (Authorization.Has(Claims.Config.JobPreferences.Show))
{
@@ -630,20 +680,20 @@ WriteLiteral(" class=\"fa fa-cog\"");
WriteLiteral("></i>");
#line 97 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 104 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line default
#line hidden
#line 97 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 104 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("General Preferences", MVC.Config.JobPreferences.Index(), "config"));
#line default
#line hidden
#line 97 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 104 "..\..\Areas\Config\Views\Config\Index.cshtml"
@@ -657,7 +707,7 @@ WriteLiteral(">\r\n Configure general preferences
"\r\n </div>\r\n");
#line 101 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 108 "..\..\Areas\Config\Views\Config\Index.cshtml"
}
@@ -666,7 +716,7 @@ WriteLiteral(">\r\n Configure general preferences
WriteLiteral(" ");
#line 102 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 109 "..\..\Areas\Config\Views\Config\Index.cshtml"
if (Authorization.Has(Claims.Config.JobQueue.Show))
{
@@ -680,20 +730,20 @@ WriteLiteral(" class=\"fa fa-cog\"");
WriteLiteral("></i>");
#line 104 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 111 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line default
#line hidden
#line 104 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 111 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("Job Queues", MVC.Config.JobQueue.Index(), "config"));
#line default
#line hidden
#line 104 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 111 "..\..\Areas\Config\Views\Config\Index.cshtml"
@@ -707,7 +757,7 @@ WriteLiteral(">\r\n Create and manage job queues
"ies and queue members.\r\n </div>\r\n");
#line 108 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 115 "..\..\Areas\Config\Views\Config\Index.cshtml"
}
@@ -716,7 +766,7 @@ WriteLiteral(">\r\n Create and manage job queues
WriteLiteral(" </div>\r\n");
#line 110 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 117 "..\..\Areas\Config\Views\Config\Index.cshtml"
}
@@ -725,7 +775,7 @@ WriteLiteral(" </div>\r\n");
WriteLiteral(" ");
#line 111 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 118 "..\..\Areas\Config\Views\Config\Index.cshtml"
if (Authorization.HasAny(Claims.Config.UserFlag.Show))
{
@@ -739,13 +789,13 @@ WriteLiteral(" class=\"pageMenuArea noSeperator\"");
WriteLiteral(">\r\n <h2>Users</h2>\r\n");
#line 115 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 122 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line default
#line hidden
#line 115 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 122 "..\..\Areas\Config\Views\Config\Index.cshtml"
if (Authorization.Has(Claims.Config.UserFlag.Show))
{
@@ -759,21 +809,21 @@ WriteLiteral(" class=\"fa fa-cog\"");
WriteLiteral("></i>");
#line 117 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 124 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line default
#line hidden
#line 117 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("User Flags", MVC.Config.UserFlag.Index(), "config"));
#line 124 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("Flags", MVC.Config.UserFlag.Index(), "config"));
#line default
#line hidden
#line 117 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 124 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line default
@@ -786,7 +836,7 @@ WriteLiteral(">\r\n Create and manage user flags.
" </div>\r\n");
#line 121 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 128 "..\..\Areas\Config\Views\Config\Index.cshtml"
}
@@ -795,7 +845,7 @@ WriteLiteral(">\r\n Create and manage user flags.
WriteLiteral(" </div>\r\n");
#line 123 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 130 "..\..\Areas\Config\Views\Config\Index.cshtml"
}
@@ -804,7 +854,7 @@ WriteLiteral(" </div>\r\n");
WriteLiteral(" ");
#line 124 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 131 "..\..\Areas\Config\Views\Config\Index.cshtml"
if (Authorization.HasAny(Claims.Config.DocumentTemplate.Show))
{
@@ -818,13 +868,13 @@ WriteLiteral(" class=\"pageMenuArea noSeperator\"");
WriteLiteral(">\r\n <h2>Features</h2>\r\n");
#line 128 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 135 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line default
#line hidden
#line 128 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 135 "..\..\Areas\Config\Views\Config\Index.cshtml"
if (Authorization.Has(Claims.Config.DocumentTemplate.Show))
{
@@ -838,20 +888,20 @@ WriteLiteral(" class=\"fa fa-cog\"");
WriteLiteral("></i>");
#line 130 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 137 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line default
#line hidden
#line 130 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 137 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Html.ActionLinkClass("Document Templates", MVC.Config.DocumentTemplate.Index(), "config"));
#line default
#line hidden
#line 130 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 137 "..\..\Areas\Config\Views\Config\Index.cshtml"
@@ -866,7 +916,7 @@ WriteLiteral(">\r\n Create, Update and Bulk Gener
" </div>\r\n");
#line 135 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 142 "..\..\Areas\Config\Views\Config\Index.cshtml"
}
@@ -875,7 +925,7 @@ WriteLiteral(">\r\n Create, Update and Bulk Gener
WriteLiteral(" </div>\r\n");
#line 137 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 144 "..\..\Areas\Config\Views\Config\Index.cshtml"
}
@@ -884,7 +934,7 @@ WriteLiteral(" </div>\r\n");
WriteLiteral(" </td>\r\n");
#line 139 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 146 "..\..\Areas\Config\Views\Config\Index.cshtml"
}
@@ -893,7 +943,7 @@ WriteLiteral(" </td>\r\n");
WriteLiteral(" </tr>\r\n</table>\r\n");
#line 142 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 149 "..\..\Areas\Config\Views\Config\Index.cshtml"
if (Model.UpdateAvailable)
{
@@ -911,14 +961,14 @@ WriteLiteral(" class=\"fa fa-cloud-download info\"");
WriteLiteral("></i>\r\n <div>An updated version of Disco is available</div>\r\n <a");
WriteAttribute("href", Tuple.Create(" href=\"", 7818), Tuple.Create("\"", 7854)
WriteAttribute("href", Tuple.Create(" href=\"", 8211), Tuple.Create("\"", 8247)
#line 148 "..\..\Areas\Config\Views\Config\Index.cshtml"
, Tuple.Create(Tuple.Create("", 7825), Tuple.Create<System.Object, System.Int32>(Model.UpdateResponse.UrlLink
#line 155 "..\..\Areas\Config\Views\Config\Index.cshtml"
, Tuple.Create(Tuple.Create("", 8218), Tuple.Create<System.Object, System.Int32>(Model.UpdateResponse.UrlLink
#line default
#line hidden
, 7825), false)
, 8218), false)
);
WriteLiteral(" class=\"button small alert\"");
@@ -928,7 +978,7 @@ WriteLiteral(" target=\"_blank\"");
WriteLiteral(">Download v");
#line 148 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 155 "..\..\Areas\Config\Views\Config\Index.cshtml"
Write(Model.UpdateResponse.LatestVersion);
@@ -945,13 +995,13 @@ WriteLiteral(@" <script>
");
#line 156 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 163 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line default
#line hidden
#line 156 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 163 "..\..\Areas\Config\Views\Config\Index.cshtml"
if (Model.UpdateResponse.ReleasedDate < DateTime.Now.AddDays(-14))
{
@@ -967,7 +1017,7 @@ WriteLiteral("\r\n updateAvailableContainer.effect(\"shake\", { t
WriteLiteral("\r\n");
#line 162 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 169 "..\..\Areas\Config\Views\Config\Index.cshtml"
}
@@ -976,7 +1026,7 @@ WriteLiteral("\r\n");
WriteLiteral("\r\n });\r\n })();\r\n </script>\r\n");
#line 167 "..\..\Areas\Config\Views\Config\Index.cshtml"
#line 174 "..\..\Areas\Config\Views\Config\Index.cshtml"
}
@@ -0,0 +1,36 @@
@model Disco.Web.Areas.Config.Models.DeviceFlag.CreateModel
@{
Authorization.RequireAll(Claims.Config.JobQueue.Create, Claims.Config.JobQueue.Configure);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Flags", MVC.Config.DeviceFlag.Index(null), "Create");
}
@using (Html.BeginForm())
{
@Html.HiddenFor(m => m.DeviceFlag.Icon)
@Html.HiddenFor(m => m.DeviceFlag.IconColour)
<div class="form" style="width: 450px">
<table>
<tr>
<th>Name:
</th>
<td>
@Html.EditorFor(model => model.DeviceFlag.Name)<br />@Html.ValidationMessageFor(model => model.DeviceFlag.Name)
</td>
</tr>
<tr>
<th>Description:
</th>
<td>
@Html.EditorFor(model => model.DeviceFlag.Description)<br />@Html.ValidationMessageFor(model => model.DeviceFlag.Description)
</td>
</tr>
</table>
<p class="actions">
<input type="submit" class="button" value="Create" />
</p>
</div>
<script type="text/javascript">
$(function () {
$('#DeviceFlag_Name').focus().select();
});
</script>
}
@@ -0,0 +1,172 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Areas.Config.Views.DeviceFlag
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Helpers;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using System.Web.Mvc.Html;
using System.Web.Routing;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using Disco;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/DeviceFlag/Create.cshtml")]
public partial class Create : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.DeviceFlag.CreateModel>
{
public Create()
{
}
public override void Execute()
{
#line 2 "..\..\Areas\Config\Views\DeviceFlag\Create.cshtml"
Authorization.RequireAll(Claims.Config.JobQueue.Create, Claims.Config.JobQueue.Configure);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Flags", MVC.Config.DeviceFlag.Index(null), "Create");
#line default
#line hidden
WriteLiteral("\r\n");
#line 6 "..\..\Areas\Config\Views\DeviceFlag\Create.cshtml"
using (Html.BeginForm())
{
#line default
#line hidden
#line 8 "..\..\Areas\Config\Views\DeviceFlag\Create.cshtml"
Write(Html.HiddenFor(m => m.DeviceFlag.Icon));
#line default
#line hidden
#line 8 "..\..\Areas\Config\Views\DeviceFlag\Create.cshtml"
#line default
#line hidden
#line 9 "..\..\Areas\Config\Views\DeviceFlag\Create.cshtml"
Write(Html.HiddenFor(m => m.DeviceFlag.IconColour));
#line default
#line hidden
#line 9 "..\..\Areas\Config\Views\DeviceFlag\Create.cshtml"
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"form\"");
WriteLiteral(" style=\"width: 450px\"");
WriteLiteral(">\r\n <table>\r\n <tr>\r\n <th>Name:\r\n " +
"</th>\r\n <td>\r\n");
WriteLiteral(" ");
#line 16 "..\..\Areas\Config\Views\DeviceFlag\Create.cshtml"
Write(Html.EditorFor(model => model.DeviceFlag.Name));
#line default
#line hidden
WriteLiteral("<br />");
#line 16 "..\..\Areas\Config\Views\DeviceFlag\Create.cshtml"
Write(Html.ValidationMessageFor(model => model.DeviceFlag.Name));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n <tr>\r\n <th" +
">Description:\r\n </th>\r\n <td>\r\n");
WriteLiteral(" ");
#line 23 "..\..\Areas\Config\Views\DeviceFlag\Create.cshtml"
Write(Html.EditorFor(model => model.DeviceFlag.Description));
#line default
#line hidden
WriteLiteral("<br />");
#line 23 "..\..\Areas\Config\Views\DeviceFlag\Create.cshtml"
Write(Html.ValidationMessageFor(model => model.DeviceFlag.Description));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n </table>\r\n <p");
WriteLiteral(" class=\"actions\"");
WriteLiteral(">\r\n <input");
WriteLiteral(" type=\"submit\"");
WriteLiteral(" class=\"button\"");
WriteLiteral(" value=\"Create\"");
WriteLiteral(" />\r\n </p>\r\n </div>\r\n");
WriteLiteral(" <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(">\r\n $(function () {\r\n $(\'#DeviceFlag_Name\').focus().select();\r\n" +
" });\r\n </script>\r\n");
#line 36 "..\..\Areas\Config\Views\DeviceFlag\Create.cshtml"
}
#line default
#line hidden
}
}
}
#pragma warning restore 1591
@@ -0,0 +1,185 @@
@using Disco.Web.Areas.Config.Models.DeviceFlag;
@model ExportModel
@{
Authorization.RequireAny(Claims.Config.DeviceFlag.Export);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Flags", MVC.Config.DeviceFlag.Index(null), "Export");
var optionsMetadata = ModelMetadata.FromLambdaExpression(m => m.Options, ViewData);
var optionGroups = optionsMetadata.Properties.Where(p => p.ShortDisplayName != null && p.ModelType == typeof(bool) && p.PropertyName != "CurrentOnly")
.GroupBy(m => m.ShortDisplayName);
}
<div id="DeviceFlag_Export">
@using (Html.BeginForm(MVC.API.DeviceFlag.Export()))
{
<div id="DeviceFlag_Export_Scope" class="form" style="width: 570px">
<h2>Export Scope</h2>
<table>
<tr>
<th style="width: 150px">
Device Flags:
</th>
<td>
@foreach (var flag in Model.DeviceFlags)
{
<div>
<label>
<input type="checkbox" id="Options_DeviceFlagIds" name="Options.DeviceFlagIds" value="@flag.Id" @(((bool)Model.Options.DeviceFlagIds.Contains(flag.Id)) ? "checked " : null) />
<i class="fa fa-@(flag.Icon) fa-lg d-@(flag.IconColour)"></i>
<span>@flag.Name</span>
</label>
</div>
}
</td>
</tr>
<tr>
<th>@Html.LabelFor(m => m.Options.CurrentOnly)</th>
<td>
@Html.CheckBoxFor(m => m.Options.CurrentOnly)
<p>Uncheck to include all historical device flag assignments.</p>
</td>
</tr>
<tr>
<th>@Html.LabelFor(m => m.Options.Format)</th>
<td>
@Html.DropDownListFor(m => m.Options.Format, Enum.GetNames(typeof(Disco.Models.Exporting.ExportFormat)).Select(v => new SelectListItem() { Value = v, Text = v }))
</td>
</tr>
</table>
</div>
<div id="DeviceFlag_Export_Fields" class="form" style="width: 570px; margin-top: 15px;">
<h2>Export Fields <a id="DeviceFlag_Export_Fields_Defaults" href="#">(Defaults)</a></h2>
<table>
@foreach (var optionGroup in optionGroups)
{
var optionFields = optionGroup.ToList();
var itemsPerColumn = (int)Math.Ceiling((double)optionFields.Count / 2);
<tr>
<th style="width: 120px;">
@optionGroup.Key
@if (optionFields.Count > 2)
{
<span style="display: block;" class="select"><a class="selectAll" href="#">ALL</a> | <a class="selectNone" href="#">NONE</a></span>
}
</th>
<td>
<div class="DeviceFlag_Export_Fields_Group">
<table class="none">
<tr>
<td style="width: 50%">
<ul class="none">
@foreach (var optionItem in optionFields.Take(itemsPerColumn))
{
<li title="@optionItem.Description">
<input type="checkbox" id="Options_@optionItem.PropertyName" name="Options.@optionItem.PropertyName" value="true" @(((bool)optionItem.Model) ? "checked " : null)/><label for="Options_@optionItem.PropertyName">@optionItem.DisplayName</label></li>
}
</ul>
</td>
<td style="width: 50%">
<ul class="none">
@foreach (var optionItem in optionFields.Skip(itemsPerColumn))
{
<li title="@optionItem.Description">
<input type="checkbox" id="Options_@optionItem.PropertyName" name="Options.@optionItem.PropertyName" value="true" @(((bool)optionItem.Model) ? "checked " : null)/><label for="Options_@optionItem.PropertyName">@optionItem.DisplayName</label></li>
}
</ul>
</td>
</tr>
</table>
</div>
</td>
</tr>
}
</table>
</div>
<script>
$(function () {
var exportDefaultFields = ['Name', 'AddedDate', 'UserId', 'UserDisplayName', 'Comments'];
var $exportFields = $('#DeviceFlag_Export_Fields');
var $exportScope = $('#DeviceFlag_Export_Scope');
var $form = $exportScope.closest('form');
var $exportingDialog = null;
$exportFields.on('click', 'a.selectAll,a.selectNone', function () {
var $this = $(this);
$this.closest('tr').find('input').prop('checked', $this.is('.selectAll'));
return false;
});
$('#DeviceFlag_Export_Fields_Defaults').click(function () {
$exportFields.find('input').prop('checked', false);
$.each(exportDefaultFields, function (index, value) {
$('#Options_' + value).prop('checked', true);
});
return false;
});
// Submit Validation
function submitHandler() {
var exportFieldCount = $exportFields.find('input:checked').length;
if (exportFieldCount > 0) {
if ($exportingDialog == null) {
$exportingDialog = $('#DeviceFlag_Export_Exporting').dialog({
width: 400,
height: 164,
resizable: false,
modal: true,
autoOpen: false
});
}
$exportingDialog.dialog('open');
$form[0].submit();
}
else
alert('Select at least one field to export.');
}
$.validator.unobtrusive.parse($form);
$form.data("validator").settings.submitHandler = submitHandler;
$('#DeviceFlag_Export_Download_Dialog').dialog({
width: 400,
height: 164,
resizable: false,
modal: true,
autoOpen: true
});
$('#DeviceFlag_Export_Button').click(function () {
$form.submit();
});
});
</script>
}
</div>
@if (Model.ExportSessionId != null)
{
<div id="DeviceFlag_Export_Download_Dialog" class="dialog" title="Export Device Flags">
<h4>@Model.ExportSessionResult.RecordCount record@(Model.ExportSessionResult.RecordCount != 1 ? "s" : null) were successfully exported.</h4>
<a href="@Url.Action(MVC.API.DeviceFlag.ExportRetrieve(Model.ExportSessionId))" class="button"><i class="fa fa-download fa-lg"></i>Download Device Flag Export</a>
</div>
<script>
$(function () {
$('#DeviceFlag_Export_Download_Dialog')
.dialog({
width: 400,
height: 164,
resizable: false,
modal: true,
autoOpen: true
});
});
</script>
}
<div id="DeviceFlag_Export_Exporting" class="dialog" title="Exporting Device Flags...">
<h4><i class="fa fa-lg fa-cog fa-spin" title="Please Wait"></i>Exporting device flags...</h4>
</div>
<div class="actionBar">
<a id="DeviceFlag_Export_Button" href="#" class="button">Export Device Flags</a>
</div>
@@ -0,0 +1,707 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Areas.Config.Views.DeviceFlag
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Helpers;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using System.Web.Mvc.Html;
using System.Web.Routing;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using Disco;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
#line 1 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
using Disco.Web.Areas.Config.Models.DeviceFlag;
#line default
#line hidden
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/DeviceFlag/Export.cshtml")]
public partial class Export : Disco.Services.Web.WebViewPage<ExportModel>
{
public Export()
{
}
public override void Execute()
{
#line 3 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
Authorization.RequireAny(Claims.Config.DeviceFlag.Export);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Flags", MVC.Config.DeviceFlag.Index(null), "Export");
var optionsMetadata = ModelMetadata.FromLambdaExpression(m => m.Options, ViewData);
var optionGroups = optionsMetadata.Properties.Where(p => p.ShortDisplayName != null && p.ModelType == typeof(bool) && p.PropertyName != "CurrentOnly")
.GroupBy(m => m.ShortDisplayName);
#line default
#line hidden
WriteLiteral("\r\n<div");
WriteLiteral(" id=\"DeviceFlag_Export\"");
WriteLiteral(">\r\n");
#line 13 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
#line default
#line hidden
#line 13 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
using (Html.BeginForm(MVC.API.DeviceFlag.Export()))
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" id=\"DeviceFlag_Export_Scope\"");
WriteLiteral(" class=\"form\"");
WriteLiteral(" style=\"width: 570px\"");
WriteLiteral(">\r\n <h2>Export Scope</h2>\r\n <table>\r\n <tr>\r\n" +
" <th");
WriteLiteral(" style=\"width: 150px\"");
WriteLiteral(">\r\n Device Flags:\r\n </th>\r\n " +
" <td>\r\n");
#line 23 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
#line default
#line hidden
#line 23 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
foreach (var flag in Model.DeviceFlags)
{
#line default
#line hidden
WriteLiteral(" <div>\r\n <label>\r\n " +
" <input");
WriteLiteral(" type=\"checkbox\"");
WriteLiteral(" id=\"Options_DeviceFlagIds\"");
WriteLiteral(" name=\"Options.DeviceFlagIds\"");
WriteAttribute("value", Tuple.Create(" value=\"", 1252), Tuple.Create("\"", 1268)
#line 27 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
, Tuple.Create(Tuple.Create("", 1260), Tuple.Create<System.Object, System.Int32>(flag.Id
#line default
#line hidden
, 1260), false)
);
WriteLiteral(" ");
#line 27 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
Write(((bool)Model.Options.DeviceFlagIds.Contains(flag.Id)) ? "checked " : null);
#line default
#line hidden
WriteLiteral(" />\r\n <i");
WriteAttribute("class", Tuple.Create(" class=\"", 1389), Tuple.Create("\"", 1442)
, Tuple.Create(Tuple.Create("", 1397), Tuple.Create("fa", 1397), true)
, Tuple.Create(Tuple.Create(" ", 1399), Tuple.Create("fa-", 1400), true)
#line 28 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
, Tuple.Create(Tuple.Create("", 1403), Tuple.Create<System.Object, System.Int32>(flag.Icon
#line default
#line hidden
, 1403), false)
, Tuple.Create(Tuple.Create(" ", 1415), Tuple.Create("fa-lg", 1416), true)
, Tuple.Create(Tuple.Create(" ", 1421), Tuple.Create("d-", 1422), true)
#line 28 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
, Tuple.Create(Tuple.Create("", 1424), Tuple.Create<System.Object, System.Int32>(flag.IconColour
#line default
#line hidden
, 1424), false)
);
WriteLiteral("></i>\r\n <span>");
#line 29 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
Write(flag.Name);
#line default
#line hidden
WriteLiteral("</span>\r\n </label>\r\n </" +
"div>\r\n");
#line 32 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n </tr>\r\n <tr>\r\n " +
" <th>");
#line 36 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
Write(Html.LabelFor(m => m.Options.CurrentOnly));
#line default
#line hidden
WriteLiteral("</th>\r\n <td>\r\n");
WriteLiteral(" ");
#line 38 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
Write(Html.CheckBoxFor(m => m.Options.CurrentOnly));
#line default
#line hidden
WriteLiteral("\r\n <p>Uncheck to include all historical device flag assign" +
"ments.</p>\r\n </td>\r\n </tr>\r\n <t" +
"r>\r\n <th>");
#line 43 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
Write(Html.LabelFor(m => m.Options.Format));
#line default
#line hidden
WriteLiteral("</th>\r\n <td>\r\n");
WriteLiteral(" ");
#line 45 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
Write(Html.DropDownListFor(m => m.Options.Format, Enum.GetNames(typeof(Disco.Models.Exporting.ExportFormat)).Select(v => new SelectListItem() { Value = v, Text = v })));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n </tr>\r\n </table>\r\n " +
" </div>\r\n");
WriteLiteral(" <div");
WriteLiteral(" id=\"DeviceFlag_Export_Fields\"");
WriteLiteral(" class=\"form\"");
WriteLiteral(" style=\"width: 570px; margin-top: 15px;\"");
WriteLiteral(">\r\n <h2>Export Fields <a");
WriteLiteral(" id=\"DeviceFlag_Export_Fields_Defaults\"");
WriteLiteral(" href=\"#\"");
WriteLiteral(">(Defaults)</a></h2>\r\n <table>\r\n");
#line 53 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
#line default
#line hidden
#line 53 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
foreach (var optionGroup in optionGroups)
{
var optionFields = optionGroup.ToList();
var itemsPerColumn = (int)Math.Ceiling((double)optionFields.Count / 2);
#line default
#line hidden
WriteLiteral(" <tr>\r\n <th");
WriteLiteral(" style=\"width: 120px;\"");
WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 59 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
Write(optionGroup.Key);
#line default
#line hidden
WriteLiteral("\r\n");
#line 60 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
#line default
#line hidden
#line 60 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
if (optionFields.Count > 2)
{
#line default
#line hidden
WriteLiteral(" <span");
WriteLiteral(" style=\"display: block;\"");
WriteLiteral(" class=\"select\"");
WriteLiteral("><a");
WriteLiteral(" class=\"selectAll\"");
WriteLiteral(" href=\"#\"");
WriteLiteral(">ALL</a> | <a");
WriteLiteral(" class=\"selectNone\"");
WriteLiteral(" href=\"#\"");
WriteLiteral(">NONE</a></span>\r\n");
#line 63 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
}
#line default
#line hidden
WriteLiteral(" </th>\r\n <td>\r\n " +
" <div");
WriteLiteral(" class=\"DeviceFlag_Export_Fields_Group\"");
WriteLiteral(">\r\n <table");
WriteLiteral(" class=\"none\"");
WriteLiteral(">\r\n <tr>\r\n " +
" <td");
WriteLiteral(" style=\"width: 50%\"");
WriteLiteral(">\r\n <ul");
WriteLiteral(" class=\"none\"");
WriteLiteral(">\r\n");
#line 71 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
#line default
#line hidden
#line 71 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
foreach (var optionItem in optionFields.Take(itemsPerColumn))
{
#line default
#line hidden
WriteLiteral(" <li");
WriteAttribute("title", Tuple.Create(" title=\"", 3832), Tuple.Create("\"", 3863)
#line 73 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
, Tuple.Create(Tuple.Create("", 3840), Tuple.Create<System.Object, System.Int32>(optionItem.Description
#line default
#line hidden
, 3840), false)
);
WriteLiteral(">\r\n <input");
WriteLiteral(" type=\"checkbox\"");
WriteAttribute("id", Tuple.Create(" id=\"", 3945), Tuple.Create("\"", 3982)
, Tuple.Create(Tuple.Create("", 3950), Tuple.Create("Options_", 3950), true)
#line 74 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
, Tuple.Create(Tuple.Create("", 3958), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
#line default
#line hidden
, 3958), false)
);
WriteAttribute("name", Tuple.Create(" name=\"", 3983), Tuple.Create("\"", 4022)
, Tuple.Create(Tuple.Create("", 3990), Tuple.Create("Options.", 3990), true)
#line 74 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
, Tuple.Create(Tuple.Create("", 3998), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
#line default
#line hidden
, 3998), false)
);
WriteLiteral(" value=\"true\"");
WriteLiteral(" ");
#line 74 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
Write(((bool)optionItem.Model) ? "checked " : null);
#line default
#line hidden
WriteLiteral("/><label");
WriteAttribute("for", Tuple.Create(" for=\"", 4092), Tuple.Create("\"", 4130)
, Tuple.Create(Tuple.Create("", 4098), Tuple.Create("Options_", 4098), true)
#line 74 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
, Tuple.Create(Tuple.Create("", 4106), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
#line default
#line hidden
, 4106), false)
);
WriteLiteral(">");
#line 74 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
Write(optionItem.DisplayName);
#line default
#line hidden
WriteLiteral("</label></li>\r\n");
#line 75 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
}
#line default
#line hidden
WriteLiteral(" </ul>\r\n " +
" </td>\r\n <td");
WriteLiteral(" style=\"width: 50%\"");
WriteLiteral(">\r\n <ul");
WriteLiteral(" class=\"none\"");
WriteLiteral(">\r\n");
#line 80 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
#line default
#line hidden
#line 80 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
foreach (var optionItem in optionFields.Skip(itemsPerColumn))
{
#line default
#line hidden
WriteLiteral(" <li");
WriteAttribute("title", Tuple.Create(" title=\"", 4665), Tuple.Create("\"", 4696)
#line 82 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
, Tuple.Create(Tuple.Create("", 4673), Tuple.Create<System.Object, System.Int32>(optionItem.Description
#line default
#line hidden
, 4673), false)
);
WriteLiteral(">\r\n <input");
WriteLiteral(" type=\"checkbox\"");
WriteAttribute("id", Tuple.Create(" id=\"", 4778), Tuple.Create("\"", 4815)
, Tuple.Create(Tuple.Create("", 4783), Tuple.Create("Options_", 4783), true)
#line 83 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
, Tuple.Create(Tuple.Create("", 4791), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
#line default
#line hidden
, 4791), false)
);
WriteAttribute("name", Tuple.Create(" name=\"", 4816), Tuple.Create("\"", 4855)
, Tuple.Create(Tuple.Create("", 4823), Tuple.Create("Options.", 4823), true)
#line 83 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
, Tuple.Create(Tuple.Create("", 4831), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
#line default
#line hidden
, 4831), false)
);
WriteLiteral(" value=\"true\"");
WriteLiteral(" ");
#line 83 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
Write(((bool)optionItem.Model) ? "checked " : null);
#line default
#line hidden
WriteLiteral("/><label");
WriteAttribute("for", Tuple.Create(" for=\"", 4925), Tuple.Create("\"", 4963)
, Tuple.Create(Tuple.Create("", 4931), Tuple.Create("Options_", 4931), true)
#line 83 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
, Tuple.Create(Tuple.Create("", 4939), Tuple.Create<System.Object, System.Int32>(optionItem.PropertyName
#line default
#line hidden
, 4939), false)
);
WriteLiteral(">");
#line 83 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
Write(optionItem.DisplayName);
#line default
#line hidden
WriteLiteral("</label></li>\r\n");
#line 84 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
}
#line default
#line hidden
WriteLiteral(@" </ul>
</td>
</tr>
</table>
</div>
</td>
</tr>
");
#line 92 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
}
#line default
#line hidden
WriteLiteral(" </table>\r\n </div>\r\n");
WriteLiteral(" <script>\r\n $(function () {\r\n var exportDefaultF" +
"ields = [\'Name\', \'AddedDate\', \'UserId\', \'UserDisplayName\', \'Comments\'];\r\n " +
" var $exportFields = $(\'#DeviceFlag_Export_Fields\');\r\n va" +
"r $exportScope = $(\'#DeviceFlag_Export_Scope\');\r\n var $form = $ex" +
"portScope.closest(\'form\');\r\n var $exportingDialog = null;\r\n\r\n " +
" $exportFields.on(\'click\', \'a.selectAll,a.selectNone\', function () {\r" +
"\n var $this = $(this);\r\n\r\n $this.closest(\'" +
"tr\').find(\'input\').prop(\'checked\', $this.is(\'.selectAll\'));\r\n\r\n " +
" return false;\r\n });\r\n\r\n $(\'#DeviceFlag_Export_F" +
"ields_Defaults\').click(function () {\r\n\r\n $exportFields.find(\'" +
"input\').prop(\'checked\', false);\r\n\r\n $.each(exportDefaultField" +
"s, function (index, value) {\r\n $(\'#Options_\' + value).pro" +
"p(\'checked\', true);\r\n });\r\n\r\n return false" +
";\r\n });\r\n\r\n // Submit Validation\r\n " +
"function submitHandler() {\r\n var exportFieldCount = $exportFi" +
"elds.find(\'input:checked\').length;\r\n\r\n if (exportFieldCount >" +
" 0) {\r\n\r\n if ($exportingDialog == null) {\r\n " +
" $exportingDialog = $(\'#DeviceFlag_Export_Exporting\').dialog({\r\n " +
" width: 400,\r\n height" +
": 164,\r\n resizable: false,\r\n " +
" modal: true,\r\n autoOpen: false\r\n " +
" });\r\n }\r\n $e" +
"xportingDialog.dialog(\'open\');\r\n\r\n $form[0].submit();\r\n " +
" }\r\n else\r\n alert(\'Se" +
"lect at least one field to export.\');\r\n }\r\n $.vali" +
"dator.unobtrusive.parse($form);\r\n $form.data(\"validator\").setting" +
"s.submitHandler = submitHandler;\r\n\r\n $(\'#DeviceFlag_Export_Downlo" +
"ad_Dialog\').dialog({\r\n width: 400,\r\n heigh" +
"t: 164,\r\n resizable: false,\r\n modal: true," +
"\r\n autoOpen: true\r\n });\r\n $(\'#D" +
"eviceFlag_Export_Button\').click(function () {\r\n $form.submit(" +
");\r\n });\r\n });\r\n </script>\r\n");
#line 159 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
}
#line default
#line hidden
WriteLiteral("</div>\r\n");
#line 161 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
if (Model.ExportSessionId != null)
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" id=\"DeviceFlag_Export_Download_Dialog\"");
WriteLiteral(" class=\"dialog\"");
WriteLiteral(" title=\"Export Device Flags\"");
WriteLiteral(">\r\n <h4>");
#line 164 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
Write(Model.ExportSessionResult.RecordCount);
#line default
#line hidden
WriteLiteral(" record");
#line 164 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
Write(Model.ExportSessionResult.RecordCount != 1 ? "s" : null);
#line default
#line hidden
WriteLiteral(" were successfully exported.</h4>\r\n <a");
WriteAttribute("href", Tuple.Create(" href=\"", 8250), Tuple.Create("\"", 8326)
#line 165 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
, Tuple.Create(Tuple.Create("", 8257), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.DeviceFlag.ExportRetrieve(Model.ExportSessionId))
#line default
#line hidden
, 8257), false)
);
WriteLiteral(" class=\"button\"");
WriteLiteral("><i");
WriteLiteral(" class=\"fa fa-download fa-lg\"");
WriteLiteral("></i>Download Device Flag Export</a>\r\n </div>\r\n");
WriteLiteral(@" <script>
$(function () {
$('#DeviceFlag_Export_Download_Dialog')
.dialog({
width: 400,
height: 164,
resizable: false,
modal: true,
autoOpen: true
});
});
</script>
");
#line 179 "..\..\Areas\Config\Views\DeviceFlag\Export.cshtml"
}
#line default
#line hidden
WriteLiteral("<div");
WriteLiteral(" id=\"DeviceFlag_Export_Exporting\"");
WriteLiteral(" class=\"dialog\"");
WriteLiteral(" title=\"Exporting Device Flags...\"");
WriteLiteral(">\r\n <h4><i");
WriteLiteral(" class=\"fa fa-lg fa-cog fa-spin\"");
WriteLiteral(" title=\"Please Wait\"");
WriteLiteral("></i>Exporting device flags...</h4>\r\n</div>\r\n<div");
WriteLiteral(" class=\"actionBar\"");
WriteLiteral(">\r\n <a");
WriteLiteral(" id=\"DeviceFlag_Export_Button\"");
WriteLiteral(" href=\"#\"");
WriteLiteral(" class=\"button\"");
WriteLiteral(">Export Device Flags</a>\r\n</div>\r\n");
}
}
}
#pragma warning restore 1591
@@ -0,0 +1,78 @@
@model Disco.Web.Areas.Config.Models.DeviceFlag.IndexModel
@{
Authorization.Require(Claims.Config.DeviceFlag.Show);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Flags");
var showTags = Model.DeviceFlags.Keys.Any(i => i.DevicesLinkedGroup != null || i.DeviceUsersLinkedGroup != null ||
i.OnAssignmentExpression != null || i.OnUnassignmentExpression != null);
}
<div id="Config_DeviceFlags_Index">
@if (Model.DeviceFlags.Count == 0)
{
<div class="form" style="width: 450px; padding: 100px 0;">
<h2>No device flags are configured</h2>
</div>
}
else
{
<table class="tableData">
<tr>
<th>Name</th>
<th>Description</th>
<th>Current&nbsp;Assignments</th>
@if (showTags)
{
<th>&nbsp;</th>
}
</tr>
@foreach (var pair in Model.DeviceFlags.OrderBy(i => i.Key.Name))
{
var item = pair.Key;
var assignmentCount = pair.Value;
<tr>
<td>
<a href="@Url.Action(MVC.Config.DeviceFlag.Index(item.Id))">
<i class="fa fa-@(item.Icon) fa-lg d-@(item.IconColour)"></i>
@item.Name
</a>
</td>
<td>
@if (string.IsNullOrWhiteSpace(item.Description))
{
<span class="smallMessage">&lt;none&gt;</span>
}
else
{
@item.Description.ToHtmlComment()
}
</td>
<td>
@assignmentCount.ToString("N0")
</td>
@if (showTags)
{
<td>
@if (item.DevicesLinkedGroup != null || item.DeviceUsersLinkedGroup != null)
{
<i class="fa fa-link fa-lg success" title="Is Linked"></i>
}
@if (item.OnAssignmentExpression != null || item.OnUnassignmentExpression != null)
{
<i class="fa fa-bolt fa-lg alert" title="Has Expressions"></i>
}
</td>
}
</tr>
}
</table>
}
<div class="actionBar">
@if (Authorization.Has(Claims.Config.DeviceFlag.Export) && Model.DeviceFlags.Count > 0)
{
@Html.ActionLinkButton("Export", MVC.Config.DeviceFlag.Export())
}
@if (Authorization.Has(Claims.Config.DeviceFlag.Create))
{
@Html.ActionLinkButton("Create Device Flag", MVC.Config.DeviceFlag.Create())
}
</div>
</div>
@@ -0,0 +1,410 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Areas.Config.Views.DeviceFlag
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Helpers;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using System.Web.Mvc.Html;
using System.Web.Routing;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using Disco;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Web;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Areas/Config/Views/DeviceFlag/Index.cshtml")]
public partial class Index : Disco.Services.Web.WebViewPage<Disco.Web.Areas.Config.Models.DeviceFlag.IndexModel>
{
public Index()
{
}
public override void Execute()
{
#line 2 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
Authorization.Require(Claims.Config.DeviceFlag.Show);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Flags");
var showTags = Model.DeviceFlags.Keys.Any(i => i.DevicesLinkedGroup != null || i.DeviceUsersLinkedGroup != null ||
i.OnAssignmentExpression != null || i.OnUnassignmentExpression != null);
#line default
#line hidden
WriteLiteral("\r\n<div");
WriteLiteral(" id=\"Config_DeviceFlags_Index\"");
WriteLiteral(">\r\n");
#line 9 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
#line default
#line hidden
#line 9 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
if (Model.DeviceFlags.Count == 0)
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"form\"");
WriteLiteral(" style=\"width: 450px; padding: 100px 0;\"");
WriteLiteral(">\r\n <h2>No device flags are configured</h2>\r\n </div>\r\n");
#line 14 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
}
else
{
#line default
#line hidden
WriteLiteral(" <table");
WriteLiteral(" class=\"tableData\"");
WriteLiteral(">\r\n <tr>\r\n <th>Name</th>\r\n <th>Descripti" +
"on</th>\r\n <th>Current&nbsp;Assignments</th>\r\n");
#line 22 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
#line default
#line hidden
#line 22 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
if (showTags)
{
#line default
#line hidden
WriteLiteral(" <th>&nbsp;</th>\r\n");
#line 25 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" </tr>\r\n");
#line 27 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
#line default
#line hidden
#line 27 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
foreach (var pair in Model.DeviceFlags.OrderBy(i => i.Key.Name))
{
var item = pair.Key;
var assignmentCount = pair.Value;
#line default
#line hidden
WriteLiteral(" <tr>\r\n <td>\r\n <a");
WriteAttribute("href", Tuple.Create(" href=\"", 1229), Tuple.Create("\"", 1285)
#line 33 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
, Tuple.Create(Tuple.Create("", 1236), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.Config.DeviceFlag.Index(item.Id))
#line default
#line hidden
, 1236), false)
);
WriteLiteral(">\r\n <i");
WriteAttribute("class", Tuple.Create(" class=\"", 1319), Tuple.Create("\"", 1372)
, Tuple.Create(Tuple.Create("", 1327), Tuple.Create("fa", 1327), true)
, Tuple.Create(Tuple.Create(" ", 1329), Tuple.Create("fa-", 1330), true)
#line 34 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
, Tuple.Create(Tuple.Create("", 1333), Tuple.Create<System.Object, System.Int32>(item.Icon
#line default
#line hidden
, 1333), false)
, Tuple.Create(Tuple.Create(" ", 1345), Tuple.Create("fa-lg", 1346), true)
, Tuple.Create(Tuple.Create(" ", 1351), Tuple.Create("d-", 1352), true)
#line 34 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
, Tuple.Create(Tuple.Create("", 1354), Tuple.Create<System.Object, System.Int32>(item.IconColour
#line default
#line hidden
, 1354), false)
);
WriteLiteral("></i>\r\n");
WriteLiteral(" ");
#line 35 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
Write(item.Name);
#line default
#line hidden
WriteLiteral("\r\n </a>\r\n </td>\r\n <t" +
"d>\r\n");
#line 39 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
#line default
#line hidden
#line 39 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
if (string.IsNullOrWhiteSpace(item.Description))
{
#line default
#line hidden
WriteLiteral(" <span");
WriteLiteral(" class=\"smallMessage\"");
WriteLiteral(">&lt;none&gt;</span>\r\n");
#line 42 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
}
else
{
#line default
#line hidden
#line 45 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
Write(item.Description.ToHtmlComment());
#line default
#line hidden
#line 45 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 49 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
Write(assignmentCount.ToString("N0"));
#line default
#line hidden
WriteLiteral("\r\n </td>\r\n");
#line 51 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
#line default
#line hidden
#line 51 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
if (showTags)
{
#line default
#line hidden
WriteLiteral(" <td>\r\n");
#line 54 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
#line default
#line hidden
#line 54 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
if (item.DevicesLinkedGroup != null || item.DeviceUsersLinkedGroup != null)
{
#line default
#line hidden
WriteLiteral(" <i");
WriteLiteral(" class=\"fa fa-link fa-lg success\"");
WriteLiteral(" title=\"Is Linked\"");
WriteLiteral("></i>\r\n");
#line 57 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" ");
#line 58 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
if (item.OnAssignmentExpression != null || item.OnUnassignmentExpression != null)
{
#line default
#line hidden
WriteLiteral(" <i");
WriteLiteral(" class=\"fa fa-bolt fa-lg alert\"");
WriteLiteral(" title=\"Has Expressions\"");
WriteLiteral("></i>\r\n");
#line 61 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n");
#line 63 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" </tr>\r\n");
#line 65 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" </table>\r\n");
#line 67 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
}
#line default
#line hidden
WriteLiteral("<div");
WriteLiteral(" class=\"actionBar\"");
WriteLiteral(">\r\n");
#line 69 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
#line default
#line hidden
#line 69 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
if (Authorization.Has(Claims.Config.DeviceFlag.Export) && Model.DeviceFlags.Count > 0)
{
#line default
#line hidden
#line 71 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
Write(Html.ActionLinkButton("Export", MVC.Config.DeviceFlag.Export()));
#line default
#line hidden
#line 71 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
}
#line default
#line hidden
WriteLiteral(" ");
#line 73 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
if (Authorization.Has(Claims.Config.DeviceFlag.Create))
{
#line default
#line hidden
#line 75 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
Write(Html.ActionLinkButton("Create Device Flag", MVC.Config.DeviceFlag.Create()));
#line default
#line hidden
#line 75 "..\..\Areas\Config\Views\DeviceFlag\Index.cshtml"
}
#line default
#line hidden
WriteLiteral("</div>\r\n</div>\r\n");
}
}
}
#pragma warning restore 1591
@@ -0,0 +1,590 @@
@model Disco.Web.Areas.Config.Models.DeviceFlag.ShowModel
@using Disco.Services.Interop.ActiveDirectory;
@using Disco.Services.Devices.DeviceFlags;
@using Disco.Web.Areas.Config.Models.Shared;
@{
Authorization.Require(Claims.Config.DeviceFlag.Show);
ViewBag.Title = Html.ToBreadcrumb("Configuration", MVC.Config.Config.Index(), "Device Flags", MVC.Config.DeviceFlag.Index(null), Model.DeviceFlag.ToString());
var canConfig = Authorization.Has(Claims.Config.DeviceFlag.Configure);
var canDelete = Authorization.Has(Claims.Config.DeviceFlag.Delete);
var canBulkAssignment = Authorization.HasAll(Claims.Device.Actions.AddFlags, Claims.Device.Actions.RemoveFlags, Claims.Device.ShowFlagAssignments);
var canShowDevices = Model.CurrentAssignmentCount > 0 && Authorization.HasAll(Claims.Device.Search, Claims.Device.ShowFlagAssignments);
var canExportCurrent = Model.CurrentAssignmentCount > 0 && Authorization.Has(Claims.Config.DeviceFlag.Export);
var canExportAll = Model.TotalAssignmentCount > 0 && Authorization.Has(Claims.Config.DeviceFlag.Export);
var hideAdvanced =
Model.DeviceFlag.DevicesLinkedGroup == null &&
Model.DeviceFlag.DeviceUsersLinkedGroup == null &&
Model.DeviceFlag.OnAssignmentExpression == null &&
Model.DeviceFlag.OnUnassignmentExpression == null;
Html.BundleDeferred("~/ClientScripts/Modules/Disco-PropertyChangeHelpers");
}
<div id="Config_DeviceFlags_Show" class="form@(hideAdvanced ? " Config_HideAdvanced" : null)" style="width: 550px">
<table>
<tr>
<th style="width: 150px">
Id:
</th>
<td>
@Html.DisplayFor(model => model.DeviceFlag.Id)
</td>
</tr>
<tr>
<th>
Name:
</th>
<td>
@if (canConfig)
{@Html.EditorFor(model => model.DeviceFlag.Name)
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
$(function () {
document.DiscoFunctions.PropertyChangeHelper(
$('#DeviceFlag_Name'),
'Invalid Name',
'@(Url.Action(MVC.API.DeviceFlag.UpdateName(Model.DeviceFlag.Id)))',
'FlagName'
);
});
</script>
}
else
{
@Model.DeviceFlag.Name
}
</td>
</tr>
<tr>
<th>
Description:
</th>
<td>
@if (canConfig)
{@Html.EditorFor(model => model.DeviceFlag.Description)
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
$(function () {
document.DiscoFunctions.PropertyChangeHelper(
$('#DeviceFlag_Description'),
'Invalid Description',
'@(Url.Action(MVC.API.DeviceFlag.UpdateDescription(Model.DeviceFlag.Id)))',
'Description'
);
});
</script>
}
else
{
<pre>
@if (string.IsNullOrEmpty(Model.DeviceFlag.Description))
{
<text>&lt;None&gt;</text>
}
else
{
@Model.DeviceFlag.Description.ToHtmlComment()
}
</pre>
}
</td>
</tr>
<tr>
<th>
Statistics:
</th>
<td>
<div><strong>@Model.CurrentAssignmentCount device@(Model.CurrentAssignmentCount != 1 ? "s" : null) currently assigned</strong></div>
<div>@Model.TotalAssignmentCount total device historical assignment@(Model.TotalAssignmentCount != 1 ? "s" : null)</div>
</td>
</tr>
<tr>
<th>
Icon:
</th>
<td>
<i id="Config_DeviceFlags_Icon" data-icon="@(Model.DeviceFlag.Icon)" data-colour="@(Model.DeviceFlag.IconColour)" class="fa fa-@(Model.DeviceFlag.Icon) fa-4x d-@(Model.DeviceFlag.IconColour)"></i>
@if (canConfig)
{
<div>
<a id="Config_DeviceFlags_Icon_Update" href="#" class="button small">Update</a>
<div id="Config_DeviceFlags_Icon_Update_Dialog" class="dialog" title="Device Flag Icon">
<div>
<div class="colours">
@foreach (var colour in Model.ThemeColours)
{
<i data-colour="@(colour.Key)" class="fa fa-square d-@(colour.Key)" title="@colour.Value"></i>
}
</div>
<div class="icons">
@foreach (var icon in Model.Icons)
{
<i data-icon="@(icon.Key)" class="fa fa-@(icon.Key)" title="@icon.Value"></i>
}
</div>
</div>
</div>
<script>
(function () {
var dialog, icon, colours, icons;
function showDialog() {
if (!dialog) {
dialog = $('#Config_DeviceFlags_Icon_Update_Dialog').dialog({
resizable: false,
modal: true,
autoOpen: false,
width: 1000,
buttons: {
"Save": save,
Cancel: cancel
}
});
colours = dialog.find('.colours');
icons = dialog.find('.icons');
colours.on('click', 'i', selectColour);
icons.on('click', 'i', selectIcon);
}
colours.find('i[data-colour="' + icon.attr('data-colour') + '"]').each(selectColour);
icons.find('i[data-icon="' + icon.attr('data-icon') + '"]').each(selectIcon);
dialog.dialog('open');
return false;
}
function selectColour() {
var $this = $(this),
colourCode = $this.attr('data-colour'),
previousColourCode = icons.attr('data-colour');
colours.find('i').removeClass('selected fa-check-square').addClass('fa-square');
$this.removeClass('fa-square').addClass('fa-check-square selected');
if (previousColourCode)
icons.removeClass('d-' + previousColourCode);
icons.attr('data-colour', colourCode)
icons.addClass('d-' + colourCode);
}
function selectIcon() {
var $this = $(this),
iconCode = $this.attr('data-icon');
icons.find('i').removeClass('selected');
$this.addClass('selected');
}
function save() {
var url = '@(Url.Action(MVC.API.DeviceFlag.UpdateIconAndColour(id: Model.DeviceFlag.Id, redirect: true)))',
data = {
Icon: icons.find('i.selected').attr('data-icon'),
IconColour: colours.find('i.selected').attr('data-colour')
};
window.location.href = url + '&' + $.param(data);
dialog.dialog("disable");
dialog.dialog("option", "buttons", null);
}
function cancel() {
$(this).dialog("close");
}
$(function () {
icon = $('#Config_DeviceFlags_Icon');
$('#Config_DeviceFlags_Icon_Update').click(showDialog);
});
}());
</script>
</div>
}
</td>
</tr>
@if (hideAdvanced)
{
<tr>
<td colspan="2" style="text-align: right;">
<button id="Config_HideAdvanced_Show" class="button small">Show Advanced Options</button>
<script>
$(function () {
$('#Config_HideAdvanced_Show').click(function () {
var $this = $(this);
$this.closest('.Config_HideAdvanced').removeClass('Config_HideAdvanced');
$this.closest('tr').remove();
});
});
</script>
</td>
</tr>
}
<tr class="Config_HideAdvanced_Item">
<th>
On Assignment<br />Expression:
</th>
<td>
@if (canConfig)
{
@Html.EditorFor(model => model.DeviceFlag.OnAssignmentExpression)
@AjaxHelpers.AjaxRemove()
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
$(function () {
var field = $('#DeviceFlag_OnAssignmentExpression');
var fieldRemove = field.next('.ajaxRemove');
var fieldOriginalWidth, fieldOriginalHeight;
document.DiscoFunctions.PropertyChangeHelper(
field,
'None',
'@Url.Action(MVC.API.DeviceFlag.UpdateOnAssignmentExpression(Model.DeviceFlag.Id))',
'OnAssignmentExpression'
);
field.focus(function () {
fieldOriginalWidth = field.width();
fieldOriginalHeight = field.height();
field.css('overflow', 'visible').animate({ width: field.parent().width() - 42, height: 75 }, 200);
}).blur(function () {
field.css('overflow', 'hidden').animate({ width: fieldOriginalWidth, height: fieldOriginalHeight }, 200);
}).change(function () {
if (!!field.val()) {
fieldRemove.show();
} else {
fieldRemove.hide();
}
}).attr('placeholder', 'None').attr('spellcheck', 'false');
fieldRemove.click(function () {
field.val('').change();
});
if (!!field.val()) {
fieldRemove.show();
} else {
fieldRemove.hide();
}
});
</script>
}
else
{
if (string.IsNullOrWhiteSpace(Model.DeviceFlag.OnAssignmentExpression))
{
<span class="smallMessage">&lt;None Specified&gt;</span>
}
else
{
<div class="code">
@Model.DeviceFlag.OnAssignmentExpression
</div>
}
}
<div class="info-box">
<p class="fa-p">
<i class="fa fa-fw fa-info-circle"></i>This expression will be evaluated whenever the flag is assigned to a device. The output of the expression will be shown with the flag assignment.
</p>
</div>
</td>
</tr>
<tr class="Config_HideAdvanced_Item">
<th>
On Unassignment<br />Expression:
</th>
<td>
@if (canConfig)
{
@Html.EditorFor(model => model.DeviceFlag.OnUnassignmentExpression)
@AjaxHelpers.AjaxRemove()
@AjaxHelpers.AjaxSave()
@AjaxHelpers.AjaxLoader()
<script type="text/javascript">
$(function () {
var field = $('#DeviceFlag_OnUnassignmentExpression');
var fieldRemove = field.next('.ajaxRemove');
var fieldOriginalWidth, fieldOriginalHeight;
document.DiscoFunctions.PropertyChangeHelper(
field,
'None',
'@Url.Action(MVC.API.DeviceFlag.UpdateOnUnassignmentExpression(Model.DeviceFlag.Id))',
'OnUnassignmentExpression'
);
field.focus(function () {
fieldOriginalWidth = field.width();
fieldOriginalHeight = field.height();
field.css('overflow', 'visible').animate({ width: field.parent().width() - 42, height: 75 }, 200);
}).blur(function () {
field.css('overflow', 'hidden').animate({ width: fieldOriginalWidth, height: fieldOriginalHeight }, 200);
}).change(function () {
if (!!field.val()) {
fieldRemove.show();
} else {
fieldRemove.hide();
}
}).attr('placeholder', 'None').attr('spellcheck', 'false');
fieldRemove.click(function () {
field.val('').change();
});
if (!!field.val()) {
fieldRemove.show();
} else {
fieldRemove.hide();
}
});
</script>
}
else
{
if (string.IsNullOrWhiteSpace(Model.DeviceFlag.OnUnassignmentExpression))
{
<span class="smallMessage">&lt;None Specified&gt;</span>
}
else
{
<div class="code">
@Model.DeviceFlag.OnUnassignmentExpression
</div>
}
}
<div class="info-box">
<p class="fa-p">
<i class="fa fa-fw fa-info-circle"></i>This expression will be evaluated whenever the flag is removed from a device. The output of the expression will be shown with the flag assignment.
</p>
</div>
</td>
</tr>
<tr class="Config_HideAdvanced_Item">
<th>
Linked Groups:
</th>
<td>
<div>
@Html.Partial(MVC.Config.Shared.Views.LinkedGroupInstance, new LinkedGroupModel()
{
CanConfigure = canConfig,
CategoryDescription = DeviceFlagDevicesManagedGroup.GetCategoryDescription(Model.DeviceFlag),
Description = DeviceFlagDevicesManagedGroup.GetDescription(Model.DeviceFlag),
ManagedGroup = Model.DevicesLinkedGroup,
IncludeFilterBeginDate = true,
UpdateUrl = Url.Action(MVC.API.DeviceFlag.UpdateDevicesLinkedGroup(Model.DeviceFlag.Id, redirect: true))
})
@Html.Partial(MVC.Config.Shared.Views.LinkedGroupInstance, new LinkedGroupModel()
{
CanConfigure = canConfig,
CategoryDescription = DeviceFlagDeviceAssignedUsersManagedGroup.GetCategoryDescription(Model.DeviceFlag),
Description = DeviceFlagDeviceAssignedUsersManagedGroup.GetDescription(Model.DeviceFlag),
ManagedGroup = Model.AssignedUserLinkedGroup,
IncludeFilterBeginDate = true,
UpdateUrl = Url.Action(MVC.API.DeviceFlag.UpdateAssignedUserLinkedGroup(Model.DeviceFlag.Id, redirect: true))
})
@if (canConfig)
{
@Html.Partial(MVC.Config.Shared.Views.LinkedGroupShared)
}
</div>
</td>
</tr>
</table>
</div>
@if (canBulkAssignment || canDelete || canShowDevices || canExportCurrent || canExportAll)
{
<div class="actionBar">
@if (canExportCurrent)
{
@Html.ActionLinkButton("Export Current Assignments", MVC.Config.DeviceFlag.Export(null, Model.DeviceFlag.Id, true), "Config_DeviceFlags_Actions_ExportCurrent_Button")
}
@if (canExportAll)
{
@Html.ActionLinkButton("Export All Assignments", MVC.Config.DeviceFlag.Export(null, Model.DeviceFlag.Id, false), "Config_DeviceFlags_Actions_ExportAll_Button")
}
@if (canBulkAssignment)
{
<a href="#" id="Config_DeviceFlags_BulkAssign_Button" class="button">Bulk Assign Devices</a>
<div id="Config_DeviceFlags_BulkAssign_ModeDialog" class="dialog" title="Bulk Assign Device Mode">
<p>
Select the mode used to assign devices:
</p>
<div>
<div class="add">
<h5><i class="fa fa-plus fa-fw"></i>Add</h5>
<p>
Specified devices will have this flag <strong>added</strong>. Devices who already have this flag will be skipped.
</p>
</div>
<div class="override">
<h5><i class="fa fa-repeat fa-fw"></i>Override</h5>
<p>
Specified devices will have this flag <strong>added</strong>. Specified devices which already have this flag will be skipped.
Devices who already have this flag but are not specified will have the flag <strong>removed</strong>.
</p>
</div>
</div>
</div>
<div id="Config_DeviceFlags_BulkAssign_AssignDialog" class="dialog" title="Bulk Assign Devices">
<div class="brief">
<div>
Enter multiple <strong>Device Serial Numbers</strong> separated by <code>&lt;new line&gt;</code>, commas (<code>,</code>) or semicolons (<code>;</code>).
</div>
</div>
<div class="loading">
<h4><i class="fa fa-lg fa-cog fa-spin" title="Please Wait"></i>Loading current assignments...</h4>
</div>
<form action="#" method="post">
<textarea id="Config_DeviceFlags_BulkAssign_AssignDialog_DeviceSerialNumbers" name="DeviceSerialNumbers"></textarea>
<h4>Comments:</h4>
<textarea id="Config_DeviceFlags_BulkAssign_AssignDialog_Comments" name="Comments"></textarea>
</form>
</div>
<script>
$(function () {
var modeDialog, assignDialog, assignDeviceSerialNumbers;
function showModeDialog() {
if (!modeDialog) {
modeDialog = $('#Config_DeviceFlags_BulkAssign_ModeDialog').dialog({
resizable: false,
modal: true,
autoOpen: false,
width: 400,
buttons: {
Cancel: function () {
$(this).dialog('close');
}
}
});
modeDialog.find('.add').click(function () {
modeDialog.dialog('close');
showAssignDialog('Add');
});
modeDialog.find('.override').click(function () {
modeDialog.dialog('close');
showAssignDialog('Override');
});
}
modeDialog.dialog('open');
}
function showAssignDialog(mode) {
if (!assignDialog) {
assignDialog = $('#Config_DeviceFlags_BulkAssign_AssignDialog').dialog({
resizable: false,
modal: true,
autoOpen: false,
width: 460
});
assignDeviceSerialNumbers = $('#Config_DeviceFlags_BulkAssign_AssignDialog_DeviceSerialNumbers');
}
assignDialog.removeClass('loading');
var buttons = {};
buttons[mode + " Device Flags"] = function () {
$(this).find('form').submit();
$(this).dialog("disable");
}
buttons['Cancel'] = function () {
$(this).dialog('close');
}
assignDialog.dialog('option', 'buttons', buttons);
assignDialog.dialog('option', 'title', 'Bulk Assign Devices: ' + mode);
if (mode == "Override") {
assignDeviceSerialNumbers.closest('form').attr('action', '@(Url.Action(MVC.API.DeviceFlag.BulkAssignDevices(Model.DeviceFlag.Id, true)))');
assignDialog.addClass('loading');
$.getJSON('@Url.Action(MVC.API.DeviceFlag.AssignedDevices(Model.DeviceFlag.Id))', function (response, result) {
assignDialog.removeClass('loading');
if (result != 'success') {
alert('Unable to load current assignments:\n' + response);
assignDialog.dialog('close');
} else {
if (!!response) {
assignDeviceSerialNumbers.val(response.join('\n'));
} else {
assignDeviceSerialNumbers.val('');
}
}
});
}
else // Assume Add
{
assignDeviceSerialNumbers.closest('form').attr('action', '@(Url.Action(MVC.API.DeviceFlag.BulkAssignDevices(Model.DeviceFlag.Id, false)))');
}
assignDialog.dialog('open');
}
$('#Config_DeviceFlags_BulkAssign_Button').click(function () {
showModeDialog();
return false;
});
});
</script>
}
@if (canDelete)
{
@Html.ActionLinkButton("Delete", MVC.API.DeviceFlag.Delete(Model.DeviceFlag.Id, true), "Config_DeviceFlags_Actions_Delete_Button")
<div id="Config_DeviceFlags_Actions_Delete_Dialog" title="Delete this Device Flag?">
<p>
<i class="fa fa-exclamation-triangle fa-lg warning"></i>
This item will be permanently deleted and cannot be recovered.<br />
<br />
@if (Model.CurrentAssignmentCount > 0)
{
<strong>@Model.CurrentAssignmentCount device@(Model.CurrentAssignmentCount != 1 ? "s are" : " is") currently assigned</strong>
<br />
<br />
}
Are you sure?
</p>
</div>
<script type="text/javascript">
$(function () {
var button = $('#Config_DeviceFlags_Actions_Delete_Button');
var buttonDialog = $('#Config_DeviceFlags_Actions_Delete_Dialog');
var buttonLink = button.attr('href');
button.attr('href', '#');
button.click(function () {
buttonDialog.dialog('open');
return false;
});
buttonDialog.dialog({
resizable: false,
modal: true,
autoOpen: false,
buttons: {
"Delete": function () {
var $this = $(this);
$this.dialog("disable");
$this.dialog("option", "buttons", null);
window.location.href = buttonLink;
},
Cancel: function () {
$(this).dialog("close");
}
}
});
});
</script>
}
@if (canShowDevices)
{
@Html.ActionLinkButton(string.Format("Show {0} device{1}", Model.CurrentAssignmentCount, (Model.CurrentAssignmentCount == 1 ? null : "s")), MVC.Search.Query(Model.DeviceFlag.Id.ToString(), "DeviceFlag"), "Config_DeviceFlags_Actions_ShowDevices_Button")
}
</div>
}
File diff suppressed because it is too large Load Diff
+9 -6
View File
@@ -5209,14 +5209,17 @@ table.genericData td.id a {
.dataTables_wrapper table > thead tr > th.sorting_disabled {
background-image: none;
}
table.userTable div.flags {
table.userTable div.flags,
table.deviceTable div.flags {
display: inline-block;
float: right;
}
table.userTable div.flags > i {
table.userTable div.flags > i,
table.deviceTable div.flags > i {
cursor: default;
}
table.userTable div.flags > i > .details {
table.userTable div.flags > i > .details,
table.deviceTable div.flags > i > .details {
display: none;
}
.jobStatus {
@@ -5689,15 +5692,15 @@ div.Disco-AttachmentUpload-ImageDialog {
background-color: #000 !important;
padding: 0 !important;
}
body > .User_FlagAssignment_Tooltip span.name {
body > .FlagAssignment_Tooltip span.name {
display: block;
font-weight: 600;
}
body > .User_FlagAssignment_Tooltip span.comments {
body > .FlagAssignment_Tooltip span.comments {
display: block;
padding: 2px 0 2px 4px;
}
body > .User_FlagAssignment_Tooltip span.added {
body > .FlagAssignment_Tooltip span.added {
font-style: italic;
font-size: 0.9em;
}
File diff suppressed because one or more lines are too long
+158
View File
@@ -1824,6 +1824,164 @@ h1.Config_DocumentTemplates {
margin-right: 10px;
color: #1e6dab;
}
#Config_DeviceFlags_Show #DeviceFlag_OnAssignmentExpression,
#Config_DeviceFlags_Show #DeviceFlag_OnUnassignmentExpression {
height: 16px;
min-height: 16px;
overflow: hidden;
font-family: Consolas, "Courier New", monospace;
}
#Config_DeviceFlags_Index i {
width: 1.28571429em;
text-align: center;
}
#Config_DeviceFlags_Icon {
display: block;
margin: 0 0 10px 10px;
}
#Config_DeviceFlags_Icon_Update_Dialog {
display: none;
}
#Config_DeviceFlags_Icon_Update_Dialog div.colours {
text-align: center;
font-size: 30px;
}
#Config_DeviceFlags_Icon_Update_Dialog div.colours i {
cursor: pointer;
padding: 1px;
opacity: 0.9;
}
#Config_DeviceFlags_Icon_Update_Dialog div.colours i:hover {
opacity: 1;
}
#Config_DeviceFlags_Icon_Update_Dialog div.colours i.selected {
opacity: 1;
}
#Config_DeviceFlags_Icon_Update_Dialog div.icons {
text-align: center;
font-size: 30px;
background-color: #fff;
border: 1px solid #D1D1D1;
margin: 6px 0 14px 0;
}
#Config_DeviceFlags_Icon_Update_Dialog div.icons i {
width: 1.28571429em;
text-align: center;
cursor: pointer;
padding: 4px 0px;
color: #333;
opacity: 0.6;
}
#Config_DeviceFlags_Icon_Update_Dialog div.icons i:hover {
opacity: 0.9;
color: inherit;
}
#Config_DeviceFlags_Icon_Update_Dialog div.icons i.selected {
opacity: 1;
color: inherit;
}
#Config_DeviceFlags_BulkAssign_ModeDialog > div {
margin-top: 6px;
background-color: #fff;
line-height: 1.3em;
border: 1px solid #ddd;
}
#Config_DeviceFlags_BulkAssign_ModeDialog > div > div {
display: block;
padding: 4px;
cursor: pointer;
}
#Config_DeviceFlags_BulkAssign_ModeDialog > div > div:not(:last-child) {
border-bottom: 1px dashed #ddd;
}
#Config_DeviceFlags_BulkAssign_ModeDialog > div > div h5 {
font-size: 1.1em;
padding: 4px 0;
}
#Config_DeviceFlags_BulkAssign_ModeDialog > div > div i {
margin-right: 4px;
}
#Config_DeviceFlags_BulkAssign_ModeDialog > div > div.add:hover {
background-color: #eeffde;
}
#Config_DeviceFlags_BulkAssign_ModeDialog > div > div.add i {
color: #60A917;
}
#Config_DeviceFlags_BulkAssign_ModeDialog > div > div.override:hover {
background-color: #ffe1de;
}
#Config_DeviceFlags_BulkAssign_ModeDialog > div > div.override i {
color: #e51400;
}
#Config_DeviceFlags_BulkAssign_AssignDialog .brief {
margin: 0 0 8px 0;
}
#Config_DeviceFlags_BulkAssign_AssignDialog .brief .scopeDescBulkGenerate {
font-weight: 600;
}
#Config_DeviceFlags_BulkAssign_AssignDialog .brief div.examples {
margin: 8px auto;
width: 300px;
}
#Config_DeviceFlags_BulkAssign_AssignDialog .brief div.examples div {
margin: 2px 4px 2px 0;
width: 150px;
float: left;
}
#Config_DeviceFlags_BulkAssign_AssignDialog .brief div.examples div.example1 {
width: 100px;
}
#Config_DeviceFlags_BulkAssign_AssignDialog div.loading {
display: none;
padding: 40px 0;
text-align: center;
}
#Config_DeviceFlags_BulkAssign_AssignDialog div.loading i {
margin-right: 10px;
color: #1e6dab;
}
#Config_DeviceFlags_BulkAssign_AssignDialog #Config_DeviceFlags_BulkAssign_AssignDialog_DeviceSerialNumbers {
height: 200px;
margin-bottom: 8px;
}
#Config_DeviceFlags_BulkAssign_AssignDialog textarea {
width: calc(100% - .5em);
margin: 0;
}
#Config_DeviceFlags_BulkAssign_AssignDialog.loading > div.loading {
display: block;
}
#Config_DeviceFlags_BulkAssign_AssignDialog.loading > form {
display: none;
}
#DeviceFlag_Export #DeviceFlag_Export_Fields #DeviceFlag_Export_Fields_Defaults {
font-size: 0.75em;
}
#DeviceFlag_Export #DeviceFlag_Export_Fields th {
font-size: 1.05em;
}
#DeviceFlag_Export #DeviceFlag_Export_Fields th span {
margin-top: 4px;
font-size: 0.8em;
}
#DeviceFlag_Export_Download_Dialog {
padding-top: 20px;
text-align: center;
}
#DeviceFlag_Export_Download_Dialog h4 {
margin-bottom: 30px;
}
#DeviceFlag_Export_Download_Dialog a {
margin-bottom: 20px;
}
#DeviceFlag_Export_Exporting {
padding-top: 50px;
text-align: center;
}
#DeviceFlag_Export_Exporting i {
margin-right: 10px;
color: #1e6dab;
}
#DocumentTemplate_BulkGenerate .actions {
padding-bottom: 0.5em;
text-align: right;
+216
View File
@@ -2165,6 +2165,222 @@ h1.Config_DocumentTemplates {
}
}
#Config_DeviceFlags_Show {
#DeviceFlag_OnAssignmentExpression, #DeviceFlag_OnUnassignmentExpression {
height: 16px;
min-height: 16px;
overflow: hidden;
font-family: @FontFamilyMono;
}
}
#Config_DeviceFlags_Index {
i {
width: 1.2857142857142858em;
text-align: center;
}
}
#Config_DeviceFlags_Icon {
display: block;
margin: 0 0 10px 10px;
}
#Config_DeviceFlags_Icon_Update_Dialog {
display: none;
div.colours {
text-align: center;
font-size: 30px;
i {
cursor: pointer;
padding: 1px;
opacity: .9;
&:hover {
opacity: 1;
}
&.selected {
opacity: 1;
}
}
}
div.icons {
text-align: center;
font-size: 30px;
background-color: @white;
border: 1px solid @BackgroundColour;
margin: 6px 0 14px 0;
i {
width: 1.2857142857142858em;
text-align: center;
cursor: pointer;
padding: 4px 0px;
color: @HeaderBackgroundColour;
opacity: .6;
&:hover {
opacity: .9;
color: inherit;
}
&.selected {
opacity: 1;
color: inherit;
}
}
}
}
#Config_DeviceFlags_BulkAssign_ModeDialog {
& > div {
margin-top: 6px;
background-color: @white;
line-height: 1.3em;
border: 1px solid #ddd;
& > div {
display: block;
padding: 4px;
cursor: pointer;
&:not(:last-child) {
border-bottom: 1px dashed #ddd;
}
h5 {
font-size: 1.1em;
padding: 4px 0;
}
i {
margin-right: 4px;
}
&.add {
&:hover {
background-color: hsv(hsvhue(@StatusSuccess), 13%, 100%);
}
i {
color: @StatusSuccess;
}
}
&.override {
&:hover {
background-color: hsv(hsvhue(@StatusError), 13%, 100%);
}
i {
color: @StatusError;
}
}
}
}
}
#Config_DeviceFlags_BulkAssign_AssignDialog {
.brief {
margin: 0 0 8px 0;
.scopeDescBulkGenerate {
font-weight: @FontWeightBodyBold;
}
div.examples {
margin: 8px auto;
width: 300px;
div {
margin: 2px 4px 2px 0;
width: 150px;
float: left;
&.example1 {
width: 100px;
}
}
}
}
div.loading {
display: none;
padding: 40px 0;
text-align: center;
i {
margin-right: 10px;
color: @StatusInformation;
}
}
#Config_DeviceFlags_BulkAssign_AssignDialog_DeviceSerialNumbers {
height: 200px;
margin-bottom: 8px;
}
textarea {
width: calc(~"100% - .5em");
margin: 0;
}
&.loading {
& > div.loading {
display: block;
}
& > form {
display: none;
}
}
}
#DeviceFlag_Export {
#DeviceFlag_Export_Fields {
#DeviceFlag_Export_Fields_Defaults {
font-size: .75em;
}
th {
font-size: 1.05em;
span {
margin-top: 4px;
font-size: .8em;
}
}
}
}
#DeviceFlag_Export_Download_Dialog {
padding-top: 20px;
text-align: center;
h4 {
margin-bottom: 30px;
}
a {
margin-bottom: 20px;
}
}
#DeviceFlag_Export_Exporting {
padding-top: 50px;
text-align: center;
i {
margin-right: 10px;
color: @StatusInformation;
}
}
#DocumentTemplate_BulkGenerate {
.actions {
padding-bottom: .5em;
File diff suppressed because one or more lines are too long
+124
View File
@@ -91,6 +91,18 @@
#layout_PageHeading #Device_Show_Status span.icon {
margin-right: 6px;
}
#layout_PageHeading #Device_Show_Flags {
display: inline-block;
float: right;
height: 50px;
font-size: 0.6em;
}
#layout_PageHeading #Device_Show_Flags > i {
cursor: default;
}
#layout_PageHeading #Device_Show_Flags > i > .details {
display: none;
}
#Device_Show #Device_Show_Subjects {
table-layout: fixed;
}
@@ -404,6 +416,118 @@
background-color: inherit;
border: 1px solid #fff;
}
#Device_Show_Details_Actions_AddFlag_Dialog {
height: 400px;
}
#Device_Show_Details_Actions_AddFlag_Dialog .flagPicker {
position: absolute;
width: 250px;
height: 300px;
overflow-y: auto;
background-color: #fcfcfc;
border: 1px solid #ccc;
}
#Device_Show_Details_Actions_AddFlag_Dialog .flagPicker > div {
background-color: #fff;
border-bottom: 1px solid #ddd;
padding: 6px 0 6px 6px;
cursor: pointer;
}
#Device_Show_Details_Actions_AddFlag_Dialog .flagPicker > div:hover {
background-color: #f4f4f4;
}
#Device_Show_Details_Actions_AddFlag_Dialog .flagPicker > div.selected,
#Device_Show_Details_Actions_AddFlag_Dialog .flagPicker > div.selected:hover {
background-color: #eee;
}
#Device_Show_Details_Actions_AddFlag_Dialog .details {
display: none;
position: absolute;
left: 280px;
top: 1em;
}
#Device_Show_Details_Actions_AddFlag_Dialog .details h4 {
margin-bottom: 4px;
}
#Device_Show_Details_Actions_AddFlag_Dialog .details textarea {
min-width: 280px;
height: 200px;
}
#DeviceDetailTab-Flags #deviceFlags {
border: solid 1px #d8d8d8;
border-collapse: collapse;
table-layout: fixed;
}
#DeviceDetailTab-Flags #deviceFlags td {
border: solid 1px #d8d8d8;
background-color: #fff;
}
#DeviceDetailTab-Flags #deviceFlags th {
background-color: #eee;
border: solid 1px #d8d8d8;
}
#DeviceDetailTab-Flags #deviceFlags i.fa-edit {
position: absolute;
top: 0;
right: 0;
margin-top: 4px;
font-size: 1.1em;
cursor: pointer;
display: none;
color: #335A87;
}
#DeviceDetailTab-Flags #deviceFlags i.fa-edit:hover {
color: #5e8cc2;
}
#DeviceDetailTab-Flags #deviceFlags td:hover i.fa-edit {
display: inline-block;
}
#DeviceDetailTab-Flags #deviceFlags th.name {
width: 200px;
}
#DeviceDetailTab-Flags #deviceFlags tr.removed td {
background-color: #f4f4f4;
}
#DeviceDetailTab-Flags #deviceFlags td.name {
vertical-align: middle;
}
#DeviceDetailTab-Flags #deviceFlags td.name .fa-stack {
line-height: 1.6em;
}
#DeviceDetailTab-Flags #deviceFlags td.added,
#DeviceDetailTab-Flags #deviceFlags td.removed {
vertical-align: middle;
}
#DeviceDetailTab-Flags #deviceFlags td.added .expressionResult,
#DeviceDetailTab-Flags #deviceFlags td.removed .expressionResult {
margin-top: 4px;
font-style: italic;
}
#DeviceDetailTab-Flags #deviceFlags td.comments {
vertical-align: middle;
}
#DeviceDetailTab-Flags #deviceFlags td.comments .editable {
position: relative;
}
#DeviceDetailTab-Flags #deviceFlags td.comments .commentsRaw {
display: none;
}
#DeviceDetailTab-Flags #deviceFlags td.removed.na {
vertical-align: middle;
text-align: center;
}
#DeviceDetailTab-Flags > .none {
text-align: center;
padding: 30px 0;
font-style: italic;
background-color: #fff;
}
#Device_Show_Flags_Actions_EditComments_Dialog h4 {
margin-bottom: 4px;
}
#Device_Show_Flags_Actions_EditComments_Dialog_Comments {
width: 280px;
}
#Devices_Export .Devices_Export_Type_Target {
margin-top: 10px;
display: none;
+153
View File
@@ -18,6 +18,21 @@
margin-right: 6px;
}
}
#Device_Show_Flags {
display: inline-block;
float: right;
height: 50px;
font-size: 0.6em;
& > i {
cursor: default;
& > .details {
display: none;
}
}
}
}
#Device_Show {
@@ -188,6 +203,7 @@
}
}
}
.enforce-ou {
padding-top: .5em;
}
@@ -393,6 +409,143 @@
}
}
#Device_Show_Details_Actions_AddFlag_Dialog {
height: 400px;
.flagPicker {
position: absolute;
width: 250px;
height: 300px;
overflow-y: auto;
background-color: #fcfcfc;
border: 1px solid #ccc;
& > div {
background-color: @white;
border-bottom: 1px solid #ddd;
padding: 6px 0 6px 6px;
cursor: pointer;
&:hover {
background-color: @TableDataBorderColour;
}
&.selected, &.selected:hover {
background-color: @TableDataDarkBackgroundColour;
}
}
}
.details {
display: none;
position: absolute;
left: 280px;
top: 1em;
h4 {
margin-bottom: 4px;
}
textarea {
min-width: 280px;
height: 200px;
}
}
}
#DeviceDetailTab-Flags {
#deviceFlags {
.tableDataDark;
table-layout: fixed;
i.fa-edit {
position: absolute;
top: 0;
right: 0;
margin-top: 4px;
font-size: 1.1em;
cursor: pointer;
display: none;
color: @HyperLinkColour;
&:hover {
color: @HyperLinkHoverColour;
}
}
td:hover i.fa-edit {
display: inline-block;
}
th.name {
width: 200px;
}
th.added {
}
th.removed {
}
tr.removed td {
background-color: @TableDataBorderColour;
}
td.name {
vertical-align: middle;
.fa-stack {
line-height: 1.6em;
}
}
td.added, td.removed {
vertical-align: middle;
.expressionResult {
margin-top: 4px;
font-style: italic;
}
}
td.comments {
vertical-align: middle;
.editable {
position: relative;
}
.commentsRaw {
display: none;
}
}
td.removed {
&.na {
vertical-align: middle;
text-align: center;
}
}
}
& > .none {
text-align: center;
padding: 30px 0;
font-style: italic;
background-color: @white;
}
}
#Device_Show_Flags_Actions_EditComments_Dialog {
h4 {
margin-bottom: 4px;
}
}
#Device_Show_Flags_Actions_EditComments_Dialog_Comments {
width: 280px;
}
#Devices_Export {
.Devices_Export_Type_Target {
margin-top: 10px;
File diff suppressed because one or more lines are too long
+10
View File
@@ -185,6 +185,16 @@
#Job_Show #Job_Show_Subjects #Job_Show_Device #Job_Show_Device_Details {
float: left;
}
#Job_Show #Job_Show_Subjects #Job_Show_Device #Job_Show_Device_Flags {
margin: 4px 0;
font-size: 16px;
}
#Job_Show #Job_Show_Subjects #Job_Show_Device #Job_Show_Device_Flags > i {
cursor: default;
}
#Job_Show #Job_Show_Subjects #Job_Show_Device #Job_Show_Device_Flags > i > .details {
display: none;
}
#Job_Show #Job_Show_Subjects #Job_Show_Device #Job_Show_Device_Details_HWar,
#Job_Show #Job_Show_Subjects #Job_Show_Device #Job_Show_Device_Details_HNWar {
float: right;
+13
View File
@@ -143,6 +143,19 @@
float: left;
}
#Job_Show_Device_Flags {
margin: 4px 0;
font-size: 16px;
& > i {
cursor: default;
& > .details {
display: none;
}
}
}
#Job_Show_Device_Details_HWar, #Job_Show_Device_Details_HNWar {
float: right;
border-left: 1px dashed #ddd;
File diff suppressed because one or more lines are too long
+9 -6
View File
@@ -777,14 +777,17 @@ table.genericData td.id a {
.dataTables_wrapper table > thead tr > th.sorting_disabled {
background-image: none;
}
table.userTable div.flags {
table.userTable div.flags,
table.deviceTable div.flags {
display: inline-block;
float: right;
}
table.userTable div.flags > i {
table.userTable div.flags > i,
table.deviceTable div.flags > i {
cursor: default;
}
table.userTable div.flags > i > .details {
table.userTable div.flags > i > .details,
table.deviceTable div.flags > i > .details {
display: none;
}
.jobStatus {
@@ -1257,15 +1260,15 @@ div.Disco-AttachmentUpload-ImageDialog {
background-color: #000 !important;
padding: 0 !important;
}
body > .User_FlagAssignment_Tooltip span.name {
body > .FlagAssignment_Tooltip span.name {
display: block;
font-weight: 600;
}
body > .User_FlagAssignment_Tooltip span.comments {
body > .FlagAssignment_Tooltip span.comments {
display: block;
padding: 2px 0 2px 4px;
}
body > .User_FlagAssignment_Tooltip span.added {
body > .FlagAssignment_Tooltip span.added {
font-style: italic;
font-size: 0.9em;
}
+2 -2
View File
@@ -746,7 +746,7 @@ table.genericData {
}
}
table.userTable {
table.userTable, table.deviceTable {
div.flags {
display: inline-block;
float: right;
@@ -1275,7 +1275,7 @@ div.Disco-AttachmentUpload-ImageDialog {
padding: 0 !important;
}
body > .User_FlagAssignment_Tooltip {
body > .FlagAssignment_Tooltip {
span.name {
display: block;
font-weight: @FontWeightBodyBold;
File diff suppressed because one or more lines are too long
+9
View File
@@ -152,6 +152,15 @@
#User_Show #User_Show_Subjects #User_Show_AssignedDevices .User_Show_AssignedDevices_CurrentAssignment div.User_Show_AssignedDevices_CurrentAssignment_Details {
float: left;
}
#User_Show #User_Show_Subjects #User_Show_AssignedDevices .User_Show_AssignedDevices_CurrentAssignment .User_Show_Assigned_Devices_CurrentAssignment_Flags {
font-size: 16px;
}
#User_Show #User_Show_Subjects #User_Show_AssignedDevices .User_Show_AssignedDevices_CurrentAssignment .User_Show_Assigned_Devices_CurrentAssignment_Flags > i {
cursor: default;
}
#User_Show #User_Show_Subjects #User_Show_AssignedDevices .User_Show_AssignedDevices_CurrentAssignment .User_Show_Assigned_Devices_CurrentAssignment_Flags > i > .details {
display: none;
}
#User_Show #User_Show_Subjects #User_Show_Subjects_Actions > td {
padding-top: 4px;
}
+12
View File
@@ -103,6 +103,18 @@
div.User_Show_AssignedDevices_CurrentAssignment_Details {
float: left;
}
.User_Show_Assigned_Devices_CurrentAssignment_Flags {
font-size: 16px;
& > i {
cursor: default;
& > .details {
display: none;
}
}
}
}
}
File diff suppressed because one or more lines are too long
+24 -10
View File
@@ -4,6 +4,7 @@ using Disco.Models.Services.Jobs.JobLists;
using Disco.Models.UI.Device;
using Disco.Services;
using Disco.Services.Authorization;
using Disco.Services.Devices.DeviceFlags;
using Disco.Services.Exporting;
using Disco.Services.Interop.ActiveDirectory;
using Disco.Services.Plugins.Features.DetailsProvider;
@@ -12,6 +13,7 @@ using Disco.Services.Users;
using Disco.Services.Web;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Mvc;
@@ -226,16 +228,18 @@ namespace Disco.Web.Controllers
Database.Configuration.LazyLoadingEnabled = true;
m.Device = Database.Devices
.Include("DeviceModel")
.Include("DeviceProfile")
.Include("DeviceBatch")
.Include("DeviceDetails")
.Include("DeviceUserAssignments.AssignedUser.UserFlagAssignments")
.Include("AssignedUser.UserFlagAssignments")
.Include("AssignedUser.UserDetails")
.Include("DeviceCertificates")
.Include("DeviceAttachments.TechUser")
.Include("DeviceAttachments.DocumentTemplate")
.Include(d => d.DeviceModel)
.Include(d => d.DeviceProfile)
.Include(d => d.DeviceBatch)
.Include(d => d.DeviceDetails)
.Include(d => d.DeviceUserAssignments.Select(a => a.AssignedUser.UserFlagAssignments))
.Include(d => d.AssignedUser.UserFlagAssignments)
.Include(d => d.AssignedUser.UserDetails)
.Include(d => d.DeviceCertificates)
.Include(d => d.DeviceAttachments.Select(a => a.TechUser))
.Include(d => d.DeviceAttachments.Select(a => a.DocumentTemplate))
.Include(d => d.DeviceFlagAssignments.Select(a => a.AddedUser))
.Include(d => d.DeviceFlagAssignments.Select(a => a.RemovedUser))
.FirstOrDefault(d => d.SerialNumber == id);
if (m.Device == null)
@@ -310,6 +314,16 @@ namespace Disco.Web.Controllers
m.DeviceProfileWirelessProfileProviders = m.Device.DeviceProfile.GetWirelessProfileProviders().ToList();
}
if (Authorization.Has(Claims.Device.ShowFlagAssignments))
{
var usedFlags = m.Device.DeviceFlagAssignments
.Where(a => !a.RemovedDate.HasValue)
.Select(a => a.DeviceFlagId)
.Distinct().ToList();
m.AvailableDeviceFlags = DeviceFlagService.GetDeviceFlags().Where(f => !usedFlags.Contains(f.Id)).ToList();
}
if (Authorization.Has(Claims.User.ShowDetails))
{
// Populate Custom Details
+18 -15
View File
@@ -18,6 +18,7 @@ using Disco.Services.Web;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web.Mvc;
@@ -298,21 +299,23 @@ namespace Disco.Web.Controllers
var m = new Models.Job.ShowModel();
m.Job = Database.Jobs
.Include("Device.DeviceModel")
.Include("Device.DeviceBatch")
.Include("Device.DeviceDetails")
.Include("DeviceHeldTechUser")
.Include("DeviceReadyForReturnTechUser")
.Include("DeviceReturnedTechUser")
.Include("OpenedTechUser")
.Include("ClosedTechUser")
.Include("JobType")
.Include("JobSubTypes")
.Include("User.UserFlagAssignments")
.Include("User.UserDetails")
.Include("JobLogs.TechUser")
.Include("JobAttachments.TechUser")
.Include("JobAttachments.DocumentTemplate")
.Include(j => j.Device.DeviceModel)
.Include(j => j.Device.DeviceBatch)
.Include(j => j.Device.DeviceProfile)
.Include(j => j.Device.DeviceDetails)
.Include(j => j.Device.DeviceFlagAssignments)
.Include(j => j.DeviceHeldTechUser)
.Include(j => j.DeviceReadyForReturnTechUser)
.Include(j => j.DeviceReturnedTechUser)
.Include(j => j.OpenedTechUser)
.Include(j => j.ClosedTechUser)
.Include(j => j.JobType)
.Include(j => j.JobSubTypes)
.Include(j => j.User.UserFlagAssignments)
.Include(j => j.User.UserDetails)
.Include(j => j.JobLogs.Select(l => l.TechUser))
.Include(j => j.JobAttachments.Select(a => a.TechUser))
.Include(j => j.JobAttachments.Select(a => a.DocumentTemplate))
.FirstOrDefault(j => j.Id == id.Value);
if (m.Job == null)
+24 -7
View File
@@ -83,7 +83,7 @@ namespace Disco.Web.Controllers
var vm = Database.DeviceModels.Find(deviceModelId);
if (vm != null)
{
m.FriendlyTerm = string.Format("Device Model: {0}", vm.ToString());
m.FriendlyTerm = $"Device Model: {vm.ToString()}";
m.Devices = Services.Searching.Search.SearchDeviceModel(Database, vm.Id);
break;
}
@@ -100,7 +100,7 @@ namespace Disco.Web.Controllers
var dp = Database.DeviceProfiles.Find(deviceProfileId);
if (dp != null)
{
m.FriendlyTerm = string.Format("Device Profile: {0}", dp.ToString());
m.FriendlyTerm = $"Device Profile: {dp.ToString()}";
m.Devices = Services.Searching.Search.SearchDeviceProfile(Database, dp.Id);
break;
}
@@ -117,7 +117,7 @@ namespace Disco.Web.Controllers
var db = Database.DeviceBatches.Find(deviceBatchId);
if (db != null)
{
m.FriendlyTerm = string.Format("Device Batch: {0}", db.ToString());
m.FriendlyTerm = $"Device Batch: {db.ToString()}";
m.Devices = Services.Searching.Search.SearchDeviceBatch(Database, db.Id);
break;
}
@@ -233,10 +233,10 @@ namespace Disco.Web.Controllers
}
case "userflag":
Authorization.RequireAll(Claims.User.Search, Claims.User.ShowFlagAssignments);
int flagId;
if (int.TryParse(term, out flagId))
int userFlagId;
if (int.TryParse(term, out userFlagId))
{
var flag = Database.UserFlags.Find(flagId);
var flag = Database.UserFlags.Find(userFlagId);
if (flag != null)
{
m.FriendlyTerm = string.Format("User Flag: {0}", flag.ToString());
@@ -244,10 +244,27 @@ namespace Disco.Web.Controllers
break;
}
}
m.FriendlyTerm = string.Format("User Flag: {0}", term);
m.FriendlyTerm = $"User Flag: {term}";
m.Success = false;
m.ErrorMessage = "Invalid User Flag Id";
break;
case "deviceflag":
Authorization.RequireAll(Claims.Device.Search, Claims.Device.ShowFlagAssignments);
int deviceFlagId;
if (int.TryParse(term, out deviceFlagId))
{
var flag = Database.DeviceFlags.Find(deviceFlagId);
if (flag != null)
{
m.FriendlyTerm = string.Format("Device Flag: {0}", flag.ToString());
m.Devices = Services.Searching.Search.SearchDeviceFlag(Database, flag.Id);
break;
}
}
m.FriendlyTerm = $"Device Flag: {term}";
m.Success = false;
m.ErrorMessage = "Invalid Device Flag Id";
break;
}
}
+11 -10
View File
@@ -10,6 +10,7 @@ using Disco.Services.Users;
using Disco.Services.Users.UserFlags;
using Disco.Services.Web;
using System;
using System.Data.Entity;
using System.Linq;
using System.Web.Mvc;
@@ -54,15 +55,15 @@ namespace Disco.Web.Controllers
}
m.User = Database.Users
.Include("DeviceUserAssignments.Device.DeviceModel")
.Include("DeviceUserAssignments.Device.DeviceProfile")
.Include("DeviceUserAssignments.Device.DeviceBatch")
.Include("DeviceUserAssignments.Device.DeviceDetails")
.Include("UserAttachments.TechUser")
.Include("UserAttachments.DocumentTemplate")
.Include("UserFlagAssignments.AddedUser")
.Include("UserFlagAssignments.RemovedUser")
.Include("UserDetails")
.Include(u => u.DeviceUserAssignments.Select(dua => dua.Device.DeviceModel))
.Include(u => u.DeviceUserAssignments.Select(dua => dua.Device.DeviceProfile))
.Include(u => u.DeviceUserAssignments.Select(dua => dua.Device.DeviceBatch))
.Include(u => u.DeviceUserAssignments.Select(dua => dua.Device.DeviceDetails))
.Include(u => u.UserAttachments.Select(ua => ua.TechUser))
.Include(u => u.UserAttachments.Select(ua => ua.DocumentTemplate))
.Include(u => u.UserFlagAssignments.Select(ufa => ufa.AddedUser))
.Include(u => u.UserFlagAssignments.Select(ufa => ufa.RemovedUser))
.Include(u => u.UserDetails)
.FirstOrDefault(um => um.UserId == id);
if (m.User == null)
@@ -79,7 +80,7 @@ namespace Disco.Web.Controllers
HideClosedJobs = true,
EnablePaging = false
};
m.Jobs.Fill(Database, Disco.Services.Searching.Search.BuildJobTableModel(Database).Where(j => j.UserId == id).OrderByDescending(j => j.Id), true);
m.Jobs.Fill(Database, Services.Searching.Search.BuildJobTableModel(Database).Where(j => j.UserId == id).OrderByDescending(j => j.Id), true);
}
if (Authorization.Has(Claims.User.ShowFlagAssignments))
+61
View File
@@ -207,7 +207,9 @@
<Compile Include="App_Start\OwinStartupConfig.cs" />
<Compile Include="Areas\API\Controllers\AuthorizationRoleController.cs" />
<Compile Include="Areas\API\Controllers\DocumentTemplatePackageController.cs" />
<Compile Include="Areas\API\Controllers\DeviceFlagAssignmentController.cs" />
<Compile Include="Areas\API\Controllers\UserFlagAssignmentController.cs" />
<Compile Include="Areas\API\Controllers\DeviceFlagController.cs" />
<Compile Include="Areas\API\Controllers\UserFlagController.cs" />
<Compile Include="Areas\API\Controllers\JobPreferencesController.cs" />
<Compile Include="Areas\API\Controllers\JobQueueController.cs" />
@@ -222,6 +224,7 @@
<Compile Include="Areas\API\Models\Shared\SubjectDescriptorModel.cs" />
<Compile Include="Areas\API\Models\System\DomainOrganisationalUnitsModel.cs" />
<Compile Include="Areas\Config\Controllers\AuthorizationRoleController.cs" />
<Compile Include="Areas\Config\Controllers\DeviceFlagController.cs" />
<Compile Include="Areas\Config\Controllers\UserFlagController.cs" />
<Compile Include="Areas\Config\Controllers\JobPreferencesController.cs" />
<Compile Include="Areas\Config\Controllers\JobQueueController.cs" />
@@ -234,6 +237,10 @@
<Compile Include="Areas\Config\Models\DocumentTemplate\ShowPackageModel.cs" />
<Compile Include="Areas\Config\Models\Shared\DeviceGroupDocumentTemplateBulkGenerateModel.cs" />
<Compile Include="Areas\Config\Models\Shared\LinkedGroupModel.cs" />
<Compile Include="Areas\Config\Models\DeviceFlag\CreateModel.cs" />
<Compile Include="Areas\Config\Models\DeviceFlag\ExportModel.cs" />
<Compile Include="Areas\Config\Models\DeviceFlag\IndexModel.cs" />
<Compile Include="Areas\Config\Models\DeviceFlag\ShowModel.cs" />
<Compile Include="Areas\Config\Models\UserFlag\CreateModel.cs" />
<Compile Include="Areas\Config\Models\UserFlag\ExportModel.cs" />
<Compile Include="Areas\Config\Models\UserFlag\IndexModel.cs" />
@@ -344,6 +351,26 @@
<DesignTime>True</DesignTime>
<DependentUpon>_DeviceGroupDocumentBulkGenerate.cshtml</DependentUpon>
</Compile>
<Compile Include="Areas\Config\Views\DeviceFlag\Create.generated.cs">
<DependentUpon>Create.cshtml</DependentUpon>
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
</Compile>
<Compile Include="Areas\Config\Views\DeviceFlag\Export.generated.cs">
<DependentUpon>Export.cshtml</DependentUpon>
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
</Compile>
<Compile Include="Areas\Config\Views\DeviceFlag\Index.generated.cs">
<DependentUpon>Index.cshtml</DependentUpon>
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
</Compile>
<Compile Include="Areas\Config\Views\DeviceFlag\Show.generated.cs">
<DependentUpon>Show.cshtml</DependentUpon>
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
</Compile>
<Compile Include="Areas\Config\Views\UserFlag\Create.generated.cs">
<DependentUpon>Create.cshtml</DependentUpon>
<AutoGen>True</AutoGen>
@@ -642,9 +669,18 @@
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
</Compile>
<Compile Include="Extensions\T4MVC\API.DeviceFlagAssignmentController.generated.cs">
<DependentUpon>T4MVC.tt</DependentUpon>
</Compile>
<Compile Include="Extensions\T4MVC\API.DeviceFlagController.generated.cs">
<DependentUpon>T4MVC.tt</DependentUpon>
</Compile>
<Compile Include="Extensions\T4MVC\API.DocumentTemplatePackageController.generated.cs">
<DependentUpon>T4MVC.tt</DependentUpon>
</Compile>
<Compile Include="Extensions\T4MVC\Config.DeviceFlagController.generated.cs">
<DependentUpon>T4MVC.tt</DependentUpon>
</Compile>
<Compile Include="Extensions\T4MVC\T4MVCExtensions.cs" />
<Compile Include="Extensions\T4MVC\API.AuthorizationRoleController.generated.cs">
<DependentUpon>T4MVC.tt</DependentUpon>
@@ -800,6 +836,11 @@
<DependentUpon>T4MVC.tt</DependentUpon>
</Compile>
<Compile Include="Models\Shared\GenerateDocumentControlModel.cs" />
<Compile Include="Views\Device\DeviceParts\_Flags.generated.cs">
<DependentUpon>_Flags.cshtml</DependentUpon>
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
</Compile>
<Compile Include="Views\Device\ImportHeaders.generated.cs">
<DependentUpon>ImportHeaders.cshtml</DependentUpon>
<AutoGen>True</AutoGen>
@@ -1298,6 +1339,22 @@
<Generator>RazorGenerator</Generator>
<LastGenOutput>_DeviceGroupDocumentBulkGenerate.generated.cs</LastGenOutput>
</None>
<Content Include="Areas\Config\Views\DeviceFlag\Create.cshtml">
<Generator>RazorGenerator</Generator>
<LastGenOutput>Create.generated.cs</LastGenOutput>
</Content>
<Content Include="Areas\Config\Views\DeviceFlag\Export.cshtml">
<Generator>RazorGenerator</Generator>
<LastGenOutput>Export.generated.cs</LastGenOutput>
</Content>
<Content Include="Areas\Config\Views\DeviceFlag\Index.cshtml">
<Generator>RazorGenerator</Generator>
<LastGenOutput>Index.generated.cs</LastGenOutput>
</Content>
<Content Include="Areas\Config\Views\DeviceFlag\Show.cshtml">
<Generator>RazorGenerator</Generator>
<LastGenOutput>Show.generated.cs</LastGenOutput>
</Content>
<None Include="Areas\Config\Views\UserFlag\Create.cshtml">
<Generator>RazorGenerator</Generator>
<LastGenOutput>Create.generated.cs</LastGenOutput>
@@ -1884,6 +1941,10 @@
<Generator>RazorGenerator</Generator>
<LastGenOutput>AddOffline.generated.cs</LastGenOutput>
</None>
<Content Include="Views\Device\DeviceParts\_Flags.cshtml">
<Generator>RazorGenerator</Generator>
<LastGenOutput>_Flags.generated.cs</LastGenOutput>
</Content>
<None Include="Views\Device\ImportHeaders.cshtml">
<Generator>RazorGenerator</Generator>
<LastGenOutput>ImportHeaders.generated.cs</LastGenOutput>
@@ -0,0 +1,235 @@
// <auto-generated />
// This file was generated by a T4 template.
// Don't change it directly as your change would get overwritten. Instead, make changes
// to the .tt file (i.e. the T4 template) and save it to regenerate this file.
// Make sure the compiler doesn't complain about missing Xml comments and CLS compliance
// 0108: suppress "Foo hides inherited member Foo. Use the new keyword if hiding was intended." when a controller and its abstract parent are both processed
// 0114: suppress "Foo.BarController.Baz()' hides inherited member 'Qux.BarController.Baz()'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword." when an action (with an argument) overrides an action in a parent controller
#pragma warning disable 1591, 3008, 3009, 0108, 0114
#region T4MVC
using System;
using System.Diagnostics;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using System.Web;
using System.Web.Hosting;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using System.Web.Mvc.Html;
using System.Web.Routing;
using T4MVC;
namespace Disco.Web.Areas.API.Controllers
{
public partial class DeviceFlagAssignmentController
{
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public DeviceFlagAssignmentController() { }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
protected DeviceFlagAssignmentController(Dummy d) { }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
protected RedirectToRouteResult RedirectToAction(ActionResult result)
{
var callInfo = result.GetT4MVCResult();
return RedirectToRoute(callInfo.RouteValueDictionary);
}
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
protected RedirectToRouteResult RedirectToAction(Task<ActionResult> taskResult)
{
return RedirectToAction(taskResult.Result);
}
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
protected RedirectToRouteResult RedirectToActionPermanent(ActionResult result)
{
var callInfo = result.GetT4MVCResult();
return RedirectToRoutePermanent(callInfo.RouteValueDictionary);
}
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
protected RedirectToRouteResult RedirectToActionPermanent(Task<ActionResult> taskResult)
{
return RedirectToActionPermanent(taskResult.Result);
}
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult Update()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Update);
}
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult UpdateComments()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateComments);
}
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult AddDevice()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.AddDevice);
}
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult RemoveDevice()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.RemoveDevice);
}
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public DeviceFlagAssignmentController Actions { get { return MVC.API.DeviceFlagAssignment; } }
[GeneratedCode("T4MVC", "2.0")]
public readonly string Area = "API";
[GeneratedCode("T4MVC", "2.0")]
public readonly string Name = "DeviceFlagAssignment";
[GeneratedCode("T4MVC", "2.0")]
public const string NameConst = "DeviceFlagAssignment";
[GeneratedCode("T4MVC", "2.0")]
static readonly ActionNamesClass s_actions = new ActionNamesClass();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionNamesClass ActionNames { get { return s_actions; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionNamesClass
{
public readonly string Update = "Update";
public readonly string UpdateComments = "UpdateComments";
public readonly string AddDevice = "AddDevice";
public readonly string RemoveDevice = "RemoveDevice";
}
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionNameConstants
{
public const string Update = "Update";
public const string UpdateComments = "UpdateComments";
public const string AddDevice = "AddDevice";
public const string RemoveDevice = "RemoveDevice";
}
static readonly ActionParamsClass_Update s_params_Update = new ActionParamsClass_Update();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_Update UpdateParams { get { return s_params_Update; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_Update
{
public readonly string id = "id";
public readonly string key = "key";
public readonly string value = "value";
public readonly string redirect = "redirect";
}
static readonly ActionParamsClass_UpdateComments s_params_UpdateComments = new ActionParamsClass_UpdateComments();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_UpdateComments UpdateCommentsParams { get { return s_params_UpdateComments; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_UpdateComments
{
public readonly string id = "id";
public readonly string Comments = "Comments";
public readonly string redirect = "redirect";
}
static readonly ActionParamsClass_AddDevice s_params_AddDevice = new ActionParamsClass_AddDevice();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_AddDevice AddDeviceParams { get { return s_params_AddDevice; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_AddDevice
{
public readonly string id = "id";
public readonly string DeviceSerialNumber = "DeviceSerialNumber";
public readonly string Comments = "Comments";
}
static readonly ActionParamsClass_RemoveDevice s_params_RemoveDevice = new ActionParamsClass_RemoveDevice();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_RemoveDevice RemoveDeviceParams { get { return s_params_RemoveDevice; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_RemoveDevice
{
public readonly string id = "id";
}
static readonly ViewsClass s_views = new ViewsClass();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ViewsClass Views { get { return s_views; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ViewsClass
{
static readonly _ViewNamesClass s_ViewNames = new _ViewNamesClass();
public _ViewNamesClass ViewNames { get { return s_ViewNames; } }
public class _ViewNamesClass
{
}
}
}
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public partial class T4MVC_DeviceFlagAssignmentController : Disco.Web.Areas.API.Controllers.DeviceFlagAssignmentController
{
public T4MVC_DeviceFlagAssignmentController() : base(Dummy.Instance) { }
[NonAction]
partial void UpdateOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id, string key, string value, bool? redirect);
[NonAction]
public override System.Web.Mvc.ActionResult Update(int id, string key, string value, bool? redirect)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Update);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "key", key);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "value", value);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "redirect", redirect);
UpdateOverride(callInfo, id, key, value, redirect);
return callInfo;
}
[NonAction]
partial void UpdateCommentsOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id, string Comments, bool? redirect);
[NonAction]
public override System.Web.Mvc.ActionResult UpdateComments(int id, string Comments, bool? redirect)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateComments);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "Comments", Comments);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "redirect", redirect);
UpdateCommentsOverride(callInfo, id, Comments, redirect);
return callInfo;
}
[NonAction]
partial void AddDeviceOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id, string DeviceSerialNumber, string Comments);
[NonAction]
public override System.Web.Mvc.ActionResult AddDevice(int id, string DeviceSerialNumber, string Comments)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.AddDevice);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "DeviceSerialNumber", DeviceSerialNumber);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "Comments", Comments);
AddDeviceOverride(callInfo, id, DeviceSerialNumber, Comments);
return callInfo;
}
[NonAction]
partial void RemoveDeviceOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id);
[NonAction]
public override System.Web.Mvc.ActionResult RemoveDevice(int id)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.RemoveDevice);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
RemoveDeviceOverride(callInfo, id);
return callInfo;
}
}
}
#endregion T4MVC
#pragma warning restore 1591, 3008, 3009, 0108, 0114
@@ -0,0 +1,585 @@
// <auto-generated />
// This file was generated by a T4 template.
// Don't change it directly as your change would get overwritten. Instead, make changes
// to the .tt file (i.e. the T4 template) and save it to regenerate this file.
// Make sure the compiler doesn't complain about missing Xml comments and CLS compliance
// 0108: suppress "Foo hides inherited member Foo. Use the new keyword if hiding was intended." when a controller and its abstract parent are both processed
// 0114: suppress "Foo.BarController.Baz()' hides inherited member 'Qux.BarController.Baz()'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword." when an action (with an argument) overrides an action in a parent controller
#pragma warning disable 1591, 3008, 3009, 0108, 0114
#region T4MVC
using System;
using System.Diagnostics;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using System.Web;
using System.Web.Hosting;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using System.Web.Mvc.Html;
using System.Web.Routing;
using T4MVC;
namespace Disco.Web.Areas.API.Controllers
{
public partial class DeviceFlagController
{
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public DeviceFlagController() { }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
protected DeviceFlagController(Dummy d) { }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
protected RedirectToRouteResult RedirectToAction(ActionResult result)
{
var callInfo = result.GetT4MVCResult();
return RedirectToRoute(callInfo.RouteValueDictionary);
}
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
protected RedirectToRouteResult RedirectToAction(Task<ActionResult> taskResult)
{
return RedirectToAction(taskResult.Result);
}
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
protected RedirectToRouteResult RedirectToActionPermanent(ActionResult result)
{
var callInfo = result.GetT4MVCResult();
return RedirectToRoutePermanent(callInfo.RouteValueDictionary);
}
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
protected RedirectToRouteResult RedirectToActionPermanent(Task<ActionResult> taskResult)
{
return RedirectToActionPermanent(taskResult.Result);
}
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult Update()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Update);
}
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult UpdateName()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateName);
}
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult UpdateDescription()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateDescription);
}
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult UpdateIcon()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateIcon);
}
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult UpdateIconColour()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateIconColour);
}
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult UpdateIconAndColour()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateIconAndColour);
}
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult UpdateOnAssignmentExpression()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateOnAssignmentExpression);
}
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult UpdateOnUnassignmentExpression()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateOnUnassignmentExpression);
}
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult UpdateDevicesLinkedGroup()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateDevicesLinkedGroup);
}
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult UpdateAssignedUserLinkedGroup()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateAssignedUserLinkedGroup);
}
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult Delete()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Delete);
}
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult BulkAssignDevices()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.BulkAssignDevices);
}
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult AssignedDevices()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.AssignedDevices);
}
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult Export()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Export);
}
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult ExportRetrieve()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.ExportRetrieve);
}
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public DeviceFlagController Actions { get { return MVC.API.DeviceFlag; } }
[GeneratedCode("T4MVC", "2.0")]
public readonly string Area = "API";
[GeneratedCode("T4MVC", "2.0")]
public readonly string Name = "DeviceFlag";
[GeneratedCode("T4MVC", "2.0")]
public const string NameConst = "DeviceFlag";
[GeneratedCode("T4MVC", "2.0")]
static readonly ActionNamesClass s_actions = new ActionNamesClass();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionNamesClass ActionNames { get { return s_actions; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionNamesClass
{
public readonly string Update = "Update";
public readonly string UpdateName = "UpdateName";
public readonly string UpdateDescription = "UpdateDescription";
public readonly string UpdateIcon = "UpdateIcon";
public readonly string UpdateIconColour = "UpdateIconColour";
public readonly string UpdateIconAndColour = "UpdateIconAndColour";
public readonly string UpdateOnAssignmentExpression = "UpdateOnAssignmentExpression";
public readonly string UpdateOnUnassignmentExpression = "UpdateOnUnassignmentExpression";
public readonly string UpdateDevicesLinkedGroup = "UpdateDevicesLinkedGroup";
public readonly string UpdateAssignedUserLinkedGroup = "UpdateAssignedUserLinkedGroup";
public readonly string Delete = "Delete";
public readonly string BulkAssignDevices = "BulkAssignDevices";
public readonly string AssignedDevices = "AssignedDevices";
public readonly string Export = "Export";
public readonly string ExportRetrieve = "ExportRetrieve";
}
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionNameConstants
{
public const string Update = "Update";
public const string UpdateName = "UpdateName";
public const string UpdateDescription = "UpdateDescription";
public const string UpdateIcon = "UpdateIcon";
public const string UpdateIconColour = "UpdateIconColour";
public const string UpdateIconAndColour = "UpdateIconAndColour";
public const string UpdateOnAssignmentExpression = "UpdateOnAssignmentExpression";
public const string UpdateOnUnassignmentExpression = "UpdateOnUnassignmentExpression";
public const string UpdateDevicesLinkedGroup = "UpdateDevicesLinkedGroup";
public const string UpdateAssignedUserLinkedGroup = "UpdateAssignedUserLinkedGroup";
public const string Delete = "Delete";
public const string BulkAssignDevices = "BulkAssignDevices";
public const string AssignedDevices = "AssignedDevices";
public const string Export = "Export";
public const string ExportRetrieve = "ExportRetrieve";
}
static readonly ActionParamsClass_Update s_params_Update = new ActionParamsClass_Update();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_Update UpdateParams { get { return s_params_Update; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_Update
{
public readonly string id = "id";
public readonly string key = "key";
public readonly string value = "value";
public readonly string redirect = "redirect";
}
static readonly ActionParamsClass_UpdateName s_params_UpdateName = new ActionParamsClass_UpdateName();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_UpdateName UpdateNameParams { get { return s_params_UpdateName; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_UpdateName
{
public readonly string id = "id";
public readonly string FlagName = "FlagName";
public readonly string redirect = "redirect";
}
static readonly ActionParamsClass_UpdateDescription s_params_UpdateDescription = new ActionParamsClass_UpdateDescription();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_UpdateDescription UpdateDescriptionParams { get { return s_params_UpdateDescription; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_UpdateDescription
{
public readonly string id = "id";
public readonly string Description = "Description";
public readonly string redirect = "redirect";
}
static readonly ActionParamsClass_UpdateIcon s_params_UpdateIcon = new ActionParamsClass_UpdateIcon();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_UpdateIcon UpdateIconParams { get { return s_params_UpdateIcon; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_UpdateIcon
{
public readonly string id = "id";
public readonly string Icon = "Icon";
public readonly string redirect = "redirect";
}
static readonly ActionParamsClass_UpdateIconColour s_params_UpdateIconColour = new ActionParamsClass_UpdateIconColour();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_UpdateIconColour UpdateIconColourParams { get { return s_params_UpdateIconColour; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_UpdateIconColour
{
public readonly string id = "id";
public readonly string IconColour = "IconColour";
public readonly string redirect = "redirect";
}
static readonly ActionParamsClass_UpdateIconAndColour s_params_UpdateIconAndColour = new ActionParamsClass_UpdateIconAndColour();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_UpdateIconAndColour UpdateIconAndColourParams { get { return s_params_UpdateIconAndColour; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_UpdateIconAndColour
{
public readonly string id = "id";
public readonly string Icon = "Icon";
public readonly string IconColour = "IconColour";
public readonly string redirect = "redirect";
}
static readonly ActionParamsClass_UpdateOnAssignmentExpression s_params_UpdateOnAssignmentExpression = new ActionParamsClass_UpdateOnAssignmentExpression();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_UpdateOnAssignmentExpression UpdateOnAssignmentExpressionParams { get { return s_params_UpdateOnAssignmentExpression; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_UpdateOnAssignmentExpression
{
public readonly string id = "id";
public readonly string OnAssignmentExpression = "OnAssignmentExpression";
public readonly string redirect = "redirect";
}
static readonly ActionParamsClass_UpdateOnUnassignmentExpression s_params_UpdateOnUnassignmentExpression = new ActionParamsClass_UpdateOnUnassignmentExpression();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_UpdateOnUnassignmentExpression UpdateOnUnassignmentExpressionParams { get { return s_params_UpdateOnUnassignmentExpression; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_UpdateOnUnassignmentExpression
{
public readonly string id = "id";
public readonly string OnUnassignmentExpression = "OnUnassignmentExpression";
public readonly string redirect = "redirect";
}
static readonly ActionParamsClass_UpdateDevicesLinkedGroup s_params_UpdateDevicesLinkedGroup = new ActionParamsClass_UpdateDevicesLinkedGroup();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_UpdateDevicesLinkedGroup UpdateDevicesLinkedGroupParams { get { return s_params_UpdateDevicesLinkedGroup; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_UpdateDevicesLinkedGroup
{
public readonly string id = "id";
public readonly string GroupId = "GroupId";
public readonly string FilterBeginDate = "FilterBeginDate";
public readonly string redirect = "redirect";
}
static readonly ActionParamsClass_UpdateAssignedUserLinkedGroup s_params_UpdateAssignedUserLinkedGroup = new ActionParamsClass_UpdateAssignedUserLinkedGroup();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_UpdateAssignedUserLinkedGroup UpdateAssignedUserLinkedGroupParams { get { return s_params_UpdateAssignedUserLinkedGroup; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_UpdateAssignedUserLinkedGroup
{
public readonly string id = "id";
public readonly string GroupId = "GroupId";
public readonly string FilterBeginDate = "FilterBeginDate";
public readonly string redirect = "redirect";
}
static readonly ActionParamsClass_Delete s_params_Delete = new ActionParamsClass_Delete();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_Delete DeleteParams { get { return s_params_Delete; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_Delete
{
public readonly string id = "id";
public readonly string redirect = "redirect";
}
static readonly ActionParamsClass_BulkAssignDevices s_params_BulkAssignDevices = new ActionParamsClass_BulkAssignDevices();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_BulkAssignDevices BulkAssignDevicesParams { get { return s_params_BulkAssignDevices; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_BulkAssignDevices
{
public readonly string id = "id";
public readonly string Override = "Override";
public readonly string DeviceSerialNumbers = "DeviceSerialNumbers";
public readonly string Comments = "Comments";
}
static readonly ActionParamsClass_AssignedDevices s_params_AssignedDevices = new ActionParamsClass_AssignedDevices();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_AssignedDevices AssignedDevicesParams { get { return s_params_AssignedDevices; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_AssignedDevices
{
public readonly string id = "id";
}
static readonly ActionParamsClass_Export s_params_Export = new ActionParamsClass_Export();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_Export ExportParams { get { return s_params_Export; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_Export
{
public readonly string Model = "Model";
}
static readonly ActionParamsClass_ExportRetrieve s_params_ExportRetrieve = new ActionParamsClass_ExportRetrieve();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_ExportRetrieve ExportRetrieveParams { get { return s_params_ExportRetrieve; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_ExportRetrieve
{
public readonly string Id = "Id";
}
static readonly ViewsClass s_views = new ViewsClass();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ViewsClass Views { get { return s_views; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ViewsClass
{
static readonly _ViewNamesClass s_ViewNames = new _ViewNamesClass();
public _ViewNamesClass ViewNames { get { return s_ViewNames; } }
public class _ViewNamesClass
{
}
}
}
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public partial class T4MVC_DeviceFlagController : Disco.Web.Areas.API.Controllers.DeviceFlagController
{
public T4MVC_DeviceFlagController() : base(Dummy.Instance) { }
[NonAction]
partial void UpdateOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id, string key, string value, bool? redirect);
[NonAction]
public override System.Web.Mvc.ActionResult Update(int id, string key, string value, bool? redirect)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Update);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "key", key);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "value", value);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "redirect", redirect);
UpdateOverride(callInfo, id, key, value, redirect);
return callInfo;
}
[NonAction]
partial void UpdateNameOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id, string FlagName, bool? redirect);
[NonAction]
public override System.Web.Mvc.ActionResult UpdateName(int id, string FlagName, bool? redirect)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateName);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "FlagName", FlagName);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "redirect", redirect);
UpdateNameOverride(callInfo, id, FlagName, redirect);
return callInfo;
}
[NonAction]
partial void UpdateDescriptionOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id, string Description, bool? redirect);
[NonAction]
public override System.Web.Mvc.ActionResult UpdateDescription(int id, string Description, bool? redirect)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateDescription);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "Description", Description);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "redirect", redirect);
UpdateDescriptionOverride(callInfo, id, Description, redirect);
return callInfo;
}
[NonAction]
partial void UpdateIconOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id, string Icon, bool? redirect);
[NonAction]
public override System.Web.Mvc.ActionResult UpdateIcon(int id, string Icon, bool? redirect)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateIcon);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "Icon", Icon);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "redirect", redirect);
UpdateIconOverride(callInfo, id, Icon, redirect);
return callInfo;
}
[NonAction]
partial void UpdateIconColourOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id, string IconColour, bool? redirect);
[NonAction]
public override System.Web.Mvc.ActionResult UpdateIconColour(int id, string IconColour, bool? redirect)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateIconColour);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "IconColour", IconColour);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "redirect", redirect);
UpdateIconColourOverride(callInfo, id, IconColour, redirect);
return callInfo;
}
[NonAction]
partial void UpdateIconAndColourOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id, string Icon, string IconColour, bool redirect);
[NonAction]
public override System.Web.Mvc.ActionResult UpdateIconAndColour(int id, string Icon, string IconColour, bool redirect)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateIconAndColour);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "Icon", Icon);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "IconColour", IconColour);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "redirect", redirect);
UpdateIconAndColourOverride(callInfo, id, Icon, IconColour, redirect);
return callInfo;
}
[NonAction]
partial void UpdateOnAssignmentExpressionOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id, string OnAssignmentExpression, bool redirect);
[NonAction]
public override System.Web.Mvc.ActionResult UpdateOnAssignmentExpression(int id, string OnAssignmentExpression, bool redirect)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateOnAssignmentExpression);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "OnAssignmentExpression", OnAssignmentExpression);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "redirect", redirect);
UpdateOnAssignmentExpressionOverride(callInfo, id, OnAssignmentExpression, redirect);
return callInfo;
}
[NonAction]
partial void UpdateOnUnassignmentExpressionOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id, string OnUnassignmentExpression, bool redirect);
[NonAction]
public override System.Web.Mvc.ActionResult UpdateOnUnassignmentExpression(int id, string OnUnassignmentExpression, bool redirect)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateOnUnassignmentExpression);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "OnUnassignmentExpression", OnUnassignmentExpression);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "redirect", redirect);
UpdateOnUnassignmentExpressionOverride(callInfo, id, OnUnassignmentExpression, redirect);
return callInfo;
}
[NonAction]
partial void UpdateDevicesLinkedGroupOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id, string GroupId, System.DateTime? FilterBeginDate, bool redirect);
[NonAction]
public override System.Web.Mvc.ActionResult UpdateDevicesLinkedGroup(int id, string GroupId, System.DateTime? FilterBeginDate, bool redirect)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateDevicesLinkedGroup);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "GroupId", GroupId);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "FilterBeginDate", FilterBeginDate);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "redirect", redirect);
UpdateDevicesLinkedGroupOverride(callInfo, id, GroupId, FilterBeginDate, redirect);
return callInfo;
}
[NonAction]
partial void UpdateAssignedUserLinkedGroupOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id, string GroupId, System.DateTime? FilterBeginDate, bool redirect);
[NonAction]
public override System.Web.Mvc.ActionResult UpdateAssignedUserLinkedGroup(int id, string GroupId, System.DateTime? FilterBeginDate, bool redirect)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.UpdateAssignedUserLinkedGroup);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "GroupId", GroupId);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "FilterBeginDate", FilterBeginDate);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "redirect", redirect);
UpdateAssignedUserLinkedGroupOverride(callInfo, id, GroupId, FilterBeginDate, redirect);
return callInfo;
}
[NonAction]
partial void DeleteOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id, bool? redirect);
[NonAction]
public override System.Web.Mvc.ActionResult Delete(int id, bool? redirect)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Delete);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "redirect", redirect);
DeleteOverride(callInfo, id, redirect);
return callInfo;
}
[NonAction]
partial void BulkAssignDevicesOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id, bool Override, string DeviceSerialNumbers, string Comments);
[NonAction]
public override System.Web.Mvc.ActionResult BulkAssignDevices(int id, bool Override, string DeviceSerialNumbers, string Comments)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.BulkAssignDevices);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "Override", Override);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "DeviceSerialNumbers", DeviceSerialNumbers);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "Comments", Comments);
BulkAssignDevicesOverride(callInfo, id, Override, DeviceSerialNumbers, Comments);
return callInfo;
}
[NonAction]
partial void AssignedDevicesOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int id);
[NonAction]
public override System.Web.Mvc.ActionResult AssignedDevices(int id)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.AssignedDevices);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
AssignedDevicesOverride(callInfo, id);
return callInfo;
}
[NonAction]
partial void ExportOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, Disco.Web.Areas.Config.Models.DeviceFlag.ExportModel Model);
[NonAction]
public override System.Web.Mvc.ActionResult Export(Disco.Web.Areas.Config.Models.DeviceFlag.ExportModel Model)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Export);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "Model", Model);
ExportOverride(callInfo, Model);
return callInfo;
}
[NonAction]
partial void ExportRetrieveOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, string Id);
[NonAction]
public override System.Web.Mvc.ActionResult ExportRetrieve(string Id)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.ExportRetrieve);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "Id", Id);
ExportRetrieveOverride(callInfo, Id);
return callInfo;
}
}
}
#endregion T4MVC
#pragma warning restore 1591, 3008, 3009, 0108, 0114
@@ -0,0 +1,210 @@
// <auto-generated />
// This file was generated by a T4 template.
// Don't change it directly as your change would get overwritten. Instead, make changes
// to the .tt file (i.e. the T4 template) and save it to regenerate this file.
// Make sure the compiler doesn't complain about missing Xml comments and CLS compliance
// 0108: suppress "Foo hides inherited member Foo. Use the new keyword if hiding was intended." when a controller and its abstract parent are both processed
// 0114: suppress "Foo.BarController.Baz()' hides inherited member 'Qux.BarController.Baz()'. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword." when an action (with an argument) overrides an action in a parent controller
#pragma warning disable 1591, 3008, 3009, 0108, 0114
#region T4MVC
using System;
using System.Diagnostics;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using System.Web;
using System.Web.Hosting;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using System.Web.Mvc.Html;
using System.Web.Routing;
using T4MVC;
namespace Disco.Web.Areas.Config.Controllers
{
public partial class DeviceFlagController
{
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public DeviceFlagController() { }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
protected DeviceFlagController(Dummy d) { }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
protected RedirectToRouteResult RedirectToAction(ActionResult result)
{
var callInfo = result.GetT4MVCResult();
return RedirectToRoute(callInfo.RouteValueDictionary);
}
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
protected RedirectToRouteResult RedirectToAction(Task<ActionResult> taskResult)
{
return RedirectToAction(taskResult.Result);
}
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
protected RedirectToRouteResult RedirectToActionPermanent(ActionResult result)
{
var callInfo = result.GetT4MVCResult();
return RedirectToRoutePermanent(callInfo.RouteValueDictionary);
}
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
protected RedirectToRouteResult RedirectToActionPermanent(Task<ActionResult> taskResult)
{
return RedirectToActionPermanent(taskResult.Result);
}
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult Index()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Index);
}
[NonAction]
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public virtual System.Web.Mvc.ActionResult Export()
{
return new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Export);
}
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public DeviceFlagController Actions { get { return MVC.Config.DeviceFlag; } }
[GeneratedCode("T4MVC", "2.0")]
public readonly string Area = "Config";
[GeneratedCode("T4MVC", "2.0")]
public readonly string Name = "DeviceFlag";
[GeneratedCode("T4MVC", "2.0")]
public const string NameConst = "DeviceFlag";
[GeneratedCode("T4MVC", "2.0")]
static readonly ActionNamesClass s_actions = new ActionNamesClass();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionNamesClass ActionNames { get { return s_actions; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionNamesClass
{
public readonly string Index = "Index";
public readonly string Create = "Create";
public readonly string Export = "Export";
}
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionNameConstants
{
public const string Index = "Index";
public const string Create = "Create";
public const string Export = "Export";
}
static readonly ActionParamsClass_Index s_params_Index = new ActionParamsClass_Index();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_Index IndexParams { get { return s_params_Index; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_Index
{
public readonly string id = "id";
}
static readonly ActionParamsClass_Create s_params_Create = new ActionParamsClass_Create();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_Create CreateParams { get { return s_params_Create; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_Create
{
public readonly string model = "model";
}
static readonly ActionParamsClass_Export s_params_Export = new ActionParamsClass_Export();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ActionParamsClass_Export ExportParams { get { return s_params_Export; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ActionParamsClass_Export
{
public readonly string DownloadId = "DownloadId";
public readonly string DeviceFlagId = "DeviceFlagId";
public readonly string CurrentOnly = "CurrentOnly";
}
static readonly ViewsClass s_views = new ViewsClass();
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public ViewsClass Views { get { return s_views; } }
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public class ViewsClass
{
static readonly _ViewNamesClass s_ViewNames = new _ViewNamesClass();
public _ViewNamesClass ViewNames { get { return s_ViewNames; } }
public class _ViewNamesClass
{
public readonly string Create = "Create";
public readonly string Export = "Export";
public readonly string Index = "Index";
public readonly string Show = "Show";
}
public readonly string Create = "~/Areas/Config/Views/DeviceFlag/Create.cshtml";
public readonly string Export = "~/Areas/Config/Views/DeviceFlag/Export.cshtml";
public readonly string Index = "~/Areas/Config/Views/DeviceFlag/Index.cshtml";
public readonly string Show = "~/Areas/Config/Views/DeviceFlag/Show.cshtml";
}
}
[GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
public partial class T4MVC_DeviceFlagController : Disco.Web.Areas.Config.Controllers.DeviceFlagController
{
public T4MVC_DeviceFlagController() : base(Dummy.Instance) { }
[NonAction]
partial void IndexOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int? id);
[NonAction]
public override System.Web.Mvc.ActionResult Index(int? id)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Index);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "id", id);
IndexOverride(callInfo, id);
return callInfo;
}
[NonAction]
partial void CreateOverride(T4MVC_System_Web_Mvc_ActionResult callInfo);
[NonAction]
public override System.Web.Mvc.ActionResult Create()
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Create);
CreateOverride(callInfo);
return callInfo;
}
[NonAction]
partial void CreateOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, Disco.Web.Areas.Config.Models.DeviceFlag.CreateModel model);
[NonAction]
public override System.Web.Mvc.ActionResult Create(Disco.Web.Areas.Config.Models.DeviceFlag.CreateModel model)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Create);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "model", model);
CreateOverride(callInfo, model);
return callInfo;
}
[NonAction]
partial void ExportOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, string DownloadId, int? DeviceFlagId, bool? CurrentOnly);
[NonAction]
public override System.Web.Mvc.ActionResult Export(string DownloadId, int? DeviceFlagId, bool? CurrentOnly)
{
var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.Export);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "DownloadId", DownloadId);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "DeviceFlagId", DeviceFlagId);
ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "CurrentOnly", CurrentOnly);
ExportOverride(callInfo, DownloadId, DeviceFlagId, CurrentOnly);
return callInfo;
}
}
}
#endregion T4MVC
#pragma warning restore 1591, 3008, 3009, 0108, 0114
@@ -218,6 +218,7 @@ namespace Disco.Web.Controllers
public readonly string _AssignmentHistory = "_AssignmentHistory";
public readonly string _Certificates = "_Certificates";
public readonly string _Details = "_Details";
public readonly string _Flags = "_Flags";
public readonly string _Jobs = "_Jobs";
public readonly string _Resources = "_Resources";
public readonly string _Subject = "_Subject";
@@ -225,6 +226,7 @@ namespace Disco.Web.Controllers
public readonly string _AssignmentHistory = "~/Views/Device/DeviceParts/_AssignmentHistory.cshtml";
public readonly string _Certificates = "~/Views/Device/DeviceParts/_Certificates.cshtml";
public readonly string _Details = "~/Views/Device/DeviceParts/_Details.cshtml";
public readonly string _Flags = "~/Views/Device/DeviceParts/_Flags.cshtml";
public readonly string _Jobs = "~/Views/Device/DeviceParts/_Jobs.cshtml";
public readonly string _Resources = "~/Views/Device/DeviceParts/_Resources.cshtml";
public readonly string _Subject = "~/Views/Device/DeviceParts/_Subject.cshtml";
+3
View File
@@ -56,6 +56,8 @@ namespace T4MVC
public Disco.Web.Areas.API.Controllers.DeviceBatchController DeviceBatch = new Disco.Web.Areas.API.Controllers.T4MVC_DeviceBatchController();
public Disco.Web.Areas.API.Controllers.DeviceCertificateController DeviceCertificate = new Disco.Web.Areas.API.Controllers.T4MVC_DeviceCertificateController();
public Disco.Web.Areas.API.Controllers.DeviceController Device = new Disco.Web.Areas.API.Controllers.T4MVC_DeviceController();
public Disco.Web.Areas.API.Controllers.DeviceFlagAssignmentController DeviceFlagAssignment = new Disco.Web.Areas.API.Controllers.T4MVC_DeviceFlagAssignmentController();
public Disco.Web.Areas.API.Controllers.DeviceFlagController DeviceFlag = new Disco.Web.Areas.API.Controllers.T4MVC_DeviceFlagController();
public Disco.Web.Areas.API.Controllers.DeviceModelController DeviceModel = new Disco.Web.Areas.API.Controllers.T4MVC_DeviceModelController();
public Disco.Web.Areas.API.Controllers.DeviceProfileController DeviceProfile = new Disco.Web.Areas.API.Controllers.T4MVC_DeviceProfileController();
public Disco.Web.Areas.API.Controllers.DocumentTemplateController DocumentTemplate = new Disco.Web.Areas.API.Controllers.T4MVC_DocumentTemplateController();
@@ -80,6 +82,7 @@ namespace T4MVC
public Disco.Web.Areas.Config.Controllers.AuthorizationRoleController AuthorizationRole = new Disco.Web.Areas.Config.Controllers.T4MVC_AuthorizationRoleController();
public Disco.Web.Areas.Config.Controllers.ConfigController Config = new Disco.Web.Areas.Config.Controllers.T4MVC_ConfigController();
public Disco.Web.Areas.Config.Controllers.DeviceBatchController DeviceBatch = new Disco.Web.Areas.Config.Controllers.T4MVC_DeviceBatchController();
public Disco.Web.Areas.Config.Controllers.DeviceFlagController DeviceFlag = new Disco.Web.Areas.Config.Controllers.T4MVC_DeviceFlagController();
public Disco.Web.Areas.Config.Controllers.DeviceModelController DeviceModel = new Disco.Web.Areas.Config.Controllers.T4MVC_DeviceModelController();
public Disco.Web.Areas.Config.Controllers.DeviceProfileController DeviceProfile = new Disco.Web.Areas.Config.Controllers.T4MVC_DeviceProfileController();
public Disco.Web.Areas.Config.Controllers.DocumentTemplateController DocumentTemplate = new Disco.Web.Areas.Config.Controllers.T4MVC_DocumentTemplateController();
+8 -5
View File
@@ -1,4 +1,5 @@
using Disco.Models.Services.Documents;
using Disco.Models.Repository;
using Disco.Models.Services.Documents;
using Disco.Models.Services.Jobs.JobLists;
using Disco.Models.UI.Device;
using Disco.Services.Plugins;
@@ -13,20 +14,20 @@ namespace Disco.Web.Models.Device
{
public Disco.Models.Repository.Device Device { get; set; }
public List<Disco.Models.Repository.DeviceProfile> DeviceProfiles { get; set; }
public List<DeviceProfile> DeviceProfiles { get; set; }
public HashSet<int> DecommissionedDeviceProfileIds { get; set; }
public Disco.Models.BI.Config.OrganisationAddress DeviceProfileDefaultOrganisationAddress { get; set; }
public List<PluginFeatureManifest> DeviceProfileCertificateProviders { get; set; }
public List<PluginFeatureManifest> DeviceProfileWirelessProfileProviders { get; set; }
public List<Disco.Models.Repository.DeviceBatch> DeviceBatches { get; set; }
public List<DeviceBatch> DeviceBatches { get; set; }
public HashSet<int> DecommissionedDeviceBatchIds { get; set; }
public JobTableModel Jobs { get; set; }
public List<Disco.Models.Repository.DeviceCertificate> Certificates { get; set; }
public List<DeviceCertificate> Certificates { get; set; }
public string OrganisationUnit { get; set; }
public List<Disco.Models.Repository.DocumentTemplate> DocumentTemplates { get; set; }
public List<DocumentTemplate> DocumentTemplates { get; set; }
public List<DocumentTemplatePackage> DocumentTemplatePackages { get; set; }
public GenerateDocumentControlModel GenerateDocumentControlModel => new GenerateDocumentControlModel()
{
@@ -36,6 +37,8 @@ namespace Disco.Web.Models.Device
HandlersPresent = Plugins.GetPluginFeatures(typeof(DocumentHandlerProviderFeature)).Any(),
};
public List<DeviceFlag> AvailableDeviceFlags { get; set; }
public Dictionary<string, string> AssignedUserDetails { get; set; }
public bool HasAssignedUserPhoto { get; set; }
}
@@ -0,0 +1,182 @@
@model Disco.Web.Models.Device.ShowModel
@using Disco.Services.Devices.DeviceFlags;
@{
Authorization.Require(Claims.Device.ShowFlagAssignments);
var hasRemove = Authorization.Has(Claims.Device.Actions.RemoveFlags);
var hasEdit = Authorization.Has(Claims.Device.Actions.EditFlags);
var hasDeviceFlagShow = Authorization.Has(Claims.Config.DeviceFlag.Show);
var activeAssignmentCount = Model.Device.DeviceFlagAssignments == null ? 0 : Model.Device.DeviceFlagAssignments.Count(a => !a.RemovedDate.HasValue);
var flagAssignments = Model.Device.DeviceFlagAssignments.Select(a => Tuple.Create(a, DeviceFlagService.GetDeviceFlag(a.DeviceFlagId))).ToList();
}
<div id="DeviceDetailTab-Flags" class="DevicePart">
@if (flagAssignments.Count > 0)
{
<table id="deviceFlags">
<tr>
<th class="name">Name</th>
<th class="added">Added</th>
<th class="sla">Comments</th>
<th class="removed">Removed</th>
</tr>
@foreach (var fa in flagAssignments.OrderByDescending(a => a.Item1.AddedDate))
{
<tr data-deviceflagassignmentid="@fa.Item1.Id" data-flagassignmentaddeddate="@(fa.Item1.AddedDate.ToString("s"))" class="@(!fa.Item1.RemovedDate.HasValue ? "added" : "removed")">
<td class="name">
<i class="fa fa-@(fa.Item2.Icon) fa-fw fa-lg d-@(fa.Item2.IconColour)"></i>
@if (hasDeviceFlagShow)
{
@Html.ActionLink(fa.Item2.Name, MVC.Config.DeviceFlag.Index(fa.Item2.Id))
}
else
{
@fa.Item2.Name
}
</td>
<td class="added">
@CommonHelpers.FriendlyDateAndUser(fa.Item1.AddedDate, fa.Item1.AddedUser)
@if (fa.Item1.OnAssignmentExpressionResult != null)
{
<div class="expressionResult">@fa.Item1.OnAssignmentExpressionResult</div>
}
</td>
<td class="comments">
@if (hasEdit)
{
<div class="editable"><i class="fa fa-fw fa-edit" title="Edit Comments"></i></div>
}
@if (fa.Item1.Comments == null)
{
<div class="comments smallMessage">[no comments]</div>
}
else
{
<div class="comments">@fa.Item1.Comments.ToHtmlComment()</div>
<div class="commentsRaw">@fa.Item1.Comments</div>
}
</td>
<td class="removed@(!fa.Item1.RemovedDate.HasValue ? " na" : null)">
@if (fa.Item1.RemovedDate.HasValue)
{
@CommonHelpers.FriendlyDateAndUser(fa.Item1.RemovedDate.Value, fa.Item1.RemovedUser)
if (fa.Item1.OnUnassignmentExpressionResult != null)
{
<div class="expressionResult">@fa.Item1.OnUnassignmentExpressionResult</div>
}
}
else if (fa.Item1.CanRemove())
{
<a href="#" class="button small remove">Remove</a>
}
</td>
</tr>
}
</table>
<div id="Device_Show_Flags_Actions_Remove_Dialog" class="dialog" title="Remove this flag from the device?">
@using (Html.BeginForm(MVC.API.DeviceFlagAssignment.RemoveDevice()))
{
<input id="Device_Show_Flags_Actions_Remove_Dialog_Id" type="hidden" name="id" value="" />
<p>
<i class="fa fa-exclamation-triangle fa-lg"></i>&nbsp;Are you sure?
</p>
}
</div>
<div id="Device_Show_Flags_Actions_EditComments_Dialog" class="dialog" title="Edit the Comments">
@using (Html.BeginForm(MVC.API.DeviceFlagAssignment.UpdateComments()))
{
<input id="Device_Show_Flags_Actions_EditComments_Dialog_Id" type="hidden" name="id" value="" />
<input type="hidden" name="redirect" value="true" />
<h4>Comments:</h4>
<p>
<textarea id="Device_Show_Flags_Actions_EditComments_Dialog_Comments" name="Comments" class="block"></textarea>
</p>
}
</div>
<script type="text/javascript">
$(function () {
var deviceFlags = $('#deviceFlags');
var dialog = null;
var dialogEditComments = null;
deviceFlags.on('click', 'a.remove', function (e) {
var $this = $(this);
var DeviceFlagAssignmentId = $this.closest('tr').attr('data-deviceflagassignmentid');
if (!dialog) {
dialog = $('#Device_Show_Flags_Actions_Remove_Dialog');
dialog.dialog({
resizable: false,
modal: true,
autoOpen: false,
buttons: {
"Remove Flag": function () {
var $this = $(this);
$this.dialog("disable");
$this.dialog("option", "buttons", null);
$this.find('form').submit();
},
Cancel: function () {
$(this).dialog("close");
}
}
});
}
$('#Device_Show_Flags_Actions_Remove_Dialog_Id').val(DeviceFlagAssignmentId);
dialog.dialog('open');
e.preventDefault();
return false;
});
deviceFlags.on('click', 'td.comments i.fa-edit', function (e) {
var $this = $(this);
var DeviceFlagAssignmentId = $this.closest('tr').attr('data-deviceflagassignmentid');
if (!dialogEditComments) {
dialogEditComments = $('#Device_Show_Flags_Actions_EditComments_Dialog');
dialogEditComments.dialog({
resizable: false,
modal: true,
width: 320,
autoOpen: false,
buttons: {
"Save Changes": function () {
var $this = $(this);
$this.dialog("disable");
$this.dialog("option", "buttons", null);
$this.find('form').submit();
},
Cancel: function () {
$(this).dialog("close");
}
}
});
}
var $comments = $this.closest('td').find('.commentsRaw');
if ($comments.hasClass('smallMessage')) {
$('#Device_Show_Flags_Actions_EditComments_Dialog_Comments').val('');
} else {
$('#Device_Show_Flags_Actions_EditComments_Dialog_Comments').val($comments.text());
}
$('#Device_Show_Flags_Actions_EditComments_Dialog_Id').val(DeviceFlagAssignmentId);
dialogEditComments.dialog('open');
e.preventDefault();
return false;
});
});
</script>
}
else
{
<div class="none">This device has no associated flags</div>
}
<script>
$('#DeviceDetailTabItems').append('<li><a href="#DeviceDetailTab-Flags">Flags [@activeAssignmentCount]</a></li>');
</script>
</div>
@@ -0,0 +1,690 @@
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Disco.Web.Views.Device.DeviceParts
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Helpers;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using System.Web.Mvc.Html;
using System.Web.Routing;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using Disco;
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
#line 2 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
using Disco.Services.Devices.DeviceFlags;
#line default
#line hidden
using Disco.Services.Web;
using Disco.Web;
using Disco.Web.Extensions;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Views/Device/DeviceParts/_Flags.cshtml")]
public partial class _Flags : Disco.Services.Web.WebViewPage<Disco.Web.Models.Device.ShowModel>
{
public _Flags()
{
}
public override void Execute()
{
#line 3 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
Authorization.Require(Claims.Device.ShowFlagAssignments);
var hasRemove = Authorization.Has(Claims.Device.Actions.RemoveFlags);
var hasEdit = Authorization.Has(Claims.Device.Actions.EditFlags);
var hasDeviceFlagShow = Authorization.Has(Claims.Config.DeviceFlag.Show);
var activeAssignmentCount = Model.Device.DeviceFlagAssignments == null ? 0 : Model.Device.DeviceFlagAssignments.Count(a => !a.RemovedDate.HasValue);
var flagAssignments = Model.Device.DeviceFlagAssignments.Select(a => Tuple.Create(a, DeviceFlagService.GetDeviceFlag(a.DeviceFlagId))).ToList();
#line default
#line hidden
WriteLiteral("\r\n<div");
WriteLiteral(" id=\"DeviceDetailTab-Flags\"");
WriteLiteral(" class=\"DevicePart\"");
WriteLiteral(">\r\n");
#line 15 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
#line default
#line hidden
#line 15 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
if (flagAssignments.Count > 0)
{
#line default
#line hidden
WriteLiteral(" <table");
WriteLiteral(" id=\"deviceFlags\"");
WriteLiteral(">\r\n <tr>\r\n <th");
WriteLiteral(" class=\"name\"");
WriteLiteral(">Name</th>\r\n <th");
WriteLiteral(" class=\"added\"");
WriteLiteral(">Added</th>\r\n <th");
WriteLiteral(" class=\"sla\"");
WriteLiteral(">Comments</th>\r\n <th");
WriteLiteral(" class=\"removed\"");
WriteLiteral(">Removed</th>\r\n </tr>\r\n");
#line 24 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
#line default
#line hidden
#line 24 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
foreach (var fa in flagAssignments.OrderByDescending(a => a.Item1.AddedDate))
{
#line default
#line hidden
WriteLiteral(" <tr");
WriteLiteral(" data-deviceflagassignmentid=\"");
#line 26 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
Write(fa.Item1.Id);
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(" data-flagassignmentaddeddate=\"");
#line 26 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
Write(fa.Item1.AddedDate.ToString("s"));
#line default
#line hidden
WriteLiteral("\"");
WriteAttribute("class", Tuple.Create(" class=\"", 1282), Tuple.Create("\"", 1345)
#line 26 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
, Tuple.Create(Tuple.Create("", 1290), Tuple.Create<System.Object, System.Int32>(!fa.Item1.RemovedDate.HasValue ? "added" : "removed"
#line default
#line hidden
, 1290), false)
);
WriteLiteral(">\r\n <td");
WriteLiteral(" class=\"name\"");
WriteLiteral(">\r\n <i");
WriteAttribute("class", Tuple.Create(" class=\"", 1414), Tuple.Create("\"", 1481)
, Tuple.Create(Tuple.Create("", 1422), Tuple.Create("fa", 1422), true)
, Tuple.Create(Tuple.Create(" ", 1424), Tuple.Create("fa-", 1425), true)
#line 28 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
, Tuple.Create(Tuple.Create("", 1428), Tuple.Create<System.Object, System.Int32>(fa.Item2.Icon
#line default
#line hidden
, 1428), false)
, Tuple.Create(Tuple.Create(" ", 1444), Tuple.Create("fa-fw", 1445), true)
, Tuple.Create(Tuple.Create(" ", 1450), Tuple.Create("fa-lg", 1451), true)
, Tuple.Create(Tuple.Create(" ", 1456), Tuple.Create("d-", 1457), true)
#line 28 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
, Tuple.Create(Tuple.Create("", 1459), Tuple.Create<System.Object, System.Int32>(fa.Item2.IconColour
#line default
#line hidden
, 1459), false)
);
WriteLiteral("></i>\r\n");
#line 29 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
#line default
#line hidden
#line 29 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
if (hasDeviceFlagShow)
{
#line default
#line hidden
#line 31 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
Write(Html.ActionLink(fa.Item2.Name, MVC.Config.DeviceFlag.Index(fa.Item2.Id)));
#line default
#line hidden
#line 31 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
}
else
{
#line default
#line hidden
#line 35 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
Write(fa.Item2.Name);
#line default
#line hidden
#line 35 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n <td");
WriteLiteral(" class=\"added\"");
WriteLiteral(">\r\n");
WriteLiteral(" ");
#line 39 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
Write(CommonHelpers.FriendlyDateAndUser(fa.Item1.AddedDate, fa.Item1.AddedUser));
#line default
#line hidden
WriteLiteral("\r\n");
#line 40 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
#line default
#line hidden
#line 40 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
if (fa.Item1.OnAssignmentExpressionResult != null)
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"expressionResult\"");
WriteLiteral(">");
#line 42 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
Write(fa.Item1.OnAssignmentExpressionResult);
#line default
#line hidden
WriteLiteral("</div>\r\n");
#line 43 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n <td");
WriteLiteral(" class=\"comments\"");
WriteLiteral(">\r\n");
#line 46 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
#line default
#line hidden
#line 46 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
if (hasEdit)
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"editable\"");
WriteLiteral("><i");
WriteLiteral(" class=\"fa fa-fw fa-edit\"");
WriteLiteral(" title=\"Edit Comments\"");
WriteLiteral("></i></div>\r\n");
#line 49 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
}
#line default
#line hidden
WriteLiteral(" ");
#line 50 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
if (fa.Item1.Comments == null)
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"comments smallMessage\"");
WriteLiteral(">[no comments]</div>\r\n");
#line 53 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
}
else
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"comments\"");
WriteLiteral(">");
#line 56 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
Write(fa.Item1.Comments.ToHtmlComment());
#line default
#line hidden
WriteLiteral("</div>\r\n");
WriteLiteral(" <div");
WriteLiteral(" class=\"commentsRaw\"");
WriteLiteral(">");
#line 57 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
Write(fa.Item1.Comments);
#line default
#line hidden
WriteLiteral("</div>\r\n");
#line 58 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n <td");
WriteAttribute("class", Tuple.Create(" class=\"", 3000), Tuple.Create("\"", 3063)
, Tuple.Create(Tuple.Create("", 3008), Tuple.Create("removed", 3008), true)
#line 60 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
, Tuple.Create(Tuple.Create("", 3015), Tuple.Create<System.Object, System.Int32>(!fa.Item1.RemovedDate.HasValue ? " na" : null
#line default
#line hidden
, 3015), false)
);
WriteLiteral(">\r\n");
#line 61 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
#line default
#line hidden
#line 61 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
if (fa.Item1.RemovedDate.HasValue)
{
#line default
#line hidden
#line 63 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
Write(CommonHelpers.FriendlyDateAndUser(fa.Item1.RemovedDate.Value, fa.Item1.RemovedUser));
#line default
#line hidden
#line 63 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
if (fa.Item1.OnUnassignmentExpressionResult != null)
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"expressionResult\"");
WriteLiteral(">");
#line 66 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
Write(fa.Item1.OnUnassignmentExpressionResult);
#line default
#line hidden
WriteLiteral("</div>\r\n");
#line 67 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
}
}
else if (fa.Item1.CanRemove())
{
#line default
#line hidden
WriteLiteral(" <a");
WriteLiteral(" href=\"#\"");
WriteLiteral(" class=\"button small remove\"");
WriteLiteral(">Remove</a>\r\n");
#line 72 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n </tr>\r\n");
#line 75 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
}
#line default
#line hidden
WriteLiteral(" </table>\r\n");
WriteLiteral(" <div");
WriteLiteral(" id=\"Device_Show_Flags_Actions_Remove_Dialog\"");
WriteLiteral(" class=\"dialog\"");
WriteLiteral(" title=\"Remove this flag from the device?\"");
WriteLiteral(">\r\n");
#line 78 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
#line default
#line hidden
#line 78 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
using (Html.BeginForm(MVC.API.DeviceFlagAssignment.RemoveDevice()))
{
#line default
#line hidden
WriteLiteral(" <input");
WriteLiteral(" id=\"Device_Show_Flags_Actions_Remove_Dialog_Id\"");
WriteLiteral(" type=\"hidden\"");
WriteLiteral(" name=\"id\"");
WriteLiteral(" value=\"\"");
WriteLiteral(" />\r\n");
WriteLiteral(" <p>\r\n <i");
WriteLiteral(" class=\"fa fa-exclamation-triangle fa-lg\"");
WriteLiteral("></i>&nbsp;Are you sure?\r\n </p>\r\n");
#line 84 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
}
#line default
#line hidden
WriteLiteral(" </div>\r\n");
WriteLiteral(" <div");
WriteLiteral(" id=\"Device_Show_Flags_Actions_EditComments_Dialog\"");
WriteLiteral(" class=\"dialog\"");
WriteLiteral(" title=\"Edit the Comments\"");
WriteLiteral(">\r\n");
#line 87 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
#line default
#line hidden
#line 87 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
using (Html.BeginForm(MVC.API.DeviceFlagAssignment.UpdateComments()))
{
#line default
#line hidden
WriteLiteral(" <input");
WriteLiteral(" id=\"Device_Show_Flags_Actions_EditComments_Dialog_Id\"");
WriteLiteral(" type=\"hidden\"");
WriteLiteral(" name=\"id\"");
WriteLiteral(" value=\"\"");
WriteLiteral(" />\r\n");
WriteLiteral(" <input");
WriteLiteral(" type=\"hidden\"");
WriteLiteral(" name=\"redirect\"");
WriteLiteral(" value=\"true\"");
WriteLiteral(" />\r\n");
WriteLiteral(" <h4>Comments:</h4>\r\n");
WriteLiteral(" <p>\r\n <textarea");
WriteLiteral(" id=\"Device_Show_Flags_Actions_EditComments_Dialog_Comments\"");
WriteLiteral(" name=\"Comments\"");
WriteLiteral(" class=\"block\"");
WriteLiteral("></textarea>\r\n </p>\r\n");
#line 95 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
}
#line default
#line hidden
WriteLiteral(" </div>\r\n");
WriteLiteral(" <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(">\r\n $(function () {\r\n var deviceFlags = $(\'#deviceFlags" +
"\');\r\n\r\n var dialog = null;\r\n var dialogEditComment" +
"s = null;\r\n\r\n deviceFlags.on(\'click\', \'a.remove\', function (e) {\r" +
"\n var $this = $(this);\r\n var DeviceFlagAss" +
"ignmentId = $this.closest(\'tr\').attr(\'data-deviceflagassignmentid\');\r\n\r\n " +
" if (!dialog) {\r\n dialog = $(\'#Device_Show_Fla" +
"gs_Actions_Remove_Dialog\');\r\n dialog.dialog({\r\n " +
" resizable: false,\r\n modal: true,\r\n " +
" autoOpen: false,\r\n buttons" +
": {\r\n \"Remove Flag\": function () {\r\n " +
" var $this = $(this);\r\n " +
" $this.dialog(\"disable\");\r\n $this.dialog(\"opt" +
"ion\", \"buttons\", null);\r\n $this.find(\'form\')." +
"submit();\r\n },\r\n C" +
"ancel: function () {\r\n $(this).dialog(\"close\"" +
");\r\n }\r\n }\r\n " +
" });\r\n }\r\n\r\n $(\'#Device_Show_" +
"Flags_Actions_Remove_Dialog_Id\').val(DeviceFlagAssignmentId);\r\n " +
" dialog.dialog(\'open\');\r\n\r\n e.preventDefault();\r\n " +
" return false;\r\n });\r\n\r\n deviceFlags.on(\'" +
"click\', \'td.comments i.fa-edit\', function (e) {\r\n var $this =" +
" $(this);\r\n var DeviceFlagAssignmentId = $this.closest(\'tr\')." +
"attr(\'data-deviceflagassignmentid\');\r\n\r\n if (!dialogEditComme" +
"nts) {\r\n dialogEditComments = $(\'#Device_Show_Flags_Actio" +
"ns_EditComments_Dialog\');\r\n dialogEditComments.dialog({\r\n" +
" resizable: false,\r\n modal" +
": true,\r\n width: 320,\r\n au" +
"toOpen: false,\r\n buttons: {\r\n " +
" \"Save Changes\": function () {\r\n var $" +
"this = $(this);\r\n $this.dialog(\"disable\");\r\n " +
" $this.dialog(\"option\", \"buttons\", null);\r\n " +
" $this.find(\'form\').submit();\r\n " +
" },\r\n Cancel: function () {\r\n " +
" $(this).dialog(\"close\");\r\n " +
" }\r\n }\r\n });\r\n " +
" }\r\n\r\n var $comments = $this.closest(\'td\').find(\'.c" +
"ommentsRaw\');\r\n if ($comments.hasClass(\'smallMessage\')) {\r\n " +
" $(\'#Device_Show_Flags_Actions_EditComments_Dialog_Comments" +
"\').val(\'\');\r\n } else {\r\n $(\'#Device_Sh" +
"ow_Flags_Actions_EditComments_Dialog_Comments\').val($comments.text());\r\n " +
" }\r\n\r\n $(\'#Device_Show_Flags_Actions_EditComments_" +
"Dialog_Id\').val(DeviceFlagAssignmentId);\r\n dialogEditComments" +
".dialog(\'open\');\r\n e.preventDefault();\r\n r" +
"eturn false;\r\n });\r\n });\r\n </script>\r\n");
#line 174 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
}
else
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"none\"");
WriteLiteral(">This device has no associated flags</div>\r\n");
#line 178 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
}
#line default
#line hidden
WriteLiteral(" <script>\r\n $(\'#DeviceDetailTabItems\').append(\'<li><a href=\"#DeviceDeta" +
"ilTab-Flags\">Flags [");
#line 180 "..\..\Views\Device\DeviceParts\_Flags.cshtml"
Write(activeAssignmentCount);
#line default
#line hidden
WriteLiteral("]</a></li>\');\r\n </script>\r\n</div>\r\n");
}
}
}
#pragma warning restore 1591
@@ -249,7 +249,7 @@
var $this = $(this);
return $this.children('.details').html();
},
tooltipClass: 'User_FlagAssignment_Tooltip',
tooltipClass: 'FlagAssignment_Tooltip',
position: {
my: "right top",
at: "right bottom",
@@ -751,6 +751,96 @@
});
</script>
}
@if (Model.Device.CanAddDeviceFlags() && Model.AvailableDeviceFlags != null && Model.AvailableDeviceFlags.Count > 0)
{
@Html.ActionLinkSmallButton("Add Flag", MVC.API.DeviceFlagAssignment.AddDevice(), "Device_Show_Details_Actions_AddFlag_Button")
<div id="Device_Show_Details_Actions_AddFlag_Dialog" class="dialog" title="Add Device Flag">
@using (Html.BeginForm(MVC.API.DeviceFlagAssignment.AddDevice()))
{
<input id="Device_Show_Details_Actions_AddFlag_Dialog_Id" type="hidden" name="id" />
<input id="Device_Show_Details_Actions_AddFlag_Dialog_DeviceSerialNumber" type="hidden" name="DeviceSerialNumber" value="@Model.Device.SerialNumber" />
<div class="flagPicker">
@foreach (var flag in Model.AvailableDeviceFlags.OrderBy(jq => jq.Name))
{
<div class="flag" data-flagid="@(flag.Id)">
<i class="fa fa-@(flag.Icon) fa-fw fa-lg d-@(flag.IconColour)"></i>@flag.Name
</div>
}
</div>
<div class="details">
<div>
<h4>Comments</h4>
<textarea name="Comments" id="Device_Show_Details_Actions_AddFlag_Dialog_Comments"></textarea>
</div>
</div>
}
</div>
<script type="text/javascript">
$(function () {
var button = $('#Device_Show_Details_Actions_AddFlag_Button');
var buttonDialog = null;
var buttonLink = button.attr('href');
var flagPicker = null;
var flagAddId = null;
var flagAddComments = null;
var details = null;
function flagSelected() {
var flag = $(this);
flagPicker.children().removeClass('selected');
flag.addClass('selected');
flagAddId.val(flag.attr('data-flagid'));
details.show();
flagAddComments.focus().select();
}
button.attr('href', '#').click(function (e) {
e.preventDefault();
if (!buttonDialog) {
buttonDialog = $('#Device_Show_Details_Actions_AddFlag_Dialog');
buttonDialog.dialog({
width: 600,
height: 410,
resizable: false,
modal: true,
autoOpen: false,
buttons: {
Cancel: function () {
$(this).dialog("close");
},
"Add Flag": function () {
if (!!flagAddId.val()) {
var $this = $(this);
$this.dialog("disable");
$this.dialog("option", "buttons", null);
buttonDialog.find('form').submit();
} else {
alert('Select a Device Flag');
}
}
}
});
flagAddId = $('#Device_Show_Details_Actions_AddFlag_Dialog_Id');
flagAddComments = buttonDialog.find('#Device_Show_Details_Actions_AddFlag_Dialog_Comments');
flagPicker = buttonDialog.find('.flagPicker');
details = buttonDialog.find('.details');
flagPicker.on('click', 'div.flag', flagSelected);
}
buttonDialog.dialog('open');
return false;
});
});
</script>
}
@if (Model.Device.CanUpdateTrustEnrol())
{
@Html.ActionLinkSmallButton("Trust Enrol", MVC.API.Device.UpdateAllowUnauthenticatedEnrol(Model.Device.SerialNumber, true.ToString(), true), "Device_Show_Device_Actions_TrustEnrol_Button")
@@ -1178,28 +1178,28 @@ WriteLiteral(">\r\n $(functio
"(this);\r\n ret" +
"urn $this.children(\'.details\').html();\r\n " +
" },\r\n " +
" tooltipClass: \'User_FlagAssignment_Tooltip\',\r\n " +
" position: {\r\n " +
" my: \"right top\",\r\n " +
" at: \"right bottom\",\r\n " +
" collision: \"flipfit fl" +
"ip\"\r\n },\r\n " +
" hade: {\r\n " +
" effect: \'\'\r\n " +
" },\r\n " +
" close: function (e, ui) {\r\n " +
" ui.tooltip.hover(\r\n " +
" function () {\r\n " +
" $(thi" +
"s).stop(true).fadeTo(100, 1);\r\n " +
" },\r\n " +
" function () {\r\n " +
" $(this).fadeOut(100, function () { $(this).remove(" +
"); });\r\n " +
"});\r\n }\r\n " +
" });\r\n " +
" });\r\n " +
" </script>\r\n </div>\r\n");
" tooltipClass: \'FlagAssignment_Tooltip\',\r\n " +
" position: {\r\n " +
" my: \"right top\",\r\n " +
" at: \"right bottom\",\r\n " +
" collision: \"flipfit flip\"\r\n" +
" },\r\n " +
" hade: {\r\n " +
" effect: \'\'\r\n " +
" },\r\n " +
" close: function (e, ui) {\r\n " +
" ui.tooltip.hover(\r\n " +
" function () {\r\n " +
" $(this).st" +
"op(true).fadeTo(100, 1);\r\n " +
" },\r\n " +
" function () {\r\n " +
" $(this).fadeOut(100, function () { $(this).remove(); })" +
";\r\n });\r\n" +
" }\r\n " +
" });\r\n " +
" });\r\n </s" +
"cript>\r\n </div>\r\n");
#line 274 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
@@ -1707,27 +1707,27 @@ WriteLiteral(">\r\n");
#line hidden
WriteLiteral(" <li");
WriteAttribute("class", Tuple.Create(" class=\"", 25472), Tuple.Create("\"", 25517)
WriteAttribute("class", Tuple.Create(" class=\"", 25467), Tuple.Create("\"", 25512)
#line 400 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
, Tuple.Create(Tuple.Create("", 25480), Tuple.Create<System.Object, System.Int32>(isDecommissioned ? "hidden" : null
, Tuple.Create(Tuple.Create("", 25475), Tuple.Create<System.Object, System.Int32>(isDecommissioned ? "hidden" : null
#line default
#line hidden
, 25480), false)
, 25475), false)
);
WriteLiteral(">\r\n <label");
WriteAttribute("title", Tuple.Create(" title=\"", 25575), Tuple.Create("\"", 25619)
, Tuple.Create(Tuple.Create("", 25583), Tuple.Create("Distribution:", 25583), true)
WriteAttribute("title", Tuple.Create(" title=\"", 25570), Tuple.Create("\"", 25614)
, Tuple.Create(Tuple.Create("", 25578), Tuple.Create("Distribution:", 25578), true)
#line 401 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
, Tuple.Create(Tuple.Create(" ", 25596), Tuple.Create<System.Object, System.Int32>(dp.DistributionType
, Tuple.Create(Tuple.Create(" ", 25591), Tuple.Create<System.Object, System.Int32>(dp.DistributionType
#line default
#line hidden
, 25597), false)
, 25592), false)
);
WriteLiteral(">\r\n <input");
@@ -1736,14 +1736,14 @@ WriteLiteral(" type=\"radio\"");
WriteLiteral(" name=\"DeviceProfileId\"");
WriteAttribute("value", Tuple.Create(" value=\"", 25717), Tuple.Create("\"", 25731)
WriteAttribute("value", Tuple.Create(" value=\"", 25712), Tuple.Create("\"", 25726)
#line 402 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
, Tuple.Create(Tuple.Create("", 25725), Tuple.Create<System.Object, System.Int32>(dp.Id
, Tuple.Create(Tuple.Create("", 25720), Tuple.Create<System.Object, System.Int32>(dp.Id
#line default
#line hidden
, 25725), false)
, 25720), false)
);
WriteLiteral(" data-ouenforced=\"");
@@ -2062,14 +2062,14 @@ WriteLiteral(" title=\"Warranty Valid Until\"");
WriteLiteral(">Warranty Until:</span>\r\n </td>\r\n " +
" <td");
WriteAttribute("class", Tuple.Create(" class=\"", 33479), Tuple.Create("\"", 33627)
WriteAttribute("class", Tuple.Create(" class=\"", 33474), Tuple.Create("\"", 33622)
#line 523 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
, Tuple.Create(Tuple.Create("", 33487), Tuple.Create<System.Object, System.Int32>(Model.Device.DeviceBatch.WarrantyValidUntil.HasValue && Model.Device.DeviceBatch.WarrantyValidUntil.Value < DateTime.Now ? "alert" : null
, Tuple.Create(Tuple.Create("", 33482), Tuple.Create<System.Object, System.Int32>(Model.Device.DeviceBatch.WarrantyValidUntil.HasValue && Model.Device.DeviceBatch.WarrantyValidUntil.Value < DateTime.Now ? "alert" : null
#line default
#line hidden
, 33487), false)
, 33482), false)
);
WriteLiteral(">\r\n");
@@ -2110,14 +2110,14 @@ WriteLiteral(" title=\"Insured Until\"");
WriteLiteral(">Insured Until:</span>\r\n </td>\r\n " +
" <td");
WriteAttribute("class", Tuple.Create(" class=\"", 34481), Tuple.Create("\"", 34617)
WriteAttribute("class", Tuple.Create(" class=\"", 34476), Tuple.Create("\"", 34612)
#line 539 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
, Tuple.Create(Tuple.Create("", 34489), Tuple.Create<System.Object, System.Int32>(Model.Device.DeviceBatch.InsuredUntil.HasValue && Model.Device.DeviceBatch.InsuredUntil.Value < DateTime.Now ? "alert" : null
, Tuple.Create(Tuple.Create("", 34484), Tuple.Create<System.Object, System.Int32>(Model.Device.DeviceBatch.InsuredUntil.HasValue && Model.Device.DeviceBatch.InsuredUntil.Value < DateTime.Now ? "alert" : null
#line default
#line hidden
, 34489), false)
, 34484), false)
);
WriteLiteral(">\r\n");
@@ -2208,27 +2208,27 @@ WriteLiteral(">\r\n");
#line hidden
WriteLiteral(" <li");
WriteAttribute("class", Tuple.Create(" class=\"", 35808), Tuple.Create("\"", 35853)
WriteAttribute("class", Tuple.Create(" class=\"", 35803), Tuple.Create("\"", 35848)
#line 559 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
, Tuple.Create(Tuple.Create("", 35816), Tuple.Create<System.Object, System.Int32>(isDecommissioned ? "hidden" : null
, Tuple.Create(Tuple.Create("", 35811), Tuple.Create<System.Object, System.Int32>(isDecommissioned ? "hidden" : null
#line default
#line hidden
, 35816), false)
, 35811), false)
);
WriteLiteral(">\r\n <label");
WriteAttribute("title", Tuple.Create(" title=\"", 35907), Tuple.Create("\"", 35963)
, Tuple.Create(Tuple.Create("", 35915), Tuple.Create("Purchased:", 35915), true)
WriteAttribute("title", Tuple.Create(" title=\"", 35902), Tuple.Create("\"", 35958)
, Tuple.Create(Tuple.Create("", 35910), Tuple.Create("Purchased:", 35910), true)
#line 560 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
, Tuple.Create(Tuple.Create(" ", 35925), Tuple.Create<System.Object, System.Int32>(db.PurchaseDate.ToLongDateString()
, Tuple.Create(Tuple.Create(" ", 35920), Tuple.Create<System.Object, System.Int32>(db.PurchaseDate.ToLongDateString()
#line default
#line hidden
, 35926), false)
, 35921), false)
);
WriteLiteral(">\r\n <input");
@@ -2461,14 +2461,14 @@ WriteLiteral(" id=\"Device_Show_Aspects_Model_Image\"");
WriteLiteral(" alt=\"Model Image\"");
WriteAttribute("src", Tuple.Create(" src=\"", 42170), Tuple.Create("\"", 42280)
WriteAttribute("src", Tuple.Create(" src=\"", 42165), Tuple.Create("\"", 42275)
#line 658 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
, Tuple.Create(Tuple.Create("", 42176), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.DeviceModel.Image(Model.Device.DeviceModelId, Model.Device.DeviceModel.ImageHash()))
, Tuple.Create(Tuple.Create("", 42171), Tuple.Create<System.Object, System.Int32>(Url.Action(MVC.API.DeviceModel.Image(Model.Device.DeviceModelId, Model.Device.DeviceModel.ImageHash()))
#line default
#line hidden
, 42176), false)
, 42171), false)
);
WriteLiteral(" />\r\n </div>\r\n </div>\r\n </td>\r\n </tr>\r\n <t" +
@@ -2694,7 +2694,7 @@ WriteLiteral(" ");
#line 754 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
if (Model.Device.CanUpdateTrustEnrol())
if (Model.Device.CanAddDeviceFlags() && Model.AvailableDeviceFlags != null && Model.AvailableDeviceFlags.Count > 0)
{
@@ -2702,13 +2702,245 @@ WriteLiteral(" ");
#line hidden
#line 756 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
Write(Html.ActionLinkSmallButton("Trust Enrol", MVC.API.Device.UpdateAllowUnauthenticatedEnrol(Model.Device.SerialNumber, true.ToString(), true), "Device_Show_Device_Actions_TrustEnrol_Button"));
Write(Html.ActionLinkSmallButton("Add Flag", MVC.API.DeviceFlagAssignment.AddDevice(), "Device_Show_Details_Actions_AddFlag_Button"));
#line default
#line hidden
#line 756 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" id=\"Device_Show_Details_Actions_AddFlag_Dialog\"");
WriteLiteral(" class=\"dialog\"");
WriteLiteral(" title=\"Add Device Flag\"");
WriteLiteral(">\r\n");
#line 758 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
#line default
#line hidden
#line 758 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
using (Html.BeginForm(MVC.API.DeviceFlagAssignment.AddDevice()))
{
#line default
#line hidden
WriteLiteral(" <input");
WriteLiteral(" id=\"Device_Show_Details_Actions_AddFlag_Dialog_Id\"");
WriteLiteral(" type=\"hidden\"");
WriteLiteral(" name=\"id\"");
WriteLiteral(" />\r\n");
WriteLiteral(" <input");
WriteLiteral(" id=\"Device_Show_Details_Actions_AddFlag_Dialog_DeviceSerialNumber\"");
WriteLiteral(" type=\"hidden\"");
WriteLiteral(" name=\"DeviceSerialNumber\"");
WriteAttribute("value", Tuple.Create(" value=\"", 48123), Tuple.Create("\"", 48157)
#line 761 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
, Tuple.Create(Tuple.Create("", 48131), Tuple.Create<System.Object, System.Int32>(Model.Device.SerialNumber
#line default
#line hidden
, 48131), false)
);
WriteLiteral(" />\r\n");
WriteLiteral(" <div");
WriteLiteral(" class=\"flagPicker\"");
WriteLiteral(">\r\n");
#line 763 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
#line default
#line hidden
#line 763 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
foreach (var flag in Model.AvailableDeviceFlags.OrderBy(jq => jq.Name))
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"flag\"");
WriteLiteral(" data-flagid=\"");
#line 765 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
Write(flag.Id);
#line default
#line hidden
WriteLiteral("\"");
WriteLiteral(">\r\n <i");
WriteAttribute("class", Tuple.Create(" class=\"", 48461), Tuple.Create("\"", 48520)
, Tuple.Create(Tuple.Create("", 48469), Tuple.Create("fa", 48469), true)
, Tuple.Create(Tuple.Create(" ", 48471), Tuple.Create("fa-", 48472), true)
#line 766 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
, Tuple.Create(Tuple.Create("", 48475), Tuple.Create<System.Object, System.Int32>(flag.Icon
#line default
#line hidden
, 48475), false)
, Tuple.Create(Tuple.Create(" ", 48487), Tuple.Create("fa-fw", 48488), true)
, Tuple.Create(Tuple.Create(" ", 48493), Tuple.Create("fa-lg", 48494), true)
, Tuple.Create(Tuple.Create(" ", 48499), Tuple.Create("d-", 48500), true)
#line 766 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
, Tuple.Create(Tuple.Create("", 48502), Tuple.Create<System.Object, System.Int32>(flag.IconColour
#line default
#line hidden
, 48502), false)
);
WriteLiteral("></i>");
#line 766 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
Write(flag.Name);
#line default
#line hidden
WriteLiteral("\r\n </div>\r\n");
#line 768 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
}
#line default
#line hidden
WriteLiteral(" </div>\r\n");
WriteLiteral(" <div");
WriteLiteral(" class=\"details\"");
WriteLiteral(">\r\n <div>\r\n <h4>Comment" +
"s</h4>\r\n <textarea");
WriteLiteral(" name=\"Comments\"");
WriteLiteral(" id=\"Device_Show_Details_Actions_AddFlag_Dialog_Comments\"");
WriteLiteral("></textarea>\r\n </div>\r\n </div>\r" +
"\n");
#line 776 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
}
#line default
#line hidden
WriteLiteral(" </div>\r\n");
WriteLiteral(" <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(">\r\n $(function () {\r\n var button = $(\'#" +
"Device_Show_Details_Actions_AddFlag_Button\');\r\n var butto" +
"nDialog = null;\r\n var buttonLink = button.attr(\'href\');\r\n" +
"\r\n var flagPicker = null;\r\n var fl" +
"agAddId = null;\r\n var flagAddComments = null;\r\n " +
" var details = null;\r\n\r\n function flagSelect" +
"ed() {\r\n var flag = $(this);\r\n\r\n " +
" flagPicker.children().removeClass(\'selected\');\r\n " +
" flag.addClass(\'selected\');\r\n\r\n flagAddId.val(flag." +
"attr(\'data-flagid\'));\r\n\r\n details.show();\r\n\r\n " +
" flagAddComments.focus().select();\r\n }" +
"\r\n\r\n button.attr(\'href\', \'#\').click(function (e) {\r\n " +
" e.preventDefault();\r\n\r\n if (!b" +
"uttonDialog) {\r\n buttonDialog = $(\'#Device_Show_D" +
"etails_Actions_AddFlag_Dialog\');\r\n buttonDialog.d" +
"ialog({\r\n width: 600,\r\n " +
" height: 410,\r\n resizable: false" +
",\r\n modal: true,\r\n " +
" autoOpen: false,\r\n buttons: {\r\n " +
" Cancel: function () {\r\n " +
" $(this).dialog(\"close\");\r\n " +
" },\r\n \"Add Flag\": function () {\r\n " +
" if (!!flagAddId.val()) {\r\n " +
" var $this = $(this);\r\n " +
" $this.dialog(\"disable\");\r\n " +
" $this.dialog(\"option\", \"buttons\", null);\r\n " +
" buttonDialog.find(\'form\').submit();\r\n " +
" } else {\r\n " +
" alert(\'Select a Device Flag\');\r\n " +
" }\r\n }\r\n " +
" }\r\n });\r\n\r\n " +
" flagAddId = $(\'#Device_Show_Details_Actions_AddFlag_Dialog_Id\');\r\n " +
" flagAddComments = buttonDialog.find(\'#Device_Show_Details_Ac" +
"tions_AddFlag_Dialog_Comments\');\r\n flagPicker = b" +
"uttonDialog.find(\'.flagPicker\');\r\n details = butt" +
"onDialog.find(\'.details\');\r\n\r\n flagPicker.on(\'cli" +
"ck\', \'div.flag\', flagSelected);\r\n }\r\n\r\n " +
" buttonDialog.dialog(\'open\');\r\n return f" +
"alse;\r\n });\r\n });\r\n </s" +
"cript>\r\n");
#line 843 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
}
#line default
#line hidden
WriteLiteral(" ");
#line 844 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
if (Model.Device.CanUpdateTrustEnrol())
{
#line default
#line hidden
#line 846 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
Write(Html.ActionLinkSmallButton("Trust Enrol", MVC.API.Device.UpdateAllowUnauthenticatedEnrol(Model.Device.SerialNumber, true.ToString(), true), "Device_Show_Device_Actions_TrustEnrol_Button"));
#line default
#line hidden
#line 846 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
@@ -2749,7 +2981,7 @@ WriteLiteral("></i>This action will allow a device <em>claiming</em> to have the
"\'");
#line 766 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
#line 856 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
Write(Model.Device.SerialNumber);
@@ -2791,7 +3023,7 @@ WriteLiteral(">\r\n $(function () {\r\n
" });\r\n </script>\r\n");
#line 806 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
#line 896 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
}
@@ -2800,7 +3032,7 @@ WriteLiteral(">\r\n $(function () {\r\n
WriteLiteral(" ");
#line 807 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
#line 897 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
if (Model.Device.CanUpdateUntrustEnrol())
{
@@ -2808,14 +3040,14 @@ WriteLiteral(" ");
#line default
#line hidden
#line 809 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
#line 899 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
Write(Html.ActionLinkSmallButton("Untrust Enrol", MVC.API.Device.UpdateAllowUnauthenticatedEnrol(Model.Device.SerialNumber, false.ToString(), true), "Device_Show_Device_Actions_UntrustEnrol_Button"));
#line default
#line hidden
#line 809 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
#line 899 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
@@ -2886,7 +3118,7 @@ WriteLiteral(@">
");
#line 849 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
#line 939 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
}
@@ -2895,7 +3127,7 @@ WriteLiteral(@">
WriteLiteral(" ");
#line 850 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
#line 940 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
if (Model.Device.CanDecommission())
{
@@ -2903,14 +3135,14 @@ WriteLiteral(" ");
#line default
#line hidden
#line 852 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
#line 942 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
Write(Html.ActionLinkSmallButton("Decommission", MVC.API.Device.Decommission(), "Device_Show_Device_Actions_Decommission_Button"));
#line default
#line hidden
#line 852 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
#line 942 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
@@ -2942,13 +3174,13 @@ WriteLiteral(" class=\"none\"");
WriteLiteral(">\r\n");
#line 859 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
#line 949 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
#line default
#line hidden
#line 859 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
#line 949 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
foreach (DecommissionReasons decommissionReason in Enum.GetValues(typeof(DecommissionReasons)).Cast<DecommissionReasons>().OrderBy(r => r.ToString()))
{
@@ -2959,34 +3191,34 @@ WriteLiteral(" <li>\r\n
WriteLiteral(" type=\"radio\"");
WriteAttribute("id", Tuple.Create(" id=\"", 53845), Tuple.Create("\"", 53923)
, Tuple.Create(Tuple.Create("", 53850), Tuple.Create("Device_Show_Device_Actions_Decommission_Reason_", 53850), true)
WriteAttribute("id", Tuple.Create(" id=\"", 58681), Tuple.Create("\"", 58759)
, Tuple.Create(Tuple.Create("", 58686), Tuple.Create("Device_Show_Device_Actions_Decommission_Reason_", 58686), true)
#line 862 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
, Tuple.Create(Tuple.Create("", 53897), Tuple.Create<System.Object, System.Int32>((int)decommissionReason
#line 952 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
, Tuple.Create(Tuple.Create("", 58733), Tuple.Create<System.Object, System.Int32>((int)decommissionReason
#line default
#line hidden
, 53897), false)
, 58733), false)
);
WriteLiteral("\r\n name=\"Device_Show_Device_Actions_Dec" +
"ommission_Reason\"");
WriteAttribute("value", Tuple.Create(" value=\"", 54022), Tuple.Create("\"", 54056)
WriteAttribute("value", Tuple.Create(" value=\"", 58858), Tuple.Create("\"", 58892)
#line 863 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
, Tuple.Create(Tuple.Create("", 54030), Tuple.Create<System.Object, System.Int32>((int)decommissionReason
#line 953 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
, Tuple.Create(Tuple.Create("", 58866), Tuple.Create<System.Object, System.Int32>((int)decommissionReason
#line default
#line hidden
, 54030), false)
, 58866), false)
);
WriteLiteral(" ");
#line 863 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
#line 953 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
Write((decommissionReason == DecommissionReasons.EndOfLife) ? "checked=\"checked\"" : string.Empty);
@@ -2994,21 +3226,21 @@ WriteLiteral(" ");
#line hidden
WriteLiteral(" />\r\n <label");
WriteAttribute("for", Tuple.Create(" for=\"", 54200), Tuple.Create("\"", 54279)
, Tuple.Create(Tuple.Create("", 54206), Tuple.Create("Device_Show_Device_Actions_Decommission_Reason_", 54206), true)
WriteAttribute("for", Tuple.Create(" for=\"", 59036), Tuple.Create("\"", 59115)
, Tuple.Create(Tuple.Create("", 59042), Tuple.Create("Device_Show_Device_Actions_Decommission_Reason_", 59042), true)
#line 864 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
, Tuple.Create(Tuple.Create("", 54253), Tuple.Create<System.Object, System.Int32>((int)decommissionReason
#line 954 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
, Tuple.Create(Tuple.Create("", 59089), Tuple.Create<System.Object, System.Int32>((int)decommissionReason
#line default
#line hidden
, 54253), false)
, 59089), false)
);
WriteLiteral(">");
#line 864 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
#line 954 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
Write(decommissionReason.ReasonMessage());
@@ -3017,7 +3249,7 @@ WriteLiteral(">");
WriteLiteral("</label>\r\n </li>\r\n");
#line 866 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
#line 956 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
}
@@ -3035,7 +3267,7 @@ WriteLiteral(">\r\n $(function () {\r\n
"uttonDialog = null;\r\n var deviceSerialNumber = \'");
#line 874 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
#line 964 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
Write(Model.Device.SerialNumber);
@@ -3068,7 +3300,7 @@ WriteLiteral("\';\r\n\r\n button.click(function () {\r\n\
" });\r\n </script>\r\n");
#line 910 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
#line 1000 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
}
@@ -3077,7 +3309,7 @@ WriteLiteral("\';\r\n\r\n button.click(function () {\r\n\
WriteLiteral(" ");
#line 911 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
#line 1001 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
if (Model.Device.CanRecommission())
{
@@ -3085,14 +3317,14 @@ WriteLiteral(" ");
#line default
#line hidden
#line 913 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
#line 1003 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
Write(Html.ActionLinkSmallButton("Recommission", MVC.API.Device.Recommission(Model.Device.SerialNumber, true), "Device_Show_Device_Actions_Recommission_Button"));
#line default
#line hidden
#line 913 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
#line 1003 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
@@ -3146,7 +3378,7 @@ WriteLiteral(@">
");
#line 948 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
#line 1038 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
}
@@ -3155,7 +3387,7 @@ WriteLiteral(@">
WriteLiteral(" ");
#line 949 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
#line 1039 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
if (Model.Device.CanDelete())
{
@@ -3163,14 +3395,14 @@ WriteLiteral(" ");
#line default
#line hidden
#line 951 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
#line 1041 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
Write(Html.ActionLinkSmallButton("Delete Device", MVC.API.Device.Delete(Model.Device.SerialNumber, true), "Device_Show_Device_Actions_Delete_Button"));
#line default
#line hidden
#line 951 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
#line 1041 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
@@ -3230,7 +3462,7 @@ WriteLiteral(@">
");
#line 989 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
#line 1079 "..\..\Views\Device\DeviceParts\_Subject.cshtml"
}
+50
View File
@@ -1,4 +1,5 @@
@model Disco.Web.Models.Device.ShowModel
@using Disco.Services.Devices.DeviceFlags;
@{
ViewBag.Title = Html.ToBreadcrumb("Devices", MVC.Device.Index(), string.Format("Device: {0}", Model.Device.SerialNumber));
}
@@ -11,6 +12,51 @@
});
</script>
</div>
@if (Authorization.Has(Claims.Device.ShowFlagAssignments))
{
<div id="Device_Show_Flags">
@foreach (var flag in Model.Device.DeviceFlagAssignments.Where(f => !f.RemovedDate.HasValue).Select(f => Tuple.Create(f, DeviceFlagService.GetDeviceFlag(f.DeviceFlagId))))
{
<i class="flag fa fa-@(flag.Item2.Icon) fa-fw fa-lg d-@(flag.Item2.IconColour)">
<span class="details">
<span class="name">@flag.Item2.Name</span>@if (flag.Item1.Comments != null)
{<span class="comments">@flag.Item1.Comments.ToHtmlComment()</span>}<span class="added">@CommonHelpers.FriendlyDateAndUser(flag.Item1.AddedDate, flag.Item1.AddedUser)</span>
</span>
</i>
}
</div>
<script type="text/javascript">
$(function () {
$('#Device_Show_Flags')
.appendTo('#layout_PageHeading')
.tooltip({
items: 'i.flag',
content: function () {
var $this = $(this);
return $this.children('.details').html();
},
tooltipClass: 'FlagAssignment_Tooltip',
position: {
my: "right top",
at: "right bottom",
collision: "flipfit flip"
},
hade: {
effect: ''
},
close: function (e, ui) {
ui.tooltip.hover(
function () {
$(this).stop(true).fadeTo(100, 1);
},
function () {
$(this).fadeOut(100, function () { $(this).remove(); });
});
}
});
});
</script>
}
@Html.Partial(MVC.Device.Views.DeviceParts._Subject, Model)
<script type="text/javascript">
$(function () {
@@ -63,6 +109,10 @@
{
@Html.Partial(MVC.Device.Views.DeviceParts._Resources, Model)
}
@if (Authorization.Has(Claims.Device.ShowFlagAssignments))
{
@Html.Partial(MVC.Device.Views.DeviceParts._Flags, Model)
}
@if (Authorization.Has(Claims.Device.ShowCertificates))
{
@Html.Partial(MVC.Device.Views.DeviceParts._Certificates, Model)
+231 -26
View File
@@ -30,6 +30,12 @@ namespace Disco.Web.Views.Device
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
#line 2 "..\..\Views\Device\Show.cshtml"
using Disco.Services.Devices.DeviceFlags;
#line default
#line hidden
using Disco.Services.Web;
using Disco.Web;
using Disco.Web.Extensions;
@@ -44,7 +50,7 @@ namespace Disco.Web.Views.Device
public override void Execute()
{
#line 2 "..\..\Views\Device\Show.cshtml"
#line 3 "..\..\Views\Device\Show.cshtml"
ViewBag.Title = Html.ToBreadcrumb("Devices", MVC.Device.Index(), string.Format("Device: {0}", Model.Device.SerialNumber));
@@ -61,23 +67,23 @@ WriteLiteral(" id=\"Device_Show_Status\"");
WriteLiteral(">\r\n <i");
WriteAttribute("class", Tuple.Create(" class=\"", 246), Tuple.Create("\"", 308)
, Tuple.Create(Tuple.Create("", 254), Tuple.Create("fa", 254), true)
, Tuple.Create(Tuple.Create(" ", 256), Tuple.Create("fa-square", 257), true)
, Tuple.Create(Tuple.Create(" ", 266), Tuple.Create("deviceStatus", 267), true)
WriteAttribute("class", Tuple.Create(" class=\"", 290), Tuple.Create("\"", 352)
, Tuple.Create(Tuple.Create("", 298), Tuple.Create("fa", 298), true)
, Tuple.Create(Tuple.Create(" ", 300), Tuple.Create("fa-square", 301), true)
, Tuple.Create(Tuple.Create(" ", 310), Tuple.Create("deviceStatus", 311), true)
#line 7 "..\..\Views\Device\Show.cshtml"
, Tuple.Create(Tuple.Create(" ", 279), Tuple.Create<System.Object, System.Int32>(Model.Device.StatusCode()
#line 8 "..\..\Views\Device\Show.cshtml"
, Tuple.Create(Tuple.Create(" ", 323), Tuple.Create<System.Object, System.Int32>(Model.Device.StatusCode()
#line default
#line hidden
, 280), false)
, 324), false)
);
WriteLiteral("></i>&nbsp;");
#line 7 "..\..\Views\Device\Show.cshtml"
#line 8 "..\..\Views\Device\Show.cshtml"
Write(Model.Device.Status());
@@ -90,10 +96,184 @@ WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(">\r\n $(function () {\r\n $(\'#Device_Show_Status\').appendTo" +
"(\'#layout_PageHeading\')\r\n });\r\n </script>\r\n </div>\r\n");
#line 15 "..\..\Views\Device\Show.cshtml"
#line default
#line hidden
#line 15 "..\..\Views\Device\Show.cshtml"
if (Authorization.Has(Claims.Device.ShowFlagAssignments))
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" id=\"Device_Show_Flags\"");
WriteLiteral(">\r\n");
#line 18 "..\..\Views\Device\Show.cshtml"
#line default
#line hidden
#line 18 "..\..\Views\Device\Show.cshtml"
foreach (var flag in Model.Device.DeviceFlagAssignments.Where(f => !f.RemovedDate.HasValue).Select(f => Tuple.Create(f, DeviceFlagService.GetDeviceFlag(f.DeviceFlagId))))
{
#line default
#line hidden
WriteLiteral(" <i");
WriteAttribute("class", Tuple.Create(" class=\"", 907), Tuple.Create("\"", 983)
, Tuple.Create(Tuple.Create("", 915), Tuple.Create("flag", 915), true)
, Tuple.Create(Tuple.Create(" ", 919), Tuple.Create("fa", 920), true)
, Tuple.Create(Tuple.Create(" ", 922), Tuple.Create("fa-", 923), true)
#line 20 "..\..\Views\Device\Show.cshtml"
, Tuple.Create(Tuple.Create("", 926), Tuple.Create<System.Object, System.Int32>(flag.Item2.Icon
#line default
#line hidden
, 926), false)
, Tuple.Create(Tuple.Create(" ", 944), Tuple.Create("fa-fw", 945), true)
, Tuple.Create(Tuple.Create(" ", 950), Tuple.Create("fa-lg", 951), true)
, Tuple.Create(Tuple.Create(" ", 956), Tuple.Create("d-", 957), true)
#line 20 "..\..\Views\Device\Show.cshtml"
, Tuple.Create(Tuple.Create("", 959), Tuple.Create<System.Object, System.Int32>(flag.Item2.IconColour
#line default
#line hidden
, 959), false)
);
WriteLiteral(">\r\n <span");
WriteLiteral(" class=\"details\"");
WriteLiteral(">\r\n <span");
WriteLiteral(" class=\"name\"");
WriteLiteral(">");
#line 22 "..\..\Views\Device\Show.cshtml"
Write(flag.Item2.Name);
#line default
#line hidden
WriteLiteral("</span>");
#line 22 "..\..\Views\Device\Show.cshtml"
if (flag.Item1.Comments != null)
{
#line default
#line hidden
WriteLiteral("<span");
WriteLiteral(" class=\"comments\"");
WriteLiteral(">");
#line 23 "..\..\Views\Device\Show.cshtml"
Write(flag.Item1.Comments.ToHtmlComment());
#line default
#line hidden
WriteLiteral("</span>");
#line 23 "..\..\Views\Device\Show.cshtml"
}
#line default
#line hidden
WriteLiteral("<span");
WriteLiteral(" class=\"added\"");
WriteLiteral(">");
#line 23 "..\..\Views\Device\Show.cshtml"
Write(CommonHelpers.FriendlyDateAndUser(flag.Item1.AddedDate, flag.Item1.AddedUser));
#line default
#line hidden
WriteLiteral("</span>\r\n </span>\r\n </i>\r\n");
#line 26 "..\..\Views\Device\Show.cshtml"
}
#line default
#line hidden
WriteLiteral(" </div>\r\n");
WriteLiteral(" <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(@">
$(function () {
$('#Device_Show_Flags')
.appendTo('#layout_PageHeading')
.tooltip({
items: 'i.flag',
content: function () {
var $this = $(this);
return $this.children('.details').html();
},
tooltipClass: 'FlagAssignment_Tooltip',
position: {
my: ""right top"",
at: ""right bottom"",
collision: ""flipfit flip""
},
hade: {
effect: ''
},
close: function (e, ui) {
ui.tooltip.hover(
function () {
$(this).stop(true).fadeTo(100, 1);
},
function () {
$(this).fadeOut(100, function () { $(this).remove(); });
});
}
});
});
</script>
");
#line 59 "..\..\Views\Device\Show.cshtml"
}
#line default
#line hidden
WriteLiteral(" ");
#line 14 "..\..\Views\Device\Show.cshtml"
#line 60 "..\..\Views\Device\Show.cshtml"
Write(Html.Partial(MVC.Device.Views.DeviceParts._Subject, Model));
@@ -134,13 +314,13 @@ WriteLiteral(" id=\"DeviceDetailTabItems\"");
WriteLiteral("></ul>\r\n");
#line 50 "..\..\Views\Device\Show.cshtml"
#line 96 "..\..\Views\Device\Show.cshtml"
#line default
#line hidden
#line 50 "..\..\Views\Device\Show.cshtml"
#line 96 "..\..\Views\Device\Show.cshtml"
if (Authorization.Has(Claims.Device.ShowJobs))
{
@@ -148,14 +328,14 @@ WriteLiteral("></ul>\r\n");
#line default
#line hidden
#line 52 "..\..\Views\Device\Show.cshtml"
#line 98 "..\..\Views\Device\Show.cshtml"
Write(Html.Partial(MVC.Device.Views.DeviceParts._Jobs, Model));
#line default
#line hidden
#line 52 "..\..\Views\Device\Show.cshtml"
#line 98 "..\..\Views\Device\Show.cshtml"
}
@@ -165,7 +345,7 @@ WriteLiteral("></ul>\r\n");
WriteLiteral(" ");
#line 54 "..\..\Views\Device\Show.cshtml"
#line 100 "..\..\Views\Device\Show.cshtml"
if (Authorization.Has(Claims.Device.ShowDetails))
{
@@ -173,14 +353,14 @@ WriteLiteral(" ");
#line default
#line hidden
#line 56 "..\..\Views\Device\Show.cshtml"
#line 102 "..\..\Views\Device\Show.cshtml"
Write(Html.Partial(MVC.Device.Views.DeviceParts._Details, Model));
#line default
#line hidden
#line 56 "..\..\Views\Device\Show.cshtml"
#line 102 "..\..\Views\Device\Show.cshtml"
}
@@ -190,7 +370,7 @@ WriteLiteral(" ");
WriteLiteral(" ");
#line 58 "..\..\Views\Device\Show.cshtml"
#line 104 "..\..\Views\Device\Show.cshtml"
if (Authorization.Has(Claims.Device.ShowAssignmentHistory))
{
@@ -198,14 +378,14 @@ WriteLiteral(" ");
#line default
#line hidden
#line 60 "..\..\Views\Device\Show.cshtml"
#line 106 "..\..\Views\Device\Show.cshtml"
Write(Html.Partial(MVC.Device.Views.DeviceParts._AssignmentHistory, Model));
#line default
#line hidden
#line 60 "..\..\Views\Device\Show.cshtml"
#line 106 "..\..\Views\Device\Show.cshtml"
}
@@ -215,7 +395,7 @@ WriteLiteral(" ");
WriteLiteral(" ");
#line 62 "..\..\Views\Device\Show.cshtml"
#line 108 "..\..\Views\Device\Show.cshtml"
if (Authorization.Has(Claims.Device.ShowAttachments))
{
@@ -223,14 +403,14 @@ WriteLiteral(" ");
#line default
#line hidden
#line 64 "..\..\Views\Device\Show.cshtml"
#line 110 "..\..\Views\Device\Show.cshtml"
Write(Html.Partial(MVC.Device.Views.DeviceParts._Resources, Model));
#line default
#line hidden
#line 64 "..\..\Views\Device\Show.cshtml"
#line 110 "..\..\Views\Device\Show.cshtml"
}
@@ -240,7 +420,32 @@ WriteLiteral(" ");
WriteLiteral(" ");
#line 66 "..\..\Views\Device\Show.cshtml"
#line 112 "..\..\Views\Device\Show.cshtml"
if (Authorization.Has(Claims.Device.ShowFlagAssignments))
{
#line default
#line hidden
#line 114 "..\..\Views\Device\Show.cshtml"
Write(Html.Partial(MVC.Device.Views.DeviceParts._Flags, Model));
#line default
#line hidden
#line 114 "..\..\Views\Device\Show.cshtml"
}
#line default
#line hidden
WriteLiteral(" ");
#line 116 "..\..\Views\Device\Show.cshtml"
if (Authorization.Has(Claims.Device.ShowCertificates))
{
@@ -248,14 +453,14 @@ WriteLiteral(" ");
#line default
#line hidden
#line 68 "..\..\Views\Device\Show.cshtml"
#line 118 "..\..\Views\Device\Show.cshtml"
Write(Html.Partial(MVC.Device.Views.DeviceParts._Certificates, Model));
#line default
#line hidden
#line 68 "..\..\Views\Device\Show.cshtml"
#line 118 "..\..\Views\Device\Show.cshtml"
}
+78 -20
View File
@@ -1,4 +1,5 @@
@model IEnumerable<Disco.Models.Services.Searching.DeviceSearchResultItem>
@using Disco.Services.Devices.DeviceFlags;
@{
var canShowDevices = Authorization.Has(Claims.Device.Show);
var canShowUsers = Authorization.Has(Claims.User.Show);
@@ -7,7 +8,7 @@
}
<div class="genericData deviceTable">
@if (Model != null && Model.Count() > 0)
{
{
<table class="genericData deviceTable">
<thead>
<tr>
@@ -29,15 +30,32 @@
<td>
@if (canShowDevices)
{@Html.ActionLink(item.Id, MVC.Device.Show(item.Id))}
else
{@item.Id}
else
{@item.Id}
@if (Authorization.Has(Claims.Device.ShowFlagAssignments))
{
@if (item.DeviceFlagAssignments != null && item.DeviceFlagAssignments.Count > 0)
{
<div class="flags">
@foreach (var flag in item.DeviceFlagAssignments.Where(f => !f.RemovedDate.HasValue).Select(f => Tuple.Create(f, DeviceFlagService.GetDeviceFlag(f.DeviceFlagId))))
{
<i class="flag fa fa-@(flag.Item2.Icon) fa-fw d-@(flag.Item2.IconColour)">
<span class="details">
<span class="name">@flag.Item2.Name</span>@if (flag.Item1.Comments != null)
{<span class="comments">@flag.Item1.Comments.ToHtmlComment()</span>}<span class="added">@CommonHelpers.FriendlyDateAndUser(flag.Item1.AddedDate, flag.Item1.AddedUserId)</span>
</span>
</i>
}
</div>
}
}
</td>
<td>
@item.AssetNumber
</td>
<td>
@if (item.DecommissionedDate.HasValue)
{ @CommonHelpers.FriendlyDate(item.DecommissionedDate.Value) }
{@CommonHelpers.FriendlyDate(item.DecommissionedDate.Value)}
</td>
<td>
@if (string.IsNullOrWhiteSpace(item.ComputerName))
@@ -45,7 +63,7 @@
<span class="smallMessage">Unknown</span>
}
else
{
{
@item.ComputerName
}
</td>
@@ -55,8 +73,8 @@
<span>@item.DeviceModelDescription</span>
}
else
{
<span class="smallMessage">Unknown</span>
{
<span class="smallMessage">Unknown</span>
}
</td>
<td>
@@ -68,25 +86,26 @@
<span>@item.DeviceBatchName</span>
}
else
{
<span class="smallMessage">N/A</span>
{
<span class="smallMessage">N/A</span>
}
</td>
<td>
@if (string.IsNullOrEmpty(item.AssignedUserId))
{
<span class="smallMessage">N/A</span>
<span class="smallMessage">N/A</span>
}
else
{
<span>@if (canShowUsers)
{
@Html.ActionLink(item.AssignedUserDescription, MVC.User.Show(item.AssignedUserId))
}
else
{
@item.AssignedUserDescription
}
{
<span>
@if (canShowUsers)
{
@Html.ActionLink(item.AssignedUserDescription, MVC.User.Show(item.AssignedUserId))
}
else
{
@item.AssignedUserDescription
}
</span>
}
</td>
@@ -97,9 +116,48 @@
}
</tbody>
</table>
<script type="text/javascript">
$(function () {
var userTable = $('table.deviceTable');
userTable.each(function () {
var $this = $(this);
if (!$this.data('deviceTable_Flags')) {
$this.tooltip({
items: 'i.flag',
content: function () {
var $this = $(this);
return $this.children('.details').html();
},
tooltipClass: 'FlagAssignment_Tooltip',
position: {
my: "right top",
at: "right bottom",
collision: "flipfit flip"
},
hade: {
effect: ''
},
close: function (e, ui) {
ui.tooltip.hover(
function () {
$(this).stop(true).fadeTo(100, 1);
},
function () {
$(this).fadeOut(100, function () { $(this).remove(); });
});
}
});
$this.data('deviceTable_Flags', true)
}
});
});
</script>
}
else
{
{
<span class="smallMessage">No Devices Found</span>
}
</div>
+338 -134
View File
@@ -30,6 +30,12 @@ namespace Disco.Web.Views.Device
using Disco.Models.Repository;
using Disco.Services;
using Disco.Services.Authorization;
#line 2 "..\..\Views\Device\_DeviceTable.cshtml"
using Disco.Services.Devices.DeviceFlags;
#line default
#line hidden
using Disco.Services.Web;
using Disco.Web;
using Disco.Web.Extensions;
@@ -44,7 +50,7 @@ namespace Disco.Web.Views.Device
public override void Execute()
{
#line 2 "..\..\Views\Device\_DeviceTable.cshtml"
#line 3 "..\..\Views\Device\_DeviceTable.cshtml"
var canShowDevices = Authorization.Has(Claims.Device.Show);
var canShowUsers = Authorization.Has(Claims.User.Show);
@@ -61,15 +67,15 @@ WriteLiteral(" class=\"genericData deviceTable\"");
WriteLiteral(">\r\n");
#line 9 "..\..\Views\Device\_DeviceTable.cshtml"
#line 10 "..\..\Views\Device\_DeviceTable.cshtml"
#line default
#line hidden
#line 9 "..\..\Views\Device\_DeviceTable.cshtml"
#line 10 "..\..\Views\Device\_DeviceTable.cshtml"
if (Model != null && Model.Count() > 0)
{
{
#line default
@@ -96,13 +102,13 @@ WriteLiteral(@">Decommissioned</th>
");
#line 26 "..\..\Views\Device\_DeviceTable.cshtml"
#line 27 "..\..\Views\Device\_DeviceTable.cshtml"
#line default
#line hidden
#line 26 "..\..\Views\Device\_DeviceTable.cshtml"
#line 27 "..\..\Views\Device\_DeviceTable.cshtml"
foreach (var item in Model)
{
@@ -111,56 +117,203 @@ WriteLiteral(@">Decommissioned</th>
#line hidden
WriteLiteral(" <tr");
WriteAttribute("class", Tuple.Create(" class=\"", 981), Tuple.Create("\"", 1058)
WriteAttribute("class", Tuple.Create(" class=\"", 1024), Tuple.Create("\"", 1101)
#line 28 "..\..\Views\Device\_DeviceTable.cshtml"
, Tuple.Create(Tuple.Create("", 989), Tuple.Create<System.Object, System.Int32>(item.DecommissionedDate.HasValue ? "decommissioned" : string.Empty
#line 29 "..\..\Views\Device\_DeviceTable.cshtml"
, Tuple.Create(Tuple.Create("", 1032), Tuple.Create<System.Object, System.Int32>(item.DecommissionedDate.HasValue ? "decommissioned" : string.Empty
#line default
#line hidden
, 989), false)
, 1032), false)
);
WriteLiteral(">\r\n <td>\r\n");
#line 30 "..\..\Views\Device\_DeviceTable.cshtml"
#line 31 "..\..\Views\Device\_DeviceTable.cshtml"
#line default
#line hidden
#line 30 "..\..\Views\Device\_DeviceTable.cshtml"
#line 31 "..\..\Views\Device\_DeviceTable.cshtml"
if (canShowDevices)
{
#line default
#line hidden
#line 31 "..\..\Views\Device\_DeviceTable.cshtml"
#line 32 "..\..\Views\Device\_DeviceTable.cshtml"
Write(Html.ActionLink(item.Id, MVC.Device.Show(item.Id)));
#line default
#line hidden
#line 31 "..\..\Views\Device\_DeviceTable.cshtml"
#line 32 "..\..\Views\Device\_DeviceTable.cshtml"
}
else
{
else
{
#line default
#line hidden
#line 33 "..\..\Views\Device\_DeviceTable.cshtml"
Write(item.Id);
#line 34 "..\..\Views\Device\_DeviceTable.cshtml"
Write(item.Id);
#line default
#line hidden
#line 33 "..\..\Views\Device\_DeviceTable.cshtml"
}
#line 34 "..\..\Views\Device\_DeviceTable.cshtml"
}
#line default
#line hidden
WriteLiteral(" ");
#line 35 "..\..\Views\Device\_DeviceTable.cshtml"
if (Authorization.Has(Claims.Device.ShowFlagAssignments))
{
#line default
#line hidden
#line 37 "..\..\Views\Device\_DeviceTable.cshtml"
if (item.DeviceFlagAssignments != null && item.DeviceFlagAssignments.Count > 0)
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"flags\"");
WriteLiteral(">\r\n");
#line 40 "..\..\Views\Device\_DeviceTable.cshtml"
#line default
#line hidden
#line 40 "..\..\Views\Device\_DeviceTable.cshtml"
foreach (var flag in item.DeviceFlagAssignments.Where(f => !f.RemovedDate.HasValue).Select(f => Tuple.Create(f, DeviceFlagService.GetDeviceFlag(f.DeviceFlagId))))
{
#line default
#line hidden
WriteLiteral(" <i");
WriteAttribute("class", Tuple.Create(" class=\"", 1953), Tuple.Create("\"", 2023)
, Tuple.Create(Tuple.Create("", 1961), Tuple.Create("flag", 1961), true)
, Tuple.Create(Tuple.Create(" ", 1965), Tuple.Create("fa", 1966), true)
, Tuple.Create(Tuple.Create(" ", 1968), Tuple.Create("fa-", 1969), true)
#line 42 "..\..\Views\Device\_DeviceTable.cshtml"
, Tuple.Create(Tuple.Create("", 1972), Tuple.Create<System.Object, System.Int32>(flag.Item2.Icon
#line default
#line hidden
, 1972), false)
, Tuple.Create(Tuple.Create(" ", 1990), Tuple.Create("fa-fw", 1991), true)
, Tuple.Create(Tuple.Create(" ", 1996), Tuple.Create("d-", 1997), true)
#line 42 "..\..\Views\Device\_DeviceTable.cshtml"
, Tuple.Create(Tuple.Create("", 1999), Tuple.Create<System.Object, System.Int32>(flag.Item2.IconColour
#line default
#line hidden
, 1999), false)
);
WriteLiteral(">\r\n <span");
WriteLiteral(" class=\"details\"");
WriteLiteral(">\r\n <span");
WriteLiteral(" class=\"name\"");
WriteLiteral(">");
#line 44 "..\..\Views\Device\_DeviceTable.cshtml"
Write(flag.Item2.Name);
#line default
#line hidden
WriteLiteral("</span>");
#line 44 "..\..\Views\Device\_DeviceTable.cshtml"
if (flag.Item1.Comments != null)
{
#line default
#line hidden
WriteLiteral("<span");
WriteLiteral(" class=\"comments\"");
WriteLiteral(">");
#line 45 "..\..\Views\Device\_DeviceTable.cshtml"
Write(flag.Item1.Comments.ToHtmlComment());
#line default
#line hidden
WriteLiteral("</span>");
#line 45 "..\..\Views\Device\_DeviceTable.cshtml"
}
#line default
#line hidden
WriteLiteral("<span");
WriteLiteral(" class=\"added\"");
WriteLiteral(">");
#line 45 "..\..\Views\Device\_DeviceTable.cshtml"
Write(CommonHelpers.FriendlyDateAndUser(flag.Item1.AddedDate, flag.Item1.AddedUserId));
#line default
#line hidden
WriteLiteral("</span>\r\n </span>\r\n " +
" </i>\r\n");
#line 48 "..\..\Views\Device\_DeviceTable.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n </div>\r\n");
#line 50 "..\..\Views\Device\_DeviceTable.cshtml"
}
#line default
#line hidden
#line 50 "..\..\Views\Device\_DeviceTable.cshtml"
}
#line default
@@ -170,7 +323,7 @@ WriteLiteral(" </td>\r\n <td>\r\n"
WriteLiteral(" ");
#line 36 "..\..\Views\Device\_DeviceTable.cshtml"
#line 54 "..\..\Views\Device\_DeviceTable.cshtml"
Write(item.AssetNumber);
@@ -179,28 +332,28 @@ WriteLiteral(" ");
WriteLiteral("\r\n </td>\r\n <td>\r\n");
#line 39 "..\..\Views\Device\_DeviceTable.cshtml"
#line 57 "..\..\Views\Device\_DeviceTable.cshtml"
#line default
#line hidden
#line 39 "..\..\Views\Device\_DeviceTable.cshtml"
#line 57 "..\..\Views\Device\_DeviceTable.cshtml"
if (item.DecommissionedDate.HasValue)
{
{
#line default
#line hidden
#line 40 "..\..\Views\Device\_DeviceTable.cshtml"
Write(CommonHelpers.FriendlyDate(item.DecommissionedDate.Value));
#line 58 "..\..\Views\Device\_DeviceTable.cshtml"
Write(CommonHelpers.FriendlyDate(item.DecommissionedDate.Value));
#line default
#line hidden
#line 40 "..\..\Views\Device\_DeviceTable.cshtml"
}
#line 58 "..\..\Views\Device\_DeviceTable.cshtml"
}
#line default
@@ -208,13 +361,13 @@ WriteLiteral("\r\n </td>\r\n <td>\
WriteLiteral(" </td>\r\n <td>\r\n");
#line 43 "..\..\Views\Device\_DeviceTable.cshtml"
#line 61 "..\..\Views\Device\_DeviceTable.cshtml"
#line default
#line hidden
#line 43 "..\..\Views\Device\_DeviceTable.cshtml"
#line 61 "..\..\Views\Device\_DeviceTable.cshtml"
if (string.IsNullOrWhiteSpace(item.ComputerName))
{
@@ -228,23 +381,23 @@ WriteLiteral(" class=\"smallMessage\"");
WriteLiteral(">Unknown</span>\r\n");
#line 46 "..\..\Views\Device\_DeviceTable.cshtml"
#line 64 "..\..\Views\Device\_DeviceTable.cshtml"
}
else
{
{
#line default
#line hidden
#line 49 "..\..\Views\Device\_DeviceTable.cshtml"
#line 67 "..\..\Views\Device\_DeviceTable.cshtml"
Write(item.ComputerName);
#line default
#line hidden
#line 49 "..\..\Views\Device\_DeviceTable.cshtml"
#line 67 "..\..\Views\Device\_DeviceTable.cshtml"
}
@@ -254,13 +407,13 @@ WriteLiteral(">Unknown</span>\r\n");
WriteLiteral(" </td>\r\n <td>\r\n");
#line 53 "..\..\Views\Device\_DeviceTable.cshtml"
#line 71 "..\..\Views\Device\_DeviceTable.cshtml"
#line default
#line hidden
#line 53 "..\..\Views\Device\_DeviceTable.cshtml"
#line 71 "..\..\Views\Device\_DeviceTable.cshtml"
if (item.DeviceModelDescription != null)
{
@@ -270,7 +423,7 @@ WriteLiteral(" </td>\r\n <td>\r\n"
WriteLiteral(" <span>");
#line 55 "..\..\Views\Device\_DeviceTable.cshtml"
#line 73 "..\..\Views\Device\_DeviceTable.cshtml"
Write(item.DeviceModelDescription);
@@ -279,10 +432,10 @@ WriteLiteral(" <span>");
WriteLiteral("</span>\r\n");
#line 56 "..\..\Views\Device\_DeviceTable.cshtml"
#line 74 "..\..\Views\Device\_DeviceTable.cshtml"
}
else
{
{
#line default
@@ -291,10 +444,10 @@ WriteLiteral(" <span");
WriteLiteral(" class=\"smallMessage\"");
WriteLiteral(">Unknown</span> \r\n");
WriteLiteral(">Unknown</span>\r\n");
#line 60 "..\..\Views\Device\_DeviceTable.cshtml"
#line 78 "..\..\Views\Device\_DeviceTable.cshtml"
}
@@ -305,7 +458,7 @@ WriteLiteral(" </td>\r\n <td>\r\n"
WriteLiteral(" ");
#line 63 "..\..\Views\Device\_DeviceTable.cshtml"
#line 81 "..\..\Views\Device\_DeviceTable.cshtml"
Write(item.DeviceProfileName);
@@ -314,13 +467,13 @@ WriteLiteral(" ");
WriteLiteral("\r\n </td>\r\n <td>\r\n");
#line 66 "..\..\Views\Device\_DeviceTable.cshtml"
#line 84 "..\..\Views\Device\_DeviceTable.cshtml"
#line default
#line hidden
#line 66 "..\..\Views\Device\_DeviceTable.cshtml"
#line 84 "..\..\Views\Device\_DeviceTable.cshtml"
if (item.DeviceBatchName != null)
{
@@ -330,7 +483,7 @@ WriteLiteral("\r\n </td>\r\n <td>\
WriteLiteral(" <span>");
#line 68 "..\..\Views\Device\_DeviceTable.cshtml"
#line 86 "..\..\Views\Device\_DeviceTable.cshtml"
Write(item.DeviceBatchName);
@@ -339,38 +492,9 @@ WriteLiteral(" <span>");
WriteLiteral("</span>\r\n");
#line 69 "..\..\Views\Device\_DeviceTable.cshtml"
#line 87 "..\..\Views\Device\_DeviceTable.cshtml"
}
else
{
#line default
#line hidden
WriteLiteral(" <span");
WriteLiteral(" class=\"smallMessage\"");
WriteLiteral(">N/A</span> \r\n");
#line 73 "..\..\Views\Device\_DeviceTable.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n <td>\r\n");
#line 76 "..\..\Views\Device\_DeviceTable.cshtml"
#line default
#line hidden
#line 76 "..\..\Views\Device\_DeviceTable.cshtml"
if (string.IsNullOrEmpty(item.AssignedUserId))
{
@@ -380,60 +504,7 @@ WriteLiteral(" <span");
WriteLiteral(" class=\"smallMessage\"");
WriteLiteral(">N/A</span> \r\n");
#line 79 "..\..\Views\Device\_DeviceTable.cshtml"
}
else
{
#line default
#line hidden
WriteLiteral(" <span>");
#line 82 "..\..\Views\Device\_DeviceTable.cshtml"
if (canShowUsers)
{
#line default
#line hidden
#line 84 "..\..\Views\Device\_DeviceTable.cshtml"
Write(Html.ActionLink(item.AssignedUserDescription, MVC.User.Show(item.AssignedUserId)));
#line default
#line hidden
#line 84 "..\..\Views\Device\_DeviceTable.cshtml"
}
else
{
#line default
#line hidden
#line 88 "..\..\Views\Device\_DeviceTable.cshtml"
Write(item.AssignedUserDescription);
#line default
#line hidden
#line 88 "..\..\Views\Device\_DeviceTable.cshtml"
}
#line default
#line hidden
WriteLiteral(" </span>\r\n");
WriteLiteral(">N/A</span>\r\n");
#line 91 "..\..\Views\Device\_DeviceTable.cshtml"
@@ -444,10 +515,98 @@ WriteLiteral(" </span>\r\n");
#line hidden
WriteLiteral(" </td>\r\n <td>\r\n");
#line 94 "..\..\Views\Device\_DeviceTable.cshtml"
#line default
#line hidden
#line 94 "..\..\Views\Device\_DeviceTable.cshtml"
if (string.IsNullOrEmpty(item.AssignedUserId))
{
#line default
#line hidden
WriteLiteral(" <span");
WriteLiteral(" class=\"smallMessage\"");
WriteLiteral(">N/A</span>\r\n");
#line 97 "..\..\Views\Device\_DeviceTable.cshtml"
}
else
{
#line default
#line hidden
WriteLiteral(" <span>\r\n");
#line 101 "..\..\Views\Device\_DeviceTable.cshtml"
#line default
#line hidden
#line 101 "..\..\Views\Device\_DeviceTable.cshtml"
if (canShowUsers)
{
#line default
#line hidden
#line 103 "..\..\Views\Device\_DeviceTable.cshtml"
Write(Html.ActionLink(item.AssignedUserDescription, MVC.User.Show(item.AssignedUserId)));
#line default
#line hidden
#line 103 "..\..\Views\Device\_DeviceTable.cshtml"
}
else
{
#line default
#line hidden
#line 107 "..\..\Views\Device\_DeviceTable.cshtml"
Write(item.AssignedUserDescription);
#line default
#line hidden
#line 107 "..\..\Views\Device\_DeviceTable.cshtml"
}
#line default
#line hidden
WriteLiteral(" </span>\r\n");
#line 110 "..\..\Views\Device\_DeviceTable.cshtml"
}
#line default
#line hidden
WriteLiteral(" </td>\r\n <td>\r\n");
WriteLiteral(" ");
#line 94 "..\..\Views\Device\_DeviceTable.cshtml"
#line 113 "..\..\Views\Device\_DeviceTable.cshtml"
Write(item.JobCount);
@@ -456,7 +615,7 @@ WriteLiteral(" ");
WriteLiteral("\r\n </td>\r\n </tr>\r\n");
#line 97 "..\..\Views\Device\_DeviceTable.cshtml"
#line 116 "..\..\Views\Device\_DeviceTable.cshtml"
}
@@ -464,11 +623,56 @@ WriteLiteral("\r\n </td>\r\n </tr>\r\n
#line hidden
WriteLiteral(" </tbody>\r\n </table>\r\n");
WriteLiteral(" <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(@">
$(function () {
var userTable = $('table.deviceTable');
userTable.each(function () {
var $this = $(this);
if (!$this.data('deviceTable_Flags')) {
$this.tooltip({
items: 'i.flag',
content: function () {
var $this = $(this);
return $this.children('.details').html();
},
tooltipClass: 'FlagAssignment_Tooltip',
position: {
my: ""right top"",
at: ""right bottom"",
collision: ""flipfit flip""
},
hade: {
effect: ''
},
close: function (e, ui) {
ui.tooltip.hover(
function () {
$(this).stop(true).fadeTo(100, 1);
},
function () {
$(this).fadeOut(100, function () { $(this).remove(); });
});
}
});
$this.data('deviceTable_Flags', true)
}
});
});
</script>
");
#line 100 "..\..\Views\Device\_DeviceTable.cshtml"
#line 158 "..\..\Views\Device\_DeviceTable.cshtml"
}
else
{
{
#line default
@@ -480,7 +684,7 @@ WriteLiteral(" class=\"smallMessage\"");
WriteLiteral(">No Devices Found</span>\r\n");
#line 104 "..\..\Views\Device\_DeviceTable.cshtml"
#line 162 "..\..\Views\Device\_DeviceTable.cshtml"
}
+110 -63
View File
@@ -1,6 +1,7 @@
@model Disco.Web.Models.Job.ShowModel
@using Disco.Models.Services.Job;
@using Disco.Services.Users.UserFlags;
@using Disco.Services.Devices.DeviceFlags;
@{
Authorization.Require(Claims.Job.Show);
}
@@ -190,69 +191,115 @@
{
<div id="Job_Show_Device_Batch" title="Batch">@Html.ActionLink(Model.Job.Device.DeviceBatch.Name, MVC.Config.DeviceBatch.Index(Model.Job.Device.DeviceBatchId))</div>
}
@if (Model.Job.Device.DeviceBatch != null)
{
if (Model.Job.JobTypeId == JobType.JobTypeIds.HWar)
{
<div id="Job_Show_Device_Details_HWar">
<div>DEVICE WARRANTY</div>
<div>Until: <span id="Job_Show_Device_Details_HWar_ValidUntil" data-livestamp="@Model.Job.Device.DeviceBatch.WarrantyValidUntil.ToUnixEpoc()">@Model.Job.Device.DeviceBatch.WarrantyValidUntil.ToFullDateTime("Unknown")</span></div>
@if (!string.IsNullOrWhiteSpace(Model.Job.Device.DeviceBatch.WarrantyDetails))
{
<a id="Job_Show_Device_Details_HWar_Details_Button" href="#">Show Details</a>
<div id="Job_Show_Device_Details_HWar_Details_Dialog" class="dialog" title="Warranty Details for @(Model.Job.Device.DeviceBatch.Name)">
<div>@(new HtmlString(Model.Job.Device.DeviceBatch.WarrantyDetails))</div>
</div>
<script type="text/javascript">
$(function () {
var d;
$('#Job_Show_Device_Details_HWar_Details_Button').click(function () {
if (!d)
d = $('#Job_Show_Device_Details_HWar_Details_Dialog').dialog({
width: 570,
modal: true
});
else
d.dialog('open');
return false;
});
});
</script>
}
</div>
}
if (Model.Job.JobTypeId == JobType.JobTypeIds.HNWar)
{
<div id="Job_Show_Device_Details_HNWar">
<div>INSURANCE</div>
<div id="Job_Show_Device_Details_HNWar_InsuranceSupplier">@Model.Job.Device.DeviceBatch.InsuranceSupplier</div>
<div>Until: <span id="Job_Show_Device_Details_HNWar_ValidUntil" data-livestamp="@Model.Job.Device.DeviceBatch.InsuredUntil.ToUnixEpoc()">@Model.Job.Device.DeviceBatch.InsuredUntil.ToFullDateTime("Unknown")</span></div>
@if (!string.IsNullOrWhiteSpace(Model.Job.Device.DeviceBatch.InsuranceDetails))
{
<a id="Job_Show_Device_Details_HNWar_Details_Button" href="#">Show Details</a>
<div id="Job_Show_Device_Details_HNWar_Details_Dialog" class="dialog" title="Insurance Details for @(Model.Job.Device.DeviceBatch.Name)">
<div>@(new HtmlString(Model.Job.Device.DeviceBatch.InsuranceDetails))</div>
</div>
<script type="text/javascript">
$(function () {
var d;
$('#Job_Show_Device_Details_HNWar_Details_Button').click(function () {
if (!d)
d = $('#Job_Show_Device_Details_HNWar_Details_Dialog').dialog({
width: 570,
modal: true
});
else
d.dialog('open');
return false;
});
});
</script>
}
</div>
}
}
@if (Authorization.Has(Claims.Device.ShowFlagAssignments) &&
Model.Job.Device.DeviceFlagAssignments != null &&
Model.Job.Device.DeviceFlagAssignments.Any(a => !a.RemovedDate.HasValue))
{
<div id="Job_Show_Device_Flags">
@foreach (var flag in Model.Job.Device.DeviceFlagAssignments.Where(f => !f.RemovedDate.HasValue).Select(f => Tuple.Create(f, DeviceFlagService.GetDeviceFlag(f.DeviceFlagId))))
{
<i class="flag fa fa-@(flag.Item2.Icon) fa-fw d-@(flag.Item2.IconColour)">
<span class="details">
<span class="name">@flag.Item2.Name</span>@if (flag.Item1.Comments != null)
{<span class="comments">@flag.Item1.Comments.ToHtmlComment()</span>}<span class="added">@CommonHelpers.FriendlyDateAndUser(flag.Item1.AddedDate, flag.Item1.AddedUserId)</span>
</span>
</i>
}
<script type="text/javascript">
$(function () {
$('#Job_Show_Device_Flags')
.tooltip({
items: 'i.flag',
content: function () {
var $this = $(this);
return $this.children('.details').html();
},
tooltipClass: 'FlagAssignment_Tooltip',
position: {
my: "right top",
at: "right bottom",
collision: "flipfit flip"
},
hade: {
effect: ''
},
close: function (e, ui) {
ui.tooltip.hover(
function () {
$(this).stop(true).fadeTo(100, 1);
},
function () {
$(this).fadeOut(100, function () { $(this).remove(); });
});
}
});
});
</script>
</div>
}
</div>
@if (Model.Job.Device.DeviceBatch != null)
{
if (Model.Job.JobTypeId == JobType.JobTypeIds.HWar)
{
<div id="Job_Show_Device_Details_HWar">
<div>DEVICE WARRANTY</div>
<div>Until: <span id="Job_Show_Device_Details_HWar_ValidUntil" data-livestamp="@Model.Job.Device.DeviceBatch.WarrantyValidUntil.ToUnixEpoc()">@Model.Job.Device.DeviceBatch.WarrantyValidUntil.ToFullDateTime("Unknown")</span></div>
@if (!string.IsNullOrWhiteSpace(Model.Job.Device.DeviceBatch.WarrantyDetails))
{
<a id="Job_Show_Device_Details_HWar_Details_Button" href="#">Show Details</a>
<div id="Job_Show_Device_Details_HWar_Details_Dialog" class="dialog" title="Warranty Details for @(Model.Job.Device.DeviceBatch.Name)">
<div>@(new HtmlString(Model.Job.Device.DeviceBatch.WarrantyDetails))</div>
</div>
<script type="text/javascript">
$(function () {
var d;
$('#Job_Show_Device_Details_HWar_Details_Button').click(function () {
if (!d)
d = $('#Job_Show_Device_Details_HWar_Details_Dialog').dialog({
width: 570,
modal: true
});
else
d.dialog('open');
return false;
});
});
</script>
}
</div>
}
if (Model.Job.JobTypeId == JobType.JobTypeIds.HNWar)
{
<div id="Job_Show_Device_Details_HNWar">
<div>INSURANCE</div>
<div id="Job_Show_Device_Details_HNWar_InsuranceSupplier">@Model.Job.Device.DeviceBatch.InsuranceSupplier</div>
<div>Until: <span id="Job_Show_Device_Details_HNWar_ValidUntil" data-livestamp="@Model.Job.Device.DeviceBatch.InsuredUntil.ToUnixEpoc()">@Model.Job.Device.DeviceBatch.InsuredUntil.ToFullDateTime("Unknown")</span></div>
@if (!string.IsNullOrWhiteSpace(Model.Job.Device.DeviceBatch.InsuranceDetails))
{
<a id="Job_Show_Device_Details_HNWar_Details_Button" href="#">Show Details</a>
<div id="Job_Show_Device_Details_HNWar_Details_Dialog" class="dialog" title="Insurance Details for @(Model.Job.Device.DeviceBatch.Name)">
<div>@(new HtmlString(Model.Job.Device.DeviceBatch.InsuranceDetails))</div>
</div>
<script type="text/javascript">
$(function () {
var d;
$('#Job_Show_Device_Details_HNWar_Details_Button').click(function () {
if (!d)
d = $('#Job_Show_Device_Details_HNWar_Details_Dialog').dialog({
width: 570,
modal: true
});
else
d.dialog('open');
return false;
});
});
</script>
}
</div>
}
}
</div>
@if (Model.Job.DeviceHeld.HasValue)
{
@@ -469,7 +516,7 @@
var $this = $(this);
return $this.children('.details').html();
},
tooltipClass: 'User_FlagAssignment_Tooltip',
tooltipClass: 'FlagAssignment_Tooltip',
position: {
my: "right top",
at: "right bottom",
File diff suppressed because it is too large Load Diff
+45 -38
View File
@@ -6,44 +6,51 @@
ViewBag.Title = Html.ToBreadcrumb("Users", MVC.User.Index(), string.Format("User: {0} ({1})", Model.User.DisplayName, Model.User.FriendlyId()));
}
<div id="User_Show">
<div id="User_Show_Flags">
@foreach (var flag in Model.User.UserFlagAssignments.Where(f => !f.RemovedDate.HasValue).Select(f => Tuple.Create(f, UserFlagService.GetUserFlag(f.UserFlagId))))
{
<i class="flag fa fa-@(flag.Item2.Icon) fa-fw fa-lg d-@(flag.Item2.IconColour)"><span class="details"><span class="name">@flag.Item2.Name</span>@if (flag.Item1.Comments != null)
{<span class="comments">@flag.Item1.Comments.ToHtmlComment()</span>}<span class="added">@CommonHelpers.FriendlyDateAndUser(flag.Item1.AddedDate, flag.Item1.AddedUser)</span></span></i>
}
</div>
<script type="text/javascript">
$(function () {
$('#User_Show_Flags')
.appendTo('#layout_PageHeading')
.tooltip({
items: 'i.flag',
content: function () {
var $this = $(this);
return $this.children('.details').html();
},
tooltipClass: 'User_FlagAssignment_Tooltip',
position: {
my: "right top",
at: "right bottom",
collision: "flipfit flip"
},
hade: {
effect: ''
},
close: function (e, ui) {
ui.tooltip.hover(
function () {
$(this).stop(true).fadeTo(100, 1);
},
function () {
$(this).fadeOut(100, function () { $(this).remove(); });
});
}
});
});
</script>
@if (Authorization.Has(Claims.User.ShowFlagAssignments))
{
<div id="User_Show_Flags">
@foreach (var flag in Model.User.UserFlagAssignments.Where(f => !f.RemovedDate.HasValue).Select(f => Tuple.Create(f, UserFlagService.GetUserFlag(f.UserFlagId))))
{
<i class="flag fa fa-@(flag.Item2.Icon) fa-fw fa-lg d-@(flag.Item2.IconColour)">
<span class="details">
<span class="name">@flag.Item2.Name</span>@if (flag.Item1.Comments != null)
{<span class="comments">@flag.Item1.Comments.ToHtmlComment()</span>}<span class="added">@CommonHelpers.FriendlyDateAndUser(flag.Item1.AddedDate, flag.Item1.AddedUser)</span>
</span>
</i>
}
</div>
<script type="text/javascript">
$(function () {
$('#User_Show_Flags')
.appendTo('#layout_PageHeading')
.tooltip({
items: 'i.flag',
content: function () {
var $this = $(this);
return $this.children('.details').html();
},
tooltipClass: 'FlagAssignment_Tooltip',
position: {
my: "right top",
at: "right bottom",
collision: "flipfit flip"
},
hade: {
effect: ''
},
close: function (e, ui) {
ui.tooltip.hover(
function () {
$(this).stop(true).fadeTo(100, 1);
},
function () {
$(this).fadeOut(100, function () { $(this).remove(); });
});
}
});
});
</script>
}
@Html.Partial(MVC.User.Views.UserParts._Subject, Model)
<script type="text/javascript">
$(function () {
+109 -84
View File
@@ -63,64 +63,80 @@ WriteLiteral("\r\n<div");
WriteLiteral(" id=\"User_Show\"");
WriteLiteral(">\r\n <div");
WriteLiteral(">\r\n");
#line 9 "..\..\Views\User\Show.cshtml"
#line default
#line hidden
#line 9 "..\..\Views\User\Show.cshtml"
if (Authorization.Has(Claims.User.ShowFlagAssignments))
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" id=\"User_Show_Flags\"");
WriteLiteral(">\r\n");
#line 10 "..\..\Views\User\Show.cshtml"
#line 12 "..\..\Views\User\Show.cshtml"
#line default
#line hidden
#line 10 "..\..\Views\User\Show.cshtml"
foreach (var flag in Model.User.UserFlagAssignments.Where(f => !f.RemovedDate.HasValue).Select(f => Tuple.Create(f, UserFlagService.GetUserFlag(f.UserFlagId))))
{
#line 12 "..\..\Views\User\Show.cshtml"
foreach (var flag in Model.User.UserFlagAssignments.Where(f => !f.RemovedDate.HasValue).Select(f => Tuple.Create(f, UserFlagService.GetUserFlag(f.UserFlagId))))
{
#line default
#line hidden
WriteLiteral(" <i");
WriteLiteral(" <i");
WriteAttribute("class", Tuple.Create(" class=\"", 535), Tuple.Create("\"", 611)
, Tuple.Create(Tuple.Create("", 543), Tuple.Create("flag", 543), true)
, Tuple.Create(Tuple.Create(" ", 547), Tuple.Create("fa", 548), true)
, Tuple.Create(Tuple.Create(" ", 550), Tuple.Create("fa-", 551), true)
WriteAttribute("class", Tuple.Create(" class=\"", 620), Tuple.Create("\"", 696)
, Tuple.Create(Tuple.Create("", 628), Tuple.Create("flag", 628), true)
, Tuple.Create(Tuple.Create(" ", 632), Tuple.Create("fa", 633), true)
, Tuple.Create(Tuple.Create(" ", 635), Tuple.Create("fa-", 636), true)
#line 12 "..\..\Views\User\Show.cshtml"
, Tuple.Create(Tuple.Create("", 554), Tuple.Create<System.Object, System.Int32>(flag.Item2.Icon
#line 14 "..\..\Views\User\Show.cshtml"
, Tuple.Create(Tuple.Create("", 639), Tuple.Create<System.Object, System.Int32>(flag.Item2.Icon
#line default
#line hidden
, 554), false)
, Tuple.Create(Tuple.Create(" ", 572), Tuple.Create("fa-fw", 573), true)
, Tuple.Create(Tuple.Create(" ", 578), Tuple.Create("fa-lg", 579), true)
, Tuple.Create(Tuple.Create(" ", 584), Tuple.Create("d-", 585), true)
, 639), false)
, Tuple.Create(Tuple.Create(" ", 657), Tuple.Create("fa-fw", 658), true)
, Tuple.Create(Tuple.Create(" ", 663), Tuple.Create("fa-lg", 664), true)
, Tuple.Create(Tuple.Create(" ", 669), Tuple.Create("d-", 670), true)
#line 12 "..\..\Views\User\Show.cshtml"
, Tuple.Create(Tuple.Create("", 587), Tuple.Create<System.Object, System.Int32>(flag.Item2.IconColour
#line 14 "..\..\Views\User\Show.cshtml"
, Tuple.Create(Tuple.Create("", 672), Tuple.Create<System.Object, System.Int32>(flag.Item2.IconColour
#line default
#line hidden
, 587), false)
, 672), false)
);
WriteLiteral("><span");
WriteLiteral(">\r\n <span");
WriteLiteral(" class=\"details\"");
WriteLiteral("><span");
WriteLiteral(">\r\n <span");
WriteLiteral(" class=\"name\"");
WriteLiteral(">");
#line 12 "..\..\Views\User\Show.cshtml"
Write(flag.Item2.Name);
#line 16 "..\..\Views\User\Show.cshtml"
Write(flag.Item2.Name);
#line default
@@ -128,9 +144,9 @@ WriteLiteral(">");
WriteLiteral("</span>");
#line 12 "..\..\Views\User\Show.cshtml"
if (flag.Item1.Comments != null)
{
#line 16 "..\..\Views\User\Show.cshtml"
if (flag.Item1.Comments != null)
{
#line default
#line hidden
@@ -141,8 +157,8 @@ WriteLiteral(" class=\"comments\"");
WriteLiteral(">");
#line 13 "..\..\Views\User\Show.cshtml"
Write(flag.Item1.Comments.ToHtmlComment());
#line 17 "..\..\Views\User\Show.cshtml"
Write(flag.Item1.Comments.ToHtmlComment());
#line default
@@ -150,8 +166,8 @@ WriteLiteral(">");
WriteLiteral("</span>");
#line 13 "..\..\Views\User\Show.cshtml"
}
#line 17 "..\..\Views\User\Show.cshtml"
}
#line default
#line hidden
@@ -162,62 +178,71 @@ WriteLiteral(" class=\"added\"");
WriteLiteral(">");
#line 13 "..\..\Views\User\Show.cshtml"
Write(CommonHelpers.FriendlyDateAndUser(flag.Item1.AddedDate, flag.Item1.AddedUser));
#line 17 "..\..\Views\User\Show.cshtml"
Write(CommonHelpers.FriendlyDateAndUser(flag.Item1.AddedDate, flag.Item1.AddedUser));
#line default
#line hidden
WriteLiteral("</span></span></i>\r\n");
WriteLiteral("</span>\r\n </span>\r\n </i>\r\n");
#line 14 "..\..\Views\User\Show.cshtml"
}
#line 20 "..\..\Views\User\Show.cshtml"
}
#line default
#line hidden
WriteLiteral(" </div>\r\n <script");
WriteLiteral(" </div>\r\n");
WriteLiteral(" <script");
WriteLiteral(" type=\"text/javascript\"");
WriteLiteral(@">
$(function () {
$('#User_Show_Flags')
.appendTo('#layout_PageHeading')
.tooltip({
items: 'i.flag',
content: function () {
var $this = $(this);
return $this.children('.details').html();
},
tooltipClass: 'User_FlagAssignment_Tooltip',
position: {
my: ""right top"",
at: ""right bottom"",
collision: ""flipfit flip""
},
hade: {
effect: ''
},
close: function (e, ui) {
ui.tooltip.hover(
function () {
$(this).stop(true).fadeTo(100, 1);
},
function () {
$(this).fadeOut(100, function () { $(this).remove(); });
});
}
});
});
</script>
$(function () {
$('#User_Show_Flags')
.appendTo('#layout_PageHeading')
.tooltip({
items: 'i.flag',
content: function () {
var $this = $(this);
return $this.children('.details').html();
},
tooltipClass: 'FlagAssignment_Tooltip',
position: {
my: ""right top"",
at: ""right bottom"",
collision: ""flipfit flip""
},
hade: {
effect: ''
},
close: function (e, ui) {
ui.tooltip.hover(
function () {
$(this).stop(true).fadeTo(100, 1);
},
function () {
$(this).fadeOut(100, function () { $(this).remove(); });
});
}
});
});
</script>
");
#line 53 "..\..\Views\User\Show.cshtml"
}
#line default
#line hidden
WriteLiteral(" ");
#line 47 "..\..\Views\User\Show.cshtml"
#line 54 "..\..\Views\User\Show.cshtml"
Write(Html.Partial(MVC.User.Views.UserParts._Subject, Model));
@@ -257,13 +282,13 @@ WriteLiteral(" id=\"UserDetailTabItems\"");
WriteLiteral("></ul>\r\n");
#line 83 "..\..\Views\User\Show.cshtml"
#line 90 "..\..\Views\User\Show.cshtml"
#line default
#line hidden
#line 83 "..\..\Views\User\Show.cshtml"
#line 90 "..\..\Views\User\Show.cshtml"
if (Authorization.Has(Claims.User.ShowJobs))
{
@@ -271,14 +296,14 @@ WriteLiteral("></ul>\r\n");
#line default
#line hidden
#line 85 "..\..\Views\User\Show.cshtml"
#line 92 "..\..\Views\User\Show.cshtml"
Write(Html.Partial(MVC.User.Views.UserParts._Jobs, Model));
#line default
#line hidden
#line 85 "..\..\Views\User\Show.cshtml"
#line 92 "..\..\Views\User\Show.cshtml"
}
@@ -288,7 +313,7 @@ WriteLiteral("></ul>\r\n");
WriteLiteral(" ");
#line 87 "..\..\Views\User\Show.cshtml"
#line 94 "..\..\Views\User\Show.cshtml"
if (Authorization.Has(Claims.User.ShowAssignmentHistory))
{
@@ -296,14 +321,14 @@ WriteLiteral(" ");
#line default
#line hidden
#line 89 "..\..\Views\User\Show.cshtml"
#line 96 "..\..\Views\User\Show.cshtml"
Write(Html.Partial(MVC.User.Views.UserParts._AssignmentHistory, Model));
#line default
#line hidden
#line 89 "..\..\Views\User\Show.cshtml"
#line 96 "..\..\Views\User\Show.cshtml"
}
@@ -313,7 +338,7 @@ WriteLiteral(" ");
WriteLiteral(" ");
#line 91 "..\..\Views\User\Show.cshtml"
#line 98 "..\..\Views\User\Show.cshtml"
if (Authorization.Has(Claims.User.ShowAttachments))
{
@@ -321,14 +346,14 @@ WriteLiteral(" ");
#line default
#line hidden
#line 93 "..\..\Views\User\Show.cshtml"
#line 100 "..\..\Views\User\Show.cshtml"
Write(Html.Partial(MVC.User.Views.UserParts._Resources, Model));
#line default
#line hidden
#line 93 "..\..\Views\User\Show.cshtml"
#line 100 "..\..\Views\User\Show.cshtml"
}
@@ -338,7 +363,7 @@ WriteLiteral(" ");
WriteLiteral(" ");
#line 95 "..\..\Views\User\Show.cshtml"
#line 102 "..\..\Views\User\Show.cshtml"
if (Authorization.Has(Claims.User.ShowFlagAssignments))
{
@@ -346,14 +371,14 @@ WriteLiteral(" ");
#line default
#line hidden
#line 97 "..\..\Views\User\Show.cshtml"
#line 104 "..\..\Views\User\Show.cshtml"
Write(Html.Partial(MVC.User.Views.UserParts._Flags, Model));
#line default
#line hidden
#line 97 "..\..\Views\User\Show.cshtml"
#line 104 "..\..\Views\User\Show.cshtml"
}
@@ -363,7 +388,7 @@ WriteLiteral(" ");
WriteLiteral(" ");
#line 99 "..\..\Views\User\Show.cshtml"
#line 106 "..\..\Views\User\Show.cshtml"
if (Authorization.Has(Claims.User.ShowAuthorization))
{
@@ -371,14 +396,14 @@ WriteLiteral(" ");
#line default
#line hidden
#line 101 "..\..\Views\User\Show.cshtml"
#line 108 "..\..\Views\User\Show.cshtml"
Write(Html.Partial(MVC.User.Views.UserParts._Authorization, Model));
#line default
#line hidden
#line 101 "..\..\Views\User\Show.cshtml"
#line 108 "..\..\Views\User\Show.cshtml"
}
@@ -1,4 +1,5 @@
@model Disco.Web.Models.User.ShowModel
@using Disco.Services.Devices.DeviceFlags;
@{
Authorization.Require(Claims.User.Show);
@@ -418,6 +419,55 @@
<span class="User_Show_AssignedDevices_CurrentAssignment_Assigned">@CommonHelpers.FriendlyDate(assignment.AssignedDate)</span>
</td>
</tr>
@if (Authorization.Has(Claims.Device.ShowFlagAssignments) &&
assignment.Device.DeviceFlagAssignments.Any(a => a.RemovedDate.HasValue))
{
<tr>
<td colspan="2">
<div class="User_Show_Assigned_Devices_CurrentAssignment_Flags">
@foreach (var flag in assignment.Device.DeviceFlagAssignments.Where(f => !f.RemovedDate.HasValue).Select(f => Tuple.Create(f, DeviceFlagService.GetDeviceFlag(f.DeviceFlagId))))
{
<i class="flag fa fa-@(flag.Item2.Icon) fa-fw d-@(flag.Item2.IconColour)">
<span class="details">
<span class="name">@flag.Item2.Name</span>@if (flag.Item1.Comments != null)
{<span class="comments">@flag.Item1.Comments.ToHtmlComment()</span>}<span class="added">@CommonHelpers.FriendlyDateAndUser(flag.Item1.AddedDate, flag.Item1.AddedUserId)</span>
</span>
</i>
}
<script type="text/javascript">
$(function () {
$('.User_Show_Assigned_Devices_CurrentAssignment_Flags')
.tooltip({
items: 'i.flag',
content: function () {
var $this = $(this);
return $this.children('.details').html();
},
tooltipClass: 'FlagAssignment_Tooltip',
position: {
my: "right top",
at: "right bottom",
collision: "flipfit flip"
},
hade: {
effect: ''
},
close: function (e, ui) {
ui.tooltip.hover(
function () {
$(this).stop(true).fadeTo(100, 1);
},
function () {
$(this).fadeOut(100, function () { $(this).remove(); });
});
}
});
});
</script>
</div>
</td>
</tr>
}
</tbody>
</table>
</div>
File diff suppressed because it is too large Load Diff
+32 -17
View File
@@ -5,21 +5,27 @@
}
<div class="genericData userTable">
@if (Model != null && Model.Count() > 0)
{
{
<table class="genericData userTable">
<thead>
<tr>
<th>Id
<th>
Id
</th>
<th>Surname
<th>
Surname
</th>
<th>Given Name
<th>
Given Name
</th>
<th>Display Name
<th>
Display Name
</th>
<th>Assigned Devices
<th>
Assigned Devices
</th>
<th>Jobs
<th>
Jobs
</th>
</tr>
</thead>
@@ -36,14 +42,23 @@
{
@item.FriendlyId
}
@if (item.UserFlagAssignments != null && item.UserFlagAssignments.Count > 0)
{<div class="flags">
@foreach (var flag in item.UserFlagAssignments.Where(f => !f.RemovedDate.HasValue).Select(f => Tuple.Create(f, UserFlagService.GetUserFlag(f.UserFlagId))))
@if (Authorization.Has(Claims.User.ShowFlagAssignments))
{
@if (item.UserFlagAssignments != null && item.UserFlagAssignments.Count > 0)
{
<i class="flag fa fa-@(flag.Item2.Icon) fa-fw d-@(flag.Item2.IconColour)"><span class="details"><span class="name">@flag.Item2.Name</span>@if (flag.Item1.Comments != null)
{<span class="comments">@flag.Item1.Comments.ToHtmlComment()</span>}<span class="added">@CommonHelpers.FriendlyDateAndUser(flag.Item1.AddedDate, flag.Item1.AddedUserId)</span></span></i>
<div class="flags">
@foreach (var flag in item.UserFlagAssignments.Where(f => !f.RemovedDate.HasValue).Select(f => Tuple.Create(f, UserFlagService.GetUserFlag(f.UserFlagId))))
{
<i class="flag fa fa-@(flag.Item2.Icon) fa-fw d-@(flag.Item2.IconColour)">
<span class="details">
<span class="name">@flag.Item2.Name</span>@if (flag.Item1.Comments != null)
{<span class="comments">@flag.Item1.Comments.ToHtmlComment()</span>}<span class="added">@CommonHelpers.FriendlyDateAndUser(flag.Item1.AddedDate, flag.Item1.AddedUserId)</span>
</span>
</i>
}
</div>
}
</div>}
}
</td>
<td>
@item.Surname
@@ -59,9 +74,9 @@
</td>
<td>
@item.JobCountOpen @if (item.JobCount > item.JobCountOpen)
{
{
<span class="smallMessage">(@(item.JobCount - item.JobCountOpen) Closed)</span>
}
}
</td>
</tr>
}
@@ -81,7 +96,7 @@
var $this = $(this);
return $this.children('.details').html();
},
tooltipClass: 'User_FlagAssignment_Tooltip',
tooltipClass: 'FlagAssignment_Tooltip',
position: {
my: "right top",
at: "right bottom",
@@ -108,7 +123,7 @@
</script>
}
else
{
{
<span class="smallMessage">No Users Found</span>
}
</div>
+106 -84
View File
@@ -72,7 +72,7 @@ WriteLiteral(">\r\n");
#line 7 "..\..\Views\User\_UserTable.cshtml"
if (Model != null && Model.Count() > 0)
{
{
#line default
@@ -84,17 +84,23 @@ WriteLiteral(" class=\"genericData userTable\"");
WriteLiteral(@">
<thead>
<tr>
<th>Id
<th>
Id
</th>
<th>Surname
<th>
Surname
</th>
<th>Given Name
<th>
Given Name
</th>
<th>Display Name
<th>
Display Name
</th>
<th>Assigned Devices
<th>
Assigned Devices
</th>
<th>Jobs
<th>
Jobs
</th>
</tr>
</thead>
@@ -102,13 +108,13 @@ WriteLiteral(@">
");
#line 27 "..\..\Views\User\_UserTable.cshtml"
#line 33 "..\..\Views\User\_UserTable.cshtml"
#line default
#line hidden
#line 27 "..\..\Views\User\_UserTable.cshtml"
#line 33 "..\..\Views\User\_UserTable.cshtml"
foreach (var item in Model)
{
@@ -118,13 +124,13 @@ WriteLiteral(@">
WriteLiteral(" <tr>\r\n <td>\r\n");
#line 31 "..\..\Views\User\_UserTable.cshtml"
#line 37 "..\..\Views\User\_UserTable.cshtml"
#line default
#line hidden
#line 31 "..\..\Views\User\_UserTable.cshtml"
#line 37 "..\..\Views\User\_UserTable.cshtml"
if (Authorization.Has(Claims.User.Show))
{
@@ -132,14 +138,14 @@ WriteLiteral(" <tr>\r\n <td>\r\n");
#line default
#line hidden
#line 33 "..\..\Views\User\_UserTable.cshtml"
#line 39 "..\..\Views\User\_UserTable.cshtml"
Write(Html.ActionLink(item.FriendlyId, MVC.User.Show(item.Id)));
#line default
#line hidden
#line 33 "..\..\Views\User\_UserTable.cshtml"
#line 39 "..\..\Views\User\_UserTable.cshtml"
}
else
@@ -149,14 +155,14 @@ WriteLiteral(" <tr>\r\n <td>\r\n");
#line default
#line hidden
#line 37 "..\..\Views\User\_UserTable.cshtml"
#line 43 "..\..\Views\User\_UserTable.cshtml"
Write(item.FriendlyId);
#line default
#line hidden
#line 37 "..\..\Views\User\_UserTable.cshtml"
#line 43 "..\..\Views\User\_UserTable.cshtml"
}
@@ -166,69 +172,78 @@ WriteLiteral(" <tr>\r\n <td>\r\n");
WriteLiteral(" ");
#line 39 "..\..\Views\User\_UserTable.cshtml"
if (item.UserFlagAssignments != null && item.UserFlagAssignments.Count > 0)
#line 45 "..\..\Views\User\_UserTable.cshtml"
if (Authorization.Has(Claims.User.ShowFlagAssignments))
{
#line default
#line hidden
WriteLiteral("<div");
#line 47 "..\..\Views\User\_UserTable.cshtml"
if (item.UserFlagAssignments != null && item.UserFlagAssignments.Count > 0)
{
#line default
#line hidden
WriteLiteral(" <div");
WriteLiteral(" class=\"flags\"");
WriteLiteral(">\r\n");
#line 41 "..\..\Views\User\_UserTable.cshtml"
#line 50 "..\..\Views\User\_UserTable.cshtml"
#line default
#line hidden
#line 41 "..\..\Views\User\_UserTable.cshtml"
foreach (var flag in item.UserFlagAssignments.Where(f => !f.RemovedDate.HasValue).Select(f => Tuple.Create(f, UserFlagService.GetUserFlag(f.UserFlagId))))
{
#line 50 "..\..\Views\User\_UserTable.cshtml"
foreach (var flag in item.UserFlagAssignments.Where(f => !f.RemovedDate.HasValue).Select(f => Tuple.Create(f, UserFlagService.GetUserFlag(f.UserFlagId))))
{
#line default
#line hidden
WriteLiteral(" <i");
WriteLiteral(" <i");
WriteAttribute("class", Tuple.Create(" class=\"", 1722), Tuple.Create("\"", 1792)
, Tuple.Create(Tuple.Create("", 1730), Tuple.Create("flag", 1730), true)
, Tuple.Create(Tuple.Create(" ", 1734), Tuple.Create("fa", 1735), true)
, Tuple.Create(Tuple.Create(" ", 1737), Tuple.Create("fa-", 1738), true)
WriteAttribute("class", Tuple.Create(" class=\"", 2064), Tuple.Create("\"", 2134)
, Tuple.Create(Tuple.Create("", 2072), Tuple.Create("flag", 2072), true)
, Tuple.Create(Tuple.Create(" ", 2076), Tuple.Create("fa", 2077), true)
, Tuple.Create(Tuple.Create(" ", 2079), Tuple.Create("fa-", 2080), true)
#line 43 "..\..\Views\User\_UserTable.cshtml"
, Tuple.Create(Tuple.Create("", 1741), Tuple.Create<System.Object, System.Int32>(flag.Item2.Icon
#line 52 "..\..\Views\User\_UserTable.cshtml"
, Tuple.Create(Tuple.Create("", 2083), Tuple.Create<System.Object, System.Int32>(flag.Item2.Icon
#line default
#line hidden
, 1741), false)
, Tuple.Create(Tuple.Create(" ", 1759), Tuple.Create("fa-fw", 1760), true)
, Tuple.Create(Tuple.Create(" ", 1765), Tuple.Create("d-", 1766), true)
, 2083), false)
, Tuple.Create(Tuple.Create(" ", 2101), Tuple.Create("fa-fw", 2102), true)
, Tuple.Create(Tuple.Create(" ", 2107), Tuple.Create("d-", 2108), true)
#line 43 "..\..\Views\User\_UserTable.cshtml"
, Tuple.Create(Tuple.Create("", 1768), Tuple.Create<System.Object, System.Int32>(flag.Item2.IconColour
#line 52 "..\..\Views\User\_UserTable.cshtml"
, Tuple.Create(Tuple.Create("", 2110), Tuple.Create<System.Object, System.Int32>(flag.Item2.IconColour
#line default
#line hidden
, 1768), false)
, 2110), false)
);
WriteLiteral("><span");
WriteLiteral(">\r\n <span");
WriteLiteral(" class=\"details\"");
WriteLiteral("><span");
WriteLiteral(">\r\n <span");
WriteLiteral(" class=\"name\"");
WriteLiteral(">");
#line 43 "..\..\Views\User\_UserTable.cshtml"
Write(flag.Item2.Name);
#line 54 "..\..\Views\User\_UserTable.cshtml"
Write(flag.Item2.Name);
#line default
@@ -236,9 +251,9 @@ WriteLiteral(">");
WriteLiteral("</span>");
#line 43 "..\..\Views\User\_UserTable.cshtml"
if (flag.Item1.Comments != null)
{
#line 54 "..\..\Views\User\_UserTable.cshtml"
if (flag.Item1.Comments != null)
{
#line default
#line hidden
@@ -249,8 +264,8 @@ WriteLiteral(" class=\"comments\"");
WriteLiteral(">");
#line 44 "..\..\Views\User\_UserTable.cshtml"
Write(flag.Item1.Comments.ToHtmlComment());
#line 55 "..\..\Views\User\_UserTable.cshtml"
Write(flag.Item1.Comments.ToHtmlComment());
#line default
@@ -258,8 +273,8 @@ WriteLiteral(">");
WriteLiteral("</span>");
#line 44 "..\..\Views\User\_UserTable.cshtml"
}
#line 55 "..\..\Views\User\_UserTable.cshtml"
}
#line default
#line hidden
@@ -270,26 +285,33 @@ WriteLiteral(" class=\"added\"");
WriteLiteral(">");
#line 44 "..\..\Views\User\_UserTable.cshtml"
Write(CommonHelpers.FriendlyDateAndUser(flag.Item1.AddedDate, flag.Item1.AddedUserId));
#line 55 "..\..\Views\User\_UserTable.cshtml"
Write(CommonHelpers.FriendlyDateAndUser(flag.Item1.AddedDate, flag.Item1.AddedUserId));
#line default
#line hidden
WriteLiteral("</span></span></i>\r\n");
WriteLiteral("</span>\r\n </span>\r\n " +
" </i>\r\n");
#line 45 "..\..\Views\User\_UserTable.cshtml"
#line 58 "..\..\Views\User\_UserTable.cshtml"
}
#line default
#line hidden
WriteLiteral("\r\n </div>\r\n");
#line 60 "..\..\Views\User\_UserTable.cshtml"
}
#line default
#line hidden
WriteLiteral(" </div>");
#line 46 "..\..\Views\User\_UserTable.cshtml"
}
#line 60 "..\..\Views\User\_UserTable.cshtml"
}
#line default
@@ -299,7 +321,7 @@ WriteLiteral(" </td>\r\n <td>\r\n"
WriteLiteral(" ");
#line 49 "..\..\Views\User\_UserTable.cshtml"
#line 64 "..\..\Views\User\_UserTable.cshtml"
Write(item.Surname);
@@ -310,7 +332,7 @@ WriteLiteral("\r\n </td>\r\n <td>\
WriteLiteral(" ");
#line 52 "..\..\Views\User\_UserTable.cshtml"
#line 67 "..\..\Views\User\_UserTable.cshtml"
Write(item.GivenName);
@@ -321,7 +343,7 @@ WriteLiteral("\r\n </td>\r\n <td>\
WriteLiteral(" ");
#line 55 "..\..\Views\User\_UserTable.cshtml"
#line 70 "..\..\Views\User\_UserTable.cshtml"
Write(item.DisplayName);
@@ -332,7 +354,7 @@ WriteLiteral("\r\n </td>\r\n <td>\
WriteLiteral(" ");
#line 58 "..\..\Views\User\_UserTable.cshtml"
#line 73 "..\..\Views\User\_UserTable.cshtml"
Write(item.AssignedDevicesCount);
@@ -343,7 +365,7 @@ WriteLiteral("\r\n </td>\r\n <td>\
WriteLiteral(" ");
#line 61 "..\..\Views\User\_UserTable.cshtml"
#line 76 "..\..\Views\User\_UserTable.cshtml"
Write(item.JobCountOpen);
@@ -352,9 +374,9 @@ WriteLiteral(" ");
WriteLiteral(" ");
#line 61 "..\..\Views\User\_UserTable.cshtml"
#line 76 "..\..\Views\User\_UserTable.cshtml"
if (item.JobCount > item.JobCountOpen)
{
{
#line default
@@ -366,7 +388,7 @@ WriteLiteral(" class=\"smallMessage\"");
WriteLiteral(">(");
#line 63 "..\..\Views\User\_UserTable.cshtml"
#line 78 "..\..\Views\User\_UserTable.cshtml"
Write(item.JobCount - item.JobCountOpen);
@@ -375,8 +397,8 @@ WriteLiteral(">(");
WriteLiteral(" Closed)</span>\r\n");
#line 64 "..\..\Views\User\_UserTable.cshtml"
}
#line 79 "..\..\Views\User\_UserTable.cshtml"
}
#line default
@@ -384,7 +406,7 @@ WriteLiteral(" Closed)</span>\r\n");
WriteLiteral(" </td>\r\n </tr>\r\n");
#line 67 "..\..\Views\User\_UserTable.cshtml"
#line 82 "..\..\Views\User\_UserTable.cshtml"
}
@@ -403,26 +425,26 @@ WriteLiteral(">\r\n $(function () {\r\n var userTable
"\',\r\n content: function () {\r\n " +
" var $this = $(this);\r\n return $this.child" +
"ren(\'.details\').html();\r\n },\r\n " +
" tooltipClass: \'User_FlagAssignment_Tooltip\',\r\n p" +
"osition: {\r\n my: \"right top\",\r\n " +
" at: \"right bottom\",\r\n collision: \"f" +
"lipfit flip\"\r\n },\r\n hade: " +
"{\r\n effect: \'\'\r\n },\r\n " +
" close: function (e, ui) {\r\n " +
" ui.tooltip.hover(\r\n function () {\r\n " +
" $(this).stop(true).fadeTo(100, 1);\r\n " +
" },\r\n function () " +
"{\r\n $(this).fadeOut(100, function () { $(" +
"this).remove(); });\r\n });\r\n " +
" }\r\n });\r\n\r\n $this.data(\'" +
"userTable_Flags\', true)\r\n }\r\n });\r\n " +
" });\r\n </script>\r\n");
" tooltipClass: \'FlagAssignment_Tooltip\',\r\n positi" +
"on: {\r\n my: \"right top\",\r\n " +
" at: \"right bottom\",\r\n collision: \"flipfi" +
"t flip\"\r\n },\r\n hade: {\r\n " +
" effect: \'\'\r\n },\r\n " +
" close: function (e, ui) {\r\n " +
" ui.tooltip.hover(\r\n function () {\r\n " +
" $(this).stop(true).fadeTo(100, 1);\r\n " +
" },\r\n function () {\r\n " +
" $(this).fadeOut(100, function () { $(this)" +
".remove(); });\r\n });\r\n " +
" }\r\n });\r\n\r\n $this.data(\'userT" +
"able_Flags\', true)\r\n }\r\n });\r\n });\r" +
"\n </script>\r\n");
#line 109 "..\..\Views\User\_UserTable.cshtml"
#line 124 "..\..\Views\User\_UserTable.cshtml"
}
else
{
{
#line default
@@ -434,7 +456,7 @@ WriteLiteral(" class=\"smallMessage\"");
WriteLiteral(">No Users Found</span>\r\n");
#line 113 "..\..\Views\User\_UserTable.cshtml"
#line 128 "..\..\Views\User\_UserTable.cshtml"
}