Exemple #1
0
        public BehaviorCorrelation(BehaviorNode node)
        {
            var chain = node.ParentChain();
            ChainId = chain == null ? Guid.Empty : chain.UniqueId;

            Node = node;
        }
        public BehaviorNodeTraceTag(BehaviorNode node, RequestLog log) : base("li")
        {
            var description = Description.For(node);
            AddClass("node-trace").Data("node-id", node.UniqueId.ToString());

            var container = Add("div").AddClass("node-trace-container");
            container.Text(description.Title);

            var start = log.FindStep<BehaviorStart>(x => x.Correlation.Node == node);
            var finish = log.FindStep<BehaviorFinish>(x => x.Correlation.Node == node);

            if (start == null)
            {
                AddClass("gray");
                return;
            }

            var exception = log.FindStep<ExceptionReport>(x => node.UniqueId.Equals(x.CorrelationId));
            if (exception != null || !finish.Log.Succeeded)
            {
                AddClass("exception");
            }

            var duration = finish.RequestTimeInMilliseconds - start.RequestTimeInMilliseconds;

            container.Add("span").Text(duration.ToString() + " ms").AddClass("node-trace-duration");
        }
        //this is hideous but wanted to show an idea.
        public HtmlTag BuildLabel(BehaviorNode behaviorNode)
        {
            // TODO -- come back and policize this

            var span = new HtmlTag("span").AddClass("label");
            var pp = behaviorNode.GetType().PrettyPrint();
            span.Text("behavior");

            if (pp.StartsWith("WebForm"))
            {
                span.Text("View");
                span.AddClass("notice");
            }
            else if (pp.StartsWith("Call"))
            {
                span.AddClass("warning");
                span.Text("continuation");
            }
            else if (!behaviorNode.GetType().Name.StartsWith("Fubu"))
            {
                span.Text("fubu");
            }

            return span;
        }
Exemple #4
0
        public static HtmlTag Visualize(this IFubuPage page, BehaviorNode node)
        {
            var visualizer = page.Get<Visualizer>(); // TODO -- change this
            var model = visualizer.ToVisualizationSubject(node);

            var html =
                page.CollapsiblePartialFor<BehaviorNodeViewModel>(model).Title(model.Description.Title).ToString();

            return new HtmlTag("a", a => {
                a.Attr("name", node.UniqueId.ToString());
                a.Next = new LiteralTag(html);
            });
        }
 public BehaviorTracerNode(BehaviorNode inner)
 {
     inner.AddBefore(this);
 }
 public BehaviorTracer(BehaviorNode node, IChainExecutionLog log)
 {
     _node = node;
     _log = log;
 }
Exemple #7
0
        public static bool NonDiagnosticNodes(BehaviorNode node)
        {
            if (node is DiagnosticNode || node is BehaviorTracerNode) return false;

            return true;
        }
 public ChainedBehaviorExpression Chain()
 {
     return new ChainedBehaviorExpression(node => _topBehavior = node);
 }
Exemple #9
0
 public NodeRemoved(BehaviorNode node)
 {
     _node = node;
 }
Exemple #10
0
 public NodeReplaced(BehaviorNode oldNode, BehaviorNode newNode)
 {
     _oldNode = oldNode;
     _newNode = newNode;
 }