From 2044b67526a0404697198f049b3bf4c929076439 Mon Sep 17 00:00:00 2001 From: jessikitty Date: Tue, 5 May 2026 15:01:43 +1000 Subject: [PATCH] feat: add ServiceTrackerConfig with default priorities/locations --- Models/ServiceTrackerConfig.cs | 88 ++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 Models/ServiceTrackerConfig.cs diff --git a/Models/ServiceTrackerConfig.cs b/Models/ServiceTrackerConfig.cs new file mode 100644 index 0000000..c99d9f5 --- /dev/null +++ b/Models/ServiceTrackerConfig.cs @@ -0,0 +1,88 @@ +using System; +using System.Collections.Generic; + +namespace Disco.Plugins.ServiceTracker.Models +{ + /// + /// Plugin configuration for custom priorities, locations, and SLA timeframes. + /// Stored as JSON in the plugin data directory. + /// + public class ServiceTrackerConfig + { + public List Priorities { get; set; } + public List Locations { get; set; } + public List StatusOptions { get; set; } + public bool AutoCreateTicketsForNewJobs { get; set; } + public string DefaultPriorityId { get; set; } + public string DefaultLocationId { get; set; } + public int DashboardRefreshSeconds { get; set; } + + public ServiceTrackerConfig() + { + Priorities = new List(); + Locations = new List(); + StatusOptions = new List(); + AutoCreateTicketsForNewJobs = true; + DashboardRefreshSeconds = 60; + } + + public static ServiceTrackerConfig CreateDefault() + { + return new ServiceTrackerConfig + { + Priorities = new List + { + new PriorityLevel { Id = "critical", Name = "Critical", Color = "#DC3545", SortOrder = 1, SlaHours = 4, Description = "System down, no workaround" }, + new PriorityLevel { Id = "high", Name = "High", Color = "#FD7E14", SortOrder = 2, SlaHours = 8, Description = "Major impact, workaround available" }, + new PriorityLevel { Id = "medium", Name = "Medium", Color = "#FFC107", SortOrder = 3, SlaHours = 24, Description = "Moderate impact" }, + new PriorityLevel { Id = "low", Name = "Low", Color = "#28A745", SortOrder = 4, SlaHours = 72, Description = "Minor issue, no urgency" }, + new PriorityLevel { Id = "scheduled", Name = "Scheduled", Color = "#6C757D", SortOrder = 5, SlaHours = 0, Description = "Planned work, no SLA" } + }, + Locations = new List + { + new DeviceLocation { Id = "it-office", Name = "IT Office", Icon = "💻", Color = "#337AB7", IsDefault = true }, + new DeviceLocation { Id = "with-user", Name = "With User", Icon = "👤", Color = "#5CB85C", IsDefault = false }, + new DeviceLocation { Id = "at-repairer", Name = "At Repairer", Icon = "🔧", Color = "#F0AD4E", IsDefault = false }, + new DeviceLocation { Id = "in-transit", Name = "In Transit", Icon = "🚚", Color = "#5BC0DE", IsDefault = false }, + new DeviceLocation { Id = "storage", Name = "Storage/Spare Pool", Icon = "📦", Color = "#777777", IsDefault = false }, + new DeviceLocation { Id = "disposed", Name = "Disposed/Written Off", Icon = "❌", Color = "#999999", IsDefault = false } + }, + StatusOptions = new List + { + "Triaging", + "In Progress", + "Awaiting Parts", + "Awaiting User", + "Awaiting Vendor", + "On Hold", + "Ready for Return", + "Escalated", + "Resolved" + }, + AutoCreateTicketsForNewJobs = true, + DefaultPriorityId = "medium", + DefaultLocationId = "it-office", + DashboardRefreshSeconds = 60 + }; + } + } + + public class PriorityLevel + { + public string Id { get; set; } + public string Name { get; set; } + public string Color { get; set; } + public int SortOrder { get; set; } + public int SlaHours { get; set; } + public string Description { get; set; } + } + + public class DeviceLocation + { + public string Id { get; set; } + public string Name { get; set; } + public string Icon { get; set; } + public string Color { get; set; } + public bool IsDefault { get; set; } + } +}