Expression fields as choices: values from a list, conditions in words #35

Merged
jcoffey-dev merged 1 commits from feature/expression-simple-mode into main 2026-09-28 21:54:18 +00:00
Owner

Second step of the settings reorganization (spec: settings-reorg). Needs inbuxa-server #91, which puts each expression field's allowed constants and variables in the schema. Without it, fields look exactly as they do today.

With the hints, an expression field opens in a plain form:

  • Values: a value that is one of the field's constants is a dropdown (Relaxed / Strict / Off…), with Custom expression… for anything else.
  • Conditions: a condition that is one comparison reads Port on this server / is / 25, with the variable chosen from the ones the field allows. Words are quoted and numbers, durations and booleans are left bare when it's written back.
  • Summary line: when the whole rule can be said in words, a line above says it: Relaxed when port on this server is 25; otherwise off.
  • Fallbacks: anything the form can't read (functions, &&, variables as values) stays as text. It is never rewritten. Edit as text brings back the full IF / THEN / ELSE editor, and Edit as choices returns.

Labels are ours: 19 constants, and about 40 common variables named; the rest are humanized. English only, like the rest of the console.

Checked: unit tests for parsing, literals, round-trips and summaries (428 total), plus typecheck, lint and build. In Chrome against a local server built from #91, on Sender checks: DKIM verification was set to Strict from the dropdown. A condition was then built from scratch (port on this server is 587 → Off), and the text view showed local_port == 587 → disable, else strict. After saving and reloading it read back the same. DKIM signing, which uses a function, stays as text.

Second step of the settings reorganization (spec: settings-reorg). Needs inbuxa-server #91, which puts each expression field's allowed constants and variables in the schema. Without it, fields look exactly as they do today. With the hints, an expression field opens in a plain form: - **Values:** a value that is one of the field's constants is a dropdown (Relaxed / Strict / Off…), with *Custom expression…* for anything else. - **Conditions:** a condition that is one comparison reads *Port on this server / is / 25*, with the variable chosen from the ones the field allows. Words are quoted and numbers, durations and booleans are left bare when it's written back. - **Summary line:** when the whole rule can be said in words, a line above says it: *Relaxed when port on this server is 25; otherwise off*. - **Fallbacks:** anything the form can't read (functions, `&&`, variables as values) stays as text. It is never rewritten. *Edit as text* brings back the full IF / THEN / ELSE editor, and *Edit as choices* returns. Labels are ours: 19 constants, and about 40 common variables named; the rest are humanized. English only, like the rest of the console. **Checked:** unit tests for parsing, literals, round-trips and summaries (428 total), plus typecheck, lint and build. In Chrome against a local server built from #91, on Sender checks: DKIM verification was set to Strict from the dropdown. A condition was then built from scratch (port on this server is 587 → Off), and the text view showed `local_port == 587` → `disable`, else `strict`. After saving and reloading it read back the same. DKIM signing, which uses a function, stays as text.
jcoffey-dev added 1 commit 2026-09-28 17:43:33 +00:00
Expression fields as choices: values from a list, conditions in words
ci / build (pull_request) Successful in 2m9s
ci / publish (pull_request) Skipped
6337dc5364
With the server's schema naming each expression field's allowed constants
and variables, an expression field opens in a plain form:

- a value that is one of the constants is a dropdown (Relaxed, Strict,
  Off), with Custom expression… for anything else;
- a condition that is one comparison reads "Port on this server / is /
  25", with the variable picked from the ones the field allows;
- a line above says the whole thing in words when it can ("Relaxed when
  port on this server is 25; otherwise off").

What the form can't read stays as text, and Edit as text gives the full
IF / THEN / ELSE editor back. Without hints from the server the field is
unchanged.
jcoffey-dev merged commit 96ab1cecc9 into main 2026-09-28 21:54:18 +00:00
jcoffey-dev deleted branch feature/expression-simple-mode 2026-09-28 21:54:18 +00:00
Sign in to join this conversation.