top counters style & adaptive for mobile displays
This commit is contained in:
@@ -57,7 +57,7 @@ namespace c {
|
||||
} // namespace c
|
||||
|
||||
namespace p {
|
||||
uint LAST_AND_TOP_LIST_SIZE = 5;
|
||||
uint LAST_AND_TOP_LIST_SIZE = 10;
|
||||
QStringList IGNORED_DESTINATIONS = {"[0.0.0.0]", "0.0.0.0"};
|
||||
QString WORKING_DIR = "data";
|
||||
QString SERVICE_TITLE = "3proxy-eagle";
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
@@ -54,7 +54,7 @@ void usage()
|
||||
" -a --bind-to-address <127.0.0.1>\n"
|
||||
" -p --bind-to-port <8161>\n"
|
||||
" -l --log-level <info> (off, error, warn, info, debug)\n"
|
||||
" -s --top-lists-size <5>\n"
|
||||
" -s --top-lists-size <10>\n"
|
||||
" -D --reject-ip-from-statistics\n\n"
|
||||
|
||||
"N O T E S:\n"
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ void Statistics::report(const LogEvent& event)
|
||||
m_lastDestinationsMtx.lock();
|
||||
if (not m_lastDestinations.contains(event.dest))
|
||||
{
|
||||
if (m_lastDestinations.size() >= static_cast<int>(g::p::LAST_AND_TOP_LIST_SIZE))
|
||||
if (m_lastDestinations.size() == 5)
|
||||
{
|
||||
m_lastDestinations.pop_back();
|
||||
}
|
||||
|
||||
+8
-20
@@ -36,14 +36,10 @@ const QString WebPage::m_lastDestinationItemBlocked ="\
|
||||
{{VALUE}}\n\
|
||||
</li>\n";
|
||||
|
||||
const QString WebPage::m_dailyTopDestinationItem = "\
|
||||
<li class=\"topDestinations__item\" title=\"{{COUNT}}\">\n\
|
||||
{{VALUE}}\n\
|
||||
</li>\n";
|
||||
|
||||
const QString WebPage::m_totalTopDestinationItem = "\
|
||||
<li class=\"topDestinations__item\" title=\"{{COUNT}}\">\n\
|
||||
{{VALUE}}\n\
|
||||
const QString WebPage::m_topDestinationItem = "\
|
||||
<li class=\"topDestinations__item\" title=\"{{VALUE}}\">\n\
|
||||
<span class=\"topDestinations__destination\">{{VALUE}}</span>\n\
|
||||
<span class=\"topDestinations__counter\">{{COUNT}}</span>\n\
|
||||
</li>\n";
|
||||
|
||||
const QString WebPage::m_blockedDestinationsBlock = "\
|
||||
@@ -211,14 +207,14 @@ void WebPage::topDestinations(QString &document)
|
||||
QString dailyTopList;
|
||||
for (const auto& dTop: Statistics::dailyTopDestinations())
|
||||
{
|
||||
dailyTopList += dailyTopDestinationItem(dTop.first, dTop.second);
|
||||
dailyTopList += topDestinationItem(dTop.first, dTop.second);
|
||||
}
|
||||
document.replace(g::c::HA_DAILY_TOP_DESTINATIONS_LIST, dailyTopList);
|
||||
|
||||
QString totalTopList;
|
||||
for (const auto& dTop: Statistics::totalTopDestinations())
|
||||
{
|
||||
totalTopList += totalTopDestinationItem(dTop.first, dTop.second);
|
||||
totalTopList += topDestinationItem(dTop.first, dTop.second);
|
||||
}
|
||||
document.replace(g::c::HA_TOTAL_TOP_DESTINATIONS_LIST, totalTopList);
|
||||
}
|
||||
@@ -319,17 +315,9 @@ QString WebPage::lastDestinationItemBlocked(const QString &destination)
|
||||
return result;
|
||||
}
|
||||
|
||||
QString WebPage::dailyTopDestinationItem(const QString &destination, quint64 count)
|
||||
QString WebPage::topDestinationItem(const QString &destination, quint64 count)
|
||||
{
|
||||
QString result {m_dailyTopDestinationItem};
|
||||
result.replace("{{VALUE}}", destination);
|
||||
result.replace("{{COUNT}}", QString::number(count));
|
||||
return result;
|
||||
}
|
||||
|
||||
QString WebPage::totalTopDestinationItem(const QString &destination, quint64 count)
|
||||
{
|
||||
QString result {m_totalTopDestinationItem};
|
||||
QString result {m_topDestinationItem};
|
||||
result.replace("{{VALUE}}", destination);
|
||||
result.replace("{{COUNT}}", QString::number(count));
|
||||
return result;
|
||||
|
||||
+2
-4
@@ -42,15 +42,13 @@ private:
|
||||
|
||||
static QString lastDestinationItemAllowed(const QString& destination);
|
||||
static QString lastDestinationItemBlocked(const QString& destination);
|
||||
static QString dailyTopDestinationItem(const QString& destination, quint64 count);
|
||||
static QString totalTopDestinationItem(const QString& destination, quint64 count);
|
||||
static QString topDestinationItem(const QString& destination, quint64 count);
|
||||
static QString blockedDestinationItem(const QString& destination, const QStringList& addresses);
|
||||
static HumanReadableValue bytesToHumanReadableString(quint64 bytes);
|
||||
|
||||
static const QString m_lastDestinationItemAllowed;
|
||||
static const QString m_lastDestinationItemBlocked;
|
||||
static const QString m_dailyTopDestinationItem;
|
||||
static const QString m_totalTopDestinationItem;
|
||||
static const QString m_topDestinationItem;
|
||||
static const QString m_blockedDestinationsBlock;
|
||||
static const QString m_blockedDestinationItemLvl1;
|
||||
static const QString m_blockedDestinationItemLvl2;
|
||||
|
||||
Reference in New Issue
Block a user