ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Successful in 6m31s
ci / test (pull_request) Successful in 13m28s
ci / build (pull_request) Successful in 10m23s
ci / image (pull_request) Successful in 5m51s
The monitor form let users tick any number of regions and only the save failed with the region limit. The form now knows the organization's regions-per-monitor limit: it says how many regions a monitor may use, counts the ticked ones, and once the limit is reached locks the other regions that count towards it, in the list and on the map, until one is unticked. Own regions stay free unless they count. The server still enforces the limit. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
41 lines
1.9 KiB
HTML
41 lines
1.9 KiB
HTML
<!doctype html><html><body data-msg-network="net">
|
|
<form id="monitor"><fieldset>
|
|
<p><span data-region-count></span></p>
|
|
<div id="monitor-regions" data-region-limit="2">
|
|
<label><input type="checkbox" name="regions" value="own" data-multi checked></label>
|
|
<label><input type="checkbox" name="regions" value="a" data-multi data-counted checked></label>
|
|
<label><input type="checkbox" name="regions" value="b" data-multi data-counted></label>
|
|
<label><input type="checkbox" name="regions" value="c" data-multi data-counted></label>
|
|
</div>
|
|
</fieldset></form>
|
|
<pre id="out"></pre>
|
|
<script>window.axios = { create: () => ({ interceptors: { request: { use() {} } }, request: async () => ({ data: {} }) }) };</script>
|
|
<script src="../assets/app.js"></script>
|
|
<script>
|
|
(async () => {
|
|
const out = [];
|
|
const check = (name, got, want) => {
|
|
const g = JSON.stringify(got), w = JSON.stringify(want);
|
|
out.push((g === w ? "PASS " : "FAIL ") + name + (g === w ? "" : " got=" + g + " want=" + w));
|
|
};
|
|
const box = (v) => document.querySelector(`[value="${v}"]`);
|
|
const locked = () => ["own", "a", "b", "c"].filter((v) => box(v).disabled);
|
|
const count = () => document.querySelector("[data-region-count]").textContent;
|
|
check("below the limit nothing is locked", locked(), []);
|
|
check("count shown", count(), "(1/2)");
|
|
box("b").click();
|
|
check("at the limit the other counted regions lock", locked(), ["c"]);
|
|
check("locked row marked", box("c").closest("label").classList.contains("is-locked"), true);
|
|
check("count follows", count(), "(2/2)");
|
|
box("c").click();
|
|
check("a locked region cannot be ticked", box("c").checked, false);
|
|
box("own").click();
|
|
box("own").click();
|
|
check("uncounted regions stay free", box("own").checked, true);
|
|
box("a").click();
|
|
check("unticking frees them again", locked(), []);
|
|
document.getElementById("out").textContent = out.join("\n");
|
|
})();
|
|
</script>
|
|
</body></html>
|