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;
        }
 private void AddItem(TableTag table, AdminItem item)
 {
     var row = table.AddBodyRow();
     row.Attr("key", JsonUtil.ToJson(new {item.AdminType, Id = item.Id.ToString()}));
     row.Cell(item.AdminType.ToString());
     row.Cell(item.Summary);
 }
Exemplo n.º 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 = _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();
        }
        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;
        }
Exemplo n.º 5
0
        private void writeProperties(Description description)
        {
            if (description.Properties.Any())
            {
                var table = new TableTag();
                table.AddClass("desc-properties");

                description.Properties.Each((key, value) =>
                {
                    table.AddBodyRow(row =>
                    {
                        row.Header(key);
                        row.Cell(value);
                    });
                });

                Append(table);
            }
        }
Exemplo n.º 6
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: "+BottlingDiagnostics.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;
        }
Exemplo n.º 7
0
        public PreviewSummary(string title)
        {
            Title = title;

            Body.Style("margin", "30px");

            AddStyle(HtmlClasses.CSS());
            Add("h1").Text(title);

            Add("hr");

            _table = new TableTag();
            _table.AddClass("summary-table");
            Add(_table);

            _table.AddHeaderRow(row => {
                row.Header("Name");
                row.Header("Suite");
                row.Header("Lifecycle");
            });
        }
Exemplo n.º 8
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;
        }
Exemplo n.º 9
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;
        }
 public ModelBindingHtmlReport()
 {
     _table = buildTable();
 }
Exemplo n.º 11
0
        private HtmlTag writeTable(IEnumerable<BehaviorChain> chains, params IColumn[] columns)
        {
            var table = new TableTag();
            table.AddHeaderRow(row =>
            {
                columns.Each(c => row.Header(c.Header()));
            });

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

            return table;
        }
Exemplo n.º 12
0
        protected override void teardown()
        {
            var messages = _nodes.LoggedEvents().ToArray();
            var table = new TableTag();

            table.AddClasses("table", "table-striped");
            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.AddLogs(Context);

            _nodes.Dispose();
        }
Exemplo n.º 13
0
        private void writeOptions(DeploymentPlan plan)
        {
            wrapInSection("Options","Options used at runtime", div =>
            {

                var table = new TableTag();
                table.AddClass("table");
                table.AddProperty("Written at", DateTime.Now.ToLongTimeString());
                table.AddProperty("Profile", plan.Options.ProfileName);

                table.AddBodyRow(tr =>
                {
                    tr.Add("th", th =>
                    {
                        th.Text("Recipes").Append(new HtmlTag("small").Text(" (in order)"));
                    });
                    tr.Add("td", td =>
                    {
                        td.Text(plan.Recipes.Select(x => x.Name).Join(" > "));
                    });
                });

                table.AddProperty("Hosts", plan.Hosts.Select(x => x.Name).OrderBy(x => x).Join(", "));
                table.AddProperty("Bottles",
                                  plan.Hosts.SelectMany(host => host.BottleReferences).Select(bottle => bottle.Name).
                                      Distinct().OrderBy(x => x).Join(", "));
                div.Append(table);
            });
        }
Exemplo n.º 14
0
        private static HtmlTag writeSettings(string provRoot ,IEnumerable<SettingDataSource> settingDataSources)
        {
            var table = new TableTag();
            table.AddClass("table");
            table.AddHeaderRow("Key", "Value", "Provenance");

            settingDataSources.Each(s =>
            {
                var prov = s.Provenance.Replace(provRoot, "");
                table.AddBodyRow(s.Key, s.Value, s.Provenance);
            });

            return table;
        }
Exemplo n.º 15
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.Child(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().UnEncoded().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.AddChildren(new[]{
                document,
                new HtmlTag("h3").Text("Nodes:"),
                nodeTable,
                new HtmlTag("h3").Text("Log:"),
                logDiv});

            return BuildDocument(title, content);
        }
Exemplo n.º 16
0
        private void writeOptions(DeploymentPlan plan)
        {
            wrapInCollapsable("Options", div =>
            {

                var table = new TableTag();
                table.Id("properties");
                table.AddProperty("Written at", DateTime.Now.ToLongTimeString());
                table.AddProperty("Profile", plan.Options.ProfileName + " at " + plan.Options.ProfileFileName); // TODO -- add file name
                table.AddProperty("Recipes", plan.Recipes.Select(x => x.Name).OrderBy(x => x).Join(", "));
                table.AddProperty("Hosts", plan.Hosts.Select(x => x.Name).OrderBy(x => x).Join(", "));
                table.AddProperty("Bottles",
                                  plan.Hosts.SelectMany(host => host.BottleReferences).Select(bottle => bottle.Name).
                                      Distinct().OrderBy(x => x).Join(", "));
                div.Append(table);
            });
        }
Exemplo n.º 17
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;
        }
Exemplo n.º 18
0
        public HtmlDocument Chain(ChainRequest chainRequest)
        {
            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 heading = new HtmlTag("h1").Modify(t =>
            {
                t.Add("span").Text("Chain ");
                t.Add("span").AddClass("chainId").Text(behaviorChain.UniqueId.ToString());
            });
            var document = new HtmlTag("div");
            document.Child(new HtmlTag("div").Text("Route: " + behaviorChain.RoutePattern));

            var nodeTable = new TableTag();
            nodeTable.AddHeaderRow(header =>
            {
                header.Header("Category");
                header.Header("Description");
                header.Header("Type");
            });
            behaviorChain.Each(node => nodeTable.AddBodyRow(row =>
            {
                row.Cell().Text(node.Category.ToString());
                row.Cell().Text(node.ToString());
                row.Cell().Text(node.GetType().FullName);
            }));
            return BuildDocument("Chain " + chainRequest.Id, heading, document, new HtmlTag("h2").Text("Nodes:"), nodeTable);
        }
        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.Trace(table);

            _nodes.Dispose();
        }
Exemplo n.º 20
0
 private static void AddHeader(TableTag table)
 {
     var header = table.AddHeaderRow();
     header.Cell("Type");
     header.Cell("Description");
 }
Exemplo n.º 21
0
 private void AddItems(TableTag table)
 {
     _Filters.GetAdminItems().ForEach(i => AddItem(table, i));
 }