diff options
-rw-r--r-- | docs/profile.md | 2 | ||||
-rw-r--r-- | src/webserver_main.cpp | 52 | ||||
-rw-r--r-- | static/CMakeLists.txt | 20 | ||||
-rw-r--r-- | static/css/intel.css | 110 | ||||
-rw-r--r-- | static/partial-sensor.html | 2 |
5 files changed, 142 insertions, 44 deletions
diff --git a/docs/profile.md b/docs/profile.md index b3ceff0ace..e4c14a7d33 100644 --- a/docs/profile.md +++ b/docs/profile.md @@ -15,4 +15,4 @@ scp ed@hades.jf.intel.com:/home/ed/webserver/buildarm/getvideo /tmp -i /nv/.ssh/ kill -12 1480 -dbus-monitor --system "type='signal',path_namespace='/xyz/openbmc_project/sensors'"
\ No newline at end of file +dbus-monitor --system "type='signal',path_namespace='/xyz/openbmc_project/sensors/tach'"
\ No newline at end of file diff --git a/src/webserver_main.cpp b/src/webserver_main.cpp index d20b8d5af2..ec21f6d48d 100644 --- a/src/webserver_main.cpp +++ b/src/webserver_main.cpp @@ -54,7 +54,7 @@ void on_sensor_update(boost::system::error_code ec, dbus::message s) { s.unpack(object_name).unpack(values); crow::json::wvalue j; for (auto& value : values) { - //std::cout << "Got sensor value for " << s.get_path() << "\n"; + // std::cout << "Got sensor value for " << s.get_path() << "\n"; boost::apply_visitor([&](auto val) { j[s.get_path()] = val; }, value.second); } @@ -107,39 +107,25 @@ int main(int argc, char** argv) { CROW_ROUTE(app, "/sensorws") .websocket() .onopen([&](crow::websocket::connection& conn) { - system_bus = std::make_shared<dbus::connection>(conn.get_io_service(), - dbus::bus::system); - sensor_match = std::make_shared<dbus::match>( - *system_bus, - "type='signal',path_namespace='/xyz/openbmc_project/sensors'"); - - sensor_filter = - std::make_shared<dbus::filter>(*system_bus, [](dbus::message& m) { - auto member = m.get_member(); - return member == "PropertiesChanged"; - }); - /* - std::function<void(boost::system::error_code, dbus::message)> - sensor_callback = [&conn, sensor_callback]( - boost::system::error_code ec, dbus::message s) { - std::string object_name; - std::vector<std::pair<std::string, dbus::dbus_variant>> values; - s.unpack(object_name).unpack(values); - crow::json::wvalue j; - for (auto& value : values) { - std::cout << "Got sensor value for " << s.get_path() << "\n"; - boost::apply_visitor([&](auto val) { j[s.get_path()] = val; }, - value.second); - } - for (auto conn : users) { - conn.send_text(crow::json::dump(j)); - } - sensor_filter->async_dispatch(sensor_callback); - }; - */ - sensor_filter->async_dispatch(on_sensor_update); + if (!system_bus) { + system_bus = std::make_shared<dbus::connection>(conn.get_io_service(), + dbus::bus::system); + } + if (!sensor_match) { + sensor_match = std::make_shared<dbus::match>( + *system_bus, + "type='signal',path_namespace='/xyz/openbmc_project/sensors'"); + } + if (!sensor_filter) { + sensor_filter = + std::make_shared<dbus::filter>(*system_bus, [](dbus::message& m) { + auto member = m.get_member(); + return member == "PropertiesChanged"; + }); + sensor_filter->async_dispatch(on_sensor_update); + } + users.insert(&conn); - ; }) .onclose( [&](crow::websocket::connection& conn, const std::string& reason) { diff --git a/static/CMakeLists.txt b/static/CMakeLists.txt index b5a53ecbe9..4e6831c13d 100644 --- a/static/CMakeLists.txt +++ b/static/CMakeLists.txt @@ -79,15 +79,17 @@ foreach(JAVASCRIPT_ASSET ${JAVASCRIPT_ASSETS}) get_filename_component(FOLDERNAME ${MINIFIED_FILENAME} DIRECTORY) # string(REGEX REPLACE "(\\.[^.]*$)" ".min\\1" OUTPUT_FILENAME ${OUTPUT_FILENAME}) file(MAKE_DIRECTORY "${FOLDERNAME}") - add_custom_command(OUTPUT ${MINIFIED_FILENAME} - COMMAND uglifyjs --compress --mangle - --output "${MINIFIED_FILENAME}" - "${CMAKE_CURRENT_SOURCE_DIR}/${JAVASCRIPT_ASSET}" - DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${JAVASCRIPT_ASSET}" - COMMENT "Minifying ${JAVASCRIPT_ASSET}" - ) - - list(APPEND MINIFIED_ASSETS_OUT ${MINIFIED_FILENAME}) + if(UGLIFY_MINIFIER) + add_custom_command(OUTPUT ${MINIFIED_FILENAME} + COMMAND uglifyjs --compress --mangle + --output "${MINIFIED_FILENAME}" + "${CMAKE_CURRENT_SOURCE_DIR}/${JAVASCRIPT_ASSET}" + DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${JAVASCRIPT_ASSET}" + COMMENT "Minifying ${JAVASCRIPT_ASSET}" + ) + list(APPEND MINIFIED_ASSETS_OUT ${MINIFIED_FILENAME}) + endif(UGLIFY_MINIFIER) + # if it's a debug build, use the unminified version if (CMAKE_BUILD_TYPE STREQUAL "Debug" OR NOT UGLIFY_MINIFIER) list(APPEND STATIC_ASSETS_OUT ${CMAKE_CURRENT_SOURCE_DIR}/${JAVASCRIPT_ASSET}) diff --git a/static/css/intel.css b/static/css/intel.css index 6915f8adac..2596d1e1bf 100644 --- a/static/css/intel.css +++ b/static/css/intel.css @@ -2880,5 +2880,115 @@ a.forgot-pass { color: #fff!important } +.animate-enter { + -webkit-animation: enter 600ms cubic-bezier(0.390, 0.575, 0.565, 1.000); + animation: enter 600ms cubic-bezier(0.390, 0.575, 0.565, 1.000); + display: block; + position: relative; +} + +@-webkit-keyframes enter { + from { + opacity: 0; + height: 0px; + } + 20% { + opacity: .5; + } + 40% { + opacity: .15; + color: red; + } + 60% { + opacity: .75; + } + 80% { + opacity: .3; + } + to { + opacity: 1; + height: 30px; + } +} + +@keyframes enter { + from { + opacity: 0; + height: 0px; + } + 20% { + opacity: .5; + } + 40% { + opacity: .15; + color: red; + } + 60% { + opacity: .75; + } + 80% { + opacity: .3; + } + to { + opacity: 1; + height: 30px; + } +} + +.animate-leave { + -webkit-animation: leave 600ms cubic-bezier(0.390, 0.575, 0.565, 1.000); + animation: leave 600ms cubic-bezier(0.390, 0.575, 0.565, 1.000); + display: block; + position: relative; +} + +@-webkit-keyframes leave { + to { + opacity: 0; + height: 0px; + } + 80% { + opacity: .25; + } + 60% { + opacity: .10; + color: red; + } + 40% { + opacity: .5; + } + 20% { + opacity: .30; + } + from { + opacity: 1; + height: 30px; + } +} + +@keyframes leave { + to { + opacity: 0; + height: 0px; + } + 80% { + opacity: .25; + } + 60% { + opacity: .10; + color: red; + } + 40% { + opacity: .5; + } + 20% { + opacity: .30; + } + from { + opacity: 1; + height: 30px; + } +} + /*# sourceMappingURL=../maps/styles/auth-a200a050c1.css.map */
\ No newline at end of file diff --git a/static/partial-sensor.html b/static/partial-sensor.html index 09f1cadfde..3486a63610 100644 --- a/static/partial-sensor.html +++ b/static/partial-sensor.html @@ -15,7 +15,7 @@ </tr> </thead> <tbody> - <tr ng-repeat="(sensor_name, value) in sensor_values"> + <tr ng-animate="'animate'" ng-repeat="(sensor_name, value) in sensor_values"> <td class="fit">{{ sensor_name }}</td> <td class="fit">{{ value }}</td> </tr> |