NTP Analyzer  0.8.2
Analyze the operation of time servers
Ntp.Analyzer.Page.BootstrapHostPageBuilder Class Reference
Inheritance diagram for Ntp.Analyzer.Page.BootstrapHostPageBuilder:
Collaboration diagram for Ntp.Analyzer.Page.BootstrapHostPageBuilder:

Public Member Functions

 BootstrapHostPageBuilder (MenuConfiguration menu, HostPageConfiguration page, IEnumerable< StatusLine > lines)
 
override Stream Generate ()
 

Public Attributes

override IEnumerable< StreamDestinationDestinations => page.Destinations.Destinations
 

Private Attributes

readonly List< StatusLinelines
 
readonly MenuConfiguration menu
 
readonly HostPageConfiguration page
 

Additional Inherited Members

- Protected Member Functions inherited from Ntp.Analyzer.Page.PageBuilderBase
Stream ToStream (string text)
 
- Properties inherited from Ntp.Analyzer.Page.PageBuilderBase
abstract IEnumerable< StreamDestinationDestinations [get]
 
- Properties inherited from Ntp.Analyzer.Export.IStreamGenerator
IEnumerable< StreamDestinationDestinations [get]
 

Detailed Description

Definition at line 37 of file BootstrapHostPageBuilder.cs.

Constructor & Destructor Documentation

Ntp.Analyzer.Page.BootstrapHostPageBuilder.BootstrapHostPageBuilder ( MenuConfiguration  menu,
HostPageConfiguration  page,
IEnumerable< StatusLine lines 
)
inline

Definition at line 39 of file BootstrapHostPageBuilder.cs.

43  {
44  this.menu = menu;
45  this.page = page;
46  this.lines = new List<StatusLine>(lines);
47  }

Member Function Documentation

override Stream Ntp.Analyzer.Page.BootstrapHostPageBuilder.Generate ( )
inlinevirtual

Implements Ntp.Analyzer.Page.PageBuilderBase.

Definition at line 55 of file BootstrapHostPageBuilder.cs.

References Ntp.Analyzer.Data.DataFace.Hosts, Ntp.Analyzer.Data.DataFace.Instance, and Ntp.Analyzer.Objects.Host.Ip.

56  {
57  DateTime now = page.ShowUtc == DateTimeKind.Utc ? DateTime.UtcNow : DateTime.Now;
58 
59  var schedule = new JobScheduleDescription(false, false, page.Frequency);
60  DateTime next = schedule.CalculateNextRun(now);
61  int wait = Convert.ToInt32(next.Subtract(now).TotalSeconds) + 1;
62 
63  Host host = DataFace.Instance.Hosts.Single(h => h.Id == page.HostId);
64 
65  var hostPage = new BootstrapHostPageRender(page.WebPath, page.Title, wait);
66 
67  if (menu != null)
68  {
69  var menuBar = new BootstrapMenuRender(page.WebPath, menu, page);
70  hostPage.Add(menuBar);
71  }
72 
73  var statusTable = new BootstrapHostTableRender(page, host.Ip, now, next);
74  hostPage.Add(statusTable);
75 
76  // Create table content
77  foreach (StatusLine line in lines)
78  {
79  statusTable.Add(new HostLineRender(line, page.PeerPage));
80  }
81 
82  // Create graph links
83  hostPage.Add(new BootstrapHostGraphRender(page.WebPath, page, page.Graphs));
84 
85  // Generate HTML
86  var htmlRender = new HtmlRenderer(hostPage);
87  string html = htmlRender.Render();
88 
89  return ToStream(html);
90  }
HostDatabaseMapper Hosts
Gets the host mapper.
Definition: DataFace.cs:57
A description of job schedule rules.
int HostId
Gets the host identifier in the HostSubConfiguration.
PeerPageConfiguration PeerPage
Gets the peer pages linked to this page.
IEnumerable< GraphSetConfiguration > Graphs
Gets the graphs to be displayed on this page.
Uri WebPath
Gets the web path in the HostSubConfiguration.
Renders IHtmlObjects into plain text for display in browsers.
Definition: HtmlRenderer.cs:31
A status line for an NTP Server containing information about configuration, peer and server details...
Definition: StatusLine.cs:28
Singleton facade class used to access memory persistent data.
Definition: DataFace.cs:30
static DataFace Instance
Gets the Singleton instance.
Definition: DataFace.cs:51

Member Data Documentation

override IEnumerable<StreamDestination> Ntp.Analyzer.Page.BootstrapHostPageBuilder.Destinations => page.Destinations.Destinations

Definition at line 53 of file BootstrapHostPageBuilder.cs.

readonly List<StatusLine> Ntp.Analyzer.Page.BootstrapHostPageBuilder.lines
private

Definition at line 49 of file BootstrapHostPageBuilder.cs.

readonly MenuConfiguration Ntp.Analyzer.Page.BootstrapHostPageBuilder.menu
private

Definition at line 50 of file BootstrapHostPageBuilder.cs.

readonly HostPageConfiguration Ntp.Analyzer.Page.BootstrapHostPageBuilder.page
private

Definition at line 51 of file BootstrapHostPageBuilder.cs.


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