NTP Analyzer  0.8.2
Analyze the operation of time servers
Ntp.Analyzer.Render.Summary.BootstrapSummaryGraphRender Class Reference
Inheritance diagram for Ntp.Analyzer.Render.Summary.BootstrapSummaryGraphRender:
Collaboration diagram for Ntp.Analyzer.Render.Summary.BootstrapSummaryGraphRender:

Public Member Functions

 BootstrapSummaryGraphRender (Uri webPath, int hostId, PeerSummaryPageConfiguration page, IEnumerable< GraphSetConfiguration > graphs)
 
override string Render ()
 
override string RenderFooter ()
 
override string RenderHead ()
 
- Public Member Functions inherited from Ntp.Analyzer.Render.HtmlObjectRender
void Add (IHtmlObject child)
 

Private Attributes

readonly List< GraphSetConfigurationgraphs
 
readonly int hostId
 
readonly PeerSummaryPageConfiguration page
 

Additional Inherited Members

- Public Attributes inherited from Ntp.Analyzer.Render.HtmlObjectRender
IEnumerable< IHtmlObjectChildren => children.ToArray()
 
- Protected Member Functions inherited from Ntp.Analyzer.Render.HtmlObjectRender
 HtmlObjectRender (Uri webPath)
 
- Properties inherited from Ntp.Analyzer.Render.HtmlObjectRender
Uri WebPath [get]
 
- Properties inherited from Ntp.Analyzer.Render.IHtmlObject
IEnumerable< IHtmlObjectChildren [get]
 
Uri WebPath [get]
 

Detailed Description

Definition at line 33 of file BootstrapSummaryGraphRender.cs.

Constructor & Destructor Documentation

Ntp.Analyzer.Render.Summary.BootstrapSummaryGraphRender.BootstrapSummaryGraphRender ( Uri  webPath,
int  hostId,
PeerSummaryPageConfiguration  page,
IEnumerable< GraphSetConfiguration graphs 
)
inline

Definition at line 35 of file BootstrapSummaryGraphRender.cs.

40  : base(webPath)
41  {
42  this.hostId = hostId;
43  this.page = page;
44  this.graphs = new List<GraphSetConfiguration>(graphs);
45  }

Member Function Documentation

override string Ntp.Analyzer.Render.Summary.BootstrapSummaryGraphRender.Render ( )
inline

Implements Ntp.Analyzer.Render.IHtmlObject.

Definition at line 51 of file BootstrapSummaryGraphRender.cs.

References Ntp.Analyzer.Data.DataFace.Instance, and Ntp.Analyzer.Data.DataFace.PeerActivities.

52  {
53  var builder = new StringBuilder();
54  int count = 1;
55 
56  foreach (var graphSet in graphs)
57  {
58  string open = count == 1 ? " in" : string.Empty;
59 
60  builder.AppendLine(@" <div class=""panel panel-default"">");
61  builder.AppendLine(@" <div class=""panel-heading"">");
62  builder.AppendLine(@" <h4 class=""panel-title"">");
63 
64  // Include panel counter
65  builder.Append(@" <a class=""accordion-toggle"" data-toggle=""collapse"" ");
66  builder.Append(@"data-parent=""#accordion"" href=""#collapse");
67  builder.Append(count);
68  builder.AppendLine(@""">");
69 
70  builder.AppendLine(@" " + graphSet.Title);
71  builder.AppendLine(@" </a>");
72  builder.AppendLine(@" </h4>");
73  builder.AppendLine(@" </div>");
74 
75  // Include panel counter
76  builder.Append(@" <div id=""collapse");
77  builder.Append(count);
78  builder.Append($@""" class=""panel-collapse collapse{open}"">");
79  builder.AppendLine();
80  builder.AppendLine(@" <div class=""panel-body"">");
81 
82 
83  var peers = DataFace.Instance.PeerActivities.
84  Where(p => p.Host.Id == hostId && p.IsActive);
85 
86  foreach (var entry in peers)
87  {
88  foreach (var graph in graphSet.Graphs)
89  {
90  builder.Append(@" <div class=""container theme-graph2"">");
91  builder.Append(@"<a href=""");
92  builder.Append(page.GetPeerLink(entry.Id).ToHtmlString());
93  builder.Append(@""">");
94  builder.Append(@"<img class=""img-responsive"" src=""");
95  builder.Append(graph.GetLink(graphSet, entry.Name).ToHtmlString());
96  builder.Append(@""" alt=""");
97  builder.Append(graph.GetAltName(graphSet, entry.Name));
98  builder.Append(@""">");
99  builder.AppendLine(@"</a></div>");
100  }
101  }
102 
103  builder.AppendLine(@" </div>");
104  builder.AppendLine(@" </div>");
105  builder.AppendLine(@" </div>");
106 
107  count++;
108  }
109 
110  return builder.ToString();
111  }
Uri GetPeerLink(int peerId)
Gets the link related to specified peer.
Singleton facade class used to access memory persistent data.
Definition: DataFace.cs:30
PeerActivityDatabaseMapper PeerActivities
Gets the peer activity mapper.
Definition: DataFace.cs:99
static DataFace Instance
Gets the Singleton instance.
Definition: DataFace.cs:51
override string Ntp.Analyzer.Render.Summary.BootstrapSummaryGraphRender.RenderFooter ( )
inlinevirtual

Implements Ntp.Analyzer.Render.HtmlObjectRender.

Definition at line 113 of file BootstrapSummaryGraphRender.cs.

114  {
115  var builder = new StringBuilder();
116 
117  builder.AppendLine(@" </div>");
118  builder.AppendLine(@" </div>");
119 
120  return builder.ToString();
121  }
override string Ntp.Analyzer.Render.Summary.BootstrapSummaryGraphRender.RenderHead ( )
inlinevirtual

Implements Ntp.Analyzer.Render.HtmlObjectRender.

Definition at line 123 of file BootstrapSummaryGraphRender.cs.

124  {
125  var builder = new StringBuilder();
126 
127  builder.AppendLine(@" <div class=""container theme-graph"">");
128  builder.AppendLine(@" <div class=""panel-group"" id=""accordion"">");
129 
130  return builder.ToString();
131  }

Member Data Documentation

readonly List<GraphSetConfiguration> Ntp.Analyzer.Render.Summary.BootstrapSummaryGraphRender.graphs
private

Definition at line 47 of file BootstrapSummaryGraphRender.cs.

readonly int Ntp.Analyzer.Render.Summary.BootstrapSummaryGraphRender.hostId
private

Definition at line 48 of file BootstrapSummaryGraphRender.cs.

readonly PeerSummaryPageConfiguration Ntp.Analyzer.Render.Summary.BootstrapSummaryGraphRender.page
private

Definition at line 49 of file BootstrapSummaryGraphRender.cs.


The documentation for this class was generated from the following file: