public PluginImpl(IApplication app) { app.Model.Postprocessing.TimeSeries.RegisterTimeSeriesTypesAssembly(typeof(TimeSeries.PostprocessorsFactory).Assembly); StateInspector.IPostprocessorsFactory statePostprocessors = new StateInspector.PostprocessorsFactory( app.Model.TempFilesManager, app.Model.Postprocessing ); TimeSeries.IPostprocessorsFactory timeSeriesPostprocessors = new TimeSeries.PostprocessorsFactory( app.Model.Postprocessing ); Timeline.IPostprocessorsFactory timelinePostprocessors = new Timeline.PostprocessorsFactory( app.Model.TempFilesManager, app.Model.Postprocessing ); IPostprocessorsRegistry postprocessorsRegistry = new PostprocessorsInitializer( app.Model.Postprocessing.Manager, app.Model.UserDefinedFormatsManager, statePostprocessors, timeSeriesPostprocessors, new Correlator.PostprocessorsFactory(app.Model), timelinePostprocessors, new SequenceDiagram.PostprocessorsFactory(app.Model.Postprocessing) ); var chromiumPlugin = app.Model.PluginsManager.Get <Chromium.IPluginModel>(); if (chromiumPlugin != null) { chromiumPlugin.RegisterSource(statePostprocessors.CreateChromeDebugSourceFactory()); chromiumPlugin.RegisterSource(timeSeriesPostprocessors.CreateChromeDebugSourceFactory()); chromiumPlugin.RegisterSource(timelinePostprocessors.CreateChromeDebugLogEventsSourceFactory()); chromiumPlugin.RegisterSource(timelinePostprocessors.CreateChromeDriverEventsSourceFactory()); } app.Model.Preprocessing.ExtensionsRegistry.AddLogDownloaderRule( new Uri("https://perzoinc.atlassian.net/secure/attachment/"), Preprocessing.LogDownloaderRule.CreateBrowserDownloaderRule(new[] { "https://id.atlassian.com/login" }) ); #if MONOMAC SpringServiceLog.IPreprocessingStepsFactory backendLogsPreprocessingStepsFactory = new SpringServiceLog.PreprocessingStepsFactory( app.Model.Preprocessing.StepsFactory, app.Model.WebViewTools ); app.Model.Preprocessing.ExtensionsRegistry.Register(new SpringServiceLog.PreprocessingManagerExtension( backendLogsPreprocessingStepsFactory)); #endif UI.Presenters.Postprocessing.TimeSeriesVisualizer.IPresenter timeSeriesPresenter = null; UI.Presenters.Postprocessing.IPostprocessorOutputForm timeSeriesForm = null; app.Presentation.PostprocessorsFormFactory.FormCreated += (sender, evt) => { if (evt.Id == UI.Presenters.Postprocessing.MainWindowTabPage.ViewControlId.StateInspector) { if (evt.Presenter is UI.Presenters.Postprocessing.StateInspectorVisualizer.IPresenter stateInspectorPresenter) { stateInspectorPresenter.OnNodeCreated += (senderPresenter, arg) => { if (Rtc.MeetingsStateInspector.ShouldBePresentedCollapsed(arg.NodeObject?.CreationEvent)) { arg.CreateCollapsed = true; } else if (Rtc.MediaStateInspector.ShouldBePresentedCollapsed(arg.NodeObject?.CreationEvent)) { arg.CreateCollapsed = true; } }; stateInspectorPresenter.OnMenu += (senderPresenter, arg) => { if (stateInspectorPresenter.SelectedObject != null) { if (Rtc.MediaStateInspector.HasTimeSeries(stateInspectorPresenter.SelectedObject.CreationEvent)) { app.Presentation.PostprocessorsFormFactory.GetPostprocessorOutputForm(UI.Presenters.Postprocessing.MainWindowTabPage.ViewControlId.TimeSeries); bool predicate(UI.Presenters.Postprocessing.TimeSeriesVisualizer.ITreeNodeData node) => node.Type == UI.Presenters.Postprocessing.TimeSeriesVisualizer.ConfigDialogNodeType.ObjectIdGroup && node.Caption.Contains(stateInspectorPresenter.SelectedObject.Id) && stateInspectorPresenter.SelectedObject.BelongsToSource(node.LogSource); if (timeSeriesPresenter != null && timeSeriesPresenter.ConfigNodeExists(predicate)) { arg.Items.Add(new UI.Presenters.Postprocessing.StateInspectorVisualizer.MenuData.Item() { Text = "Go to time series", Click = () => { timeSeriesForm.Show(); timeSeriesPresenter.OpenConfigDialog(); timeSeriesPresenter.SelectConfigNode(predicate); } }); } } #if MONOMAC IVisualizerNode GetParent(IVisualizerNode n) => n.Parent == null ? n : GetParent(n.Parent); var(id, referenceTime, env) = Rtc.MeetingsStateInspector.GetMeetingRelatedId( stateInspectorPresenter.SelectedObject.CreationEvent, stateInspectorPresenter.SelectedObject.ChangeHistory, GetParent(stateInspectorPresenter.SelectedObject).CreationEvent, GetParent(stateInspectorPresenter.SelectedObject).ChangeHistory ); if (id != null) { arg.Items.Add(new UI.Presenters.Postprocessing.StateInspectorVisualizer.MenuData.Item() { Text = "Download backend logs", Click = () => { var input = app.Presentation.PromptDialog.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; } } } app.Model.Preprocessing.Manager.Preprocess( new[] { backendLogsPreprocessingStepsFactory.CreateDownloadBackendLogsStep(ids, referenceTime, env) }, "Downloading backend logs", Preprocessing.PreprocessingOptions.HighlightNewPreprocessing ); } } }); } #endif } }; }
public static void Init(IApplication app) { app.Model.Postprocessing.TimeSeriesTypes.RegisterTimeSeriesTypesAssembly(typeof(Chromium.TimeSeries.PostprocessorsFactory).Assembly); IPostprocessorsRegistry postprocessorsRegistry = new PostprocessorsInitializer( app.Model.Postprocessing.PostprocessorsManager, app.Model.UserDefinedFormatsManager, new Chromium.StateInspector.PostprocessorsFactory(), new Chromium.TimeSeries.PostprocessorsFactory(app.Model.Postprocessing.TimeSeriesTypes), new Chromium.Correlator.PostprocessorsFactory(app.Model), new Chromium.Timeline.PostprocessorsFactory() ); UI.Presenters.Postprocessing.TimeSeriesVisualizer.IPresenter timeSeriesPresenter = null; UI.Presenters.Postprocessing.MainWindowTabPage.IPostprocessorOutputForm timeSeriesForm = null; app.Presentation.PostprocessorsFormFactory.FormCreated += (sender, evt) => { if (evt.Id == UI.Presenters.Postprocessing.MainWindowTabPage.ViewControlId.StateInspector) { var stateInspectorPresenter = evt.Presenter as UI.Presenters.Postprocessing.StateInspectorVisualizer.IPresenter; if (stateInspectorPresenter != null) { stateInspectorPresenter.OnNodeCreated += (senderPresenter, arg) => { if (Chromium.ChromeDebugLog.WebRtcStateInspector.ShouldBePresentedCollapsed(arg.NodeObject)) { arg.CreateCollapsed = true; } else if (Chromium.WebrtcInternalsDump.WebRtcStateInspector.ShouldBePresentedCollapsed(arg.NodeObject)) { arg.CreateCollapsed = true; } }; stateInspectorPresenter.OnMenu += (senderPresenter, arg) => { if (stateInspectorPresenter.SelectedObject != null) { if (WebrtcInternalsDump.WebRtcStateInspector.HasTimeSeries(stateInspectorPresenter.SelectedObject) || ChromeDebugLog.WebRtcStateInspector.HasTimeSeries(stateInspectorPresenter.SelectedObject)) { app.Presentation.PostprocessorsFormFactory.GetPostprocessorOutputForm(UI.Presenters.Postprocessing.MainWindowTabPage.ViewControlId.TimeSeries); Predicate <UI.Presenters.Postprocessing.TimeSeriesVisualizer.TreeNodeData> predicate = node => node.Type == UI.Presenters.Postprocessing.TimeSeriesVisualizer.ConfigDialogNodeType.ObjectIdGroup && node.Caption.Contains(stateInspectorPresenter.SelectedObject.Id) && stateInspectorPresenter.SelectedObject.Owner.Outputs.Any(x => x.LogSource == node.Owner.LogSource); if (timeSeriesPresenter != null && timeSeriesPresenter.ConfigNodeExists(predicate)) { arg.Items.Add(new UI.Presenters.Postprocessing.StateInspectorVisualizer.MenuData.Item() { Text = "Go to time series", Click = () => { timeSeriesForm.Show(); timeSeriesPresenter.OpenConfigDialog(); timeSeriesPresenter.SelectConfigNode(predicate); } }); } } } }; } } else if (evt.Id == UI.Presenters.Postprocessing.MainWindowTabPage.ViewControlId.TimeSeries) { timeSeriesPresenter = evt.Presenter as UI.Presenters.Postprocessing.TimeSeriesVisualizer.IPresenter; timeSeriesForm = evt.Form; } }; app.Model.PreprocessingManagerExtensionsRegistry.Register( new WebrtcInternalsDump.PreprocessingManagerExtension(app.Model.PreprocessingStepsFactory) ); app.Model.PreprocessingManagerExtensionsRegistry.Register( new ChromeDriver.PreprocessingManagerExtension(app.Model.PreprocessingStepsFactory, postprocessorsRegistry.ChromeDriver.LogProviderFactory) ); }
public static void Init(IApplication app) { var modelObjects = Factory.Create(app.Model); // todo: move code below to presentation assembly UI.Presenters.Postprocessing.TimeSeriesVisualizer.IPresenter timeSeriesPresenter = null; UI.Presenters.Postprocessing.IPostprocessorOutputForm timeSeriesForm = null; app.Presentation.PostprocessorsFormFactory.FormCreated += (sender, evt) => { if (evt.Id == UI.Presenters.Postprocessing.MainWindowTabPage.ViewControlId.StateInspector) { if (evt.Presenter is UI.Presenters.Postprocessing.StateInspectorVisualizer.IPresenter stateInspectorPresenter) { stateInspectorPresenter.OnNodeCreated += (senderPresenter, arg) => { if (ChromeDebugLog.WebRtcStateInspector.ShouldBePresentedCollapsed(arg.NodeObject?.CreationEvent, arg.NodeObject?.Id, arg.NodeObject?.Parent?.Id)) { arg.CreateCollapsed = true; } else if (WebrtcInternalsDump.WebRtcStateInspector.ShouldBePresentedCollapsed(arg.NodeObject?.CreationEvent)) { arg.CreateCollapsed = true; } }; stateInspectorPresenter.OnMenu += (senderPresenter, arg) => { if (stateInspectorPresenter.SelectedObject != null) { if (WebrtcInternalsDump.WebRtcStateInspector.HasTimeSeries(stateInspectorPresenter.SelectedObject.CreationEvent) || ChromeDebugLog.WebRtcStateInspector.HasTimeSeries(stateInspectorPresenter.SelectedObject.CreationEvent)) { app.Presentation.PostprocessorsFormFactory.GetPostprocessorOutputForm(UI.Presenters.Postprocessing.MainWindowTabPage.ViewControlId.TimeSeries); Predicate <UI.Presenters.Postprocessing.TimeSeriesVisualizer.ITreeNodeData> predicate = node => node.Type == UI.Presenters.Postprocessing.TimeSeriesVisualizer.ConfigDialogNodeType.ObjectIdGroup && node.Caption.Contains(stateInspectorPresenter.SelectedObject.Id) && stateInspectorPresenter.SelectedObject.BelongsToSource(node.LogSource); if (timeSeriesPresenter != null && timeSeriesPresenter.ConfigNodeExists(predicate)) { arg.Items.Add(new UI.Presenters.Postprocessing.StateInspectorVisualizer.MenuData.Item() { Text = "Go to time series", Click = () => { timeSeriesForm.Show(); timeSeriesPresenter.OpenConfigDialog(); timeSeriesPresenter.SelectConfigNode(predicate); } }); } } } }; } } else if (evt.Id == UI.Presenters.Postprocessing.MainWindowTabPage.ViewControlId.TimeSeries) { timeSeriesPresenter = evt.Presenter as UI.Presenters.Postprocessing.TimeSeriesVisualizer.IPresenter; timeSeriesForm = evt.Form; } }; }