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

Public Member Functions

 BootstrapPeerGraphRender (Uri webPath, Objects.Peer peer, Objects.Host host, PeerPageConfiguration 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 Objects.Host host
 
readonly PeerPageConfiguration page
 
readonly Objects.Peer peer
 

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 BootstrapPeerGraphRender.cs.

Constructor & Destructor Documentation

Ntp.Analyzer.Render.Peer.BootstrapPeerGraphRender.BootstrapPeerGraphRender ( Uri  webPath,
Objects.Peer  peer,
Objects.Host  host,
PeerPageConfiguration  page,
IEnumerable< GraphSetConfiguration graphs 
)
inline

Definition at line 35 of file BootstrapPeerGraphRender.cs.

41  : base(webPath)
42  {
43  this.peer = peer;
44  this.host = host;
45  this.page = page;
46  this.graphs = new List<GraphSetConfiguration>(graphs);
47  }

Member Function Documentation

override string Ntp.Analyzer.Render.Peer.BootstrapPeerGraphRender.Render ( )
inline

Implements Ntp.Analyzer.Render.IHtmlObject.

Definition at line 54 of file BootstrapPeerGraphRender.cs.

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

55  {
56  var builder = new StringBuilder();
57  int count = 1;
58 
59  var activity = DataFace.Instance.PeerActivities.
60  Single(p => Equals(p.Host, host) && Equals(p.Peer, peer) && p.IsActive);
61 
62  foreach (var graphSet in graphs)
63  {
64  string open = count == 1 ? " in" : string.Empty;
65 
66  builder.AppendLine(@" <div class=""panel panel-default"">");
67  builder.AppendLine(@" <div class=""panel-heading"">");
68  builder.AppendLine(@" <h4 class=""panel-title"">");
69 
70  // Include panel counter
71  builder.Append(@" <a class=""accordion-toggle"" data-toggle=""collapse"" ");
72  builder.Append(@"data-parent=""#accordion"" href=""#collapse");
73  builder.Append(count);
74  builder.AppendLine(@""">");
75 
76  builder.AppendLine($@" {graphSet.Title}");
77  builder.AppendLine(@" </a>");
78  builder.AppendLine(@" </h4>");
79  builder.AppendLine(@" </div>");
80 
81  // Include panel counter
82  builder.Append(@" <div id=""collapse");
83  builder.Append(count);
84  builder.Append($@""" class=""panel-collapse collapse{open}"">");
85  builder.AppendLine();
86  builder.AppendLine(@" <div class=""panel-body"">");
87 
88  foreach (var graph in graphSet.Graphs)
89  {
90  builder.Append(@" <div class=""container theme-graph2"">");
91 
92  if (page?.GraphPages != null && page.GraphPages.Count() != 0)
93  {
94  builder.Append(@"<a href=""");
95  builder.Append(
96  page.GraphPages.First().GetLink(host, activity.Name, graphSet, graph).ToHtmlString());
97  builder.Append(@""">");
98  }
99 
100  builder.Append(@"<img class=""img-responsive"" src=""");
101  builder.Append(graph.GetLink(graphSet, activity.Name).ToHtmlString());
102  builder.Append(@""" alt=""");
103  builder.Append(graph.GetAltName(graphSet, activity.Name));
104  builder.Append(@""">");
105 
106  if (page?.GraphPages != null && page.GraphPages.Count() != 0)
107  {
108  builder.Append(@"</a>");
109  }
110 
111  builder.AppendLine(@"</div>");
112  }
113 
114  builder.AppendLine(@" </div>");
115  builder.AppendLine(@" </div>");
116  builder.AppendLine(@" </div>");
117 
118  count++;
119  }
120 
121  return builder.ToString();
122  }
IEnumerable< PeerGraphPageConfiguration > GraphPages
Gets the graph pages to be linked from this page.
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.Peer.BootstrapPeerGraphRender.RenderFooter ( )
inlinevirtual

Implements Ntp.Analyzer.Render.HtmlObjectRender.

Definition at line 124 of file BootstrapPeerGraphRender.cs.

125  {
126  var builder = new StringBuilder();
127 
128  builder.AppendLine(@" </div>");
129  builder.AppendLine(@" </div>");
130 
131  return builder.ToString();
132  }
override string Ntp.Analyzer.Render.Peer.BootstrapPeerGraphRender.RenderHead ( )
inlinevirtual

Implements Ntp.Analyzer.Render.HtmlObjectRender.

Definition at line 134 of file BootstrapPeerGraphRender.cs.

135  {
136  var builder = new StringBuilder();
137 
138  builder.AppendLine(@" <div class=""container theme-graph"">");
139  builder.AppendLine(@" <div class=""panel-group"" id=""accordion"">");
140 
141  return builder.ToString();
142  }

Member Data Documentation

readonly List<GraphSetConfiguration> Ntp.Analyzer.Render.Peer.BootstrapPeerGraphRender.graphs
private

Definition at line 49 of file BootstrapPeerGraphRender.cs.

readonly Objects.Host Ntp.Analyzer.Render.Peer.BootstrapPeerGraphRender.host
private

Definition at line 50 of file BootstrapPeerGraphRender.cs.

readonly PeerPageConfiguration Ntp.Analyzer.Render.Peer.BootstrapPeerGraphRender.page
private

Definition at line 51 of file BootstrapPeerGraphRender.cs.

readonly Objects.Peer Ntp.Analyzer.Render.Peer.BootstrapPeerGraphRender.peer
private

Definition at line 52 of file BootstrapPeerGraphRender.cs.


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