wu-sheng opened a new pull request, #46:
URL: https://github.com/apache/skywalking-horizon-ui/pull/46
## What
Replaces the free-text `visibleWhen` widget predicate with a **structured
gate evaluated server-side**, so a dashboard widget renders only when it's
relevant to the selected entity — and a gated-out group skips its queries
entirely.
`visibleWhen` is now a discriminated object:
```ts
type VisibleWhen =
| { kind: 'mqe'; expression: string; op: 'exists' }
| { kind: 'mqe'; expression: string; op: 'gt' | 'lt'; value: number }
| { kind: 'entity'; attribute: string; op: 'exists' }
| { kind: 'entity'; attribute: string; op: 'eq'; value: string };
```
### Gate semantics
- **MQE** — `exists` / `>` / `<`, existential across **every labeled series
and bucket** of the expression's result.
- Naming the widget's **own** expression → *self-gate* (evaluated from the
widget's own batch result; **no extra query**).
- Naming a **different** metric → *group-gate* on one shared signal:
probed **once** (deduped, keyed by expression + `layerScope`) and the whole
group's MQE is **skipped** when empty — a non-JVM instance never runs the JVM
widget queries.
- **Entity** (Instance scope only) — `exists` (present & non-empty) / `eq`
(case-insensitive, e.g. `language` equals `JAVA`) against the selected
instance's attributes. Service / Endpoint entities carry no attributes, so
entity gates are ignored there.
Evaluation moved to the BFF; the SPA drops widgets flagged `hidden` (the
client-side `isVisible` is retired).
### Migration
None. Layer dashboards saved with the old free-text predicate (`"<metric>
has value"`, `#entity.*`) are **tolerated** — the schema maps any
non-conforming value to `undefined` (ungated) rather than failing the parse —
and keep rendering. Re-set the gate in the new editor to restore it.
## Admin editor improvements
- Structured **Visible when** control (kind → op → value), replacing the
unvalidated free-text box; corrected the inaccurate entity hint (`#entity.jvm`
was fictional → `language equals JAVA`).
- **Per-expression rows**: each MQE expression edits its `expression + label
+ unit + axis` together, replacing the three index-aligned parallel textareas.
- Reusable **`MqeExpressionInput`** with an expand pop-out for long
expressions — used by both the layer and overview editors.
- Sticky, full-height widget drawer (was a short box stranded in a tall grid
cell).
## Templates
71 bundled layer-dashboard gates ported to the structured form, all as
**self-gates** (zero extra query).
## Validation
Validated against the public Apache demo OAP — self / group / entity /
threshold / legacy-tolerance / `layerScope` scenarios all behave as expected,
and the bundled instance dashboard renders unchanged on a Java instance. `tsc`
(api-client + BFF), `vue-tsc`, 160 BFF tests, eslint, and `license-eye` all
clean.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]