public static SI.MenuData.Item CreateStateInspectorMenuItem( SI.IVisualizerNode selectedNode, TS.IPresenter timeSeriesPresenter ) { if (Rtc.MediaStateInspector.HasTimeSeries(selectedNode.CreationEvent)) { bool predicate(LogJoint.UI.Presenters.Postprocessing.TimeSeriesVisualizer.ITreeNodeData node) => node.Type == LogJoint.UI.Presenters.Postprocessing.TimeSeriesVisualizer.ConfigDialogNodeType.ObjectIdGroup && node.Caption.Contains(selectedNode.Id) && selectedNode.BelongsToSource(node.LogSource); if (timeSeriesPresenter.ConfigNodeExists(predicate)) { return(new SI.MenuData.Item( "Go to time series", () => { timeSeriesPresenter.Show(); timeSeriesPresenter.OpenConfigDialog(); timeSeriesPresenter.SelectConfigNode(predicate); } )); } } return(null); }
public static SI.MenuData.Item CreateStateInspectorMenuItem( SI.IVisualizerNode selectedNode, LogJoint.UI.Presenters.IPromptDialog prompt, Preprocessing.IManager preprocessingManager, SpringServiceLog.IPreprocessingStepsFactory preprocessingStepsFactory ) { if (preprocessingStepsFactory == null) { return(null); } SI.IVisualizerNode GetParent(SI.IVisualizerNode n) => n.Parent == null ? n : GetParent(n.Parent); var(id, referenceTime, env) = Rtc.MeetingsStateInspector.GetMeetingRelatedId( selectedNode.CreationEvent, selectedNode.ChangeHistory, GetParent(selectedNode).CreationEvent, GetParent(selectedNode).ChangeHistory ); if (id == null) { return(null); } return(new SI.MenuData.Item( "Download backend logs", () => { var input = prompt.ExecuteDialog( "Download RTC backend logs", "Specify query parameters", $"ID={id}{Environment.NewLine}Environment={env ?? "(undetected)"}{Environment.NewLine}Reference time={referenceTime.ToString("o")}"); if (input != null) { var ids = new[] { id }; foreach (var line in input.Split('\r', '\n')) { var m = Regex.Match(line, @"^(?<k>[^\=]+)\=(?<v>.+)$", RegexOptions.ExplicitCapture); if (!m.Success) { continue; } var k = m.Groups["k"].Value; var v = m.Groups["v"].Value; if (k == "ID") { ids = v.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); } else if (k == "Environment") { env = v; } else if (k == "Reference time") { if (DateTime.TryParseExact(v, "o", null, System.Globalization.DateTimeStyles.None, out var tmpRefTime)) { referenceTime = tmpRefTime; } } } preprocessingManager.Preprocess( new[] { preprocessingStepsFactory.CreateDownloadBackendLogsStep(ids, referenceTime, env) }, "Downloading backend logs", Preprocessing.PreprocessingOptions.HighlightNewPreprocessing ); } } )); }