Dawnline 0.12.0
Build packages / CI (push) Blocked by required conditions
Build packages / Version (push) Waiting to run
CI / Web (format, types, tests, bundles) (push) Blocked by required conditions
CI / ShellCheck (push) Blocked by required conditions
CI / ucode static checks (push) Blocked by required conditions
CI / ucode compiles and tests pass (OpenWrt 24.10) (push) Blocked by required conditions
CI / ucode compiles and tests pass (OpenWrt 25.12) (push) Blocked by required conditions
Build packages / CI (push) Blocked by required conditions
Build packages / Version (push) Waiting to run
CI / Web (format, types, tests, bundles) (push) Blocked by required conditions
CI / ShellCheck (push) Blocked by required conditions
CI / ucode static checks (push) Blocked by required conditions
CI / ucode compiles and tests pass (OpenWrt 24.10) (push) Blocked by required conditions
CI / ucode compiles and tests pass (OpenWrt 25.12) (push) Blocked by required conditions
- The portal's traffic charts show what came down and what went up apart. A device's last 7 days and "Data this month" draw each day both ways: downloads rise above a thin line, uploads hang below it, on one scale. Beside them "↓ 3.2 GB ↑ 557 MB" instead of one total; hover a day for its own, its date where "left" stands - Charts answer the pointer between their bars too, in the portal and in the admin's daily charts (a device's week, a device card's 30 days, the last 30 days): the figures no longer blink back to the total - The calendar under "Access until" plays its days in only when the row is opened, not again each time the page refreshes with it open - On a phone the page comes in from the top down: "Your access" first, then the devices - "Show key" on a router's set-up morphs to "Hide key" with its icon, and brings the keys themselves into focus (it blurred the field names)
This commit is contained in:
1 parent
2f2aaf6c34
commit
fb73ac3a9f
33 files changed
+396
-199
No files matched your search
@@ -0,0 +1,40 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import type { Pair } from '../src/shared/types';
|
||||
import { mirror, sumDays } from '../src/portal/ui/bars';
|
||||
|
||||
/** [rx, tx]: what the device sent, what it received. */
|
||||
const days: Pair[] = [
|
||||
[10, 90],
|
||||
[40, 60],
|
||||
[5, 120],
|
||||
];
|
||||
|
||||
describe('mirrored bars', () => {
|
||||
it('splits the height between the two directions around the hairline', () => {
|
||||
const m = mirror(days, 64);
|
||||
expect(m.top + m.bottom + 3).toBe(64);
|
||||
});
|
||||
|
||||
it('fits both peaks on one scale, the tighter one filling its half', () => {
|
||||
const m = mirror(days, 64);
|
||||
expect(120 * m.scale).toBeLessThanOrEqual(m.top);
|
||||
expect(40 * m.scale).toBeLessThanOrEqual(m.bottom);
|
||||
expect(Math.max(120 * m.scale - m.top, 40 * m.scale - m.bottom)).toBeCloseTo(0);
|
||||
});
|
||||
|
||||
it('keeps 55–80% of the height for downloads, however lopsided the days', () => {
|
||||
expect(mirror([[0, 100]], 64).top).toBe(Math.round(61 * 0.8));
|
||||
expect(mirror([[100, 1]], 64).top).toBe(Math.round(61 * 0.55));
|
||||
});
|
||||
|
||||
it('draws a month without traffic', () => {
|
||||
const m = mirror([[0, 0]], 34);
|
||||
expect(Number.isFinite(m.scale)).toBe(true);
|
||||
expect(m.top).toBeGreaterThan(m.bottom);
|
||||
});
|
||||
|
||||
it('adds the days up both ways', () => {
|
||||
expect(sumDays(days)).toEqual([55, 270]);
|
||||
expect(sumDays([])).toEqual([0, 0]);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user