Repository navigation
Show and change a device's blocking from its Insights panel - #415
Merged
Merged
Conversation
The device panel gains a Blocking section: the rule set the device uses and what put it there (its hardware address, an address, a network, or Bypass Clients), a picker to give it a rule set of its own or fall back to what it inherits, and Block Everything holds for 30 minutes, an hour, until a time, or until turned off, with a live countdown, Add 30 Minutes and End Now. Matching reuses the DNS server's client table through dnsserver.MatchClient so the panel agrees with what DNS does. Part of #240.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before: a device's Insights panel shows what it is and what it queries, but nothing about blocking. Putting a device in a rule set means editing
[[clients]], and there's no way to cut a device off for a while.After: the panel has a Blocking section. It names the rule set the device uses and what put it there (its hardware address, an address, a network, or Bypass Clients). A pencil opens a picker to give the device a rule set of its own or fall back to what it inherits, and the inherited choice says where it comes from, like "Guests (from the network 10.20.40.0/24)". Block Everything blocks the device for 30 minutes, an hour, until a time, or until turned off. While held, the panel shows when it ends with a live countdown, plus Add 30 Minutes and End Now. A hold that comes from a network says so, and ending it ends it for that network.
Part of #240 (PR 4b). Changes need
blocking.write; viewers without it see the section read-only.How:
dnsserver.MatchClientruns the DNS server's own client table (exact address, then MAC, then most specific network, bypass first) so the panel always agrees with DNS.config.SetClientRuleSetreuses the name/type editor path, so a MAC entry takes over the device's exact-address entries.ruleSetService.Assignwrites and audits the change (blocking.rule_set.assign/unassign) and refuses unknown rule sets; holds go through the existingholdService. New routes arePOST /ui/insights/devices/rule-setand/hold. The countdown is a small[data-countdown-until]ticker in app.js that refreshes the panel when the hold ends.Screenshots
Before shots are from
main. The editor and hold states are new, so they have after shots only.Phone
Testing
go tool mage verifypasses. New tests cover the panel's rule set picker (including permissions and an unknown set), bypassed devices, holds (start, extend, end, until turned off, bad times), network holds,holdUntil,timeLeft,config.SetClientRuleSet, anddnsserver.MatchClient.