aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/monlib/service/pages
diff options
context:
space:
mode:
authorAndrey Fomichev <andrey.fomichev@gmail.com>2022-02-10 16:49:15 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:49:15 +0300
commit1c61afbf3db63940d05e6fefa3104b03457788a1 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/monlib/service/pages
parente542cc14db4240643a06bb0dde87ecf361f101ab (diff)
downloadydb-1c61afbf3db63940d05e6fefa3104b03457788a1.tar.gz
Restoring authorship annotation for Andrey Fomichev <andrey.fomichev@gmail.com>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/monlib/service/pages')
-rw-r--r--library/cpp/monlib/service/pages/html_mon_page.cpp16
-rw-r--r--library/cpp/monlib/service/pages/index_mon_page.cpp28
-rw-r--r--library/cpp/monlib/service/pages/pre_mon_page.cpp6
-rw-r--r--library/cpp/monlib/service/pages/pre_mon_page.h2
-rw-r--r--library/cpp/monlib/service/pages/templates.cpp36
-rw-r--r--library/cpp/monlib/service/pages/templates.h116
6 files changed, 102 insertions, 102 deletions
diff --git a/library/cpp/monlib/service/pages/html_mon_page.cpp b/library/cpp/monlib/service/pages/html_mon_page.cpp
index 26c9a69334..eb4eb3b66c 100644
--- a/library/cpp/monlib/service/pages/html_mon_page.cpp
+++ b/library/cpp/monlib/service/pages/html_mon_page.cpp
@@ -24,14 +24,14 @@ void THtmlMonPage::Output(NMonitoring::IMonHttpRequest& request) {
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";
+ 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);
diff --git a/library/cpp/monlib/service/pages/index_mon_page.cpp b/library/cpp/monlib/service/pages/index_mon_page.cpp
index fb41f468a6..83ff8b529a 100644
--- a/library/cpp/monlib/service/pages/index_mon_page.cpp
+++ b/library/cpp/monlib/service/pages/index_mon_page.cpp
@@ -67,19 +67,19 @@ void TIndexMonPage::OutputIndex(IOutputStream& out, bool pathEndsWithSlash) {
void TIndexMonPage::Register(TMonPagePtr page) {
TGuard<TMutex> g(Mtx);
- auto insres = PagesByPath.insert(std::make_pair("/" + page->GetPath(), page));
- if (insres.second) {
- // new unique page just inserted, update Pages
- Pages.push_back(page);
- } else {
- // a page with the given path is already present, replace it with the new page
-
- // find old page, sorry for O(n)
- auto it = std::find(Pages.begin(), Pages.end(), insres.first->second);
- *it = page;
- // this already present, replace it
- insres.first->second = page;
- }
+ auto insres = PagesByPath.insert(std::make_pair("/" + page->GetPath(), page));
+ if (insres.second) {
+ // new unique page just inserted, update Pages
+ Pages.push_back(page);
+ } else {
+ // a page with the given path is already present, replace it with the new page
+
+ // find old page, sorry for O(n)
+ auto it = std::find(Pages.begin(), Pages.end(), insres.first->second);
+ *it = page;
+ // this already present, replace it
+ insres.first->second = page;
+ }
page->Parent = this;
}
@@ -90,7 +90,7 @@ TIndexMonPage* TIndexMonPage::RegisterIndexPage(const TString& path, const TStri
return page;
}
page = new TIndexMonPage(path, title);
- Register(page);
+ Register(page);
return VerifyDynamicCast<TIndexMonPage*>(page);
}
diff --git a/library/cpp/monlib/service/pages/pre_mon_page.cpp b/library/cpp/monlib/service/pages/pre_mon_page.cpp
index 6db90243ee..fc03a19b80 100644
--- a/library/cpp/monlib/service/pages/pre_mon_page.cpp
+++ b/library/cpp/monlib/service/pages/pre_mon_page.cpp
@@ -4,14 +4,14 @@ using namespace NMonitoring;
void TPreMonPage::OutputContent(NMonitoring::IMonHttpRequest& request) {
auto& out = request.Output();
- if (PreTag) {
+ if (PreTag) {
BeforePre(request);
out << "<pre>\n";
OutputText(out, request);
out << "</pre>\n";
- } else {
+ } else {
OutputText(out, request);
- }
+ }
}
void TPreMonPage::BeforePre(NMonitoring::IMonHttpRequest&) {
diff --git a/library/cpp/monlib/service/pages/pre_mon_page.h b/library/cpp/monlib/service/pages/pre_mon_page.h
index 281e625de3..c9a923d39a 100644
--- a/library/cpp/monlib/service/pages/pre_mon_page.h
+++ b/library/cpp/monlib/service/pages/pre_mon_page.h
@@ -23,5 +23,5 @@ namespace NMonitoring {
const bool PreTag;
};
-
+
}
diff --git a/library/cpp/monlib/service/pages/templates.cpp b/library/cpp/monlib/service/pages/templates.cpp
index 281f9c9c68..ece12bea71 100644
--- a/library/cpp/monlib/service/pages/templates.cpp
+++ b/library/cpp/monlib/service/pages/templates.cpp
@@ -1,35 +1,35 @@
-#include "templates.h"
-
-namespace NMonitoring {
+#include "templates.h"
+
+namespace NMonitoring {
extern const char HtmlTag[] = "html";
extern const char HeadTag[] = "head";
extern const char BodyTag[] = "body";
- extern const char DivTag[] = "div";
- extern const char TableTag[] = "table";
- extern const char TableHeadTag[] = "thead";
- extern const char TableBodyTag[] = "tbody";
- extern const char TableRTag[] = "tr";
- extern const char TableDTag[] = "td";
- extern const char TableHTag[] = "th";
- extern const char FormTag[] = "form";
- extern const char LabelTag[] = "label";
- extern const char SpanTag[] = "span";
- extern const char CaptionTag[] = "caption";
+ extern const char DivTag[] = "div";
+ extern const char TableTag[] = "table";
+ extern const char TableHeadTag[] = "thead";
+ extern const char TableBodyTag[] = "tbody";
+ extern const char TableRTag[] = "tr";
+ extern const char TableDTag[] = "td";
+ extern const char TableHTag[] = "th";
+ extern const char FormTag[] = "form";
+ extern const char LabelTag[] = "label";
+ extern const char SpanTag[] = "span";
+ extern const char CaptionTag[] = "caption";
extern const char PreTag[] = "pre";
- extern const char ParaTag[] = "p";
+ extern const char ParaTag[] = "p";
extern const char H1Tag[] = "h1";
extern const char H2Tag[] = "h2";
extern const char H3Tag[] = "h3";
extern const char H4Tag[] = "h4";
extern const char H5Tag[] = "h5";
extern const char H6Tag[] = "h6";
- extern const char SmallTag[] = "small";
- extern const char StrongTag[] = "strong";
+ extern const char SmallTag[] = "small";
+ extern const char StrongTag[] = "strong";
extern const char ListTag[] = "li";
extern const char UListTag[] = "ul";
extern const char OListTag[] = "ol";
extern const char DListTag[] = "dl";
extern const char DTermTag[] = "dt";
extern const char DDescTag[] = "dd";
-
+
}
diff --git a/library/cpp/monlib/service/pages/templates.h b/library/cpp/monlib/service/pages/templates.h
index dba4e8a11a..b4656f059f 100644
--- a/library/cpp/monlib/service/pages/templates.h
+++ b/library/cpp/monlib/service/pages/templates.h
@@ -1,10 +1,10 @@
-#pragma once
-
-#include <util/stream/output.h>
+#pragma once
+
+#include <util/stream/output.h>
#include <util/system/defaults.h>
-
+
#define WITH_SCOPED(var, value) WITH_SCOPED_I(var, value, Y_GENERATE_UNIQUE_ID(WITH_SCOPED_LABEL_))
-
+
#define WITH_SCOPED_I(var, value, label) \
if (auto var = (value)) { \
Y_UNUSED(var); \
@@ -12,7 +12,7 @@
} else \
label \
:
-
+
#define TAG(name) WITH_SCOPED(tmp, NMonitoring::name(__stream))
#define TAG_CLASS(name, cls) WITH_SCOPED(tmp, NMonitoring::name(__stream, cls))
#define TAG_CLASS_STYLE(name, cls, style) WITH_SCOPED(tmp, NMonitoring::name(__stream, {{"class", cls}, {"style", style}}))
@@ -21,7 +21,7 @@
#define TAG_ATTRS(name, ...) WITH_SCOPED(tmp, NMonitoring::name(__stream, ##__VA_ARGS__))
#define HTML(str) WITH_SCOPED(__stream, NMonitoring::TOutputStreamRef(str))
-
+
#define HEAD() TAG(THead)
#define BODY() TAG(TBody)
#define HTML_TAG() TAG(THtml)
@@ -51,7 +51,7 @@
#define LABEL_CLASS_FOR(cls, for0) TAG_CLASS_FOR(TLabelC, cls, for0)
#define SPAN_CLASS(cls) TAG_CLASS(TSpanC, cls)
#define SPAN_CLASS_STYLE(cls, style) TAG_CLASS_STYLE(TSpanC, cls, style)
-
+
#define PARA() TAG(TPara)
#define PARA_CLASS(cls) TAG_CLASS(TPara, cls)
@@ -67,7 +67,7 @@
#define H5_CLASS(cls) TAG_CLASS(TH5, cls)
#define H6() TAG(TH6)
#define H6_CLASS(cls) TAG_CLASS(TH6, cls)
-
+
#define SMALL() TAG(TSMALL)
#define STRONG() TAG(TSTRONG)
@@ -77,7 +77,7 @@
#define UL_CLASS(cls) TAG_CLASS(TULIST, cls)
#define OL() TAG(TOLIST)
#define OL_CLASS(cls) TAG_CLASS(TOLIST, cls)
-
+
#define DL() TAG(DLIST)
#define DL_CLASS(cls) TAG_CLASS(DLIST, cls)
#define DT() TAG(DTERM)
@@ -88,16 +88,16 @@
#define CAPTION() TAG(TCaption)
#define CAPTION_CLASS(cls) CAPTION_CLASS(TCaption, cls)
-#define HTML_OUTPUT_PARAM(str, param) str << #param << ": " << param << "<br/>"
-#define HTML_OUTPUT_TIME_PARAM(str, param) str << #param << ": " << ToStringLocalTimeUpToSeconds(param) << "<br/>"
-
+#define HTML_OUTPUT_PARAM(str, param) str << #param << ": " << param << "<br/>"
+#define HTML_OUTPUT_TIME_PARAM(str, param) str << #param << ": " << ToStringLocalTimeUpToSeconds(param) << "<br/>"
+
#define COLLAPSED_BUTTON_CONTENT(targetId, buttonText) \
WITH_SCOPED(tmp, NMonitoring::TCollapsedButton(__stream, targetId, buttonText))
-
+
#define HREF(path) \
WITH_SCOPED(tmp, NMonitoring::THref(__stream, path))
-namespace NMonitoring {
+namespace NMonitoring {
struct THref {
THref(IOutputStream& str, TStringBuf path)
: Str(str)
@@ -117,16 +117,16 @@ namespace NMonitoring {
};
template <const char* tag>
- struct TTag {
+ struct TTag {
TTag(IOutputStream& str, TStringBuf cls = "", TStringBuf for0 = "", TStringBuf id = "")
- : Str(str)
- {
+ : Str(str)
+ {
Str << "<" << tag;
-
+
if (!cls.empty()) {
Str << " class=\"" << cls << "\"";
}
-
+
if (!for0.empty()) {
Str << " for=\"" << for0 << "\"";
}
@@ -135,8 +135,8 @@ namespace NMonitoring {
Str << "id=\"" << id << "\"";
}
Str << ">";
- }
-
+ }
+
TTag(IOutputStream& str, std::initializer_list<std::pair<TStringBuf, TStringBuf>> attributes)
: Str(str)
{
@@ -149,44 +149,44 @@ namespace NMonitoring {
Str << ">";
}
- ~TTag() {
+ ~TTag() {
try {
Str << "</" << tag << ">";
} catch (...) {
}
- }
-
+ }
+
explicit inline operator bool() const noexcept {
return true; // just to work with WITH_SCOPED
}
IOutputStream& Str;
- };
-
- // a nice class for creating collapsable regions of html output
- struct TCollapsedButton {
+ };
+
+ // a nice class for creating collapsable regions of html output
+ struct TCollapsedButton {
TCollapsedButton(IOutputStream& str, const TString& targetId, const TString& buttonText)
- : Str(str)
- {
- Str << "<button type='button' class='btn' data-toggle='collapse' data-target='#" << targetId << "'>"
- << buttonText << "</button>";
- Str << "<div id='" << targetId << "' class='collapse'>";
- }
-
- ~TCollapsedButton() {
- try {
- Str << "</div>";
+ : Str(str)
+ {
+ Str << "<button type='button' class='btn' data-toggle='collapse' data-target='#" << targetId << "'>"
+ << buttonText << "</button>";
+ Str << "<div id='" << targetId << "' class='collapse'>";
+ }
+
+ ~TCollapsedButton() {
+ try {
+ Str << "</div>";
} catch (...) {
}
- }
-
+ }
+
explicit inline operator bool() const noexcept {
return true; // just to work with WITH_SCOPED
}
IOutputStream& Str;
- };
-
+ };
+
struct TOutputStreamRef {
TOutputStreamRef(IOutputStream& str)
: Str(str)
@@ -234,31 +234,31 @@ namespace NMonitoring {
extern const char DListTag[3];
extern const char DTermTag[3];
extern const char DDescTag[3];
-
+
typedef TTag<HtmlTag> THtml;
typedef TTag<HeadTag> THead;
typedef TTag<BodyTag> TBody;
- typedef TTag<DivTag> TDiv;
- typedef TTag<TableTag> TTable;
- typedef TTag<TableHeadTag> TTableHead;
- typedef TTag<TableBodyTag> TTableBody;
- typedef TTag<TableRTag> TTableR;
- typedef TTag<TableDTag> TTableD;
- typedef TTag<TableHTag> TTableH;
- typedef TTag<FormTag> TFormC;
- typedef TTag<LabelTag> TLabelC;
- typedef TTag<SpanTag> TSpanC;
- typedef TTag<CaptionTag> TCaption;
+ typedef TTag<DivTag> TDiv;
+ typedef TTag<TableTag> TTable;
+ typedef TTag<TableHeadTag> TTableHead;
+ typedef TTag<TableBodyTag> TTableBody;
+ typedef TTag<TableRTag> TTableR;
+ typedef TTag<TableDTag> TTableD;
+ typedef TTag<TableHTag> TTableH;
+ typedef TTag<FormTag> TFormC;
+ typedef TTag<LabelTag> TLabelC;
+ typedef TTag<SpanTag> TSpanC;
+ typedef TTag<CaptionTag> TCaption;
typedef TTag<PreTag> TPre;
- typedef TTag<ParaTag> TPara;
+ typedef TTag<ParaTag> TPara;
typedef TTag<H1Tag> TH1;
typedef TTag<H2Tag> TH2;
typedef TTag<H3Tag> TH3;
typedef TTag<H4Tag> TH4;
typedef TTag<H5Tag> TH5;
typedef TTag<H6Tag> TH6;
- typedef TTag<SmallTag> TSMALL;
- typedef TTag<StrongTag> TSTRONG;
+ typedef TTag<SmallTag> TSMALL;
+ typedef TTag<StrongTag> TSTRONG;
typedef TTag<ListTag> TLIST;
typedef TTag<UListTag> TULIST;
typedef TTag<OListTag> TOLIST;