aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/monlib/service/pages/html_mon_page.cpp
blob: e569063da84217cbc522517e86375a68afc37d3d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include "html_mon_page.h"

#include <library/cpp/monlib/service/pages/templates.h>

using namespace NMonitoring;

void THtmlMonPage::Output(NMonitoring::IMonHttpRequest& request) {
    IOutputStream& out = request.Output();
 
    out << HTTPOKHTML;
    HTML(out) {
        out << "<!DOCTYPE html>\n";
        HTML_TAG() {
            HEAD() {
                if (!!Title) {
                    out << "<title>" << Title << "</title>\n";
                }
                out << "<link rel='stylesheet' href='https://yastatic.net/bootstrap/3.3.1/css/bootstrap.min.css'>\n";
                out << "<script language='javascript' type='text/javascript' src='https://yastatic.net/jquery/2.1.3/jquery.min.js'></script>\n";
                out << "<script language='javascript' type='text/javascript' src='https://yastatic.net/bootstrap/3.3.1/js/bootstrap.min.js'></script>\n";
 
                if (OutputTableSorterJsCss) { 
                    out << "<link rel='stylesheet' href='/jquery.tablesorter.css'>\n";
                    out << "<script language='javascript' type='text/javascript' src='/jquery.tablesorter.js'></script>\n";
                } 
 
                out << "<style type=\"text/css\">\n";
                out << ".table-nonfluid { width: auto; }\n";
                out << ".narrow-line50 {line-height: 50%}\n";
                out << ".narrow-line60 {line-height: 60%}\n";
                out << ".narrow-line70 {line-height: 70%}\n";
                out << ".narrow-line80 {line-height: 80%}\n";
                out << ".narrow-line90 {line-height: 90%}\n";
                out << "</style>\n";
            }
            BODY() {
                OutputNavBar(out);

                DIV_CLASS("container") {
                    if (!!Title) {
                        out << "<h2>" << Title << "</h2>";
                    }
                    OutputContent(request);
                }
            }
        }
    }
}

void THtmlMonPage::NotFound(NMonitoring::IMonHttpRequest& request) const {
    IOutputStream& out = request.Output();
    out << HTTPNOTFOUND;
    out.Flush();
}

void THtmlMonPage::NoContent(NMonitoring::IMonHttpRequest& request) const {
    IOutputStream& out = request.Output();
    out << HTTPNOCONTENT;
    out.Flush();
}