diff --git a/LTEMvcApp/Models/LTEClient.cs b/LTEMvcApp/Models/LTEClient.cs index e777874..73d624e 100644 --- a/LTEMvcApp/Models/LTEClient.cs +++ b/LTEMvcApp/Models/LTEClient.cs @@ -170,10 +170,15 @@ public class LTEClient public bool HasSignalRecord { get; set; } /// - /// 头信息 + /// 头部信息 /// public string[]? Headers { get; set; } + /// + /// 模式(ran/ims) + /// + public string Mode { get; set; } = "ran"; + #endregion #region 日志相关属性 @@ -1614,6 +1619,11 @@ public class ClientConfig /// public bool Active { get; set; } + /// + /// 模式(ran/ims) + /// + public string Mode { get; set; } = "ran"; + /// /// 模型 /// diff --git a/LTEMvcApp/Models/LogLayerConfig.cs b/LTEMvcApp/Models/LogLayerConfig.cs index b9fa754..968d251 100644 --- a/LTEMvcApp/Models/LogLayerConfig.cs +++ b/LTEMvcApp/Models/LogLayerConfig.cs @@ -151,6 +151,10 @@ namespace LTEMvcApp.Models PHY, MAC, RLC, PDCP, RRC, NAS, S1AP, NGAP, GTPU, X2AP, XnAP, M2AP }; + public static readonly string[] AllIMSLayers = new[] + { + IMS, CX, RX, SIP, MEDIA, MMS + }; /// /// 获取日志级别选项 diff --git a/LTEMvcApp/Views/Home/TestClientConfig.cshtml b/LTEMvcApp/Views/Home/TestClientConfig.cshtml index 0159fcf..61d8220 100644 --- a/LTEMvcApp/Views/Home/TestClientConfig.cshtml +++ b/LTEMvcApp/Views/Home/TestClientConfig.cshtml @@ -3,6 +3,7 @@ var testConfig = ViewBag.TestConfig as LTEMvcApp.Models.ClientConfig; // 只保留不含 EVENT 的日志层 var allLayers = LTEMvcApp.Models.LogLayerTypes.AllLayers.Where(l => l != "EVENT").ToArray(); + var allIMSLayers = LTEMvcApp.Models.LogLayerTypes.AllIMSLayers.Where(l => l != "EVENT").ToArray(); // 暂时使用AllLayers,后续可以扩展 var layerConfigs = testConfig?.Logs?.Layers ?? new Dictionary(); } @@ -250,6 +251,14 @@ 只读模式 + + + RAN + + + + IMS + @@ -271,52 +280,104 @@ 包含负载 - - @foreach (var layer in allLayers) - { - var config = layerConfigs[layer]; - - @layer - - - @foreach (var logLevel in LTEMvcApp.Models.LogLayerTypes.LogLevels) - { - if (logLevel == config.Filter) + + + + @foreach (var layer in allLayers) + { + var config = layerConfigs.ContainsKey(layer) ? layerConfigs[layer] : new LTEMvcApp.Models.LogLayerConfig(); + + @layer + + + @foreach (var logLevel in LTEMvcApp.Models.LogLayerTypes.LogLevels) { - @logLevel.ToUpper() + if (logLevel == config.Filter) + { + @logLevel.ToUpper() + } + else + { + @logLevel.ToUpper() + } } - else + + + + + @foreach (var logLevel in LTEMvcApp.Models.LogLayerTypes.LogLevels) { - @logLevel.ToUpper() + if (logLevel == config.Level) + { + @logLevel.ToUpper() + } + else + { + @logLevel.ToUpper() + } } - } - - - - - @foreach (var logLevel in LTEMvcApp.Models.LogLayerTypes.LogLevels) - { - if (logLevel == config.Level) + + + + + + + + + + + + } + + + + + @foreach (var layer in allIMSLayers) + { + var config = layerConfigs.ContainsKey(layer) ? layerConfigs[layer] : new LTEMvcApp.Models.LogLayerConfig(); + + @layer + + + @foreach (var logLevel in LTEMvcApp.Models.LogLayerTypes.LogLevels) { - @logLevel.ToUpper() + if (logLevel == config.Filter) + { + @logLevel.ToUpper() + } + else + { + @logLevel.ToUpper() + } } - else + + + + + @foreach (var logLevel in LTEMvcApp.Models.LogLayerTypes.LogLevels) { - @logLevel.ToUpper() + if (logLevel == config.Level) + { + @logLevel.ToUpper() + } + else + { + @logLevel.ToUpper() + } } - } - - - - - - - - - - - - } + + + + + + + + + + + + } + @@ -357,6 +418,13 @@ e.preventDefault(); saveTestClientConfig(); }); + + // 监听模式切换 + $('input[name="mode"]').on('change', function() { + var selectedMode = $(this).val(); + $('.mode-layers').hide(); + $('#' + selectedMode + 'Layers').show(); + }); }); function saveTestClientConfig() { @@ -368,13 +436,16 @@ enabled: $('#enabled').is(':checked'), ssl: $('#ssl').is(':checked'), readonly: $('#readonly').is(':checked'), + mode: $('input[name="mode"]:checked').val(), logs: { layers: {} } }; - // 构建日志层配置 - var layers = @Html.Raw(System.Text.Json.JsonSerializer.Serialize(allLayers)); + // 根据当前模式获取日志层 + var selectedMode = $('input[name="mode"]:checked').val(); + var layers = selectedMode === 'ims' ? @Html.Raw(System.Text.Json.JsonSerializer.Serialize(allIMSLayers)) : @Html.Raw(System.Text.Json.JsonSerializer.Serialize(allLayers)); + layers.forEach(function(layer) { var level = $(`select[name="layers[${layer}][level]"]`).val(); var filter = $(`select[name="layers[${layer}][filter]"]`).val();