dashboard: pre-fill resource-limit inputs so editing one doesn't clear the other
mara: 'filling just one of the fields should not touch the other.' The cpu/mem override form always posts both fields, and the server correctly treats an empty field as 'clear this override' (documented, tested behavior in agent_config/resource_limits.rs). The bug was on the client: the inputs only ever showed the current effective value as a placeholder, never as the actual value — so a field left untouched looked filled to the eye but posted empty, silently clearing whatever override (or lack of one) was already in effect for that field. Fix: set .value to the current effective value (already fetched and displayed correctly in the read-only cap columns next to this form) so leaving a field alone round-trips it unchanged. One resulting nuance worth flagging: an agent with no per-agent override on a field, that's purely tracking the hive-wide default, now pins that field to today's default the first time *any* field on the form is edited, rather than continuing to silently follow future hive-default changes. Fixing that fully would need the server to expose whether each field is a real per-agent override or just the resolved default, which is more than this bug report asked for.
This commit is contained in:
parent
8cc7f90c98
commit
24673fac96
1 changed files with 11 additions and 2 deletions
|
|
@ -373,7 +373,14 @@ function renderContainerLoad(rows) {
|
|||
const cpuInput = document.createElement("input");
|
||||
cpuInput.type = "text";
|
||||
cpuInput.className = "cload-cpu-input";
|
||||
cpuInput.placeholder = cv ? cv.cpu_quota : "e.g. 200%";
|
||||
// Pre-fill with the current *effective* value (not just a placeholder)
|
||||
// so submitting after editing only the other field round-trips this one
|
||||
// unchanged. The form always posts both fields, and the server treats
|
||||
// an empty field as "clear this override" — a placeholder-only hint
|
||||
// reads as filled to the eye but posts as empty, silently resetting
|
||||
// whichever field the user didn't touch.
|
||||
cpuInput.value = cv ? cv.cpu_quota : "";
|
||||
cpuInput.placeholder = "e.g. 200%";
|
||||
cpuInput.title =
|
||||
'systemd CPUQuota= value (e.g. "400%"). empty = use hive default';
|
||||
cpuLabel.append(cpuInput);
|
||||
|
|
@ -384,7 +391,9 @@ function renderContainerLoad(rows) {
|
|||
const memInput = document.createElement("input");
|
||||
memInput.type = "text";
|
||||
memInput.className = "cload-mem-input";
|
||||
memInput.placeholder = cv ? cv.memory_max : "e.g. 8G";
|
||||
// Same reasoning as cpuInput above.
|
||||
memInput.value = cv ? cv.memory_max : "";
|
||||
memInput.placeholder = "e.g. 8G";
|
||||
memInput.title =
|
||||
'systemd MemoryMax= value (e.g. "8G", "50%", "infinity"). empty = use hive default';
|
||||
memLabel.append(memInput);
|
||||
|
|
|
|||
Loading…
Reference in a new issue