NTP Analyzer
0.8.2
Analyze the operation of time servers
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
DefaultHostTableRender.cs
Go to the documentation of this file.
1
//
2
// Copyright (c) 2013-2017 Carsten Sonne Larsen <cs@innolan.net>
3
//
4
// Permission is hereby granted, free of charge, to any person obtaining a copy
5
// of this software and associated documentation files (the "Software"), to deal
6
// in the Software without restriction, including without limitation the rights
7
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
// copies of the Software, and to permit persons to whom the Software is
9
// furnished to do so, subject to the following conditions:
10
//
11
// The above copyright notice and this permission notice shall be included in
12
// all copies or substantial portions of the Software.
13
//
14
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
// THE SOFTWARE.
21
22
using
System
.Collections.Generic;
23
using
System
.Text;
24
using
Ntp
.
Analyzer
.
Config
.
Node
.
Page
;
25
using
Ntp
.
Analyzer
.
Import
;
26
27
namespace
Ntp
.Analyzer.Render.Host
28
{
29
public
sealed
class
DefaultHostTableRender
:
HtmlObjectRender
30
{
31
public
DefaultHostTableRender
(
HostPageConfiguration
page)
32
: base(page.WebPath)
33
{
34
columns =
new
List<string>
35
{
36
" "
,
37
"Name"
,
38
"st"
,
39
"when"
,
40
"poll"
,
41
page.
ServerType
==
ServerType
.Ntpctl ?
"trust"
:
"reach"
,
42
" delay"
,
43
"offset"
,
44
"jitter"
,
45
"iso "
,
46
"location"
47
}.ToArray();
48
}
49
50
private
readonly
string
[]
columns
;
51
52
public
override
string
Render
()
53
{
54
return
string
.Empty;
55
}
56
57
public
override
string
RenderFooter
()
58
{
59
var builder =
new
StringBuilder();
60
61
builder.Append(MakeSpacer());
62
builder.Append(
"<tr>"
);
63
64
for
(
int
index = 0; index < columns.Length; index++)
65
{
66
builder.Append(
@"<td class=""but""> </td>"
);
67
}
68
69
builder.AppendLine(
"</tr>"
);
70
builder.AppendLine(
"</table>"
);
71
72
return
builder.ToString();
73
}
74
75
public
override
string
RenderHead
()
76
{
77
var builder =
new
StringBuilder();
78
79
builder.Append(
"<table><tr>"
);
80
81
foreach
(
string
column
in
columns)
82
{
83
builder.Append(
"<th>"
);
84
builder.Append(column);
85
builder.Append(
"</th>"
);
86
}
87
88
builder.AppendLine(
"</tr>"
);
89
builder.Append(MakeSpacer());
90
91
return
builder.ToString();
92
}
93
94
private
string
MakeSpacer
()
95
{
96
var builder =
new
StringBuilder();
97
98
builder.Append(
"<tr>"
);
99
100
for
(
int
index = 0; index < columns.Length; index++)
101
{
102
builder.Append(
@"<td class=""spc""> </td>"
);
103
}
104
105
builder.AppendLine(
"</tr>"
);
106
107
return
builder.ToString();
108
}
109
}
110
}
Ntp.Analyzer.Render.Host.DefaultHostTableRender.Render
override string Render()
Definition:
DefaultHostTableRender.cs:52
Ntp.Analyzer.Config
Ntp.Analyzer.Render.Host.DefaultHostTableRender
Definition:
DefaultHostTableRender.cs:29
Ntp.Analyzer.Import.ServerType
ServerType
Definition:
ServerType.cs:24
Ntp.Analyzer.Render.Host.DefaultHostTableRender.RenderHead
override string RenderHead()
Definition:
DefaultHostTableRender.cs:75
Ntp.Analyzer.Render.Host.DefaultHostTableRender.DefaultHostTableRender
DefaultHostTableRender(HostPageConfiguration page)
Definition:
DefaultHostTableRender.cs:31
Ntp.Analyzer.Render.Host.DefaultHostTableRender.RenderFooter
override string RenderFooter()
Definition:
DefaultHostTableRender.cs:57
Ntp
Ntp.Analyzer.Import
Definition:
DriftFileImporter.cs:27
System
Ntp.Analyzer.Render.Host.DefaultHostTableRender.columns
readonly string[] columns
Definition:
DefaultHostTableRender.cs:50
Ntp.Analyzer.Config.Node.Page
Definition:
AboutPageConfiguration.cs:29
Ntp.Analyzer.Render.Host.DefaultHostTableRender.MakeSpacer
string MakeSpacer()
Definition:
DefaultHostTableRender.cs:94
Ntp.Analyzer.Render.HtmlObjectRender
Definition:
HtmlObjectRender.cs:27
Ntp.Analyzer.Config.Node
Definition:
ClusterConfiguration.cs:24
Ntp.Analyzer
Ntp.Analyzer.Config.Node.HostSubConfiguration.ServerType
ServerType ServerType
Gets the type of the server in the HostSubConfiguration.
Definition:
HostSubConfiguration.cs:49
Ntp.Analyzer.Config.Node.Page.HostPageConfiguration
Configuration for a HTML page showing status and graphs for a hosted NTP server.
Definition:
HostPageConfiguration.cs:36
Ntp.Analyzer
Render
Host
DefaultHostTableRender.cs
Generated by
1.8.11