From 6122040752b5c5fa30733deb8d42d6c1451eb3aa Mon Sep 17 00:00:00 2001 From: Vladislav Ostapov Date: Fri, 31 Jan 2025 13:41:43 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=BE=D0=BF=D1=8B=D1=82=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=BD=D0=B0=D1=80=D0=B8=D1=81=D0=BE=D0=B2=D0=B0=D1=82=D1=8C=20?= =?UTF-8?q?=D0=B3=D1=80=D0=B0=D1=84=D0=B8=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.cpp | 9 +++++ static/dev.html | 54 ++++++++++++++++++----------- static/js/chart.js | 20 +++++++++++ static/js/chartjs-adapter-moment.js | 7 ++++ static/js/moment.js | 15 ++++++++ 5 files changed, 85 insertions(+), 20 deletions(-) create mode 100644 static/js/chart.js create mode 100644 static/js/chartjs-adapter-moment.js create mode 100644 static/js/moment.js diff --git a/src/main.cpp b/src/main.cpp index 4078bc2..5694aee 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -95,6 +95,9 @@ public: // картинки, их даже можно кешировать static constexpr const char* FAVICON_ICO = "/favicon.ico"; static constexpr const char* VUE_JS = "/js/vue.js"; // это тоже можно кешировать + static constexpr const char* CHARTJS = "/js/chart.js"; + static constexpr const char* MOMENT_JS = "/js/moment.js"; + static constexpr const char* CHARTJS_ADAPTER_MOMENT = "/js/chartjs-adapter-moment.js"; // а эти стили нельзя кешировать в отладочной версии static constexpr const char* STYLE_CSS = "/style.css"; @@ -117,6 +120,9 @@ public: auth.users.emplace_back(std::make_shared("developer", "10628cfc434fb87f31d675d37e0402c2d824cfe8393aff7a61ee57aaa7d909c3", http::auth::User::SUPERUSER)); sf->registerFile(staticFilesPath + "/favicon.png", FAVICON_ICO, mime_types::image_png, true); + sf->registerFile(staticFilesPath + CHARTJS, CHARTJS, mime_types::javascript, true); + sf->registerFile(staticFilesPath + MOMENT_JS, MOMENT_JS, mime_types::javascript, true); + sf->registerFile(staticFilesPath + CHARTJS_ADAPTER_MOMENT, CHARTJS_ADAPTER_MOMENT, mime_types::javascript, true); #ifdef USE_DEBUG sf->registerFile(staticFilesPath + VUE_JS, VUE_JS, mime_types::javascript, true); #else @@ -185,6 +191,9 @@ public: s.resources.emplace_back(std::make_unique(STYLE_CSS, [this](const auto& req, auto& rep) { boost::ignore_unused(req); sf->serve(STYLE_CSS, rep); })); s.resources.emplace_back(std::make_unique(FIELDS_CSS, [this](const auto& req, auto& rep) { boost::ignore_unused(req); sf->serve(FIELDS_CSS, rep); })); s.resources.emplace_back(std::make_unique(VUE_JS, [this](const auto& req, auto& rep) { boost::ignore_unused(req); sf->serve(VUE_JS, rep); })); + s.resources.emplace_back(std::make_unique(CHARTJS, [this](const auto& req, auto& rep) { boost::ignore_unused(req); sf->serve(CHARTJS, rep); })); + s.resources.emplace_back(std::make_unique(MOMENT_JS, [this](const auto& req, auto& rep) { boost::ignore_unused(req); sf->serve(MOMENT_JS, rep); })); + s.resources.emplace_back(std::make_unique(CHARTJS_ADAPTER_MOMENT, [this](const auto& req, auto& rep) { boost::ignore_unused(req); sf->serve(CHARTJS_ADAPTER_MOMENT, rep); })); s.resources.emplace_back(std::make_unique(INTERNET_JPG, [this](const auto& req, auto& rep) { boost::ignore_unused(req); sf->serve(INTERNET_JPG, rep); })); s.resources.emplace_back(std::make_unique("/api/get/statistics", this->auth, http::auth::User::WATCH_STATISTICS, [this](const auto& req, auto& rep) { diff --git a/static/dev.html b/static/dev.html index cfa3ab9..c5cd2cb 100644 --- a/static/dev.html +++ b/static/dev.html @@ -94,22 +94,14 @@

Просмотр логов

Скачать -
- - - - - - - - - -
{{ h }}
{{ value }}
-
+
+ + +