23 using System.Collections.Generic;
28 namespace Ntp.Analyzer.Render.Host
44 columns =
new List<BootstrapTableColumn>
63 private readonly
string ip;
64 private readonly DateTime
next;
65 private readonly DateTime
now;
75 var builder =
new StringBuilder();
77 builder.Append(MakeSpacer());
79 builder.Append(
"<tr>");
81 foreach (var column
in columns)
83 builder.Append(column.FooterString);
86 builder.AppendLine(
"</tr>");
87 builder.AppendLine(
"</table>");
88 builder.AppendLine(
"</div>");
92 builder.Append(
@"<p class=""pool""><a class=""btn btn-lg btn-primary"" ");
93 builder.Append($
@"href=""{GetPoolMemberLink()}"">View info on pool.ntp.org »</a></p>");
97 builder.AppendLine(
"</div>");
98 builder.AppendLine(
"</div>");
100 return builder.ToString();
105 var builder =
new StringBuilder();
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>");
113 builder.Append(
"<p>");
114 builder.Append(now.ToLongDateString() +
" ");
115 if (page.ShowUtc == DateTimeKind.Utc)
117 builder.Append(TimeZoneInfo.Utc.StandardName);
121 builder.Append(TimeZoneInfo.Local.IsDaylightSavingTime(now)
122 ? TimeZoneInfo.Local.DaylightName
123 : TimeZoneInfo.Local.StandardName);
125 builder.Append(
" " + now.ToShortTimeString() +
". ");
126 builder.Append(
"Next refresh scheduled at ");
127 builder.Append(next.ToShortTimeString());
128 builder.AppendLine(
".</p>");
130 builder.AppendLine(
@"<div class=""table-responsive"">");
131 builder.Append(
"<table><tr>");
133 foreach (var column
in columns)
135 builder.Append(column);
138 builder.AppendLine(
"</tr>");
140 builder.Append(MakeSpacer());
142 return builder.ToString();
147 return "http://www.pool.ntp.org/scores/" + ip;
152 var builder =
new StringBuilder();
154 builder.Append(
"<tr>");
156 foreach (var column
in columns)
158 builder.Append(column.SpacerString);
161 builder.AppendLine(
"</tr>");
163 return builder.ToString();
171 this.cssClass = cssClass;
189 public string SpacerString =>
190 $
@"<td class=""spc{(cssClass != null ? " " + cssClass : string.Empty)}""> </td>";
192 public string FooterString =>
193 $
@"<td class=""but{(cssClass != null ? " " + cssClass : string.Empty)}""> </td>";
197 return cssClass != null
198 ? $
@"<th class=""{cssClass}"">{name}</th>" 199 : $
@"<th>{name}</th>";
BootstrapHostTableRender(HostPageConfiguration page, string ip, DateTime now, DateTime next)
string GetPoolMemberLink()
override string RenderFooter()
readonly HostPageConfiguration page
override string ToString()
BootstrapTableColumn(string name, string cssClass)
readonly BootstrapTableColumn[] columns
override string RenderHead()
ServerType ServerType
Gets the type of the server in the HostSubConfiguration.
Configuration for a HTML page showing status and graphs for a hosted NTP server.
BootstrapTableColumn(string name)