mirror of
https://github.com/openwrt/luci.git
synced 2026-10-13 22:17:44 +04:00
Add configurable dashboard cards and tabs, along with five-minute WAN traffic, CPU and memory history charts. This includes: - status cards for CPU, memory, load and uptime next to Internet, all of one shape: a title, a value and one line of text; - charts of the WAN traffic and of CPU and memory usage over the last five minutes; - a Layout tab to choose which cards, charts and tabs are shown and in what order, kept in UCI as dashboard.layout; - the time a wireless client has been connected, in the tooltips of the wireless client data usage chart and in the client table; - the IPv4 and the IPv6 address of the uplink on the Internet card, one line each, and the IPv6 address in the Internet tab. The samples behind the charts are taken on the router by a small rpcd ucode plugin, luci.dashboard, every five seconds whether or not somebody is looking, so the charts are full whenever the page is opened. It keeps the raw counters of /proc/stat, /proc/meminfo and /proc/net/dev with the router's monotonic clock in a ring of 60 samples. The page fetches what is new since its last poll and takes the differences, so a reload or a hidden tab leaves no gap and the rates do not depend on the browser's timing. One pass takes 2 to 3 ms on a quad-core IPQ60xx, about 0.07% of one core, and the ring about 360 kB of memory. Includes declare their widgets with a slot, an order and whether they show by default. An include with nothing on the page is not polled, and polling stops while the page is hidden. The layout form is a form.Map of three DynamicLists in the last tab; while it is open the poll redraws the cards and charts only. ui.DynamicList greys out a choice only once it is picked and always offers a custom value, so the form marks the values a list starts out with and drops the custom entry. All of it stays within luci-mod-dashboard. Name the charts WAN traffic, Wireless client distribution and Wireless client data usage to make their scope clear. Remove <code> formatting for consistent data display in tab tables, and add CPU usage breakdown tooltips to the total and per-core rows. Signed-off-by: Eamon Xiong <eamonxiong@gmail.com>