You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
270 lines
7.8 KiB
270 lines
7.8 KiB
namespace LTEMvcApp.Models
|
|
{
|
|
/// <summary>
|
|
/// 日志过滤器配置
|
|
/// </summary>
|
|
public class LogFilterConfig
|
|
{
|
|
/// <summary>
|
|
/// 全局UE ID列表
|
|
/// </summary>
|
|
public List<int> GlobalUeIds { get; set; } = new();
|
|
|
|
/// <summary>
|
|
/// 小区ID列表
|
|
/// </summary>
|
|
public List<int> CellIds { get; set; } = new();
|
|
|
|
/// <summary>
|
|
/// IMSI列表
|
|
/// </summary>
|
|
public List<string> ImsiList { get; set; } = new();
|
|
|
|
/// <summary>
|
|
/// IMEI列表
|
|
/// </summary>
|
|
public List<string> ImeiList { get; set; } = new();
|
|
|
|
/// <summary>
|
|
/// 信息类型列表
|
|
/// </summary>
|
|
public List<int> InfoTypes { get; set; } = new();
|
|
|
|
/// <summary>
|
|
/// 层类型列表
|
|
/// </summary>
|
|
public List<string> LayerTypes { get; set; } = new();
|
|
|
|
/// <summary>
|
|
/// 日志级别列表
|
|
/// </summary>
|
|
public List<int> LogLevels { get; set; } = new();
|
|
|
|
/// <summary>
|
|
/// 方向过滤器(false表示过滤掉,true表示保留)
|
|
/// </summary>
|
|
public bool[] DirectionFilter { get; set; } = { false, false, false };
|
|
|
|
/// <summary>
|
|
/// 开始时间戳
|
|
/// </summary>
|
|
public long StartTime { get; set; } = 0;
|
|
|
|
/// <summary>
|
|
/// 结束时间戳
|
|
/// </summary>
|
|
public long EndTime { get; set; } = long.MaxValue;
|
|
|
|
/// <summary>
|
|
/// 时间原点
|
|
/// </summary>
|
|
public string TimeOrigin { get; set; } = "00:00:00.000";
|
|
|
|
/// <summary>
|
|
/// 是否分组UE ID
|
|
/// </summary>
|
|
public bool GroupUeId { get; set; } = true;
|
|
|
|
/// <summary>
|
|
/// 搜索文本
|
|
/// </summary>
|
|
public string? SearchText { get; set; }
|
|
|
|
/// <summary>
|
|
/// 是否使用正则表达式搜索
|
|
/// </summary>
|
|
public bool UseRegexSearch { get; set; } = false;
|
|
|
|
/// <summary>
|
|
/// 是否忽略大小写
|
|
/// </summary>
|
|
public bool IgnoreCase { get; set; } = true;
|
|
|
|
/// <summary>
|
|
/// 是否只显示错误
|
|
/// </summary>
|
|
public bool ShowErrorsOnly { get; set; } = false;
|
|
|
|
/// <summary>
|
|
/// 是否只显示警告
|
|
/// </summary>
|
|
public bool ShowWarningsOnly { get; set; } = false;
|
|
|
|
/// <summary>
|
|
/// 客户端过滤器
|
|
/// </summary>
|
|
public Dictionary<string, bool> ClientFilters { get; set; } = new();
|
|
|
|
/// <summary>
|
|
/// 是否启用过滤器
|
|
/// </summary>
|
|
public bool IsEnabled { get; set; } = true;
|
|
|
|
/// <summary>
|
|
/// 过滤器名称
|
|
/// </summary>
|
|
public string? FilterName { get; set; }
|
|
|
|
/// <summary>
|
|
/// 是否持久化
|
|
/// </summary>
|
|
public bool IsPersistent { get; set; } = false;
|
|
|
|
/// <summary>
|
|
/// 创建时间
|
|
/// </summary>
|
|
public DateTime CreatedAt { get; set; } = DateTime.Now;
|
|
|
|
/// <summary>
|
|
/// 更新时间
|
|
/// </summary>
|
|
public DateTime UpdatedAt { get; set; } = DateTime.Now;
|
|
|
|
/// <summary>
|
|
/// 清除所有过滤器
|
|
/// </summary>
|
|
public void ClearAll()
|
|
{
|
|
GlobalUeIds.Clear();
|
|
CellIds.Clear();
|
|
ImsiList.Clear();
|
|
ImeiList.Clear();
|
|
InfoTypes.Clear();
|
|
LayerTypes.Clear();
|
|
LogLevels.Clear();
|
|
DirectionFilter = new bool[] { false, false, false };
|
|
StartTime = 0;
|
|
EndTime = long.MaxValue;
|
|
TimeOrigin = "00:00:00.000";
|
|
SearchText = null;
|
|
ClientFilters.Clear();
|
|
UpdatedAt = DateTime.Now;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 重置为默认值
|
|
/// </summary>
|
|
public void ResetToDefault()
|
|
{
|
|
ClearAll();
|
|
GroupUeId = true;
|
|
IsEnabled = true;
|
|
UseRegexSearch = false;
|
|
IgnoreCase = true;
|
|
ShowErrorsOnly = false;
|
|
ShowWarningsOnly = false;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 复制过滤器配置
|
|
/// </summary>
|
|
/// <returns>新的过滤器配置</returns>
|
|
public LogFilterConfig Clone()
|
|
{
|
|
return new LogFilterConfig
|
|
{
|
|
GlobalUeIds = new List<int>(GlobalUeIds),
|
|
CellIds = new List<int>(CellIds),
|
|
ImsiList = new List<string>(ImsiList),
|
|
ImeiList = new List<string>(ImeiList),
|
|
InfoTypes = new List<int>(InfoTypes),
|
|
LayerTypes = new List<string>(LayerTypes),
|
|
LogLevels = new List<int>(LogLevels),
|
|
DirectionFilter = (bool[])DirectionFilter.Clone(),
|
|
StartTime = StartTime,
|
|
EndTime = EndTime,
|
|
TimeOrigin = TimeOrigin,
|
|
GroupUeId = GroupUeId,
|
|
SearchText = SearchText,
|
|
UseRegexSearch = UseRegexSearch,
|
|
IgnoreCase = IgnoreCase,
|
|
ShowErrorsOnly = ShowErrorsOnly,
|
|
ShowWarningsOnly = ShowWarningsOnly,
|
|
ClientFilters = new Dictionary<string, bool>(ClientFilters),
|
|
IsEnabled = IsEnabled,
|
|
FilterName = FilterName,
|
|
IsPersistent = IsPersistent,
|
|
CreatedAt = CreatedAt,
|
|
UpdatedAt = DateTime.Now
|
|
};
|
|
}
|
|
|
|
/// <summary>
|
|
/// 检查是否为空过滤器
|
|
/// </summary>
|
|
/// <returns>是否为空</returns>
|
|
public bool IsEmpty()
|
|
{
|
|
return GlobalUeIds.Count == 0 &&
|
|
CellIds.Count == 0 &&
|
|
ImsiList.Count == 0 &&
|
|
ImeiList.Count == 0 &&
|
|
InfoTypes.Count == 0 &&
|
|
LayerTypes.Count == 0 &&
|
|
LogLevels.Count == 0 &&
|
|
DirectionFilter.All(x => !x) &&
|
|
StartTime == 0 &&
|
|
EndTime == long.MaxValue &&
|
|
string.IsNullOrEmpty(SearchText) &&
|
|
ClientFilters.Count == 0 &&
|
|
!ShowErrorsOnly &&
|
|
!ShowWarningsOnly;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 过滤器选项
|
|
/// </summary>
|
|
public class FilterOption
|
|
{
|
|
/// <summary>
|
|
/// 值
|
|
/// </summary>
|
|
public object Value { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// 显示文本
|
|
/// </summary>
|
|
public string Text { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// 样式
|
|
/// </summary>
|
|
public string Style { get; set; } = string.Empty;
|
|
|
|
/// <summary>
|
|
/// 是否被选中
|
|
/// </summary>
|
|
public bool IsSelected { get; set; } = false;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 过滤器类型
|
|
/// </summary>
|
|
public static class FilterTypes
|
|
{
|
|
public const string GlobalUeId = "global_ue_id";
|
|
public const string Cell = "cell";
|
|
public const string Imsi = "imsi";
|
|
public const string Imei = "imei";
|
|
public const string Info = "info";
|
|
public const string Layer = "layer";
|
|
public const string Level = "level";
|
|
public const string Direction = "dir";
|
|
public const string Time = "time";
|
|
public const string Search = "search";
|
|
public const string Client = "client";
|
|
|
|
/// <summary>
|
|
/// 获取所有过滤器类型
|
|
/// </summary>
|
|
/// <returns>过滤器类型列表</returns>
|
|
public static List<string> GetAllFilterTypes()
|
|
{
|
|
return new List<string>
|
|
{
|
|
GlobalUeId, Cell, Imsi, Imei, Info, Layer, Level, Direction, Time, Search, Client
|
|
};
|
|
}
|
|
}
|
|
}
|