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

Classes

class  BootstrapTableColumn
 

Public Member Functions

 BootstrapHostTableRender (HostPageConfiguration page, string ip, DateTime now, DateTime next)
 
override string Render ()
 
override string RenderFooter ()
 
override string RenderHead ()
 
- Public Member Functions inherited from Ntp.Analyzer.Render.HtmlObjectRender
void Add (IHtmlObject child)
 

Private Member Functions

string GetPoolMemberLink ()
 
string MakeSpacer ()
 

Private Attributes

readonly BootstrapTableColumn[] columns
 
readonly string ip
 
readonly DateTime next
 
readonly DateTime now
 
readonly HostPageConfiguration 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 30 of file BootstrapHostTableRender.cs.

Constructor & Destructor Documentation

Ntp.Analyzer.Render.Host.BootstrapHostTableRender.BootstrapHostTableRender ( HostPageConfiguration  page,
string  ip,
DateTime  now,
DateTime  next 
)
inline

Definition at line 32 of file BootstrapHostTableRender.cs.

References Ntp.Analyzer.Config.Node.HostSubConfiguration.ServerType.

37  : base(page.WebPath)
38  {
39  this.page = page;
40  this.ip = ip;
41  this.now = now;
42  this.next = next;
43 
44  columns = new List<BootstrapTableColumn>
45  {
46  new BootstrapTableColumn(),
47  new BootstrapTableColumn("Name"),
48  new BootstrapTableColumn("st", "aright"),
49  new BootstrapTableColumn("when", "aright"),
50  new BootstrapTableColumn("poll", "aright2"),
51  page.ServerType == ServerType.Ntpctl
52  ? new BootstrapTableColumn("trust", "aright2")
53  : new BootstrapTableColumn("reach", "aright2"),
54  new BootstrapTableColumn("delay", "aright"),
55  new BootstrapTableColumn("offset", "aright"),
56  new BootstrapTableColumn("jitter", "aright"),
57  new BootstrapTableColumn("iso&nbsp;"),
58  new BootstrapTableColumn("location")
59  }.ToArray();
60  }
Uri WebPath
Gets the web path in the HostSubConfiguration.
ServerType ServerType
Gets the type of the server in the HostSubConfiguration.

Member Function Documentation

string Ntp.Analyzer.Render.Host.BootstrapHostTableRender.GetPoolMemberLink ( )
inlineprivate

Definition at line 145 of file BootstrapHostTableRender.cs.

146  {
147  return "http://www.pool.ntp.org/scores/" + ip;
148  }
string Ntp.Analyzer.Render.Host.BootstrapHostTableRender.MakeSpacer ( )
inlineprivate

Definition at line 150 of file BootstrapHostTableRender.cs.

151  {
152  var builder = new StringBuilder();
153 
154  builder.Append("<tr>");
155 
156  foreach (var column in columns)
157  {
158  builder.Append(column.SpacerString);
159  }
160 
161  builder.AppendLine("</tr>");
162 
163  return builder.ToString();
164  }
override string Ntp.Analyzer.Render.Host.BootstrapHostTableRender.Render ( )
inline

Implements Ntp.Analyzer.Render.IHtmlObject.

Definition at line 68 of file BootstrapHostTableRender.cs.

69  {
70  return string.Empty;
71  }
override string Ntp.Analyzer.Render.Host.BootstrapHostTableRender.RenderFooter ( )
inlinevirtual

Implements Ntp.Analyzer.Render.HtmlObjectRender.

Definition at line 73 of file BootstrapHostTableRender.cs.

74  {
75  var builder = new StringBuilder();
76 
77  builder.Append(MakeSpacer());
78 
79  builder.Append("<tr>");
80 
81  foreach (var column in columns)
82  {
83  builder.Append(column.FooterString);
84  }
85 
86  builder.AppendLine("</tr>");
87  builder.AppendLine("</table>");
88  builder.AppendLine("</div>");
89 
90  if (page.PoolMember)
91  {
92  builder.Append(@"<p class=""pool""><a class=""btn btn-lg btn-primary"" ");
93  builder.Append($@"href=""{GetPoolMemberLink()}"">View info on pool.ntp.org &raquo;</a></p>");
94  builder.AppendLine();
95  }
96 
97  builder.AppendLine("</div>");
98  builder.AppendLine("</div>");
99 
100  return builder.ToString();
101  }
override string Ntp.Analyzer.Render.Host.BootstrapHostTableRender.RenderHead ( )
inlinevirtual

Implements Ntp.Analyzer.Render.HtmlObjectRender.

Definition at line 103 of file BootstrapHostTableRender.cs.

104  {
105  var builder = new StringBuilder();
106 
107  builder.AppendLine(@"<div class=""container theme-showcase"">");
108  builder.AppendLine(@"<div class=""jumbotron"">");
109  builder.Append("<h1>");
110  builder.Append(page.Title);
111  builder.AppendLine("</h1>");
112 
113  builder.Append("<p>");
114  builder.Append(now.ToLongDateString() + " ");
115  if (page.ShowUtc == DateTimeKind.Utc)
116  {
117  builder.Append(TimeZoneInfo.Utc.StandardName);
118  }
119  else
120  {
121  builder.Append(TimeZoneInfo.Local.IsDaylightSavingTime(now)
122  ? TimeZoneInfo.Local.DaylightName
123  : TimeZoneInfo.Local.StandardName);
124  }
125  builder.Append(" " + now.ToShortTimeString() + ". ");
126  builder.Append("Next refresh scheduled at ");
127  builder.Append(next.ToShortTimeString());
128  builder.AppendLine(".</p>");
129 
130  builder.AppendLine(@"<div class=""table-responsive"">");
131  builder.Append("<table><tr>");
132 
133  foreach (var column in columns)
134  {
135  builder.Append(column);
136  }
137 
138  builder.AppendLine("</tr>");
139 
140  builder.Append(MakeSpacer());
141 
142  return builder.ToString();
143  }

Member Data Documentation

readonly BootstrapTableColumn [] Ntp.Analyzer.Render.Host.BootstrapHostTableRender.columns
private

Definition at line 62 of file BootstrapHostTableRender.cs.

readonly string Ntp.Analyzer.Render.Host.BootstrapHostTableRender.ip
private

Definition at line 63 of file BootstrapHostTableRender.cs.

readonly DateTime Ntp.Analyzer.Render.Host.BootstrapHostTableRender.next
private

Definition at line 64 of file BootstrapHostTableRender.cs.

readonly DateTime Ntp.Analyzer.Render.Host.BootstrapHostTableRender.now
private

Definition at line 65 of file BootstrapHostTableRender.cs.

readonly HostPageConfiguration Ntp.Analyzer.Render.Host.BootstrapHostTableRender.page
private

Definition at line 66 of file BootstrapHostTableRender.cs.


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