@@ -20,118 +20,6 @@ const (
2020 defaultCheckTimeMinutes = 10
2121)
2222
23- var TableHtml = `<html>
24- <html><head>
25- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
26- <meta http-equiv="X-UA-Compatible" content="IE=edge">
27- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;">
28-
29- <meta name="Generator" content="EditPlus">
30- <meta name="Author" content="">
31- <meta name="Keywords" content="">
32- <meta name="Description" content="">
33- <title>Dotweb</title>
34- <style>
35- .overtable {
36- width: 100%;
37- overflow: hidden;
38- overflow-x: auto;
39- }
40- body {
41- max-width: 780px;
42- margin:0 auto;
43- font-family: 'trebuchet MS', 'Lucida sans', Arial;
44- font-size: 1rem;
45- color: #444;
46- }
47- table {
48- font-family: 'trebuchet MS', 'Lucida sans', Arial;
49- *border-collapse: collapse;
50- /* IE7 and lower */
51- border-spacing: 0;
52- width: 100%;
53- border-collapse: collapse;
54- overflow-x: auto
55- }
56- caption {
57- font-family: 'Microsoft Yahei', 'trebuchet MS', 'Lucida sans', Arial;
58- text-align: left;
59- padding: .5rem;
60- font-weight: bold;
61- font-size: 110%;
62- color: #666;
63- }
64- tr {
65- border-top: 1px solid #dfe2e5
66- }
67- tr:nth-child(2n) {
68- background-color: #f6f8fa
69- }
70- td,
71- th {
72- border: 1px solid #dfe2e5;
73- padding: .6em 1em;
74- }
75- .bordered tr:hover {
76- background: #fbf8e9;
77- }
78- .bordered td,
79- .bordered th {
80- border: 1px solid #ccc;
81- padding: 10px;
82- text-align: left;
83- }
84- </style>
85- <script>
86-
87- (function(doc, win) {
88- window.MPIXEL_RATIO = (function () {
89- var Mctx = document.createElement("canvas").getContext("2d"),
90- Mdpr = window.devicePixelRatio || 1,
91- Mbsr = Mctx.webkitBackingStorePixelRatio ||
92- Mctx.mozBackingStorePixelRatio ||
93- Mctx.msBackingStorePixelRatio ||
94- Mctx.oBackingStorePixelRatio ||
95- Mctx.backingStorePixelRatio || 1;
96-
97- return Mdpr/Mbsr;
98- })();
99-
100- function addEventListeners(ele,type,callback){
101-
102- try{ // Chrome、FireFox、Opera、Safari、IE9.0及其以上版本
103- ele.addEventListener(type,callback,false);
104- }catch(e){
105- try{ // IE8.0及其以下版本
106- ele.attachEvent('on' + type,callback);
107- }catch(e){ // 早期浏览器
108- ele['on' + type] = callback;
109- }
110- }
111- }
112-
113- var docEl = doc.documentElement,
114- resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize';
115- window.recalc = function() {
116- var clientWidth = docEl.clientWidth < 768 ? docEl.clientWidth : 768;
117- if (!clientWidth) return;
118- docEl.style.fontSize = 10 * (clientWidth / 320) * window.MPIXEL_RATIO + 'px';
119- };
120- window.recalc();
121-
122- addEventListeners(win, resizeEvt, recalc);
123- })(document, window);
124-
125- </script>
126- </head>
127- <body>
128- <div class="overtable">
129- {{tableBody}}
130- </div>
131- </body>
132- </html>
133- `
134-
13523// NewServerStateInfo return ServerStateInfo which is init
13624func NewServerStateInfo () * ServerStateInfo {
13725 state := & ServerStateInfo {
@@ -284,7 +172,7 @@ func (state *ServerStateInfo) ShowHtmlTableData(version, globalUniqueId string)
284172 <th>Index</th>
285173 <th>Value</th>
286174 </tr>`
287- data = CreateTableHtml ("Core State" , header , data )
175+ data = CreateTablePart ("Core State" , header , data )
288176
289177 //show IntervalRequestData
290178 intervalRequestData := ""
@@ -297,7 +185,7 @@ func (state *ServerStateInfo) ShowHtmlTableData(version, globalUniqueId string)
297185 <th>Time</th>
298186 <th>Value</th>
299187 </tr>`
300- data += CreateTableHtml ("IntervalRequestData" , header , intervalRequestData )
188+ data += CreateTablePart ("IntervalRequestData" , header , intervalRequestData )
301189
302190 //show DetailRequestURLData
303191 detailRequestURLData := ""
@@ -310,9 +198,8 @@ func (state *ServerStateInfo) ShowHtmlTableData(version, globalUniqueId string)
310198 <th>Url</th>
311199 <th>Value</th>
312200 </tr>`
313- data += CreateTableHtml ("DetailRequestURLData" , header , detailRequestURLData )
314- html := strings .Replace (TableHtml , "{{tableBody}}" , data , - 1 )
315-
201+ data += CreateTablePart ("DetailRequestURLData" , header , detailRequestURLData )
202+ html := CreateHtml (data )
316203 return html
317204}
318205
0 commit comments