コード例 #1
0
        protected override void teardown()
        {
            var messages = _nodes.LoggedEvents().ToArray();
            var table    = new TableTag();

            table.AddHeaderRow(_ =>
            {
                _.Header("Node");
                _.Header("Subject");
                _.Header("Type");
                _.Header("Message");
            });

            messages.Each(message =>
            {
                table.AddBodyRow(_ =>
                {
                    _.Cell(message.NodeId);
                    _.Cell(message.Subject.ToString());
                    _.Cell(message.GetType().Name);
                    _.Cell(message.ToString());
                });
            });


            Context.Reporting.Log("Monitored Node Group", table.ToString());

            _nodes.Dispose();
        }
コード例 #2
0
        private HtmlTag toMessageTable()
        {
            var table = new TableTag();

            table.AddClass("table").AddClass("table-striped");

            table.AddHeaderRow(row =>
            {
                row.Header("Time").Attr("title",
                                        "This is the time in milliseconds since the specification started running that this message was first logged");
                row.Header("Correlation Id");
                row.Header("Message Type");
                row.Header("Details");
            });

            foreach (var history in _envelopes)
            {
                table.AddBodyRow(row =>
                {
                    row.Cell(history.Time.ToString()).Style("text-align", "right");
                    row.Cell(history.CorrelationId.ToString());
                    row.Cell(history.MessageType);
                    row.Add("td/a").Text("details").Attr("href", "#message-" + history.CorrelationId);
                });
            }



            return(table);
        }
コード例 #3
0
        public string ToHtml()
        {
            var table = new TableTag();

            table.AddClass("table");
            table.AddClass("table-striped");
            table.AddHeaderRow(row =>
            {
                row.Header("Details");
                row.Header("Duration (ms)");
                row.Header("Method");
                row.Header("Endpoint");
                row.Header("Status");
                row.Header("Content Type");
            });

            _logs.Each(log =>
            {
                var url = _system.Application.RootUrl.TrimEnd('/') + "/_fubu/#/fubumvc/request-details/" + log.Id;

                table.AddBodyRow(row =>
                {
                    row.Cell().Add("a").Text("Details").Attr("href", url).Attr("target", "_blank");
                    row.Cell(log.ExecutionTime.ToString()).Attr("align", "right");
                    row.Cell(log.HttpMethod);
                    row.Cell(log.Endpoint);
                    row.Cell(log.StatusCode.ToString());
                    row.Cell(log.ContentType);
                });
            });



            return(table.ToString());
        }
コード例 #4
0
        public HtmlTag get_tasks()
        {
            var peers = _repository.FindPeers();
            var cache = new Cache <Uri, TransportNode>();

            peers.Each(peer => peer.OwnedTasks.Each(x => cache[x] = peer));


            var tag = new HtmlTag("div");

            tag.Add("h1").Text("Task Assignements");


            var table = new TableTag();

            tag.Append(table);

            table.AddClass("table");

            table.AddHeaderRow(row => {
                row.Header("Task");
                row.Header("Assigned to");
                row.Header("Control Channel");
            });

            var tasks = _tasks.PermanentTasks().Union(_tasks.ActiveTasks()).ToArray();

            tasks.Each(uri => {
                table.AddBodyRow(row => addRow(row, uri, cache));
            });

            return(tag);
        }
コード例 #5
0
        public void should_add_headings_in_a_header_row_to_the_thead()
        {
            var expected = getExpectedHtml("<tr><th>Heading 1</th><th>Heading 2</th></tr>", null, null);

            var tag = new TableTag();
            var headerRow = tag.AddHeaderRow();
            headerRow.Header().Text("Heading 1");
            headerRow.Header("Heading 2");
            tag.ToString().ShouldEqual(expected);
        }
コード例 #6
0
ファイル: TableTagTester.cs プロジェクト: strvmarv/htmltags
        public void should_add_headings_in_a_header_row_to_the_thead()
        {
            var expected = getExpectedHtml("<tr><th>Heading 1</th><th>Heading 2</th></tr>", null, null);

            var tag       = new TableTag();
            var headerRow = tag.AddHeaderRow();

            headerRow.Header().Text("Heading 1");
            headerRow.Header("Heading 2");
            tag.ToString().ShouldEqual(expected);
        }
コード例 #7
0
        public HttpRequestReport()
        {
            _table.AddClass("table");

            _table.AddHeaderRow(row =>
            {
                row.Header("Url");
                row.Header("Status Code");
                row.Header("Duration");
                row.Header("Request Headers");
                row.Header("Response Headers");
            });
        }
コード例 #8
0
        private static TableTag buildTable()
        {
            var table = new TableTag();

            table.AddClass("table table-striped table-bordered table-condensed");

            table.AddHeaderRow(row =>
            {
                row.Header("Property");
                row.Header("Handler");
                row.Header("Value(s)");
            });

            return(table);
        }
コード例 #9
0
        public HtmlDocument FullLog()
        {
            var table = new TableTag();

            table.AddHeaderRow(r =>
            {
                r.Header("Type");
                r.Header("Description");
                r.Header("Provenance");
                r.Header("Timing");
            });

            PackageRegistry.Diagnostics.EachLog((target, log) =>
            {
                table.AddBodyRow(row =>
                {
                    row.Cell(PackagingDiagnostics.GetTypeName(target));
                    row.Cell(target.ToString());
                    row.Cell(log.Provenance);
                    row.Cell(log.TimeInMilliseconds.ToString()).AddClass("execution-time");
                });

                if (log.FullTraceText().IsNotEmpty())
                {
                    table.AddBodyRow(row =>
                    {
                        row.Cell().Attr("colspan", "4").Add("pre").AddClass("log").Text(log.FullTraceText());
                        if (!log.Success)
                        {
                            row.AddClass("failure");
                        }
                    });
                }
            });

            var document = DiagnosticHtml.BuildDocument(_urls, "Full Package Loading Log", table);



            return(document);
        }
コード例 #10
0
        public static TableTag Write(LoggingSession session)
        {
            var table = new TableTag();

            table.AddClass("table");
            table.AddHeaderRow(r =>
            {
                r.Header("Description");
                r.Header("Provenance");
            });

            session.EachLog((target, log) =>
            {
                table.AddBodyRow(row =>
                {
                    row.Add("td", td =>
                    {
                        td.Append(new HtmlTag("h3").Text("Directive: " + PackagingDiagnostics.GetTypeName(target)));
                        td.Append(new HtmlTag("h5").Text("Desc: " + target.ToString()));
                        var time = new HtmlTag("h6").Text(log.TimeInMilliseconds.ToString() + "ms");
                        td.Append(time);
                    });

                    row.Cell(log.Provenance);
                });

                if (log.FullTraceText().IsNotEmpty())
                {
                    table.AddBodyRow(row =>
                    {
                        row.Cell().Attr("colspan", "2").AddClass("log").Add("pre").Text(log.FullTraceText());
                        if (!log.Success)
                        {
                            row.AddClass("failure");
                        }
                    });
                }
            });

            return(table);
        }
コード例 #11
0
        public void smoke_test_document_with_tags()
        {
            var document = new HtmlDocument();

            document.Body.Add("h1").Text("Hello");

            var table = new TableTag();

            table.AddHeaderRow(row =>
            {
                row.Header("a");
                row.Header("b");
            });

            table.AddBodyRow(row =>
            {
                row.Cell("1");
                row.Cell("2");
            });

            Console.WriteLine(document.ToString());
        }
コード例 #12
0
        private HtmlTag tableForSerializer <T>()
        {
            var table = new TableTag();

            table.AddHeaderRow(row =>
            {
                row.Header("Index");
                row.Header("Bulk Insert");
                row.Header("Batch Update");
                row.Header("Command per Document");
            });

            table.AddBodyRow(row =>
            {
                row.Cell("No Index");
                row.Cell(timeFor <T, NoIndexes, BulkInserts>().ToString()).Style("align", "right");
                row.Cell(timeFor <T, NoIndexes, BatchUpdates>().ToString()).Style("align", "right");
                row.Cell(timeFor <T, NoIndexes, MultipleCommands>().ToString()).Style("align", "right");
            });

            table.AddBodyRow(row =>
            {
                row.Cell("Duplicated Field w/ Index");
                row.Cell(timeFor <T, IndexedDuplicatedField, BulkInserts>().ToString()).Style("align", "right");
                row.Cell(timeFor <T, IndexedDuplicatedField, BatchUpdates>().ToString()).Style("align", "right");
                row.Cell(timeFor <T, IndexedDuplicatedField, MultipleCommands>().ToString()).Style("align", "right");
            });

            table.AddBodyRow(row =>
            {
                row.Cell("Gin Index on Json");
                row.Cell(timeFor <T, WithGin, BulkInserts>().ToString()).Style("align", "right");
                row.Cell(timeFor <T, WithGin, BatchUpdates>().ToString()).Style("align", "right");
                row.Cell(timeFor <T, WithGin, MultipleCommands>().ToString()).Style("align", "right");
            });

            return(table);
        }
コード例 #13
0
        public static TableTag Write(LoggingSession session)
        {
            var table = new TableTag();

            table.AddHeaderRow(r =>
            {
                r.Header("Type");
                r.Header("Description");
                r.Header("Provenance");
                r.Header("Timing");
            });

            session.EachLog((target, log) =>
            {
                table.AddBodyRow(row =>
                {
                    row.Cell(PackagingDiagnostics.GetTypeName(target));
                    row.Cell(target.ToString());
                    row.Cell(log.Provenance);
                    row.Cell(log.TimeInMilliseconds.ToString()).AddClass("execution-time");
                });

                if (log.FullTraceText().IsNotEmpty())
                {
                    table.AddBodyRow(row =>
                    {
                        row.Cell().Attr("colspan", "4").Add("pre").AddClass("log").Text(log.FullTraceText());
                        if (!log.Success)
                        {
                            row.AddClass("failure");
                        }
                    });
                }
            });

            return(table);
        }
コード例 #14
0
        public static HtmlTag WriteBehaviorChainTable(IEnumerable <BehaviorChain> chains, params IColumn[] columns)
        {
            var table = new TableTag();

            table.Attr("cellspacing", "0");
            table.Attr("cellpadding", "0");
            table.AddHeaderRow(row =>
            {
                columns.Each(c => row.Header(c.Header()));
            });

            chains.Each(chain =>
            {
                table.AddBodyRow(row =>
                {
                    columns.Each(col =>
                    {
                        col.WriteBody(chain, row, row.Cell());
                    });
                });
            });

            return(table);
        }
コード例 #15
0
ファイル: RequestReporter.cs プロジェクト: zzekikaya/fubumvc
        public string ToHtml()
        {
            var table = new TableTag();

            table.AddClass("table");
            table.AddClass("table-striped");
            table.AddHeaderRow(row =>
            {
                row.Header("Details");
                row.Header("Duration (ms)");
                row.Header("Method");
                row.Header("Endpoint");
                row.Header("Status");
                row.Header("Content Type");
            });

            _logs.Each(log =>
            {
                var url = _runtime.BaseAddress.TrimEnd('/') + "/_fubu/#/fubumvc/request-details/" + log.Id;

                table.AddBodyRow(row =>
                {
                    row.Cell().Add("a").Text("Details").Attr("href", url).Attr("target", "_blank");
                    row.Cell(log.ExecutionTime.ToString()).Attr("align", "right");

                    var summary = new HttpRequestSummary(log);
                    row.Cell(summary.method);
                    row.Cell(log.Title());
                    row.Cell(summary.status.ToString());
                    row.Cell(summary.contentType);
                });
            });


            return(table.ToString());
        }
コード例 #16
0
        // This is the hook that lets you generate raw HTML
        // that will show up as a tab within the results for a spec
        string Report.ToHtml()
        {
            var table = new TableTag();

            table.AddClass("table").AddClass("table-striped");

            table.AddHeaderRow(row =>
            {
                row.Header("Category");
                row.Header("Level");
                row.Header("Message");
            });

            foreach (var record in Records)
            {
                table.AddBodyRow(row =>
                {
                    row.Cell(record.Category);
                    row.Cell(record.Level);
                    row.Cell(record.Message);
                });

                // Write out the full stack trace if there's an exception
                if (record.ExceptionText.IsNotEmpty())
                {
                    table.AddBodyRow(row =>
                    {
                        row.Cell().Attr("colspan", "3").AddClass("bg-warning").Add("pre").AddClass("bg-warning").Text(record.ExceptionText);
                    });
                }
            }



            return(table.ToString());
        }
コード例 #17
0
        public HtmlDocument Chain(ChainRequest chainRequest)
        {
            var title = "Chain " + chainRequest.Id;

            var behaviorChain = _graph.Behaviors.FirstOrDefault(chain => chain.UniqueId == chainRequest.Id);

            if (behaviorChain == null)
            {
                return(BuildDocument("Unknown chain", new HtmlTag("span").Text("No behavior chain registered with ID: " + chainRequest.Id)));
            }

            var content = new HtmlTag("div").AddClass("main-content");

            var document = new HtmlTag("div");
            var pattern  = behaviorChain.RoutePattern;

            if (pattern == string.Empty)
            {
                pattern = "(default)";
            }
            document.Append(new HtmlTag("div").Text("Route: " + pattern));

            var nodeTable = new TableTag();

            nodeTable.AddHeaderRow(header =>
            {
                header.Header("Category");
                header.Header("Description");
                header.Header("Type");
            });
            foreach (var node in behaviorChain)
            {
                var description = node.ToString().HtmlEncode().ConvertCRLFToBreaks();
                nodeTable.AddBodyRow(row =>
                {
                    row.Cell().Text(node.Category.ToString());
                    row.Cell().Encoded(false).Text(description);
                    row.Cell().Text(node.GetType().FullName);
                    if (description.Contains(_diagnosticsNamespace))
                    {
                        row.AddClass(FUBU_INTERNAL_CLASS);
                    }
                });
            }


            var logDiv = new HtmlTag("div").AddClass("convention-log");
            var ul     = logDiv.Add("ul");

            var observer = _graph.Observer;

            behaviorChain.Calls.Each(
                call => observer.GetLog(call).Each(
                    entry => ul.Add("li").Text(entry)));

            content.Append(new[] {
                document,
                new HtmlTag("h3").Text("Nodes:"),
                nodeTable,
                new HtmlTag("h3").Text("Log:"),
                logDiv
            });

            return(BuildDocument(title, content));
        }
コード例 #18
0
        public HtmlTag ToTableDetails()
        {
            var div     = new HtmlTag("div");
            var headers = new TableTag();

            div.Add("h5").Text("Headers");
            div.Append(headers);
            headers.AddClass("table").AddClass("table-striped");
            headers.AddHeaderRow(row =>
            {
                row.Header("Header Key");
                row.Header("Header Value");
            });

            var envelope = Records[0].Envelope;

            headers.WriteEnvelopeProperty(envelope, x => x.Source);
            headers.WriteEnvelopeProperty(envelope, x => x.MessageType);
            headers.WriteEnvelopeProperty(envelope, x => x.ReplyUri);
            headers.WriteEnvelopeProperty(envelope, x => x.ContentType);
            headers.WriteEnvelopeProperty(envelope, x => x.CorrelationId);
            headers.WriteEnvelopeProperty(envelope, x => x.CausationId);

            // TODO -- come back and add saga id

            headers.WriteEnvelopeProperty(envelope, x => x.Destination);
            headers.WriteEnvelopeProperty(envelope, x => x.AcceptedContentTypes);
            headers.WriteEnvelopeProperty(envelope, x => x.ReplyRequested);
            headers.WriteEnvelopeProperty(envelope, x => x.AckRequested);
            headers.WriteEnvelopeProperty(envelope, x => x.ExecutionTime);
            headers.WriteEnvelopeProperty(envelope, x => x.DeliverBy);
            headers.WriteEnvelopeProperty(envelope, x => x.ReceivedAt);


            foreach (var pair in envelope.Headers)
            {
                headers.AddBodyRow(row =>
                {
                    row.Cell(pair.Key);
                    row.Cell(pair.Value);
                });
            }

            var table = new TableTag();

            div.Add("h5").Text("Activity");
            div.Append(table);

            table.AddClass("table").AddClass("table-striped");


            table.AddHeaderRow(row =>
            {
                row.Header("Time");
                row.Header("Service");
                row.Header("Message");
            });

            foreach (var record in Records)
            {
                table.AddBodyRow(row =>
                {
                    row.Cell(record.Time.ToString()).Style("text-align", "right");
                    row.Cell(record.ServiceName);
                    row.Cell(record.Message);

                    if (record.ExceptionText.IsNotEmpty())
                    {
                        row.AddClass("bg-warning");
                    }
                });

                if (record.ExceptionText.IsNotEmpty())
                {
                    table.AddBodyRow(row =>
                    {
                        row.Attr("colSpan", "3");
                        row.Add("td/pre").Text(record.ExceptionText);
                    });
                }
            }

            return(div);
        }
コード例 #19
0
        public HtmlTag ToTableDetails()
        {
            var div     = new HtmlTag("div");
            var headers = new TableTag();

            div.Add("h5").Text("Headers");
            div.Append(headers);
            headers.AddClass("table").AddClass("table-striped");
            headers.AddHeaderRow(row =>
            {
                row.Header("Header Key");
                row.Header("Header Value");
            });

            foreach (var pair in Records[0].Envelope.Headers)
            {
                headers.AddBodyRow(row =>
                {
                    row.Cell(pair.Key);
                    row.Cell(pair.Value);
                });
            }

            var table = new TableTag();

            div.Add("h5").Text("Activity");
            div.Append(table);

            table.AddClass("table").AddClass("table-striped");


            table.AddHeaderRow(row =>
            {
                row.Header("Time");
                row.Header("Service");
                row.Header("Message");
            });

            foreach (var record in Records)
            {
                table.AddBodyRow(row =>
                {
                    row.Cell(record.Time.ToString()).Style("text-align", "right");
                    row.Cell(record.ServiceName);
                    row.Cell(record.Message);

                    if (record.ExceptionText.IsNotEmpty())
                    {
                        row.AddClass("bg-warning");
                    }
                });

                if (record.ExceptionText.IsNotEmpty())
                {
                    table.AddBodyRow(row =>
                    {
                        row.Attr("colSpan", "3");
                        row.Add("td/pre").Text(record.ExceptionText);
                    });
                }
            }

            return(div);
        }
コード例 #20
0
ファイル: performance_tuning.cs プロジェクト: uwascan/marten
        private HtmlTag reportForSerializer(Type serializerType)
        {
            var timing = _timings[serializerType];

            var div = new HtmlTag("div");

            div.Add("h3").Text("Serializer: " + serializerType.Name);

            var table = new TableTag();

            div.Append(table);

            table.AddHeaderRow(tr =>
            {
                tr.Header("Where Type");
                tr.Header("1K");
                tr.Header("10K");
                tr.Header("100K");
                //tr.Header("1M");
            });

            table.AddBodyRow(tr =>
            {
                tr.Header("JSON Locator Only");

                var dict = timing.Timings[typeof(JsonLocatorOnly)];

                tr.Cell(dict[1000].ToString());
                tr.Cell(dict[10000].ToString());
                tr.Cell(dict[100000].ToString());
                //tr.Cell(dict[1000000].ToString());
            });

            table.AddBodyRow(tr =>
            {
                tr.Header("jsonb_to_record + lateral join");

                var dict = timing.Timings[typeof(JsonBToRecord)];

                tr.Cell(dict[1000].ToString());
                tr.Cell(dict[10000].ToString());
                tr.Cell(dict[100000].ToString());
                //tr.Cell(dict[1000000].ToString());
            });

            table.AddBodyRow(tr =>
            {
                tr.Header("searching by duplicated field");

                var dict = timing.Timings[typeof(DateIsSearchable)];

                tr.Cell(dict[1000].ToString());
                tr.Cell(dict[10000].ToString());
                tr.Cell(dict[100000].ToString());
                //tr.Cell(dict[1000000].ToString());
            });

            table.AddBodyRow(tr =>
            {
                tr.Header("searching by containment operator");

                var dict = timing.Timings[typeof(ContainmentOperator)];

                tr.Cell(dict[1000].ToString());
                tr.Cell(dict[10000].ToString());
                tr.Cell(dict[100000].ToString());
                //tr.Cell(dict[1000000].ToString());
            });

            return(div);
        }
コード例 #21
0
        public CommonResponse NeedsReorderEmail()
        {
            var response = new CommonResponse();

            try
            {
                var ctx = context as MROContext;

                var needsReorderList = ctx.InventoryInputs
                                       .GroupBy(e => new
                {
                    e.CatMaterial
                    //, e.CatUnitOfMeasure
                }).Select(e => new
                {
                    e.Key,
                    e.Key.CatMaterial.Value,
                    e.Key.CatMaterial.MaterialDescription,
                    BalanceSum = e.Sum(b => b.Balance),
                    id         = e.Key.CatMaterial.CatMaterialKey
                })
                                       .Where(e => e.BalanceSum < e.Key.CatMaterial.Min)
                                       .ToList();


                var htmlReport = new TableTag();
                htmlReport.Style("border", "solid 1px gray");
                var headerRow = htmlReport.AddHeaderRow();

                headerRow.Header().Text("Material");
                headerRow.Header().Text("Description");
                //headerRow.Header().Text("Unit of Measure");
                headerRow.Header().Text("Balance");
                headerRow.Header("Minimum");
                foreach (var item in needsReorderList)
                {
                    var row = htmlReport.AddBodyRow();
                    row.Cell(item.Value);
                    row.Cell(item.MaterialDescription);
                    //row.Cell(item.Key.CatUnitOfMeasure.Value);
                    row.Cell(item.BalanceSum.ToString());
                    row.Cell(item.Key.CatMaterial.Min.ToString());
                }

                EmailService emailService = new EmailService("", 25)
                {
                    //EmailAddress = "",
                    //Password = "",
                    //From = "",
                    //Subject = "Needs Reorder",

                    EmailAddress = "",
                    Password     = "",
                    From         = "",
                    Subject      = "Needs Reorder",

                    Body = needsReorderList.Count > 0 ? htmlReport.ToString() : "Inventario sin requerimientos minimos. "
                };


                emailService.To.Add("");
                emailService.To.Add("");

                try
                {
                    if (needsReorderList.Count > 0)
                    {
                        emailService.SendMail();
                    }
                }
                catch (Exception ex)
                {
                    throw new KnownError("Error. Could not send email.\n" + ex.ToString());
                }

                return(response.Success());
            }
            catch (KnownError ke)
            {
                return(response.Error(ke));
            }
            catch (Exception ex)
            {
                return(response.Error(ex.Message));
            }
        }