qol: formatting

This commit is contained in:
Gary Sharp
2025-07-20 13:47:56 +10:00
parent 49da389c2c
commit 5792771ea1
158 changed files with 693 additions and 679 deletions
@@ -1,6 +1,6 @@
using RazorGenerator.Mvc;
using System.Web.Mvc;
using System.Web.WebPages;
using RazorGenerator.Mvc;
[assembly: WebActivatorEx.PostApplicationStartMethod(typeof(Disco.Web.RazorGeneratorMvcStart), "Start")]
@@ -121,7 +121,7 @@ namespace Disco.Web.Areas.API.Controllers
}
#region Update Shortcut Methods
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure)]
public virtual ActionResult UpdateName(int id, string BatchName = null, bool redirect = false)
{
@@ -139,7 +139,7 @@ namespace Disco.Web.Areas.API.Controllers
{
return Update(id, pSupplier, Supplier, redirect);
}
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure), ValidateInput(false)]
public virtual ActionResult UpdatePurchaseDetails(int id, string PurchaseDetails = null, bool redirect = false)
{
@@ -169,7 +169,7 @@ namespace Disco.Web.Areas.API.Controllers
{
return Update(id, pWarrantyValidUntil, WarrantyValidUntil, redirect);
}
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure), ValidateInput(false)]
public virtual ActionResult UpdateWarrantyDetails(int id, string WarrantyDetails = null, bool redirect = false)
{
@@ -193,7 +193,7 @@ namespace Disco.Web.Areas.API.Controllers
{
return Update(id, pInsuredUntil, InsuredUntil, redirect);
}
[DiscoAuthorize(Claims.Config.DeviceBatch.Configure), ValidateInput(false)]
public virtual ActionResult UpdateInsuranceDetails(int id, string InsuranceDetails = null, bool redirect = false)
{
@@ -1263,7 +1263,8 @@ namespace Disco.Web.Areas.API.Controllers
Scope = $"User Detail '{key}' didn't match any users{(string.IsNullOrWhiteSpace(value) ? null : $" with the value '{value}'")}",
IsError = true,
});
} else
}
else
{
foreach (var user in details.Select(d => d.User).Distinct())
{
@@ -1431,7 +1432,7 @@ namespace Disco.Web.Areas.API.Controllers
UiUrl = handler.GenerationOptionsUi == null ? null : Url.Action(MVC.API.DocumentTemplate.GenerateDocumentHandlerUi(template.Id, target.AttachmentReferenceId, f.Id)),
Icon = handler.GenerationOptionsIcon,
});
};
}
return Enumerable.Empty<DocumentHandlerModel>();
}).ToList();
@@ -92,7 +92,7 @@ namespace Disco.Web.Areas.API.Controllers
{
if (id < 0)
throw new ArgumentOutOfRangeException("id");
var jobQueueJob = Database.JobQueueJobs.Include("Job").FirstOrDefault(jqj => jqj.Id == id);
if (jobQueueJob != null)
{
@@ -115,7 +115,7 @@ namespace Disco.Web.Areas.API.Controllers
else
return Json($"Error: {ex.Message}", JsonRequestBehavior.AllowGet);
}
}
}
#endregion
#region Update Properties
@@ -139,7 +139,7 @@ namespace Disco.Web.Areas.API.Controllers
{
if (!jobQueueJob.CanEditSla())
throw new InvalidOperationException("Editing SLA for job queue job is Denied");
if (!string.IsNullOrEmpty(Sla))
{
DateTime SLADate;
@@ -124,7 +124,7 @@ namespace Disco.Web.Areas.API.Controllers
}
}
}
ScheduledTaskStatus status;
if (Plugins.PluginInstalled(packageManifest.Id))
status = UpdatePluginTask.UpdateLocalPlugin(packageManifest.Id, tempPluginLocation, immediateRestart);
@@ -246,7 +246,7 @@ namespace Disco.Web.Areas.API.Controllers
public virtual async Task<ActionResult> AttachmentOnlineUploadSession(string id, string domain)
{
var userId = ActiveDirectory.ParseDomainAccountId(id, domain);
if (!UserService.TryGetUser(userId, Database, false,out var user))
if (!UserService.TryGetUser(userId, Database, false, out var user))
throw new InvalidOperationException("Unknown User");
try
@@ -8,7 +8,7 @@ namespace Disco.Web.Areas.API.Models.DocumentTemplate
public string TemplateName { get; set; }
public string TargetId { get; set; }
public string TargetName { get; set; }
public List<DocumentHandlerModel> Handlers { get; set; }
}
@@ -1,6 +1,6 @@
using System.Collections.Generic;
using Disco.Services.Logging;
using System.Collections.Generic;
using System.Linq;
using Disco.Services.Logging;
namespace Disco.Web.Areas.API.Models.Logs
{
@@ -138,7 +138,7 @@ namespace Disco.Web.Areas.Config
context.MapRoute(
"Config_Plugins",
"Config/Plugins",
new { controller = "Plugins", action = "Index"}
new { controller = "Plugins", action = "Index" }
);
context.MapRoute(
"Config_Plugins_Install",
@@ -15,10 +15,10 @@ namespace Disco.Web.Areas.Config.Controllers
public virtual ActionResult Index()
{
IndexViewModel vm = new IndexViewModel()
{
PluginManifests = Plugins.GetPlugins(),
PluginLibrary = PluginLibrary.LoadManifest(Database)
};
{
PluginManifests = Plugins.GetPlugins(),
PluginLibrary = PluginLibrary.LoadManifest(Database)
};
return View(vm);
}
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using Disco.Models.Services.Authorization;
using Disco.Models.UI.Config.AuthorizationRole;
using Disco.Models.Services.Authorization;
using Disco.Web.Areas.API.Models.Shared;
using System.Collections.Generic;
namespace Disco.Web.Areas.Config.Models.AuthorizationRole
{
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using Disco.Data.Repository;
using Disco.Data.Repository;
using Disco.Models.UI.Config.DeviceBatch;
using System.Collections.Generic;
using System.Linq;
namespace Disco.Web.Areas.Config.Models.DeviceBatch
{
@@ -10,7 +10,7 @@ namespace Disco.Web.Areas.Config.Models.DeviceBatch
public Disco.Models.Repository.DeviceBatch DeviceBatch { get; set; }
public Disco.Models.Repository.DeviceModel DefaultDeviceModel { get; set; }
public List<Disco.Models.Repository.DeviceModel> DeviceModels { get; set; }
public List<ConfigDeviceBatchShowModelMembership> DeviceModelMembers { get; set; }
@@ -1,6 +1,6 @@
using System;
using Disco.Models.UI.Config.DeviceBatch;
using System;
using System.ComponentModel.DataAnnotations;
using Disco.Models.UI.Config.DeviceBatch;
namespace Disco.Web.Areas.Config.Models.DeviceBatch
{
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using Disco.Data.Repository;
using Disco.Data.Repository;
using Disco.Models.UI.Config.DeviceModel;
using System.Collections.Generic;
using System.Linq;
namespace Disco.Web.Areas.Config.Models.DeviceModel
{
@@ -1,9 +1,9 @@
using System.Collections.Generic;
using Disco.Data.Repository;
using Disco.Models.UI.Config.DocumentTemplate;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using Disco.Data.Repository;
using Disco.Models.UI.Config.DocumentTemplate;
namespace Disco.Web.Areas.Config.Models.DocumentTemplate
{
@@ -7,7 +7,7 @@ namespace Disco.Web.Areas.Config.Models.DocumentTemplate
public class CreatePackageModel : ConfigDocumentTemplateCreatePackageModel
{
public DocumentTemplatePackage Package { get; set; }
public List<string> Scopes
{
get
@@ -7,7 +7,7 @@ namespace Disco.Web.Areas.Config.Models.DocumentTemplate
{
public class UndetectedPagesModel : ConfigDocumentTemplateUndetectedPagesModel
{
public List<Disco.Models.Repository.DocumentTemplate> DocumentTemplates { get; set; }
public List<SelectListItem> DocumentTemplatesSelectListItems
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using Disco.Models.UI.Config.Logging;
using Disco.Services.Logging;
using Disco.Services.Logging.Models;
using Disco.Models.UI.Config.Logging;
using System.Collections.Generic;
namespace Disco.Web.Areas.Config.Models.Logging
{
@@ -1,14 +1,14 @@
using System.Collections.Generic;
using Disco.Models.BI.Config;
using System.ComponentModel.DataAnnotations;
using Disco.Models.BI.Config;
using Disco.Models.UI.Config.Organisation;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace Disco.Web.Areas.Config.Models.Organisation
{
public class IndexModel : ConfigOrganisationIndexModel
{
public string OrganisationName { get; set; }
[Display(Name="Enabled")]
[Display(Name = "Enabled")]
public bool MultiSiteMode { get; set; }
public List<OrganisationAddress> OrganisationAddresses { get; set; }
}
@@ -23,7 +23,7 @@ namespace Disco.Web.Areas.Config.Models.Plugins
if (PluginLibrary == null || PluginLibrary.Plugins == null || PluginLibrary.Plugins.Count == 0 ||
PluginManifests == null || PluginManifests.Count == 0)
{
_PluginUpdates = new Dictionary<PluginManifest,Tuple<PluginLibraryItemV2,PluginLibraryItemReleaseV2>>(); // No Updates
_PluginUpdates = new Dictionary<PluginManifest, Tuple<PluginLibraryItemV2, PluginLibraryItemReleaseV2>>(); // No Updates
}
else
{
@@ -8,7 +8,7 @@ namespace Disco.Web.Areas.Config.Models.Shared
public string Description { get; set; }
public string CategoryDescription { get; set; }
public string UpdateUrl { get; set; }
public ADManagedGroup ManagedGroup { get; set; }
@@ -77,7 +77,7 @@ namespace Disco.Web.Areas.Config.Models.SystemConfig
#region Active Directory
[Display(Name="Search All Servers")]
[Display(Name = "Search All Servers")]
public bool ADSearchAllServers { get; set; }
public List<ADDomain> ADDomains { get; set; }
@@ -20,14 +20,14 @@ namespace Disco.Web.Areas.Public.Models.UserHeldDevices
public UserHeldDeviceModel ToUserHeldDeviceModel(DiscoDataContext Database)
{
var uhdm = new UserHeldDeviceModel()
{
UserId = UserId,
UserDisplayName = UserDisplayName,
ReadyForReturn = ReadyForReturn,
WaitingForUserAction = WaitingForUserAction,
DeviceProfileId = DeviceProfileId,
DeviceAddress = (DeviceAddressId.HasValue ? Database.DiscoConfiguration.OrganisationAddresses.GetAddress(DeviceAddressId.Value)?.ShortName : string.Empty)
};
{
UserId = UserId,
UserDisplayName = UserDisplayName,
ReadyForReturn = ReadyForReturn,
WaitingForUserAction = WaitingForUserAction,
DeviceProfileId = DeviceProfileId,
DeviceAddress = (DeviceAddressId.HasValue ? Database.DiscoConfiguration.OrganisationAddresses.GetAddress(DeviceAddressId.Value)?.ShortName : string.Empty)
};
var n = DateTime.Now;
if (!ReadyForReturn && EstimatedReturnTime.HasValue && EstimatedReturnTime.Value > n)
{
@@ -67,7 +67,8 @@ namespace Disco.Web.Controllers
{
if (!Request.IsLocal && !ServerIsCoreSKU.Value && !("true".Equals(ConfigurationManager.AppSettings["DiscoAllowRemoteMaintenance"], StringComparison.OrdinalIgnoreCase)))
{
filterContext.Result = new ContentResult() {
filterContext.Result = new ContentResult()
{
Content = "Initial Configuration of Disco ICT is only allowed via a localhost connection",
ContentType = "text/plain"
};
@@ -1,10 +1,10 @@
using System;
using Disco.Services.Authorization;
using Disco.Services.Interop;
using Disco.Services.Plugins;
using Disco.Services.Users;
using System;
using System.IO;
using System.Web.Mvc;
using Disco.Services.Plugins;
using Disco.Services.Authorization;
using Disco.Services.Users;
using Disco.Services.Interop;
namespace Disco.Web.Controllers
{
+2 -2
View File
@@ -1,5 +1,5 @@
using System.Collections.Generic;
using Disco.Models.UI.Device;
using Disco.Models.UI.Device;
using System.Collections.Generic;
namespace Disco.Web.Models.Device
{
@@ -73,7 +73,7 @@ namespace Disco.Web.Models.InitialConfig
[CustomValidation(typeof(DatabaseModel), "SqlAuthRequired", ErrorMessage = "When using SQL Authentication a Username is required")]
public string Auth_SQL_Username { get; set; }
[DataType(DataType.Password), CustomValidation(typeof(DatabaseModel), "SqlAuthRequired", ErrorMessage="When using SQL Authentication a Password is required")]
[DataType(DataType.Password), CustomValidation(typeof(DatabaseModel), "SqlAuthRequired", ErrorMessage = "When using SQL Authentication a Password is required")]
public string Auth_SQL_Password { get; set; }
public List<SelectListItem> AuthMethods
+1 -1
View File
@@ -1,6 +1,6 @@
using Disco.Models.ClientServices;
using Disco.Models.Services.Jobs.Statistics;
using Disco.Models.Services.Jobs.JobLists;
using Disco.Models.Services.Jobs.Statistics;
using Disco.Models.UI.Job;
using System.Collections.Generic;
+1 -1
View File
@@ -6,8 +6,8 @@ using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Data.Entity;
using System.Linq;
namespace Disco.Web.Models.Job
{
+2 -1
View File
@@ -82,7 +82,8 @@ namespace Disco.Web.Models.Job
try
{
UserService.GetUser(jobUserId, Database, true);
} catch (Exception) {}
}
catch (Exception) { }
}
Job = Database.Jobs
+2 -2
View File
@@ -1,5 +1,5 @@
using Disco.Models.Services.Searching;
using Disco.Models.Services.Jobs.JobLists;
using Disco.Models.Services.Jobs.JobLists;
using Disco.Models.Services.Searching;
using Disco.Models.UI.Search;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
+1 -1
View File
@@ -69,7 +69,7 @@ namespace Disco.Web.Models.Shared
List<string> userCustomDetailKeys;
using (var database = new DiscoDataContext())
userCustomDetailKeys = database.UserDetails.Where(d => d.Scope == "Details").Select(d => d.Key).Distinct().OrderBy(k => k).ToList();
if (userCustomDetailKeys.Any())
{
var fieldKey = ((MemberExpression)modelAccessor.Body).Member.Name;